|Bug parsing Xtext file [message #989381]
||Wed, 05 December 2012 17:48
| Scott Hendrickson
Registered: December 2009
Here is my xtext file to parse PROLOG programs:|
grammar org.archstudio.prolog.xtext.Prolog with org.eclipse.xtext.common.Terminals
generate prolog "http://www.archstudio.org/prolog/xtext/Prolog"
(predicates+=Predicate) (':-' predicates+=Predicate (',' predicates+=Predicate)*)? '.';
'?-' predicates+=Predicate (',' predicates+=Predicate)* '.';
functor=Functor '(' terms+=Predicate (',' terms+=Predicate)* ')'
| terms+=Term functor=Functor terms+=Predicate;
(atom=ATOM) | (number=NUMBER) | ('\'' string=STRING '\'') | (variable=VARIABLE)
| (list?='[' (terms+=Predicate (',' terms+=Predicate)* ('|' rest=Predicate)?)? ']');
name=(OPERATOR | ATOM);
'==' | '\\=' | '.';
'a'..'z' ('0'..'9' | 'a'..'z' | 'A'..'Z' | '_')*;
('A'..'Z' | '_') ('0'..'9' | 'a'..'z' | 'A'..'Z' | '_')*;
'a'..'z' | 'A'..'Z' |
'_' | '0'..'9' | '+' | '-' | '*' | '/' | '\\' | '^' | '~' | ':' | '.' | '?' | '@' | '#' | '$' | '&';
When I try to Generate Xtext Artifacts, it ends with an error of:
error(208): ../org.archstudio.prolog.xtext/src-gen/org/archstudio/prolog/xtext/parser/antlr/internal/InternalProlog.g:682:1: The following token definitions can never be matched because prior tokens match the same input: RULE_INT
The problem is that I'm not using the INT rule, so it shouldn't complain about it (right?).
Is this a bug, is there a workaround?
(Size: 1.08KB, Downloaded 37 times)
|Re: Bug parsing Xtext file [message #989575 is a reply to message #989381]
||Thu, 06 December 2012 14:42
| Felix Feisst
Registered: February 2012
When you created your grammar, xtext imported (by default) some terminals. Your terminals do conflict with these terminals, that's why you get the error message.|
The import is done by
To see which terminals are defined in this grammar consult the manual or just hit F3 when your cursor is over the import.
To get rid of your error just remove the "with ...".
Note that you have to import the basic ecore types when you're no longer referencing the base grammar. This is done by:
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
[Updated on: Fri, 07 December 2012 02:23]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03074 seconds