Fantastic, thanks very much for your help! My quoted string rule used
to be a parser rule but I thought I could separate out the quotes in the
parser rather than in my own Java code. Yay for laziness. (more inline
comments below)
Gavin Lambert wrote:
> Another alternative here is to just use this instead:
>
> OTHER: . ;
Now just to check my understanding, I thought I'd try a non-greedy loop
to see what error it would give me (I assumed it would give an error
since you didn't mention it as a viable solution :):
OTHER: ( options { greedy = false; } : . )+;
Which gave me "The following alternatives can never be matched: 1".
Since the rule doesn't have some kind of terminating token (like '/*' (
options { greedy = false; } : . )* '*/') and it won't look at other
rules to find out when to stop, the greedy match won't match anything at
all. Is that the right understanding? Why then wouldn't it always
match a single character due to the '+' being 1 or more matches?
Thanks again! Got it working perfectly.
- Scott
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---