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前端其它相关文章！