What's the idiomatic way of handling errors while walking the parse tree in ANTLR4?

I'm just getting started with ANTLR4 and I'm in the process of creating a listener that walks the parse tree. I also have a custom error listener added the `Parser` instance; to build on this, I'd like any errors I report during a call to `ParseTreeWalker.walk()` to also go to the parser's error listeners. It's occurred to me that I could call `Parser.getErrorListeners()` and inject it to my listener class, but I was hoping for something a little more baked-in. While I'm at it, I need a means of determining a given node's row and column number when reporting the error. Does everyone just roll their own when it comes to reporting errors found by a listener or visitor?

以上就是What's the idiomatic way of handling errors while walking the parse tree in ANTLR4?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