异常中的 JavaCC 行号
我使用 JavaCC 来解析我的脚本... 我在 types.get
的 *.jj 中有这样的东西,
private Type parseType() throws MyScriptException:
{
Token token;
}
{ ( token = <INT>
| token = <FLOAT>
| token = <BOOL>
| token = <STRING>
)
{ return types.get(token.image); }
}
当出现任何问题时,我会从 MyScriptException
类型抛出异常。 但我需要在输出中导致错误的行。 我可以将错误代码行集成到 MyScriptException
中吗?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Token
类具有给出令牌位置的属性:The
Token
class has attributes that give the location of the token: