I have strange problem with token < NULL: "null" > in my JavaCC parser. In expression like
String IsNullClause():
{
String res = "";
}
{
<IS> {res += " IS ";}
[<NOT> {res += " NOT ";} ]
<NULL> {res += " NULL ";}
{
return res;
}
}
parser doesn't see NULL token and throws exception that "null" expected. If I change token definition to < NULL: "null_val" > or something else it works fine. Is this my mistake or JavaCC doesn't accept 'null' as a token value?
There are sample Java language grammars in JavaCC package, with the following token difinition:
< NULL: "null" >
so I'm pretty sure JavaCC can handle null token.
Are you sure no token declared before NULL matches "null"? Tokens are matched in the order of declaration. You may try to declare NULL at the very beginning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With