[antlr-interest] How to match a phrase i.e. multiple words?

Swaroop C H swaroopch at gmail.com
Sun Feb 15 22:47:42 PST 2009


Hi Gavin,

On Sun, Feb 15, 2009 at 12:41 PM, Gavin Lambert wrote:
> Since PHRASE is a lexer rule, it is at the same "level" as the WHITESPACE
> rule, and thus whitespace isn't magically removed from the character stream
> (like it would be if it were a parser rule instead).
> <snip />
> The simplest thing to do is simply to define a PHRASE as anything at all
> within quotes:
>
> PHRASE
>  : '"' .* '"'
>  ;


Thanks a ton, this understanding was indeed what I was missing. It is
now working as expected :)

Regards,
Swaroop


More information about the antlr-interest mailing list