Community
Participate
Working Groups
Build Identifier: 20100218-1602 I have a case when an ValueConverterException is wrongly raised. Consider the following two grammars A and B, whereas B derives from A. Grammar B: SomeRule : 'some' 'rule' name=MyDataTypeRuleInA ; Grammar A: MyDataTypeRuleInA : 'a' | 'b' | OtherDataTypeRule | MY_TERMINAL_RULE ; MY_TERMINAL_RULE : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'#'|'$')* ; A simple model instance for B contains an assignment in SomeRule. When formatting is applied an exception is raised: "Format" did not complete normally... ... the value XYZ is an invalid MyDataTypeRuleInA I traced down the problem to this point: org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter#assertTokens line 67: if (!getRuleName().toUpperCase().equals(getRuleName(token))) { throw createTokenTypeMismatchException(value, escapedString, token); } In my case getRuleName() is "MyDataTypeRuleInA" and getRuleName(token) is "MY_TERMINAL_RULE". The condition looks incorrect to me. Is it a bug? Reproducible: Always
Did you bind a subclass of AbstractLexerBasedConverter to a data type rule (which is not lexer-based)?
Yes I did, and that seems to have been the problem. Thanks.
see comment #2