Sebastien, nevertheless it seems to be a bug of Xtext
I tried to simplify the generated grammar and I got this one
grammar InternalMyDsl2;
entryRuleModel:
model
EOF
;
// rule 1
model: translation_unit;
entryRuletranslation_unit:
translation_unit
EOF
;
// rule 2
translation_unit: (declaration ';')*;
entryRulenest_rule :
nest_rule
EOF
;
// rule 3
nest_rule: ID?;
entryRuledeclaration:
declaration
EOF
;
// rule 4
declaration: 'decl' nest_rule ID;
fragment LETTER : ('$'|'A'..'Z'|'a'..'z'|'_');
ID : LETTER (LETTER|'0'..'9')*;
WS : (' '|'\t'|'\r'|'\n')+;
ANY_OTHER : .;
when checking it in antlr (I currently use antlr3.5 but as we know the same is in antlr3.2) I still have this error:
error(202): InternalMyDsl2.g:27:2: the decision cannot distinguish between alter native(s) 1,2 for input such as "ID EOF EOF"
If I remove or comment using of "EOF" token inside the GENERATED RULE entryRulenest_rule - NO MISTAKE anymore.
So I still didn't understand - why generate entry rules with EOF token for EACH user xtext rule? Does every "part" which is parsed during partial parsing look like a whole file with EOF at the end?