[antlr-interest] Order of token matching
Jim Idle
jimi at temporal-wave.com
Wed Sep 3 09:46:09 PDT 2008
On Wed, 2008-09-03 at 18:34 +0200, Jenny Balfer wrote:
> No, it is too long. But I reproduced the error in a short one.
> An example for the occuring error would be the following string:
OK - well it would be searching for the } because you didn't tell the
IMPL about comments :-). You need this (as well as the other stuff being
fragments):
IMPL
: '{' (
(SLCOM|MLCOM)=> COMMENT
| ('{')=> IMPL
| ~'}'
)*
'}' {skip();}
;
Also, in your grammar the paramLists in implementation need to be
optional.
Jim
>
> isWorking = function(param1,param2) {
> some implementation;
> some expressions;
> }
>
> function throwsError(param1, param2) {
> // this is a nasty comment {
> something else
> }
>
> function isIgnored() {
> // lexer is still searching for a closing brace
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080903/e06ab731/attachment.html
More information about the antlr-interest
mailing list