[antlr-interest] Get rule text only if rule was applied

Oliver Zeigermann oliver.zeigermann at gmail.com
Sat Mar 31 13:22:11 PDT 2007


I have not tried this, but doesn't

tableAlias
        : (schemaName DOT)? tableName  alias?
          {refs.notityTableRef($tableName.text, $alias == null ? null
: $alias.text, this.scope);}
        ;

work?

HTH

Oliver

2007/3/31, Miguel Ping <mblp at mega.ist.utl.pt>:
> Hi all,
>
> I got this rule:
>
>
> tableAlias
>         : (schemaName DOT)? tableName  alias?
>           {refs.notityTableRef($tableName.text, $alias.text, this.scope);}
>
> But as you can see, if  the alias? part was not applied, $alias.text
> throws me a NullPointerException (of course, because $alias does not
> exist). How can I check if alias rule was applied?
>
> Thanks,
> Miguel Ping
>


More information about the antlr-interest mailing list