• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Révisionbf6d9d5f94387fb7fc785941e03f36c03b97c913 (tree)
l'heure2022-01-15 07:52:02
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

Added a SKIPED test to parse the grammer-file into an AST

Change Summary

Modification

diff -r 7e121f56e9bc -r bf6d9d5f9438 Arpeggio/pytst/d2_ast/__init__.py
--- a/Arpeggio/pytst/d2_ast/__init__.py Fri Jan 14 23:17:08 2022 +0100
+++ b/Arpeggio/pytst/d2_ast/__init__.py Fri Jan 14 23:52:02 2022 +0100
@@ -4,10 +4,12 @@
44 import sys; sys.path.append("./../AST/") ; sys.path.append("./../../AST/")
55 from castle import peg # has the AST clases
66
7+import grammar
8+
79 def parse(txt, rule,
810 print_tree_debug=False,
911 visitor_debug=False):
10- parser = arpeggio.ParserPython(rule)
12+ parser = arpeggio.ParserPython(rule, grammar.comment)
1113 pt = parser.parse(txt)
1214 if print_tree_debug:
1315 print('\n'+pt.tree_str())
diff -r 7e121f56e9bc -r bf6d9d5f9438 Arpeggio/pytst/d2_ast/test_9_grammar.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Arpeggio/pytst/d2_ast/test_9_grammar.py Fri Jan 14 23:52:02 2022 +0100
@@ -0,0 +1,22 @@
1+import pytest
2+import logging; logger = logging.getLogger(__name__)
3+from pathlib import Path
4+import os
5+import grammar
6+from castle import peg # has the AST classes
7+
8+from . import parse, assert_ID
9+
10+def parse_file(filename, dir=Path('..')):
11+ path_to_current_test = Path(os.path.realpath(__file__))
12+ path_to_current_dir = path_to_current_test.parent
13+ with (path_to_current_dir / dir / filename).open() as f:
14+ txt = f.read()
15+ ast = parse(txt, grammar.peg_grammar, print_tree_debug=False)
16+
17+ return tree
18+
19+@pytest.mark.skip(reason="NOT all visitors are done, like ``peg_grammar``")
20+def test_grammar():
21+ parse_file("grammar.peg")
22+ ... # XXX