-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want implement in Golang, but ... #156
Comments
I'm afraid it won't work without this array. You usually don't know which ATN start state is used to start a parser rule. This array is generated when the ATN is loaded from the serialized ATN in your generated parser. However, you could generate them yourself by walking over all ATN states and collect all that are rule start states. An ATN state always comes with the index of the rule it belongs to. |
Thank you very much. I have implement antlr4-c3 in Go. SELECT | FROM t1 Thank you agagin. |
Great to hear you managed the port to Go! Would you mind opening a PR here to add your port to the official repo (along with the other ports for C++, C# etc.)? For code completion: important is that the SQL code is correct up to the invocation point of the engine. So in your case it should give you everything what's possible after SELECT. btw. I have implemented SQL code completion myself, twice actually. Maybe you want to study that code for quicker results? Here's my latest implementation: https://github.com/mysql/mysql-shell-plugins/blob/master/gui/frontend/src/parsing/mysql/MySQLCodeCompletion.ts |
Hi lischke, I am having some problems. SELECT name FROM users // caretTokenIndex 4 is 'From' right?
collection := core.CollectCandidates(4, nil)
Collected tokens:
DOT_SYMBOL
AS_SYMBOL
ID
COMMA_SYMBOL
FROM_SYMBOL By ignoring spaces, collected tokens inlucde ID, but obviously there can't be an ID, so incorret result is My question is:
Thank you very much. |
There can be an id: |
Thank you for your reply, I did miss some details. |
Hello lischke, I'm sorry to bother you again.
PreferredRules:
Example1simpleExpression:
simpleExpression (PLUS | MINUS) simpleExpression
| simpleExpression (MULTIPLY | DIVIDE) simpleExpression
| functionRef
| variableRef
;
variableRef: identifier dotIdentifier;
functionRef: identifier dotIdentifier OPEN_PAR CLOSE_PAR;
identifier: ID;
dotIdentifier: DOT identifier; result:
Example 2simpleExpression:
simpleExpression (PLUS | MINUS) simpleExpression
| simpleExpression (MULTIPLY | DIVIDE) simpleExpression
| functionRef
| variableRef
;
variableRef: identifier DOT identifier;
functionRef: identifier DOT identifier OPEN_PAR CLOSE_PAR;
identifier: ID; result:
Why Example1 only has Thanks for your help! |
I will provide Go port later. |
Thanks for the repo!
I meet antlr/antlr4#4702
Is there another way to implement the function without using
ruleToStartState
variable?The text was updated successfully, but these errors were encountered: