token in my JavaCC parser. In a type expression String IsNullClause(): ...">

Null token in JavaCC

I have a strange problem with the <NULL: "null"> token in my JavaCC parser. In a type expression

String IsNullClause():
{
      String res = "";
}
{
     <IS> {res += " IS ";}
     [<NOT> {res += " NOT ";} ]
     <NULL> {res += " NULL ";}

{
    return res;
}
}

the parser does not see the NULL token and throws an exception that expects a null. If I change the definition of the token to <NULL: "null_val"> or something else works fine. Is this my mistake or is JavaCC not accepting "null" as the value of the token?

+3
source share
1 answer

The JavaCC package contains examples of Java language grammars with the following token definition:

< NULL: "null" >

so I'm sure JavaCC can handle a null token.

, , NULL "null"? . NULL .

+3

All Articles