mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
As the LexicalEnv.get method always return an array of root nodes while the root node is defined in user code, we need to turn the Node and LexicalEnv classes into generic traits and instantiate them using the actual root node. To make this works, root node declaration has to be changed from `class FooNode : Node` to `class FooNode implements Node[FooNode]`, which required to refactor a bit almost all the lkt tests.
13 lines
227 B
Plaintext
13 lines
227 B
Plaintext
import lexer_example
|
|
@with_lexer(foo_lexer)
|
|
grammar foo_grammar {
|
|
@main_rule main_rule <- list+(Example("example"))
|
|
|
|
}
|
|
|
|
@abstract class FooNode implements Node[FooNode] {
|
|
}
|
|
|
|
class Example : FooNode implements TokenNode {
|
|
}
|