What is minimal sample Gradle project for ANTLR4 (with antlr plugin)?

后端 未结 7 1421
陌清茗
陌清茗 2021-02-14 03:47

I have created new Gradle project, added

apply plugin: \'antlr\'

and

dependencies {
    antlr \"org.antlr:antlr4:4.5.3\"


        
相关标签:
7条回答
  • 2021-02-14 04:47

    The Gradle sample noted by @Mark Vieira only got me halfway there. I found that I had to specify the package in the header of my ANTLR grammar file in order for everything to be seen in both directions (generated code able to access hand-written code and vice-versa).

    grammar MyGrammar;
    
    @header {
        package com.mypackage;
    }
    

    Prior to switching to Gradle, I had been using the ANTLR plugin in IntelliJ, which filled in the package for me. Upon switching to Gradle, the package went away, which caused problems.

    Source: https://stackoverflow.com/a/1655920/1877143

    0 讨论(0)
提交回复
热议问题