Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Antlr4 缺少python3 Parser.setErrorHandler方法_Antlr4 - Fatal编程技术网

Antlr4 缺少python3 Parser.setErrorHandler方法

Antlr4 缺少python3 Parser.setErrorHandler方法,antlr4,Antlr4,我试图在出现第一个语法错误时退出解析器。 似乎没有实现setErrorHandler?这就是错误所在 parser.setErrorHandler(BailErrorStrategy()) AttributeError: 'XParser' object has no attribute 'setErrorHandler' 看起来好像没有一个设定值。不知道为什么 无论如何,这是您可以设置它的方式: 从antlr4.error.ErrorStrategy导入BailerStrategy ..

我试图在出现第一个语法错误时退出解析器。 似乎没有实现
setErrorHandler
?这就是错误所在

 parser.setErrorHandler(BailErrorStrategy())

AttributeError: 'XParser' object has no attribute 'setErrorHandler'
看起来好像没有一个设定值。不知道为什么

无论如何,这是您可以设置它的方式:

从antlr4.error.ErrorStrategy导入BailerStrategy
...
解析器=。。。
解析器。_errHandler=BailErrorStrategy()