Files

27 lines
503 B
Plaintext
Raw Permalink Normal View History

# Check that passing structs as property argument and returning structs works
# as expected.
2026-01-13 14:49:31 +00:00
from lexer_example import foo_lexer
@with_lexer(foo_lexer)
grammar foo_grammar {
@main_rule main_rule <- Example(@Example)
}
@abstract
class FooNode implements Node[FooNode] {
}
class Example: FooNode implements TokenNode {
@exported
fun sum(s: MyStruct): Int = s.a + s.b
@exported
fun create(a: Int, b: Int): MyStruct = MyStruct(a=a, b=b)
}
struct MyStruct {
a: Int
b: Int
}