Skip to content

Commit

Permalink
adds tracing for sections (#41)
Browse files Browse the repository at this point in the history
adds tracing for chapter 17
  • Loading branch information
christophkloeffel authored Oct 24, 2023
1 parent 6648472 commit a1f208c
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions trlc/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions trlc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a1f208c

Please sign in to comment.