cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 159 forks source link

candy-generator build fail #335

Closed 9468305 closed 7 years ago

9468305 commented 7 years ago

I use jsweet-2.0.0-rc1, try to build candy-generator. But failed, output log as below: My env is Win7, maven 3.5.0, node.js 6.11.0, npm 3.10.10

D:\jsweet-2.0.0-rc1\candy-generator>mvn generate-sources -P genparser
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JSweet candy generator 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.jsweet.org/artifactory/libs-release-local/org/jsw
eet/jsweet-core/5-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.jsweet.org/artifactory/ext-release-local/org/jswe
et/jsweet-core/5-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.jsweet.org/artifactory/libs-snapshot-local/org/js
weet/jsweet-core/5-SNAPSHOT/maven-metadata.xml
Downloaded: http://repository.jsweet.org/artifactory/libs-snapshot-local/org/jsw
eet/jsweet-core/5-SNAPSHOT/maven-metadata.xml (1.2 kB at 532 B/s)
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (default) @ jsweet-candy-generator ---
[INFO] Executing tasks

main:

gen-parser:
     [echo] Generating TSDef API parser...
     [echo] compile classpath: D:\jsweet-2.0.0-rc1\candy-generator\target\classe
s;D:\Users\chenqib\.m2\repository\com\martiansoftware\jsap\2.1\jsap-2.1.jar;D:\U
sers\chenqib\.m2\repository\edu\princeton\cup\java-cup\10k\java-cup-10k.jar;D:\U
sers\chenqib\.m2\repository\de\jflex\jflex\1.3.5\jflex-1.3.5.jar;D:\Users\chenqi
b\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\Users\chenqib\.m2\reposi
tory\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;D:\Users\che
nqib\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\Users\chenqi
b\.m2\repository\org\jsoup\jsoup\1.7.2\jsoup-1.7.2.jar;D:\Users\chenqib\.m2\repo
sitory\org\jsweet\jsweet-core\5-SNAPSHOT\jsweet-core-5-SNAPSHOT.jar;D:\Users\che
nqib\.m2\repository\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;D:\Users\chen
qib\.m2\repository\org\apache\httpcomponents\httpcore\4.4.5\httpcore-4.4.5.jar;D
:\Users\chenqib\.m2\repository\org\apache\httpcomponents\httpclient\4.5.2\httpcl
ient-4.5.2.jar;D:\Users\chenqib\.m2\repository\commons-logging\commons-logging\1
.2\commons-logging-1.2.jar;D:\Users\chenqib\.m2\repository\commons-codec\commons
-codec\1.9\commons-codec-1.9.jar
     [java] Opening files...
     [java] Parsing specification from standard input...
     [java] Checking specification...
     [java] Warning: Terminal "AT" was declared but never used
     [java] Warning: Terminal "ANDAND" was declared but never used
     [java] Warning: Terminal "OROR" was declared but never used
     [java] Warning: Terminal "FALSE" was declared but never used
     [java] Warning: Terminal "NOT" was declared but never used
     [java] Warning: Terminal "NOTEQUALS" was declared but never used
     [java] Warning: Terminal "NUM" was declared but never used
     [java] Warning: Terminal "DOLLAR" was declared but never used
     [java] Warning: Terminal "TRUE" was declared but never used
     [java] Warning: Terminal "MATCHES" was declared but never used
     [java] Warning: Terminal "PLUS" was declared but never used
     [java] Warning: Terminal "DIV" was declared but never used
     [java] Warning: Terminal "DOTDOT" was declared but never used
     [java] Warning: Terminal "LTE" was declared but never used
     [java] Warning: Terminal "REFERENCE" was declared but never used
     [java] Warning: Terminal "MINUS" was declared but never used
     [java] Warning: Terminal "ARROW_RIGHT" was declared but never used
     [java] Warning: Terminal "GTE" was declared but never used
     [java] Warning: Terminal "MINUSMINUS" was declared but never used
     [java] Warning: Terminal "PLUSPLUS" was declared but never used
     [java] Warning: Terminal "EQUALS" was declared but never used
     [java] Warning: Non terminal "new_functional_type" was declared but never u
sed
     [java] Warning: Non terminal "basic_type" was declared but never used
     [java] Warning: Non terminal "type_arg_and" was declared but never used
     [java] Warning: Non terminal "var_opt" was declared but never used
     [java] Building parse tables...
     [java]   Computing non-terminal nullability...
     [java]   Computing first sets...
     [java]   Building state machine...
     [java]   Filling in tables...
     [java]   Checking for non-reduced productions...
     [java] Writing parser...
     [java] Closing files...
     [java] ------- CUP v0.10k Parser Generation Summary -------
     [java]   0 errors and 25 warnings
     [java]   75 terminals, 75 non-terminals, and 175 productions declared,
     [java]   producing 357 unique parse states.
     [java]   25 terminals declared but not used.
     [java]   0 non-terminals declared but not used.
     [java]   0 productions never reduced.
     [java]   0 conflicts detected (0 expected).
     [java]   Code written to "TypescriptDefParser.java", and "sym.java".
     [java] ---------------------------------------------------- (v0.10k)
     [move] Moving 1 file to D:\jsweet-2.0.0-rc1\candy-generator\src\main\java\o
