I am writing a parser for a language that has a lot of functions. I am
grouping the functions by their signature, but new functions could be
added to the language from an outside source, e.g. thru an XML
definitions file (with the requirement that they match an existing
signature).
Is there a way to predefine my token kinds so that my lexer logic can
return the correct value and javacc won't complain about identifier
not defined? In the snippet below, the RFN_I_S and RFN_I_IO are token
kinds that would be returned by the DetermineFunctionSigniture method.
TOKEN :
{
<FUNCTION: "@" ["a"-"z"](["a"-"z","0"-"9","_")*> {
matchedToken.kind = DetermineFunctionSignature(image);}
...
}
void FunctionCall():{}
{
<RFN_I_S> "(" StringValue() ")"
| <RFN_I_IO> "(" IntegerValue() ( "," IntegerValue() )* ")"
...
}
TIA,
-Rob