Conversation
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
There was a problem hiding this comment.
Suggestion: Since we need all of this code in other parts of the parser (not just the lookahead), it might make sense to move it to the parser parent directory.
There was a problem hiding this comment.
FTM a lot of stuff is inside the generator package. Only the Runtime ATN is in the parser package.
| // Go code in external packages can construct them as struct literals. | ||
| type RuntimeAtomTransition struct { | ||
| Target *RuntimeATNState | ||
| TokenTypeID int |
There was a problem hiding this comment.
Suggestion: I don't think it's enough to just pass the target token type ID here, because we eventually want to implement token categories like in Chevrotain - see #49. For this, we need an actual reference to the token type.
There was a problem hiding this comment.
FTM I removed the CategoryMatches. Eventually, we can link token types here, if needed.
| "typefox.dev/fastbelt/generator" | ||
| ) | ||
|
|
||
| func EmitMarkdownSource(pkgName string, rtn *RuntimeATN, tokenTypeNames map[int]string) generator.Node { |
There was a problem hiding this comment.
Suggestion: This part of the code should live in the internal part of the framework - adopters shouldn't be able to call this function IMO.
| // pkgName – Go package name for the generated file (e.g. "myparser") | ||
| // funcName – name of the generated constructor function | ||
| // importPath – import path of the allstar package (e.g. "typefox.dev/fastbelt/parser/allstar") | ||
| func EmitGoSource(pkgName, funcName, importPath string, rtn *RuntimeATN) generator.Node { |
There was a problem hiding this comment.
Suggestion: This part of the code should live in the internal part of the framework - adopters shouldn't be able to call this function IMO.
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
| // Go code in external packages can construct them as struct literals. | ||
| type RuntimeAtomTransition struct { | ||
| Target *RuntimeATNState | ||
| TokenTypeID int |
There was a problem hiding this comment.
FTM I removed the CategoryMatches. Eventually, we can link token types here, if needed.
| } | ||
|
|
||
| // TokenType carries the type ID and category-match IDs for a token type. | ||
| type TokenType struct { |
There was a problem hiding this comment.
Need to replace this one...
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
| Action_Alternatives_1 ATNDecisionId = 0 | ||
| Action_Group_2 ATNDecisionId = 1 | ||
| Alternatives_Group_2 ATNDecisionId = 2 | ||
| Alternatives_Group_3 ATNDecisionId = 3 |
There was a problem hiding this comment.
The counter inside the name looks broken...
There was a problem hiding this comment.
The counter refers to the index of all parts in a rule. Only a few are used for the decision map.
Signed-off-by: Markus Rudolph <markus.rudolph@typefox.io>
There is a big Compile Time ATN for construction and a slim Runtime ATN.
I also added a Markdown generator to be able to debug the ATN visually.