首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pascal语法的反恐慌

pascal语法的反恐慌
EN

Stack Overflow用户
提问于 2016-03-31 16:06:46
回答 1查看 869关注 0票数 4

我希望生成Pascal java解析器,然后在我的gradle应用程序中使用它。

对于Pascal,我使用了这个语法https://github.com/antlr/grammars-v4/tree/master/pascal

我的build.gradle看起来像这样。我使用了antlr插件。

代码语言:javascript
复制
apply plugin: 'groovy'
apply plugin: 'antlr'

repositories {
    jcenter()
}

dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.4.6'
    compile 'org.antlr:antlr4:4.5.3'

    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
    testCompile 'junit:junit:4.12'
}

但是,当我尝试运行任务generateGrammarSource时,我会得到这个错误

代码语言:javascript
复制
:generateGrammarSource
L:\app\src\main\antlr\pascal.g4:36:1: unexpected token: grammar
error: Token stream error reading grammar(s):
L:\app\src\main\antlr\pascal.g4:804:8: expecting ''', found '='
L:\app\src\main\antlr\pascal.g4:36:1: unexpected token: grammar
error: Token stream error reading grammar(s):
L:\app\src\main\antlr\pascal.g4:804:8: expecting ''', found '='
L:\app\src\main\antlr\pascal.g4:36:1: rule grammar trapped:
L:\app\src\main\antlr\pascal.g4:36:1: unexpected token: grammar
TokenStreamException: expecting ''', found '='
:generateGrammarSource FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateGrammarSource'.
> There was 1 error during grammar generation
   > ANTLR Panic: TokenStreamException: expecting ''', found '='

问题是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-29 15:40:16

management的插入文档中

"antlr:antlr:2.7.7将用作默认值。“

要更改此选项,只需按下面所示说明使用哪个版本即可

代码语言:javascript
复制
dependencies {
    //antlr "org.antlr:antlr:3.5.2" // use ANTLR version 3
    antlr "org.antlr:antlr4:4.5" // use ANTLR version 4
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36338445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档