You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/07/14 23:12:23 UTC
[royale-compiler] 04/06: StreamingASTokenizer: fixed issue where sourcePath variable was passed to original RawASTokenizer in setPath(), but not passed to a new RawASTokenizer created in setReader()
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 9095032b93a41b82f8553d86644b9de1ac3e2508
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Jul 14 11:32:25 2022 -0700
StreamingASTokenizer: fixed issue where sourcePath variable was passed to original RawASTokenizer in setPath(), but not passed to a new RawASTokenizer created in setReader()
---
compiler/src/assembly/scripts/aslint | 62 ++++++++++++++++++++++
compiler/src/assembly/scripts/aslint.bat | 26 +++++++++
.../internal/parsing/as/StreamingASTokenizer.java | 1 +
3 files changed, 89 insertions(+)
diff --git a/compiler/src/assembly/scripts/aslint b/compiler/src/assembly/scripts/aslint
new file mode 100644
index 000000000..b23185ab8
--- /dev/null
+++ b/compiler/src/assembly/scripts/aslint
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+################################################################################
+##
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+################################################################################
+
+#
+# fasc shell script to launch compiler-asc.jar on OSX, Unix, or Cygwin.
+# In Windows Command Prompt, use fasc.bat instead.
+#
+
+if [ "x${ROYALE_COMPILER_HOME}" = "x" ]
+then
+ SCRIPT_HOME=`dirname "$0"`
+ ROYALE_COMPILER_HOME=${SCRIPT_HOME}/..
+else
+ echo Using Royale codebase: $ROYALE_COMPILER_HOME
+fi
+
+case `uname` in
+ CYGWIN*)
+ OS="Windows"
+ ;;
+ *)
+ OS=Unix
+esac
+
+D32=''
+
+if [ $OS = "Windows" ]; then
+
+ ROYALE_COMPILER_HOME=`cygpath -m $ROYALE_COMPILER_HOME`
+
+elif [ $OS = "Unix" ]; then
+
+ check64="`java -version 2>&1 | grep -i 64-Bit`"
+ isOSX="`uname | grep -i Darwin`"
+ javaVersion="`java -version 2>&1 | awk -F '[ ".]+' 'NR==1 {print $3 "." $4}'`"
+
+ if [ "$isOSX" != "" -a "$HOSTTYPE" = "x86_64" -a "$check64" != "" -a "$javaVersion" = "1.6" ]; then
+ D32='-d32'
+ fi
+fi
+
+VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false "
+
+java $VMARGS $D32 $SETUP_SH_VMARGS -jar "${ROYALE_COMPILER_HOME}/lib/linter.jar" "$@"
diff --git a/compiler/src/assembly/scripts/aslint.bat b/compiler/src/assembly/scripts/aslint.bat
new file mode 100644
index 000000000..5bc7dc9da
--- /dev/null
+++ b/compiler/src/assembly/scripts/aslint.bat
@@ -0,0 +1,26 @@
+@echo off
+
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
+
+rem
+rem fasc.bat script to launch compiler-asc.jar in Windows Command Prompt.
+rem On OSX, Unix, or Cygwin, use the fasc shell script instead.
+rem
+
+@java -Dsun.io.useCanonCaches=false -Dapplication.home="%~dp0.." -Xms32m -Xmx512m -jar "%~dp0..\lib\linter.jar" %*
+
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
index efc9a53fc..52e923d2d 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
@@ -498,6 +498,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
tokenizer = new RawASTokenizer();
tokenizer.yyreset(reader);
tokenizer.setCollectComments(config.collectComments);
+ tokenizer.setSourcePath(sourcePath);
setSourcePositionAdjustment(offset, line, column);
}