[antlr-interest] literal apostrophe
Steve Bennett
stevagewp at gmail.com
Sun Dec 9 16:37:09 PST 2007
On 12/10/07, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> How do you specify a literal apostrophe in a grammar. For example, I
> want to parse something like this.
>
> f'(x)
>
> I have a rule like this.
>
> function: name '\'' '(' variable ')'
>
>
>
That's the correct way. Perhaps another rule involving apostrophes is
conflicting? In that case, perhaps a lexer rule will help:
APOSTROPHE: '\'';
function: name APOSTROPHE ...
Steve
More information about the antlr-interest
mailing list