|
Re: Parser rule to allow apostrophe and quotes [message #687665 is a reply to message #687625] |
Thu, 23 June 2011 00:15 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
You are probably using a terminal that eats the apostrophe (the String
terminal).
If your description ends with something distinct (or end of line), it is
probably ok with just a new terminal rule that eats until end of line.
The best is probably to solve this at the lexer level using an external
lexer as you need rules that allows unbalanced ' and ".
Regards
- henrik
On 6/22/11 11:37 PM, Chetan Kumar wrote:
> folks,
>
> i have a keyword in my dsl which is like so:
> @description <value>Value can be anything - one line description,
> multi-line description, with lot of characters used (' , " * : ^). The
> value is not enclosed in quotes (" | '). More importantly, value can
> have ' character as many number of times as possible.
>
> I tried these set of rules:
> ZDESCRIPTION : (ID(ZSYMBOL)*)+;
>
> // allowed symbols
> ZSYMBOL :
> ('"'|"'"|"'"|'<'|'/'|'>'|'\\'|','|'^'|'-'|'+'|'.'|':'|'*'|INT|'['|']');
>
> while generating code i get these warnings: Decision can match input
> such as "'\''" using multiple alternatives: 2, 3As a result,
> alternative(s) 3 were disabled for that input.
>
> I even tried "\\'" in ZSYMBOL but result is the same. Generated editor
> shows an error marker for something like this:
> @description simple description copied from Pete's tag. How to allow
> apostrophes in values ?
>
> + Chetan
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.01681 seconds