From c1dcaa3ccbb263f021157f2aebd185c6388c28a1 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 29 Sep 2018 16:27:21 +0200 Subject: Refactor parsing to get rid of _saved_line Handle the line-after-help-text case specially, which allows _has_tokens (renamed to _reuse_tokens) to be used as the unget mechanism for help texts as well, leaving _saved_line unused. Move the _reuse_tokens check into _next_line(). This makes _parse_block() as straightforward as _parse_properties(), and simplifies _parse_properties() a tiny bit too by getting rid of the '_tokens_i = -1' assignment. --- testsuite.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index 802234e..c027189 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1014,6 +1014,7 @@ g verify_locations(c.syms["MULTI_DEF"].nodes, "tests/Klocation:7", "tests/Klocation:37", + "tests/Klocation:39", "tests/Klocation_sourced:3", "tests/sub/Klocation_rsourced:2", "tests/sub/Klocation_gsourced1:1", @@ -1024,7 +1025,7 @@ g "tests/sub/Klocation_grsourced2:1", "tests/sub/Klocation_grsourced1:1", "tests/sub/Klocation_grsourced2:1", - "tests/Klocation:70") + "tests/Klocation:72") verify_locations(c.named_choices["CHOICE"].nodes, "tests/Klocation_sourced:5") @@ -1103,7 +1104,8 @@ tests/Krecursive2:1 [node.item.name for node in c.node_iter() if isinstance(node.item, Symbol)], ["SINGLE_DEF", "MULTI_DEF", "HELP_1", "HELP_2", "HELP_3", "MULTI_DEF", - "MULTI_DEF", "MENU_HOOK", "COMMENT_HOOK"] + 10*["MULTI_DEF"]) + "MULTI_DEF", "MULTI_DEF", "MENU_HOOK", "COMMENT_HOOK"] + \ + 10*["MULTI_DEF"]) verify_equal( [node.item.name for node in c.node_iter(True) -- cgit v1.2.3