diff --git a/src/bootstraparse/modules/syntax.py b/src/bootstraparse/modules/syntax.py index ce02861..47d4110 100644 --- a/src/bootstraparse/modules/syntax.py +++ b/src/bootstraparse/modules/syntax.py @@ -5,6 +5,9 @@ import os from itertools import zip_longest from collections import namedtuple + +import rich + from bootstraparse.modules.error_mngr import CannotBeContainedError import pyparsing as pp @@ -80,6 +83,12 @@ class SemanticType: raise CannotBeContainedError(self) +class AddFirstElementToLabel(SemanticType): + def __init__(self, content): + super().__init__(content) + self.label += ":" + content[0] + + class ExplicitSemanticType(SemanticType): """ Explicit semantic type, the label is the only information we need. @@ -202,12 +211,12 @@ class DisplayToken(SemanticType): label = "display" -class StructuralElementStartToken(SemanticType): +class StructuralElementStartToken(AddFirstElementToLabel, SemanticType): """<>""" label = "se:end"