mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
25 lines
457 B
Python
25 lines
457 B
Python
|
|
"""
|
||
|
|
Test that the bool() operator on nodes works as expected.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import absolute_import, division, print_function
|
||
|
|
|
||
|
|
from langkit.dsl import ASTNode
|
||
|
|
from langkit.parsers import Grammar, List
|
||
|
|
|
||
|
|
from utils import build_and_run
|
||
|
|
|
||
|
|
|
||
|
|
class FooNode(ASTNode):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
class Example(FooNode):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
foo_grammar = Grammar('main_rule')
|
||
|
|
foo_grammar.add_rules(main_rule=List(Example('example')))
|
||
|
|
build_and_run(foo_grammar, 'main.py')
|
||
|
|
print('Done')
|