From a1f208caf88404444920fee90eb7977abe9e52a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Kl=C3=B6ffel?= <145490354+christophkloeffel@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:27:51 +0200 Subject: [PATCH] adds tracing for sections (#41) adds tracing for chapter 17 --- tests-system/{sections-1 => rbt-section-declaration}/foo.rsl | 0 tests-system/{sections-1 => rbt-section-declaration}/foo.trlc | 0 tests-system/{sections-1 => rbt-section-declaration}/output | 0 .../{sections-1 => rbt-section-declaration}/output.brief | 0 .../{sections-1 => rbt-section-declaration}/output.json | 0 .../{sections-1 => rbt-section-declaration}/output.smtlib | 0 trlc/ast.py | 4 ++-- trlc/parser.py | 2 ++ 8 files changed, 4 insertions(+), 2 deletions(-) rename tests-system/{sections-1 => rbt-section-declaration}/foo.rsl (100%) rename tests-system/{sections-1 => rbt-section-declaration}/foo.trlc (100%) rename tests-system/{sections-1 => rbt-section-declaration}/output (100%) rename tests-system/{sections-1 => rbt-section-declaration}/output.brief (100%) rename tests-system/{sections-1 => rbt-section-declaration}/output.json (100%) rename tests-system/{sections-1 => rbt-section-declaration}/output.smtlib (100%) diff --git a/tests-system/sections-1/foo.rsl b/tests-system/rbt-section-declaration/foo.rsl similarity index 100% rename from tests-system/sections-1/foo.rsl rename to tests-system/rbt-section-declaration/foo.rsl diff --git a/tests-system/sections-1/foo.trlc b/tests-system/rbt-section-declaration/foo.trlc similarity index 100% rename from tests-system/sections-1/foo.trlc rename to tests-system/rbt-section-declaration/foo.trlc diff --git a/tests-system/sections-1/output b/tests-system/rbt-section-declaration/output similarity index 100% rename from tests-system/sections-1/output rename to tests-system/rbt-section-declaration/output diff --git a/tests-system/sections-1/output.brief b/tests-system/rbt-section-declaration/output.brief similarity index 100% rename from tests-system/sections-1/output.brief rename to tests-system/rbt-section-declaration/output.brief diff --git a/tests-system/sections-1/output.json b/tests-system/rbt-section-declaration/output.json similarity index 100% rename from tests-system/sections-1/output.json rename to tests-system/rbt-section-declaration/output.json diff --git a/tests-system/sections-1/output.smtlib b/tests-system/rbt-section-declaration/output.smtlib similarity index 100% rename from tests-system/sections-1/output.smtlib rename to tests-system/rbt-section-declaration/output.smtlib diff --git a/trlc/ast.py b/trlc/ast.py index 858fc0a1..41550837 100644 --- a/trlc/ast.py +++ b/trlc/ast.py @@ -2824,6 +2824,7 @@ class Record_Object(Typed_Entity): """ def __init__(self, name, location, n_typ, section, n_package): + # lobster-trace: LRM.Section_Declaration assert isinstance(n_typ, Record_Type) assert isinstance(section, Section) or section is None assert isinstance(n_package, Package) @@ -2908,6 +2909,7 @@ def perform_checks(self, mh): class Section(Entity): + # lobster-trace: LRM.Section_Declaration """A section for readability This represents a section construct in TRLC files to group record @@ -2923,13 +2925,11 @@ class Section(Entity): """ def __init__(self, name, location, parent): - # lobster-exclude: Constructor only declares variables super().__init__(name, location) assert isinstance(parent, Section) or parent is None self.parent = parent def dump(self, indent=0): # pragma: no cover - # lobster-exclude: Debugging feature self.write_indent(indent, "Section %s" % self.name) if self.parent is None: self.write_indent(indent + 1, "Parent: None") diff --git a/trlc/parser.py b/trlc/parser.py index 1defed0e..0542d565 100644 --- a/trlc/parser.py +++ b/trlc/parser.py @@ -1325,6 +1325,7 @@ def parse_check_block(self): return n_check_block def parse_section_declaration(self): + # lobster-trace: LRM.Section_Declaration self.match_kw("section") self.match("STRING") if self.section: @@ -1530,6 +1531,7 @@ def parse_markup_string(self): return rv def parse_record_object_declaration(self): + # lobster-trace: LRM.Section_Declaration r_typ = self.parse_qualified_name(self.default_scope, ast.Record_Type) if r_typ.is_abstract: