ANTLR 4.10.1中的依赖性声明误差
It seems there is a conflict of version for the antlr-runtime lib pulled by ANTLR 4.10.1: 3.5.2 versus 3.5.3.
Here is the gradle analyze result:
Antlr team can you confirm please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题已在项目的GitHub上提出:
https://github.com/antlr/antlr/antlr4/issues/3733
The issue has been raised on project's github:
https://github.com/antlr/antlr4/issues/3733
我偶然发现了这个问题,试图在PHP环境中使用Antlr4。
虽然问题仍然存在(我使用的是PHP7.4.3,并且对我升级为PHP8是我的选择,因此在以后版本的PHP版本上可能可以正常工作)。
我的解决方法如下:
使我的代码在类之间传达了相同的ATN类型(运行时版本和我生成的类之间的差异的第一个差异)。但是走我的语法给了我另一个错误 - 可能是运行时和生成版本之间的另一个区别。
该代码的代码是在antlr/antlr4 repo中,而不是antlr-php-runtime repo:
我发现了问题“ php target runtime crasties crasties crasties with in atndeserializer.php in 731 in 731”#3509“#3509”#3509
( https://github.com/antlr/antlr/antlr4/issues/3509 ) /p>
我在此处下载并提取文件。我的错误发生在Atndeserializer.php中,我发现来自Kaby Zipfile的Sourcecode不包括我上面描述的ATN修复程序,但确实包含了Isfeaturesuduresupport的添加。
。
。
由于我的语法未产生指示的添加_unicode_smp,所以我只是在避免函数中评论了该部分:
...
//首先,具有16位参数< = u+ffff的避难所集。
$ this-> readsets($ sets,function(){
返回$ this-> readint();
});
//接下来,如果ATN与Unicode SMP功能序列化,
//具有32位参数< = u+10ffff的值集。
/*
if($ this-> isfeaturesupported(self :: add_unicode_smp,$ this-> uuid)){
$ this-> readsets($ sets,function(){
返回$ this-> readint32();
});
}
*/
$ this-> readedges($ atn,$ sets);
...
尽管这使我有效,但这是一种解决方法,不建议作为长期解决方案。
I stumbled across this issue attempting to use ANTLR4 in a PHP environment.
While the issue still exists afaik (I'm on PHP7.4.3 and upgrading to PHP8 is not an option for me so it may work fine on later versions of PHP).
My workaround went as follows:
This got my code communicating the same ATN type between classes (the first of the differences between the runtime version and my generated classes). But walking my grammar gave me another error - probably another difference between runtime and generated versions.
The code for this one was in the antlr/antlr4 repo instead of the antlr-php-runtime repo:
I found issue "PHP target runtime crashes with "Undefined offset: 0 in ATNDeserializer.php on line 731" #3509
(https://github.com/antlr/antlr4/issues/3509)
In the posts, the last commenter (kaby76) includes a zipfile called "Generated.zip" that contains the generated source code as it is supposed to look like.
I downloaded and extracted the files here. My error was occurring in ATNDeserializer.php and I found that the sourcecode from Kaby's zipfile did not include the ATN fixes I described above but it did contain the addition of IsFeatureSupported.
Since my grammar does not produce the indicated ADDED_UNICODE_SMP, I just commented that portion out in the deserialize function:
...
// First, deserialize sets with 16-bit arguments <= U+FFFF.
$this->readSets($sets, function () {
return $this->readInt();
});
// Next, if the ATN was serialized with the Unicode SMP feature,
// deserialize sets with 32-bit arguments <= U+10FFFF.
/*
if ($this->isFeatureSupported(self::ADDED_UNICODE_SMP, $this->uuid)) {
$this->readSets($sets, function () {
return $this->readInt32();
});
}
*/
$this->readEdges($atn, $sets);
...
Although this got me working, it is a workaround and not recommended as a long-term solution.