i use JavaCC for parsing my script... I have something like this in my *.jj
private Type parseType() throws MyScriptException:
{
Token token;
}
{ ( token = <INT>
| token = <FLOAT>
| token = <BOOL>
| token = <STRING>
)
{ return types.get(token.image); }
}
in types.get I throw an exception from type MyScriptException when anything goes wrong.
But I need in the output from which line the error was caused.
Can I integrate the line from error in MyScriptException?
The
Tokenclass has attributes that give the location of the token: