Fixed the float error

This commit is contained in:
Maximilien Rigaut 2022-05-29 05:06:11 +02:00
parent c7974ffe07
commit f87c8b2c69
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
2 changed files with 10 additions and 4 deletions

View File

@ -69,7 +69,7 @@ class SemanticType:
def __ne__(self, other):
return not self.__eq__(other)
def counterpart(self): # noqa
def counterpart(self): # noqa # FUTURE: Check for static counterpart implementation
return None
def to_container(self):
@ -91,6 +91,7 @@ class AddFirstElementToLabel(SemanticType):
def __init__(self, content):
super().__init__(content)
self.label += ":" + content[0]
self._addentum = content[0]
class ExplicitSemanticType(SemanticType):
@ -233,8 +234,7 @@ class StructuralElementEndToken(AddFirstElementToLabel, ClosedSemanticType):
label = "se:end"
def counterpart(self):
return f"se:start:{self.content[0]}"
# TODO : correct this monstrosity
return f"se:start:{self._addentum}"
class HyperlinkToken(SemanticType):
@ -377,7 +377,7 @@ rgx_import_file = regex.compile(r'::( ?\< ?(?P<file_name>[\w\-._/]+) ?\>[ \s]*)+
# Base elements
quotes = pp.Word(r""""'""")
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(
pp.common.identifier('var_name') + pps('=') + value('var_value')
)("assignation")

View File

@ -304,9 +304,15 @@ dict_advanced_syntax_input_and_expected_output = {
"se_start": [
# Matches a start of a structural element
("<<div", (sy.StructuralElementStartToken(["div"]),), __GL()),
("<<aside", (sy.StructuralElementStartToken(["aside"]),), __GL()),
("<<article", (sy.StructuralElementStartToken(["article"]),), __GL()),
("<<section", (sy.StructuralElementStartToken(["section"]),), __GL()),
],
"se_end": [
("div>>", (sy.StructuralElementEndToken(["div"]),), __GL()),
("aside>>", (sy.StructuralElementEndToken(["aside"]),), __GL()),
("article>>", (sy.StructuralElementEndToken(["article"]),), __GL()),
("section>>", (sy.StructuralElementEndToken(["section"]),), __GL()),
],
"se": [
# Matches a div element, must be at the beginning of the line, the closing div can be with arguments