[antlr-interest] what does .* match

Anders Hessellund anders.hessellund at gmail.com
Mon Jun 25 06:19:55 PDT 2007


>
> For further diagnostics please post your entire grammar.


Hi,

here is the entire grammar:

grammar Web;
>

> site    :    page+;
>
> page    :    'PAGE' ID '{' pageContent '}' ;
>
> pageContent
>     :    pageHeader pageBody;
>
> pageHeader
>     :    title desc? keys?;
>
> title    :    'TITLE' .* ;
>
> desc    :    'DESC' .* ;
>
> keys    :    'KEYS' ID (',' ID)* ;
>
> pageBody:    menu? ( center | split )* sub? ;
>
> menu    :    'MENU' '{' menuOption+ '}' ;
>
> menuOption
>     :    '->' ID
>     |    '-' ID
>     ;
>
> center    :    'CENTER' '{' .* '}'  ;
>
> split    :    'SPLIT' '{' 'LEFT' '{' (.)* '}' 'RIGHT' '{' .* '}' '}' ;
>
> sub    :    'SUB' '{' .* '}' ;
>
> ID    :    LETTER ( LETTER | INT )*  ;
>
> fragment
> LETTER    :    'a'..'z'|'A'..'Z'
>     ;
>
> fragment
> INT    :    '0'..'9'+
>     ;
>
> WS    :    (' ' | '\t' | '\n' | '\r' )+ { $channel=HIDDEN; }
>     ;
>

When I feed my generated lexer/parser the following text

PAGE helloWorld {
>     TITLE Hello World
>     CENTER { ere * eryu / sdhjs }
> }
>

it complains:

line 3:14 no viable alternative at character '*'
line 3:21 no viable alternative at character '/'

Why is that?

-- Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070625/4953cb22/attachment.html 


More information about the antlr-interest mailing list