RCIX
RCIX

Reputation: 39457

Character consumption in lexical analysis

If I have a subrule like the following:

.. (~']' ~']')* ...

will it only match an even number of characters?

Upvotes: 0

Views: 69

Answers (1)

Bart Kiers
Bart Kiers

Reputation: 170227

(Assuming the dots are not meant as meta characters)

Not quite, it will match zero, or an even number of characters.

EDIT

To match a quote block, do something like this:

QUOTE
    :    '[[' (options {greedy=false;} : . )*  ']]'
    ;

Assuming [[ some text here ]] is a quote block.

Upvotes: 1

Related Questions