rg\jsweet\input\typescriptdef\parser
     [move] Moving 1 file to D:\jsweet-2.0.0-rc1\candy-generator\src\main\java\o
rg\jsweet\input\typescriptdef\parser
     [echo] Generating TSDef API lexer...
     [java] Reading "src\main\java\org\jsweet\input\typescriptdef\parser\typescr
iptdef.lex"
     [java]
     [java] Error in file "src\main\java\org\jsweet\input\typescriptdef\parser\t
ypescriptdef.lex" (line 192):
     [java] Unexpected newline in character class (closing "]" is missing)
     [java]   [锘縘 { /* ignore */ }
     [java]                       ^
     [java] 1 error, 0 warnings.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.947 s
[INFO] Finished at: 2017-08-14T13:44:37+08:00
[INFO] Final Memory: 11M/205M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:
run (default) on project jsweet-candy-generator: An Ant BuildException has occur
ed: The following error occurred while executing this line:
[ERROR] D:\jsweet-2.0.0-rc1\candy-generator\build.xml:33: Java returned: 1
[ERROR] around Ant part ...<ant antfile="D:\jsweet-2.0.0-rc1\candy-generator/bui
ld.xml" target="gen-parser"/>... @ 7:85 in D:\jsweet-2.0.0-rc1\candy-generator\t
arget\antrun\build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
renaudpawlak commented 7 years ago

Most probably an encoding issue in the typescriptdef.lex file. Il looks like the rule line 192, acts like [] was meaning something else such as a Chinese character... Not sure what to do here... you could try to remove/replace the rule and see what happens...

lgrignon commented 7 years ago

Hello, it sounds like you have an encoding issue or a wrong char, see this line in typescriptdef.lex:

  [锘縘 { /* ignore */ }

it should be []

9468305 commented 7 years ago

I double check this charactor typo issue. I am sure its not my local env encoding issue. It also has no relation to Windows Console GBK encoding.

When I replace it with [], build success. But left a warning as below.

     [java] Warning in file "src\main\java\org\jsweet\input\typescriptdef\parser
\typescriptdef.lex" (line 192):
     [java] Rule can never be matched:
     [java]   [] { /* ignore */ }

by @lgrignon 's opinion, this should be OK, so I send a PR to you.

     [java] Building parse tables...
     [java]   Computing non-terminal nullability...
     [java]   Computing first sets...
     [java]   Building state machine...
     [java]   Filling in tables...
     [java]   Checking for non-reduced productions...
     [java] Writing parser...
     [java] Closing files...
     [java] ------- CUP v0.10k Parser Generation Summary -------
     [java]   0 errors and 25 warnings
     [java]   75 terminals, 75 non-terminals, and 175 productions declared,
     [java]   producing 357 unique parse states.
     [java]   25 terminals declared but not used.
     [java]   0 non-terminals declared but not used.
     [java]   0 productions never reduced.
     [java]   0 conflicts detected (0 expected).
     [java]   Code written to "TypescriptDefParser.java", and "sym.java".
     [java] ---------------------------------------------------- (v0.10k)
     [move] Moving 1 file to D:\jsweet-2.0.0-rc1\candy-generator\src\main\java\o
rg\jsweet\input\typescriptdef\parser
     [move] Moving 1 file to D:\jsweet-2.0.0-rc1\candy-generator\src\main\java\o
rg\jsweet\input\typescriptdef\parser
     [echo] Generating TSDef API lexer...
     [java] Reading "src\main\java\org\jsweet\input\typescriptdef\parser\typescr
iptdef.lex"
     [java]
     [java] Warning : Macro "StringText" has been declared but never used.
     [java]
     [java] Warning : Macro "DecFloatLiteral" has been declared but never used.
     [java] Constructing NFA : 1291 states in NFA
     [java] Converting NFA to DFA :
     [java] ....................................................................
................................................................................
................................................................................
................................................................................
................................................................................
..........................................................................
     [java]
     [java] Warning in file "src\main\java\org\jsweet\input\typescriptdef\parser
\typescriptdef.lex" (line 192):
     [java] Rule can never be matched:
     [java]   [] { /* ignore */ }
     [java] 472 states before minimization, 370 states in minimized DFA
     [java] Writing code to "src\main\java\org\jsweet\input\typescriptdef\parser
\TypescriptDefScanner.java"
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.066 s
[INFO] Finished at: 2017-08-14T20:32:17+08:00
[INFO] Final Memory: 10M/245M
[INFO] ------------------------------------------------------------------------
renaudpawlak commented 7 years ago

I suspect that some special character was once inside the [] but it got removed or hidden because of encoding, maybe because of saving or committing... I shall investigate the history when possible.

cyf-coder commented 3 years ago

Hello,

branch develop src\main\java\org\jsweet\input\typescriptdef\parser\typescriptdef.lex#193 special char still there

My editor default encoding is utf8, when i copy the line typescriptdef.lex#193 into my editor from github web page, the special char apear.

lgrignon commented 3 years ago

can you PR a fix if simple please?