Fixed the float error
This commit is contained in:
parent
c7974ffe07
commit
f87c8b2c69
|
|
@ -69,7 +69,7 @@ class SemanticType:
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
def counterpart(self): # noqa
|
def counterpart(self): # noqa # FUTURE: Check for static counterpart implementation
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def to_container(self):
|
def to_container(self):
|
||||||
|
|
@ -91,6 +91,7 @@ class AddFirstElementToLabel(SemanticType):
|
||||||
def __init__(self, content):
|
def __init__(self, content):
|
||||||
super().__init__(content)
|
super().__init__(content)
|
||||||
self.label += ":" + content[0]
|
self.label += ":" + content[0]
|
||||||
|
self._addentum = content[0]
|
||||||
|
|
||||||
|
|
||||||
class ExplicitSemanticType(SemanticType):
|
class ExplicitSemanticType(SemanticType):
|
||||||
|
|
@ -233,8 +234,7 @@ class StructuralElementEndToken(AddFirstElementToLabel, ClosedSemanticType):
|
||||||
label = "se:end"
|
label = "se:end"
|
||||||
|
|
||||||
def counterpart(self):
|
def counterpart(self):
|
||||||
return f"se:start:{self.content[0]}"
|
return f"se:start:{self._addentum}"
|
||||||
# TODO : correct this monstrosity
|
|
||||||
|
|
||||||
|
|
||||||
class HyperlinkToken(SemanticType):
|
class HyperlinkToken(SemanticType):
|
||||||
|
|
@ -377,7 +377,7 @@ rgx_import_file = regex.compile(r'::( ?\< ?(?P<file_name>[\w\-._/]+) ?\>[ \s]*)+
|
||||||
# Base elements
|
# Base elements
|
||||||
quotes = pp.Word(r""""'""")
|
quotes = pp.Word(r""""'""")
|
||||||
value = (pps(quotes) + pp.Word(pp.alphanums + r'\._') + pps(pp.match_previous_literal(quotes)) ^
|
value = (pps(quotes) + pp.Word(pp.alphanums + r'\._') + pps(pp.match_previous_literal(quotes)) ^
|
||||||
pp.common.fnumber)("value") # TODO: not every number is a float
|
pp.common.number ^ pp.common.fnumber)("value")
|
||||||
assignation = pp.Group(
|
assignation = pp.Group(
|
||||||
pp.common.identifier('var_name') + pps('=') + value('var_value')
|
pp.common.identifier('var_name') + pps('=') + value('var_value')
|
||||||
)("assignation")
|
)("assignation")
|
||||||
|
|
|
||||||
|
|
@ -304,9 +304,15 @@ dict_advanced_syntax_input_and_expected_output = {
|
||||||
"se_start": [
|
"se_start": [
|
||||||
# Matches a start of a structural element
|
# Matches a start of a structural element
|
||||||
("<<div", (sy.StructuralElementStartToken(["div"]),), __GL()),
|
("<<div", (sy.StructuralElementStartToken(["div"]),), __GL()),
|
||||||
|
("<<aside", (sy.StructuralElementStartToken(["aside"]),), __GL()),
|
||||||
|
("<<article", (sy.StructuralElementStartToken(["article"]),), __GL()),
|
||||||
|
("<<section", (sy.StructuralElementStartToken(["section"]),), __GL()),
|
||||||
],
|
],
|
||||||
"se_end": [
|
"se_end": [
|
||||||
("div>>", (sy.StructuralElementEndToken(["div"]),), __GL()),
|
("div>>", (sy.StructuralElementEndToken(["div"]),), __GL()),
|
||||||
|
("aside>>", (sy.StructuralElementEndToken(["aside"]),), __GL()),
|
||||||
|
("article>>", (sy.StructuralElementEndToken(["article"]),), __GL()),
|
||||||
|
("section>>", (sy.StructuralElementEndToken(["section"]),), __GL()),
|
||||||
],
|
],
|
||||||
"se": [
|
"se": [
|
||||||
# Matches a div element, must be at the beginning of the line, the closing div can be with arguments
|
# Matches a div element, must be at the beginning of the line, the closing div can be with arguments
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue