[antlr-interest] structure parameter access
Alexey Demakov
demakov at ispras.ru
Wed Nov 10 05:19:13 PST 2004
From: <silverio.di at qem.it>
> "Alexey Demakov" <demakov at ispras.ru> wrote:
> >Because parser doesn't know about skipped tokens the only way to
> >skip WS and forbid WS near POINT - is to handle
> struct_name.struct_parameter
> >as single token in lexer.
>
> >Another idea - the only idea - is to track WS while skipping and decorate
> >POINT token by flag indicating that there was WS just before or after.
> >You can check it in parser rule and print error message.
>
> Ok, I can write:
>
> STRUCT_PARAMETER
> : IDENT
> '.'
> IDENT
> ;
>
> but in parser how can I extract from STRUCT_PARAMETER token
> the structure name and the parameter name ?
In parser
struct_parameter : t:STRUCT_PARAMETER
{
String s = t.getText();
int dot = s.indexOf( '.' );
String structureName = s.substring( 0, dot );
String parameterName = s.substring( dot + 1 );
...
}
;
Regards,
Alexey
-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list