ANTLR 4.10.1中的依赖性声明误差

发布于 2025-02-02 23:53:08 字数 254 浏览 5 评论 0原文

Antlr 4.10.1:3.5.2对3.5.3的Antlr-luntime Lib似乎存在一个版本冲突。 这是Gradle分析结果:

ANTLR团队您能确认吗?

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:
gradle dependency check

Antlr team can you confirm please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠栀 2025-02-09 23:53:08

这个问题已在项目的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

-黛色若梦 2025-02-09 23:53:08

我偶然发现了这个问题,试图在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>

  • ) p>在帖子中,最后一位评论者(kaby76)包括一个称为“生成的zip”的Zipfile,该Zipfile包含应该看起来像的生成源代码。

  • 我在此处下载并提取文件。我的错误发生在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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文