mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
tests/: update __future__ imports
TN: Q223-029
This commit is contained in:
@@ -3,6 +3,9 @@ Test that the "create-project.py" script creates a valid Langkit project by
|
||||
generating it and building it.
|
||||
"""
|
||||
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -23,4 +26,4 @@ manage_py = os.path.join('mylang', 'manage.py')
|
||||
python(create_project_py, 'Mylang')
|
||||
python(manage_py, '-vnone', 'make')
|
||||
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
File "test.py", line 30, In definition of grammar rule main_rule
|
||||
File "test.py", line 33, In definition of grammar rule main_rule
|
||||
Error: List parsers only accept subparsers that yield AST nodes (TokenType provided here)
|
||||
File "test.py", line 39, In definition of grammar rule main_rule
|
||||
File "test.py", line 42, In definition of grammar rule main_rule
|
||||
Error: Invalid list type for List parser: ListNode. Not a list type
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
|
||||
from langkit.compiled_types import ASTNode, Field, root_grammar_class
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 21, In definition of grammar
|
||||
File "test.py", line 24, In definition of grammar
|
||||
Error: Invalid rule name specified for main rule: "main_rulezz". Did you mean "main_rule"?
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from langkit.compiled_types import ASTNode, abstract, root_grammar_class
|
||||
from langkit.diagnostics import Diagnostics
|
||||
from langkit.parsers import Grammar, Row
|
||||
@@ -27,4 +30,4 @@ def lang_def():
|
||||
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 30, In definition of grammar rule main_rule
|
||||
File "test.py", line 33, In definition of grammar rule main_rule
|
||||
Error: Grammar rules must yield an AST node
|
||||
Done
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
Test that top-level Row parsers are properly reported as errors.
|
||||
"""
|
||||
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
|
||||
from langkit.compiled_types import ASTNode, Field, root_grammar_class
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 28, In definition of rule 'sec_rule'
|
||||
File "test.py", line 31, In definition of rule 'sec_rule'
|
||||
Error: Rule 'sec_rule' is already present in the grammar
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from langkit.compiled_types import ASTNode, abstract, root_grammar_class
|
||||
from langkit.diagnostics import Diagnostics
|
||||
from langkit.parsers import Grammar, Row
|
||||
@@ -29,4 +32,4 @@ def lang_def():
|
||||
)
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 24, In definition of grammar rule main_rule
|
||||
File "test.py", line 27, In definition of grammar rule main_rule
|
||||
Error: Wrong rule name: 'sec_rules'. Did you mean 'sec_rule'?
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from langkit.compiled_types import ASTNode, abstract, root_grammar_class
|
||||
from langkit.diagnostics import Diagnostics
|
||||
from langkit.parsers import Grammar, Row
|
||||
@@ -27,4 +30,4 @@ def lang_def():
|
||||
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import libfoolang
|
||||
|
||||
ctx = libfoolang.AnalysisContext()
|
||||
@@ -6,9 +9,9 @@ ctx = libfoolang.AnalysisContext()
|
||||
def process(text):
|
||||
u = ctx.get_from_buffer('main.txt', text)
|
||||
if u.diagnostics:
|
||||
print "Found errors:"
|
||||
print("Found errors:")
|
||||
for d in u.diagnostics:
|
||||
print "", d
|
||||
print("", d)
|
||||
else:
|
||||
u.root.dump()
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
Test that Bind works when binding from env elements.
|
||||
"""
|
||||
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
|
||||
from langkit.compiled_types import (
|
||||
@@ -94,4 +97,4 @@ foo_grammar.add_rules(
|
||||
main_rule=Or(A.comp, A.ind, A.nl)
|
||||
)
|
||||
build_and_run(foo_grammar, 'main.py', lexer=foo_lexer)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from langkit.compiled_types import (
|
||||
ASTNode, Field, root_grammar_class
|
||||
)
|
||||
@@ -35,4 +38,4 @@ def lang_def():
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import libfoolang
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ Test that garbage tokens left after the main parsing rule completes does not
|
||||
crash. It used to!
|
||||
"""
|
||||
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
|
||||
from langkit.compiled_types import ASTNode, Field, root_grammar_class
|
||||
@@ -30,4 +33,4 @@ foo_grammar.add_rules(
|
||||
main_rule=Row(Tok(Token.Number, keep=True)) ^ Literal,
|
||||
)
|
||||
build_and_run(foo_grammar, 'main.py')
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 21, in UnreferencedNode
|
||||
File "test.py", line 24, in UnreferencedNode
|
||||
Error: Unresolved ASTNode subclass. Use it in the grammar or provide a type annotation for all its fields
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from langkit.compiled_types import ASTNode, Field, abstract, root_grammar_class
|
||||
from langkit.diagnostics import Diagnostics
|
||||
from langkit.parsers import Grammar, Row
|
||||
@@ -29,4 +32,4 @@ def lang_def():
|
||||
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
File "test.py", line 20, in BarNode
|
||||
File "test.py", line 23, in BarNode
|
||||
Error: Cannot invoke the environment hook if CompileContext.bind_env_hook has not been called
|
||||
Done
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
|
||||
from langkit.compiled_types import ASTNode, root_grammar_class
|
||||
@@ -30,4 +33,4 @@ def lang_def():
|
||||
|
||||
|
||||
emit_and_print_errors(lang_def)
|
||||
print 'Done'
|
||||
print('Done')
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user