Code Monkey home page Code Monkey logo

antlr-tgen's Introduction

Things I Use for My Work

Development Design Work Code Management Collaboration
Visual Studio Code Araxis Merge TextMate Xcode clang Acorn Graphic.app xScope MacDown  Git Jenkins Gerrit Fork  Confluence Zoom Slack 
Programming Languages Testing Technology Stack
TypeScript JavaScript C++ Python CSS HTML Java Jest Jasmine NodeJS Preact MySQL ANTLRng esbuild Vite ESLint 

antlr-tgen's People

Contributors

mike-lischke avatar

Stargazers

 avatar

Watchers

 avatar  avatar

antlr-tgen's Issues

Process stderr might be undefined

After spawning a process, you access output.stderr, but without checking if it exists.

if (output.stderr.length > 0) {

Without an additional check, e.g., if (output.stderr && ...), I get

TypeError: Cannot read properties of null (reading 'length')
    at C.generateANTLRFilesInWorkDir

Generate grammars with unique names

Generated grammars - under different directories - will have the same name.

image

This is problematic for the Gradle's ANTLR plugin, which will output generated classes on a single directory, with a single package.
This means class names will conflict.

My proposal is to generate unique names by using a global counter as suffix:

M1.g4
S2.g4
M3.g4

Config file's 'files' element isn't optional

With a config file such as:

{
  "language": "Java",
  "targetPath": "./build/generatedAntlrTests",
  "targetExtension": "java",
  "testFileName": "Test",
  "grammarTemplateFile": "./templates/Kotlin.grammar.stg",
  "specTemplateFile": "./templates/Kotlin.test.stg",
  "groupIncludes": [],
  "groupExcludes": [],
  "testIncludes": [],
  "testExcludes": [],
  "files": []
}

I get

Found config validation errors in ./antlr-tgen.json

MINITEMS must NOT have fewer than 1 items

  10 |   "testIncludes": [],
  11 |   "testExcludes": [],
> 12 |   "files": []
     |            ^ ??  minItems must NOT have fewer than 1 items
  13 | }
  14 |

If I remove it entirely, I get

Found config validation errors in ./antlr-tgen.json

REQUIRED must have required property 'files'

> 1 | {
    | ^ ??  files is missing here!
  2 |   "language": "Java",
  3 |   "targetPath": "./build/generatedAntlrTests",
  4 |   "targetExtension": "java",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.