[antlr-interest] java15.g: Can't parse only conditionalExpression

Jens Theeß j.theess at tu-bs.de
Tue Nov 23 08:17:42 PST 2004


Hi,

I'm developing a tool that parses a textual form of UML sequence 
diagrams with some embedded java. The embedded java includes compound 
statements and conditional expressions. Before integrating the java 
parser (java15.g) into the sequence diagram parser, I tested the java 
parser stand-alone on some input it will encounter in the sequence 
diagram. The setup is as follows:

         JavaLexer lexer = new JavaLexer(r);
         lexer.setFilename(f);
         JavaRecognizer parser = new JavaRecognizer(lexer);
         parser.setFilename(f);
         parser.conditionalExpression();     // or 
parser.compoundStatement().

The call to parser.compoundStatement() does fine with following input:

{
    testfiles.A a = new testfiles.A();
    sdVariables.put("testfiles.A", "a", a);
}

However, a call to parser.conditionalExpression() fails on following input:

1 == 2

or

d.startsWith("ha")

What am I missing? Isn't the input a valid conditional expression?

Thanks,
Jens


 
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