Comments (13)
To reproduce:
- Create new file
A.g4
and save:
parser grammar A
;
options
{
tokenVocab = ALexer;
}
a
: A
;
- Create new file
ALexer.g4
and save:
lexer grammar ALexer
;
A
: 'a'
;
B
: 'b'
;
Result:
from vscode-antlr4.
Currently I have to cut the tokenVocab
line - save - paste - save to force the extension to recognize the new tokens.
from vscode-antlr4.
Any change in your parser grammar updates the symbol table. You can see that with your reproduction steps. After you created and saved the lexer go back to your parser. Then press the space key and A
is suddenly recognized.
from vscode-antlr4.
Well, I made a mistake in the reproduction steps...
- Create a new file
A.g4
and save:
parser grammar A
;
options
{
tokenVocab = ALexer;
}
a
: A
;
- Create a new file
ALexer.g4
and save:
lexer grammar ALexer
;
A
: 'a'
;
Now press space and A
is recognized.
- Add the following to
ALexer.g4
and save:
B
: 'b'
;
- Add the following to
A.g4
and save:
b
: B
;
Now the issue is right there: Unknown token reference 'B'
.
from vscode-antlr4.
Reopening the parser file can let the new tokens recognized, but I would appreciate it if you could make it work as soon as the lexer file is modified and saved. Maybe add a hook or something?
from vscode-antlr4.
Weird. When I add a new lexer symbol in the lexer grammar it is immediately available in the parser grammar. No error marker appears and the symbol info is available. I don't even need to save either file. I tried this also with a fairly complex grammar, which takes a moment to analyze. Still, everything is immediately there. What else could cause your trouble?
from vscode-antlr4.
My configuration:
{
"antlr4.format.alignColons": "hanging",
//"antlr4.format.alignLexerCommands": true,
"antlr4.format.alignSemicolons": "ownLine",
//"antlr4.format.allowShortBlocksOnASingleLine": false,
"antlr4.format.allowShortRulesOnASingleLine": false,
"antlr4.format.breakBeforeBraces": true,
"antlr4.format.breakBeforeParens": true,
"antlr4.format.columnLimit": 10000,
"antlr4.format.minEmptyLines": 1,
"antlr4.format.reflowComments": false,
"antlr4.format.useTab": false,
//"antlr4.referencesCodeLens.enabled": true,
}
VSC information:
版本 1.19.0-insider
提交 d8989c95964ce06c64ffebc2fb400a0327bd447d
日期 2017-12-08T10:45:40.870Z
Shell 1.7.9
渲染器 58.0.3029.110
Node 7.9.0
架构 x64
from vscode-antlr4.
Btw, could you please print some logs (output from antlr4, javac, etc.) in the output window? Of course users can clone the repo and debug the extension in vsc, but it may be better if they can check what's wrong without the need of it.
from vscode-antlr4.
Why did you add your formatter settings here? This issue is about unrecognized symbols.
Btw, could you please print some logs (output from antlr4, javac, etc.) in the output window? Of course users can clone the repo and debug the extension in vsc, but it may be better if they can check what's wrong without the need of it.
What do you have in mind that should be printed?
from vscode-antlr4.
Why did you add your formatter settings here? This issue is about unrecognized symbols.
I thought the settings may affect the behavior of the extension, however I've been aware that I was wrong.
What do you have in mind that should be printed?
Emmm... Output from antlr4-graps maybe? I mean I don't quite understand the mechanism of this extension.
from vscode-antlr4.
I see, ok. So what about converting this issue into a FR for more debug output? I cannot reproduce the original issue. It seems to work well, as I described above.
from vscode-antlr4.
Fair enough. I'll reinstall vsc and disable other extensions to see if the issue will still persists.
from vscode-antlr4.
Thinking about this again, I come to the conclusion that there's nothing here I can do. Adding extra logging calls to the extension code is pretty odd. This is not how problems are handled in vscode extensions. Errors can be seen in the developer tools window and anything else is useless, since nobody is every going to read it.
Better ask specific questions if you need to understand certain processing in the extension.
from vscode-antlr4.
Related Issues (20)
- Error terminal nodes show as green in visualized parse tree HOT 3
- No rule selected HOT 4
- Navigation not working HOT 6
- Update to 2.4.2 broke project HOT 7
- Split grammar not generating properly, and can't debug HOT 3
- Debug antlr in vscode with launch.json HOT 10
- Cannot build .vsix HOT 2
- Extension does not work on Windows HOT 2
- TypeError: Cannot read properties of undefined (reading 'toString') HOT 1
- Formatting HOT 2
- railroad diagram: empty route and repeating routes are ambigious HOT 3
- Tokens not found if there's no lexer file, but only a .tokens file
- Bug: Generate valid input for rule ignores negation
- How can I have my parser tree graphical visualizations with my antlr grammar file and input for parse? HOT 3
- Visual parse tree not showing for version 2.4.5 HOT 5
- A Bottom part of big digram can be hidden. HOT 15
- [Internal Error] Unhandled error message (code 50, message: syntax error: mismatched character '<EOF>' expecting ''' Please file a bug report at https://github.com/mike-lischke/vscode-antlr4/issues) HOT 5
- [Feature Request] live tester HOT 4
- implicit token command not found HOT 1
- Feature/Bug: Disable cache for Parse Tree HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-antlr4.