[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [xtext-dev] Xtext grammar translation bug?
|
Hi Oleg,
>> Does every "part" which is parsed during partial parsing look like a whole file with EOF at the end?
Yes, it does and there is no backwards compatible way to circumvent that. Same example as from my previous answer applies to partially parsed models, e.g. if the changed text looks like this:
ID ID ID
but the affected region would only be a nest_rule, the parial parsing would erroneously succeed and the syntax problem would remain undetected.
Regards, Sebastian
On 15.01.2014, at 11:58, Oleg Bolshakov wrote: 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?
_______________________________________________ xtext-dev mailing list xtext-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/xtext-dev
|
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail