XText suggests left-factoring. Why? [message #1743084] |
Sun, 11 September 2016 15:47  |
Eclipse User |
|
|
|
I have the following model:
grammar com.septentrio.infrastructure.smf.Model with org.eclipse.xtext.common.Terminals
generate language "http://www.septentrio.com/infrastructure/smf/Model"
Model:
('package' name=QualifiedName)?
(imports+=Import)*
(entities+=Entity)*;
Import:
'import' importedNamespace=QualifiedNameWithWildcard;
QualifiedName:
ID ('.' ID)*;
QualifiedNameWithWildcard:
QualifiedName '.*'?;
Entity:
Class|Test;
Class:
'class' name=ID
( '<' (params+=ID','?)+ '>' )?
( 'extends' (parents+=[Class|QualifiedName]','?)+ )?
( '{' (members+=Member)* '}' )?;
Member:
Attribute|Method;
Attribute:
type=ElementType (array='['(length=INT)?']')? name=ID;
Method:
type=ElementType name=ID '()';
ElementType:
BasicType|ClassType;
BasicType:
type=('any'|'enum'|'logical'|'string'|'integer'|'float');
ClassType:
type=[Class|QualifiedName] ( '<' (params+=[Class|QualifiedName]','?)+ '>' )?;
Test:
'test' name=ID '{' (expressions+=Expression)* '}';
Expression:
Primary ({SubscriptReference.operand=current} (indices+=SubscriptIndex)*)?;
Primary returns Expression:
'(' Expression ')' |
{Instance} class=[Class] |
{Metaclass} '?' class=[Class] |
{Identifier} name=ID;
SubscriptIndex:
{DotIndex} '.' name=[Member] |
{ParenthesisIndex} '(' (argument=Expression)? ')';
I get the following error:
[fatal] rule ruleExpression 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.
What's wrong?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04720 seconds