Code Monkey home page Code Monkey logo

Comments (10)

mike-lischke avatar mike-lischke commented on June 5, 2024

It should start debugging the grammar you have specified in the launch config. Maybe it tries to start with the current grammar instead? You probably still have the launch config active. Try switching to a grammar tab and start again. If that works, there might be a bug in the debugger session creation.

from vscode-antlr4.

Marouns avatar Marouns commented on June 5, 2024

Hello Mike,
I tried debugging both from 'mmmTable.g4' and from 'mmm_Table.txt'.
getting the same result.
What do you mean by "You probably still have the launch config active", as the debugger is active on the background ? restarted vscode and tried again...
OUTPUT: _[debug] No lexer interpreter data found at _

from vscode-antlr4.

mike-lischke avatar mike-lischke commented on June 5, 2024

If you see that "no interpreter data found" message it means that you should trigger a re-creation of that, by changing your grammar and saving it. You can also try to remove .antlr folder beside your grammar and then do the re-creation.

By "having the config active" I meant that this was your active editor tab. My suggestion was to switch to your grammar tab and try again to start debugging. This shouldn't be necessary as you have given a grammar (double check the path is correct!), but at least is worth a try.

from vscode-antlr4.

svee4 avatar svee4 commented on June 5, 2024

I renamed both lexer and grammar files, deleted .antlr, restart VSCode, and it suddenly started working. Next I got an error along the lines of cannot read properties of undefined (reading inputStream), but this was also fixed by restarting VSCode. Now I get an error saying the grammar contains issues, which I assume means that the problem is on my end now.

After typing this, I tabbed back into VSCode and pressed F5, and I got hit with the same debugger creation failed message again. Restarting VSCode fixes it until I open the parser file. After the parser file has been opened once, the error repeats, until VSCode is restarted and parser file is kept unopened.

(By parser and lexer files, I'm referring to files that have parser grammer myp; and lexer grammar myt;, one of each).

Heres my launch.json:

{
	"version": "2.0.0",
	"configurations": [
		{
			"name": "Debug ANTLR4 grammar",
			"type": "antlr-debug",
			"request": "launch",
			"input": "input.txt",
			"grammar": "myp.g4",
			"startRule": "file",
			"printParseTree": true,
			"visualParseTree": true
		}
	]
}

VSCode settings:

{
	"antlr4.generation": {
		"mode": "internal",
		"language": "Java",
		"listeners": true,
		"visitors": false
	}
}

Directory looks like this
image

For the record I'm very new to ANTLR

from vscode-antlr4.

Marouns avatar Marouns commented on June 5, 2024

Hi,
same settings is working on Windows 10.
On windows 11 same settings, got to a point where I trigger the debug and nothing happens, no Error no output. Tried all the above.

from vscode-antlr4.

svee4 avatar svee4 commented on June 5, 2024

I also got no output no error, when I pressed F5 in a non-.g4 file. Though this didn't happen always, I dont remember the exact circumstances.

I'm on Windows 11 with WSL2 Ubuntu.

from vscode-antlr4.

Marouns avatar Marouns commented on June 5, 2024

@mike-lischke any insights on differences for win 10 and win 11 ? any clue for what it might be ?

from vscode-antlr4.

ToughKnee avatar ToughKnee commented on June 5, 2024

I also got problems on Windows 11, specifically the error "Could not launch debug session: the grammar contains issues.", I've tried deleting the directory and restarting in a lot of ways vscode but the same error kept appearing, and I know my grammar file and settings for the setup for debugging are fine because they are the literal same in another computer I have which has WInodws 10, and the extension works fine in there, it seems Windows 11 somehow gives problem to this extension

from vscode-antlr4.

ToughKnee avatar ToughKnee commented on June 5, 2024

Ok I've found the solution to it that may work for someone that is struggling with this
Basically the error I got previously was actually happening in my Windows 10 pc too, the thing is that in the launch.json, the "grammar" value had a really long path in my case, but if I copy and pasted the same exact grammar to another file, BUT placed the file in a simpler location like 'C:/Desktop', and specified that location to the launch.json, then the antlr extension started working and printing the parse tree
And now this extension works both in Windows 10 and 11, also the "input" value did not need to relocate the file
I don't know the exact problem, but that is the solution I found

from vscode-antlr4.

mike-lischke avatar mike-lischke commented on June 5, 2024

Sounds like either a too long path or some special chars in it, that are not visible (e.g. zero width characters, which got removed when you copy/pasted the path around).

from vscode-antlr4.

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.