first and last character truncated in STRING terminals [message #943160] |
Sun, 14 October 2012 03:51  |
Eclipse User |
|
|
|
I have redefined the STRING terminal this way
terminal STRING : ('.'|'+'|'('|')'|'a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
because I have to recognize STRING not delimited by " or '
the problem is that, though the generated parser works, it truncates the first and the last character of the recognized string. What am I missing?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: first and last character truncated in STRING terminals [message #960514 is a reply to message #959384] |
Sat, 27 October 2012 10:50  |
Eclipse User |
|
|
|
Please refer to the section on terminal rules in the documentation. Your
STRING rule will basicly consume everything like ID and INTs since it is
defined with a higher priority (because the others are inherited).
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 26.10.12 19:24, schrieb Kokongi Nei:
> Andrea,
>
> I am attempting to do the same thing--have a grammar that supports
> unquoted STRINGs. As the first step, I am overriding the terminal
> STRING as you did:
>
> terminal STRING : ('.'|'+'|'('|')'|'a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
>
> But, when I run the MWE2 Workflow, I get this error:
>
> error(208):
> ../org.xtext.example.definitions/src-gen/org/xtext/example/definitions/parser/antlr/internal/InternalDefinitions.g:243:1:
> The following token definitions can never be matched because prior
> tokens match the same input: RULE_INT
>
> I assume you had the same problem, and if so, what did you do?
>
> Thanks!
|
|
|
Powered by
FUDForum. Page generated in 0.05844 seconds