Add ability to get all possible next tokens for autocompletion use
See original GitHub issueBruno LETRESTE points out:
i use yours getExpectedToken after i move to position in my algorithm my algorithm check the tokens and try to find the real path (in ATN tree) it stock the potential terminate for solve for exemple (and add potential to expected token)
expr : '(' expr ')'
| expr '+' expr
| ID
;
for exemple in this case, if i have ( ID
I get expected token return +
but it should have )
as well.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:19 (13 by maintainers)
Top Results From Across the Web
H98: Using HTML 5.2 autocomplete attributes
The technique works by adding the appropriate autocomplete token to each form field on the form to make the identified inputs Programmatically Determinable....
Read more >Antlr3 next available tokens when parsing incomplete statement
Sorry to say this but: don't use a parser directly for auto completion. There are several reasons why this won't work as you...
Read more >HTML attribute: autocomplete - MDN Web Docs
The HTML autocomplete attribute lets web developers specify what if any permission the user agent has to provide automated assistance in ...
Read more >Building autocompletion for an ANTLR parser - Google Groups
I call this part "syntactic autocompletion" and it works for all kinds of tokens but identifiers. I wrote the algorithm once and I...
Read more >CodeFill: Multi-token Code Completion by Jointly Learning ...
CodeFill surpasses all baselines in single token predic- ... tocompletion systems also take into account past completions [43].
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah, good you reminded me. The C++ implementation is on Github since a few weeks already. However, there’s no readme or other document in that repo for this code. However, I have a port (or rather a parallel development) of this idea written in Typescript (and there are ports of that code to Kotlin and Java). And this repo also contains some documentation how to configure and use the engine. Let’s discuss there if you have any questions.
I’ve noticed with Mike Lischke’s implementation that it does not compute the lookahead sets correctly in some situations. In particular, for Antlr grammars, if I want the lookahead set after a parser rule semicolon, I get an incomplete set that also includes epsilon but should not. Starting with Mike’s implementation, and Parr’s LL(*) paper, I derived a similar algorithm (http://codinggorilla.com/?p=2449) and have C# implementations for code completion in an LSP server and for error reporting in a Net Core Antlr “Hello World” template (https://github.com/kaby76/Antlr4BuildTasks/blob/master/Templates/templates/AntlrCAProject/LASets.cs). Note, the design is recursive and makes a call per an edge/token match, so I don’t doubt stack overflow issues in construction of a parse. One step at a time.