mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
37 lines
717 B
Plaintext
37 lines
717 B
Plaintext
# Test that the "is_ghost" AST node predicate works in the Python API
|
|
|
|
from lexer_example import foo_lexer
|
|
|
|
@with_lexer(foo_lexer)
|
|
grammar foo_grammar {
|
|
@main_rule main_rule <- list+(Param(name mode plus))
|
|
name <- Name(@Identifier)
|
|
mode <- or(
|
|
| Enum.Null("null")
|
|
| Enum.Example("example")
|
|
| Enum.Default()
|
|
)
|
|
plus <- PlusQualifier("+")
|
|
}
|
|
|
|
@abstract
|
|
class FooNode implements Node[FooNode] {
|
|
}
|
|
|
|
enum class Enum: FooNode {
|
|
case Null, Example, Default
|
|
}
|
|
|
|
class Name: FooNode implements TokenNode {
|
|
}
|
|
|
|
class Param: FooNode {
|
|
@parse_field name: Name
|
|
@parse_field mode: Enum
|
|
@parse_field has_plus: PlusQualifier
|
|
}
|
|
|
|
@qualifier
|
|
enum class PlusQualifier: FooNode {
|
|
}
|