Merge pull request #906 from parrt/mv-python3-to-new-test-gen
got all but 4 tests passing for py3!
This commit is contained in:
commit
7d36891c82
10
bild.py
10
bild.py
|
@ -67,7 +67,7 @@ RUNTIME_TEST_TEMPLATES = {
|
|||
"Java" : uniformpath(JAVA_TARGET)+"/tool/test/org/antlr/v4/test/runtime/java/Java.test.stg",
|
||||
"CSharp" : uniformpath(CSHARP_TARGET)+"/tool/test/org/antlr/v4/test/runtime/csharp/CSharp.test.stg",
|
||||
# "Python2" : uniformpath(PYTHON2_TARGET)+"/tool/test/org/antlr/v4/test/rt/py2/Python2.test.stg",
|
||||
# "Python3" : uniformpath(PYTHON3_TARGET)+"/tool/test/org/antlr/v4/test/rt/py3/Python3.test.stg",
|
||||
"Python3" : uniformpath(PYTHON3_TARGET)+"/tool/test/org/antlr/v4/test/runtime/python3/Python3.test.stg",
|
||||
# "NodeJS" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/node/NodeJS.test.stg",
|
||||
# "Safari" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/safari/Safari.test.stg",
|
||||
# "Firefox" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/firefox/Firefox.test.stg",
|
||||
|
@ -106,7 +106,7 @@ def compile():
|
|||
javac(TARGETS[t] + "/tool/src", "out", version="1.6", cp=cp, args=args)
|
||||
# pull in generated runtime tests and runtime test support code
|
||||
for t in RUNTIME_TEST_TEMPLATES:
|
||||
javac(TARGETS[t] + "/tool/test", "out", version="1.6", cp=cp, args=args)
|
||||
javac(TARGETS[t] + "/tool/test", "out", version="1.6", cp=cp, args=args, skip=['org/antlr/v4/test/rt'])
|
||||
javac('gen/test/'+t, "out", version="1.6", cp=cp, args=args)
|
||||
|
||||
|
||||
|
@ -333,11 +333,11 @@ def test(target, juprops, args):
|
|||
skip = []
|
||||
if target=='Java':
|
||||
# don't test generator
|
||||
skip = [ "/org/antlr/v4/test/rt/gen/", "TestPerformance.java", "TestGenerator.java" ]
|
||||
skip = [ "TestPerformance.java", "TestGenerator.java" ]
|
||||
elif target=='Python2':
|
||||
# need BaseTest located in Py3 target
|
||||
# need BaseTest located in python3 target
|
||||
base = uniformpath(TARGETS['Python3'] + "/tool/test")
|
||||
skip = [ "/org/antlr/v4/test/rt/py3/" ]
|
||||
skip = [ "/org/antlr/v4/test/runtime/python3/" ]
|
||||
javac(base, "out/test/"+target, version="1.6", cp=thisjarwithjunit, args=args, skip=skip)
|
||||
skip = []
|
||||
elif target=='JavaScript':
|
||||
|
|
|
@ -28,5 +28,5 @@ WS : (' '|'\n') -> skip ;
|
|||
// wasn't terminating. @after was injected into M as if it were @members
|
||||
slaveGrammar(grammarName) ::= <<
|
||||
parser grammar S;
|
||||
a @after {int x;} : B;
|
||||
a @after {<InitIntMember("x","0")>} : B;
|
||||
>>
|
||||
|
|
|
@ -17,18 +17,18 @@ expressionList
|
|||
: e (',' e)*
|
||||
;
|
||||
e : '(' e ')'
|
||||
| 'this'
|
||||
| 'this'
|
||||
| 'super'
|
||||
| INT
|
||||
| ID
|
||||
| type '.' 'class'
|
||||
| typespec '.' 'class'
|
||||
| e '.' ID
|
||||
| e '.' 'this'
|
||||
| e '.' 'super' '(' expressionList? ')'
|
||||
| e '.' 'new' ID '(' expressionList? ')'
|
||||
| 'new' type ( '(' expressionList? ')' | ('[' e ']')+)
|
||||
| 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+)
|
||||
| e '[' e ']'
|
||||
| '(' type ')' e
|
||||
| '(' typespec ')' e
|
||||
| e ('++' | '--')
|
||||
| e '(' expressionList? ')'
|
||||
| ('+'|'-'|'++'|'--') e
|
||||
|
@ -59,10 +59,11 @@ e : '(' e ')'
|
|||
|'\<\<='
|
||||
|'%=') e
|
||||
;
|
||||
type: ID
|
||||
typespec
|
||||
: ID
|
||||
| ID '[' ']'
|
||||
| 'int'
|
||||
| 'int' '[' ']'
|
||||
| 'int' '[' ']'
|
||||
;
|
||||
ID : ('a'..'z'|'A'..'Z'|'_'|'$')+;
|
||||
INT : '0'..'9'+ ;
|
||||
|
|
|
@ -3,7 +3,7 @@ import "JavaExpressions.stg"
|
|||
Input() ::= "new T[((n-1) * x) + 1]"
|
||||
|
||||
Output() ::= <<
|
||||
(s (e new (type T) [ (e (e ( (e (e ( (e (e n) - (e 1)) )) * (e x)) )) + (e 1)) ]) \<EOF>)<\n>
|
||||
(s (e new (typespec T) [ (e (e ( (e (e ( (e (e n) - (e 1)) )) * (e x)) )) + (e 1)) ]) \<EOF>)<\n>
|
||||
>>
|
||||
|
||||
Errors() ::= ""
|
||||
|
|
|
@ -3,7 +3,7 @@ import "JavaExpressions.stg"
|
|||
Input() ::= "(T)x"
|
||||
|
||||
Output() ::= <<
|
||||
(s (e ( (type T) ) (e x)) \<EOF>)<\n>
|
||||
(s (e ( (typespec T) ) (e x)) \<EOF>)<\n>
|
||||
>>
|
||||
|
||||
Errors() ::= ""
|
||||
|
|
|
@ -3,7 +3,7 @@ import "JavaExpressions.stg"
|
|||
Input() ::= "new A().b"
|
||||
|
||||
Output() ::= <<
|
||||
(s (e (e new (type A) ( )) . b) \<EOF>)<\n>
|
||||
(s (e (e new (typespec A) ( )) . b) \<EOF>)<\n>
|
||||
>>
|
||||
|
||||
Errors() ::= ""
|
||||
|
|
|
@ -3,7 +3,7 @@ import "JavaExpressions.stg"
|
|||
Input() ::= "(T)t.f()"
|
||||
|
||||
Output() ::= <<
|
||||
(s (e (e ( (type T) ) (e (e t) . f)) ( )) \<EOF>)<\n>
|
||||
(s (e (e ( (typespec T) ) (e (e t) . f)) ( )) \<EOF>)<\n>
|
||||
>>
|
||||
|
||||
Errors() ::= ""
|
||||
|
|
|
@ -19,16 +19,16 @@ Rule() ::= "s"
|
|||
|
||||
grammar(grammarName) ::= <<
|
||||
grammar <grammarName>;
|
||||
s : e {<writeln("$e.v")>};
|
||||
s : e {<writeln("$e.v")>};
|
||||
e returns [int v]
|
||||
: e '*' e {$v = <Cast("BinaryContext","$ctx")>.e(0).v * <Cast("BinaryContext","$ctx")>.e(1).v;} # binary
|
||||
| e '+' e {$v = <Cast("BinaryContext","$ctx")>.e(0).v + <Cast("BinaryContext","$ctx")>.e(1).v;} # binary
|
||||
| INT {$v = $INT.int;} # anInt
|
||||
| '(' e ')' {$v = $e.v;} # parens
|
||||
| left=e INC {<Cast("UnaryContext","$ctx"):Concat(".INC() != null"):Assert()> $v = $left.v + 1;} # unary
|
||||
| left=e DEC {<Cast("UnaryContext","$ctx"):Concat(".DEC() != null"):Assert()> $v = $left.v - 1;} # unary
|
||||
| left=e INC {<Cast("UnaryContext","$ctx"):Concat(".INC() != null"):Assert()>$v = $left.v + 1;} # unary
|
||||
| left=e DEC {<Cast("UnaryContext","$ctx"):Concat(".DEC() != null"):Assert()>$v = $left.v - 1;} # unary
|
||||
| ID {<AssignLocal("$v","3")>} # anID
|
||||
;
|
||||
;
|
||||
ID : 'a'..'z'+ ;
|
||||
INT : '0'..'9'+ ;
|
||||
INC : '++' ;
|
||||
|
|
|
@ -25,7 +25,7 @@ grammar(grammarName) ::= <<
|
|||
grammar <grammarName>;
|
||||
s : stmt EOF ;
|
||||
stmt : ifStmt | ID;
|
||||
ifStmt : 'if' ID stmt ('else' stmt | { <LANotEquals("1", "ELSE")> }?);
|
||||
ifStmt : 'if' ID stmt ('else' stmt | { <LANotEquals("1", {<grammarName>Parser.ELSE})> }?);
|
||||
ELSE : 'else';
|
||||
ID : [a-zA-Z]+;
|
||||
WS : [ \\n\\t]+ -> skip;
|
||||
|
|
|
@ -18,7 +18,7 @@ file_
|
|||
@after {<ToStringTree("$ctx"):writeln()>}
|
||||
: para para EOF ;
|
||||
para: paraContent NL NL ;
|
||||
paraContent : ('s'|'x'|{<LANotEquals("2","TParser.NL")>}? NL)+ ;
|
||||
paraContent : ('s'|'x'|{<LANotEquals("2",{<grammarName>Parser.NL})>}? NL)+ ;
|
||||
NL : '\n' ;
|
||||
s : 's' ;
|
||||
X : 'x' ;
|
||||
|
|
|
@ -228,6 +228,14 @@ RuleInvocationStack() ::= "getRuleInvocationStack()"
|
|||
|
||||
LL_EXACT_AMBIG_DETECTION() ::= <<_interp.setPredictionMode(PredictionMode.LL_EXACT_AMBIG_DETECTION);>>
|
||||
|
||||
ParserPropertyMember() ::= <<
|
||||
@members {
|
||||
boolean Property() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
>>
|
||||
|
||||
PositionAdjustingLexer() ::= <<
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../gen/test/CSharp" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../gen/test/Java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../gen/test/Python3" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../.idea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../antlr4-maven-plugin" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../runtime" />
|
||||
|
@ -32,6 +33,10 @@
|
|||
<content url="file://$MODULE_DIR$/../../antlr4-csharp/tool/test">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-csharp/tool/test" isTestSource="false" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/../../antlr4-python3">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-python3/tool/test" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-python3/tool/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="runtime" />
|
||||
|
|
Loading…
Reference in New Issue