[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java 1.4 grammar extension



Hello,

i'm trying to extend java 1.4 grammar
(http://www.sablecc.org/grammars/j14.sablecc.html) for SableCC to allow
following constructions:

A a = new A();
...
a.foo() <edu.uci.IA, edu.uci.IB>;

int x = a.foo() <edu.uci.IA, edu.uci.IB>;

etc.

i've tried to add something like this:

method_messages =
	lt interface_type_list gt;

to: 

method_invocation =
    {name}
        name l_parenthese argument_list? r_parenthese method_messages? |

    {primary}
        primary dot identifier l_parenthese argument_list? r_parenthese
method_messages? |

    {super}
        T.super dot identifier l_parenthese argument_list? r_parenthese
method_messages? ;

but it doesn't work. SableCC throws errors while creating output files.

when i remove '?' char from the end of method_messages it is ok and works
correctly but i need normal methods invocation ("a.foo();") either.

i cannot ask the grammar author, because his email address i have is not
valid :-(

Could someone explain me, what i'm doing wrong? 

thanks in advance

Darek