Using arrays Arrays and DotNotation in Expressions [message #1793622] |
Sun, 12 August 2018 02:15  |
Eclipse User |
|
|
|
Hello.
I am trying to update my DSL to handle arrays and dot notation.
Having tried multiple different ways, and still being stuck, I am reaching out for some guidance.
Grammer on GitHub:
ExpressionDSL.xtext
Unit Test on GitHub (extract below):
ExpressionDSLParsingTest.xtend - testExpressionArray05()
Request:
Please help me change the DSL to be able to pass the unit test (below).
MWE2 - Error Message
1) [fatal] rule ruleArrayExp has non-LL(*) decision
2) Decision can match input using multiple alternatives:
error(211): ../org.xtext.example.expressiondsl/src-gen/org/xtext/example/expressiondsl/parser/antlr/internal/InternalExpressionDSLParser.g:892:2: [fatal] rule ruleArrayExp has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
warning(200): ../org.xtext.example.expressiondsl/src-gen/org/xtext/example/expressiondsl/parser/antlr/internal/InternalExpressionDSLParser.g:1171:4: Decision can match input such as "RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
error(201): ../org.xtext.example.expressiondsl/src-gen/org/xtext/example/expressiondsl/parser/antlr/internal/InternalExpressionDSLParser.g:1171:4: The following alternatives can never be matched: 2
Unit Test Extract:
var int intA;
var int intB dim(10);
struct structA;
subf int subfA;
endstruct;
struct structB dim(10);
subf int subfB;
endstruct;
struct structC dim(10);
subf int subfC dim(20);
struct subStructC dim(30); // Nested Struct Array
subf int subSubfC dim(40);
endstruct;
endstruct;
def char funcTest;
// Normal Assignment
intA = intB;
// Assign result of function
intA = funcTest();
intA = funcTest(1);
intA = funcTest(2:3);
// Arrays
intA = intB(4);
intA = intB(funcTest(5));
// Qualified
intA = structA;
intA = structA.subfA;
intA = structB(5);
intA = structB(testFunc());
intA = structB(6).subfB;
intA = stuctC(7).subfC(8);
intA = structC(9).subStructC(10).subSubf(11);
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05446 seconds