#14 Token definitons in <> and Java generics, operators

Next Release
closed
nobody
5
2008-07-02
2008-02-07
No

Hi!

Sorry for the many things, but here's another one I spotted.

When I use the '<' or '>' characters in the PARSER_BEGIN section where I can write pure Java code, the JavaCC editor colors the generics, for instance:

PARSER_BEGIN(Parser)

public class Parser {

/* Contains the syntax errors found during parsing */
private LinkedList<ParseException> errors = null;
...
}

PARSER_END(Parser)

Then the <ParseException> is colored like an identifyer.

Another similiar case when I use the < or <= operator in an if statement. The result is very similiar:

if ( 0 < maxError && maxError <= errors.size()) {
...
}

In the exmple above the full line after '0 <' is going to be colored.

The situation is the same everywhere where I can write Java code, like embedded places in grammar definitions:

ASTStart Start() #Start : {}
{
Class()
{
if ( a < b ) ...
return jjtThis;
}
}

Thx!
Richard

Discussion

  • Logged In: YES
    user_id=1755407
    Originator: YES

    Found a bug, but its really relevant to the mentioned enhancement request, so I put it here.

    When I define a greater, greater equal, or bit shifting operator token, the syntax highlighting also become inconsistent to the written code, eg.:

    TOKEN : /* OPERATORS */
    {
    < GE: ">=" >
    | < RSIGNEDSHIFTASSIGN: ">>=" >
    | < RUNSIGNEDSHIFTASSIGN: ">>>=" >
    }

     
  • Logged In: YES
    user_id=681022
    Originator: NO

    Added a special rule for JavaCC tokens both plain and private.

     
    • status: open --> closed