GithubHelp home page GithubHelp logo

Comments (11)

cubuspl42 avatar cubuspl42 commented on June 19, 2024 1

I also get something like this:

src/generated_parser/MetamarkLexer.ts:83:13 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Lexer'.

83  public get serializedATN(): string { return MetamarkLexer._serializedATN; }
               ~~~~~~~~~~~~~

I have strict tsconfig.json settings in my project and it's not really possible to add an exception from a rule for ANTLR-generated classes... So I'm basically forced to use less safe compiler options πŸ˜”

from antlr4ts.

martinmolema avatar martinmolema commented on June 19, 2024

Managed to recompile the .jar file for the generation tool (in folder 'tool'). Then put the file antlr4-typescript-4.9.0-SNAPSHOT-complete.jar in the Angular project folder for antlr4ts-cli (node_modules/antlr4ts-cli/target) and ran the regular antlr4ts script to generate new files.

from antlr4ts.

IT-CASADO avatar IT-CASADO commented on June 19, 2024

I'm having the same trouble and your workaround is unfortunately only a workaround.

This issue/ticket needs to be reopened to solve this problem here in this repository.

from antlr4ts.

martinmolema avatar martinmolema commented on June 19, 2024

Another solution would be to just unzip the .jar-file ntlr4-typescript-4.9.0-SNAPSHOT-complete.jar (after all it is just a zip-file) and replace the given attachment (see my initial contribution) and re-zip the whole thing and rename it to .jar again.
The .jar-file can me found in node_modules/antlr4ts-cli/target.

from antlr4ts.

nidomiro avatar nidomiro commented on June 19, 2024

Here is an example on how to automate this: nidomiro/relation-tuple-parser@8209a1b

from antlr4ts.

chengchengpei avatar chengchengpei commented on June 19, 2024

are your problems resolved?
did you compile using ts 4.4.0+?
@martinmolema @nidomiro

from antlr4ts.

nidomiro avatar nidomiro commented on June 19, 2024

@chengchengpei I'm using ts 4.8.2 at the commit posted above. It compiles, but only with the patches.

from antlr4ts.

martinmolema avatar martinmolema commented on June 19, 2024

@chengchengpei thank you for your help. However, I have no idea how to apply such a patch... there's a first time for everything. Could you give me pointers here?

from antlr4ts.

chengchengpei avatar chengchengpei commented on June 19, 2024

I got some errors when using antlr4ts in my project. Here is the post: https://stackoverflow.com/questions/74870072/typeerror-class-extends-value-undefined-is-not-a-constructor-or-null-when-using

I need help. Any comments welcomed. thanks :)

from antlr4ts.

martinmolema avatar martinmolema commented on June 19, 2024

I upgraded to Angular 16 and got some more errors. Noticed that a few more override statements had to be inserted.
TypeScript.txt
Please rename this attachment to TypeScript.stg and put it in the right place.

Also wrote a small shell-script to help repackaging without recompiling the whole stuff. Make sure to unpack the original .jar-file somewhere. Then put the script and the attachment (TypeScript.stg) in the same folder. So you get the following folder structure:

ProjectFolder
|
|-----antlr4-typescript-4.9.0-SNAPSHOT-complete/
|-----repackage.sh
|-----TypeScript.stg

# This will create a new JAR-file that can be used to create new G4-dependant files using the antlr4ts-cli
# - Edit the file ./TypeScript.stg (in this folder)
# - save the file
# - run this script
# The script will copy the .stg-file to the right folder in the folder structure that originated from the original
# JAR-file (antlr4-typescript-4.9.0-SNAPSHOT-complete.jar) that was unpacked here.
# then a new JAR-file is created and put in the right folder: the node_modules folder that was created when installing
# the antlr4ts-cli (https://github.com/tunnelvisionlabs/antlr4ts/tree/master) :
#   node_modules/antlr4ts-cli/target/antlr4-typescript-4.9.0-SNAPSHOT-complete.jar

PROJECT_ROOT="/mnt/ssd/Develop/crisisgame/scenariomanager-v16"
ANTLR4TS_FOLDER=${PROJECT_ROOT}/__Resources/Antlr4ts-cli
JAR_FILE_UNPACKED_FOLDER=${ANTLR4TS_FOLDER}/antlr4-typescript-4.9.0-SNAPSHOT-complete
TEMPLATE_FILENAME_DESTINATION_JAR_FILE=${JAR_FILE_UNPACKED_FOLDER}/org/antlr/v4/tool/templates/codegen/TypeScript

cd $ANTLR4TS_FOLDER
cp TypeScript.stg $TEMPLATE_FILENAME_DESTINATION_JAR_FILE

# Repackage the file. this must be done using the current folder otherwise the class-files will have an absolute path in them
cd $JAR_FILE_UNPACKED_FOLDER
jar cvfm $ANTLR4TS_FOLDER/typescript.jar ./META-INF/MANIFEST.MF .

# Copy to source location and rename to right filename
cd $ANTLR4TS_FOLDER
cp typescript.jar ${PROJECT_ROOT}/node_modules/antlr4ts-cli/target/antlr4-typescript-4.9.0-SNAPSHOT-complete.jar

from antlr4ts.

fronbasal avatar fronbasal commented on June 19, 2024

Still seeing the same thing on TypeScript 4.9.5 :(

from antlr4ts.

Related Issues (20)

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.