• 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évision85205067ff095f7a6f6458b47b5b8463aeae1f3a (tree)
l'heure2022-01-18 05:09:49
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

refactored

Change Summary

Modification

diff -r 41c22ef9b9ea -r 85205067ff09 Arpeggio/pytst/d2_ast/test_1_term.py
--- a/Arpeggio/pytst/d2_ast/test_1_term.py Mon Jan 17 20:58:34 2022 +0100
+++ b/Arpeggio/pytst/d2_ast/test_1_term.py Mon Jan 17 21:09:49 2022 +0100
@@ -23,17 +23,18 @@
2323 ast = parse(txt, grammar.term)
2424 assert_Term(ast, peg.StrTerm, txt[3:-3], "It's correct value should be without quotes")
2525
26+
2627 def test_regex_RE():
2728 txt='/a reg.ex/'
2829 ast = parse(txt, grammar.term)
2930 assert_Term(ast, peg.RegExpTerm, txt[1:-1], "It's correct value should be without slahes -- note: the regex itself is a string")
3031
3132
32-
3333 def regex_variants(txt, expect):
3434 ast = parse(txt, grammar.term)
3535 assert_Term(ast, peg.RegExpTerm, expect, "And the regex-pre/postfix should be removed from the value")
3636
37+
3738 def test_regex_variants():
3839 regex_variants(txt:="""/a reg.ex/""", expect=txt[1:-1]) # Same a test_regex_RE
3940 regex_variants(txt:="""/re_slash/""", expect=txt[1:-1])
@@ -49,7 +50,6 @@
4950 regex_variants(txt:='''r"""re__rstr_d3"""''', expect=txt[4:-3])
5051
5152
52-
5353 def test_term_as_expressions(): # A term is **ALSO an expressions
5454 txt="'a string'"
5555 ast = parse(txt, grammar.expressions)
@@ -57,5 +57,3 @@
5757 assert isinstance(ast, peg.Expression), "A (str)term is also an Expression"
5858 assert len(ast.value) == 1, "An expression with length==1"
5959 assert ast.value[0].value == txt[1:-1], "It's correct value should be without quotes"
60-
61-
diff -r 41c22ef9b9ea -r 85205067ff09 Arpeggio/pytst/d2_ast/test_2_ID.py
--- a/Arpeggio/pytst/d2_ast/test_2_ID.py Mon Jan 17 20:58:34 2022 +0100
+++ b/Arpeggio/pytst/d2_ast/test_2_ID.py Mon Jan 17 21:09:49 2022 +0100
@@ -5,6 +5,7 @@
55
66 from . import parse, assert_ID
77
8+
89 def test_rule_name():
910 """The name of a rule is an ID"""
1011
@@ -30,5 +31,3 @@
3031 assert isinstance(ast, peg.Expression), "A crossref is also an Expression"
3132 assert len(ast.value) == 1, "An expression with length==1"
3233 assert_ID(ast.value[0], name=txt, err_message= "The name of the (ID of the) Expression-value is still the same")
33-
34-
diff -r 41c22ef9b9ea -r 85205067ff09 Arpeggio/pytst/d2_ast/test_3_Seq.py
--- a/Arpeggio/pytst/d2_ast/test_3_Seq.py Mon Jan 17 20:58:34 2022 +0100
+++ b/Arpeggio/pytst/d2_ast/test_3_Seq.py Mon Jan 17 21:09:49 2022 +0100
@@ -10,6 +10,14 @@
1010
1111 from . import parse, assert_ID
1212
13+
14+def assert_Seq(ast, length=None):
15+ assert isinstance(ast, peg.Sequence)
16+ assert isinstance(ast, peg.Expression), "A sequence is aslo an Expression()"
17+ if length:
18+ assert len(ast) == length, f" ... of specified length=={length}"
19+
20+
1321 def test_seq_of_one_as_single_expr():
1422 txt = "A"
1523 ast = parse(txt, grammar.single_expr)
@@ -26,22 +34,17 @@
2634 txt = "A B"
2735 ast = parse(txt, grammar.expressions)
2836
29- assert isinstance(ast, peg.Expression), "Two sequence of two expr is an Expression()"
30- assert isinstance(ast, peg.Sequence), " ... and a Sequence()"
31- assert len(ast) == 2, " ... of length==2"
32-
37+ assert_Seq(ast, 2)
3338 assert isinstance(ast.value, list), "It will be an `arpeggio.SemanticActionResult` which is a subclass of list"
3439 assert_ID(ast[0], 'A'), " ... the first one is ID('A')"
3540 assert_ID(ast[1], 'B'), "... and the 2nd: ID('B')"
3641
3742
38-def test_seq_of_thre_with_quantification():
43+def test_seq_of_three_with_quantification():
3944 txt = "A? B+ C*"
4045 ast = parse(txt, grammar.expressions)
4146
42- assert isinstance(ast, peg.Expression), "Two sequence of two expr is an Expression()"
43- assert isinstance(ast, peg.Sequence), " ... and a Sequence()"
44- assert len(ast) == 3, " ... of length==3"
47+ assert_Seq(ast, 3)
4548
4649 assert isinstance(ast[0], peg.Optional)
4750 assert isinstance(ast[1], peg.OneOrMore)