| Bug parsing Xtext file [message #989381] | 
Wed, 05 December 2012 17:48   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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"
Program:
	(clauses+=Clause)* (query=Query)?;
Clause:
	(predicates+=Predicate) (':-' predicates+=Predicate (',' predicates+=Predicate)*)? '.';
Query:
	'?-' predicates+=Predicate (',' predicates+=Predicate)* '.';
Predicate:
	functor=Functor '(' terms+=Predicate (',' terms+=Predicate)* ')'
	| terms+=Term functor=Functor terms+=Predicate;
Term:
	(atom=ATOM) | (number=NUMBER) | ('\'' string=STRING '\'') | (variable=VARIABLE)
	| (list?='[' (terms+=Predicate (',' terms+=Predicate)* ('|' rest=Predicate)?)? ']');
Functor:
	name=(OPERATOR | ATOM);
terminal OPERATOR:
	'==' | '\\=' | '.';
terminal NUMBER:
	'-'? ('0'..'9')+;
terminal ATOM:
	'a'..'z' ('0'..'9' | 'a'..'z' | 'A'..'Z' | '_')*;
terminal VARIABLE:
	('A'..'Z' | '_') ('0'..'9' | 'a'..'z' | 'A'..'Z' | '_')*;
terminal STRING:
	'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? 
 
 
Thank you, 
-- Scott
 
Attachment: Prolog.xtext 
(Size: 1.08KB, Downloaded 153 times) 
 
 |  
 |  
  | 
 | 
 | 
Powered by 
FUDForum. Page generated in 0.05349 seconds