Can't ignore WS in rule [message #685107] |
Thu, 16 June 2011 20:39 |
Chetan Kumar Messages: 44 Registered: July 2009 |
Member |
|
|
Hi,
I have these rules in my grammar:
Category :
'@keyword' name=ZID
'@keyword2' name2=ZSTRING
;
ZID: ID('-'ID)*; // i need '-'s
// stuff after '@keyword' is like a sentence with spaces, tabs, newlines.
// its not enclosed in "" or ''
ZSTRING: ID((' 'ID)|('\t'ID)|('\n'ID))*;
Now, considering these rules the following DSL text is marked with errors
@keyword my-variable
Error:
Mismatched input ' ' expecting RULE_ID
Wat' strange is: I don't get that error if I remove the ZSTRING rule and change Category rule as:
Category :
'@keyword' name=ZID
'@keyword2' name2=STRING
;
Can anybody throw some light on this ? also, is there any predefined type that I can use for returing strings (not enclosed in quotes) ?
thanks,
Chetan Kumar
[Updated on: Thu, 16 June 2011 20:40] Report message to a moderator
|
|
|
Re: Can't ignore WS in rule [message #685110 is a reply to message #685107] |
Thu, 16 June 2011 20:48 |
|
Hi,
what about (fixing hidden tokens / overwriting of the WS terminal)
ZID hidden (): ID('-'ID)*; // i need '-'s
// stuff after '@keyword' is like a sentence with spaces, tabs, newlines.
// its not enclosed in "" or ''
ZSTRING hidden (): ID (WS ID)*;
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03204 seconds