mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
35 lines
676 B
Plaintext
35 lines
676 B
Plaintext
# Test that the $.C Ada API and the Python bindings can be used to create
|
|
# Python bindings for user libraries.
|
|
|
|
from lexer_example import foo_lexer
|
|
|
|
@metadata
|
|
struct Metadata {
|
|
f1: Bool
|
|
f2: Bool
|
|
}
|
|
|
|
@with_lexer(foo_lexer)
|
|
grammar foo_grammar {
|
|
@main_rule main_rule <- list*(Example("example"))
|
|
}
|
|
|
|
@abstract
|
|
class FooNode implements Node[FooNode] {
|
|
@exported
|
|
fun with_md(f1: Bool, f2: Bool): Entity[FooNode] = self.update(
|
|
info=self.info.update(
|
|
md=Metadata(f1=f1, f2=f2)
|
|
)
|
|
)
|
|
|
|
@exported
|
|
fun get_f1(): Bool = self.info.md.f1
|
|
|
|
@exported
|
|
fun get_f2(): Bool = self.info.md.f2
|
|
}
|
|
|
|
class Example: FooNode implements TokenNode {
|
|
}
|