Corrected a couple of missing tools and features

This commit is contained in:
Maximilien Rigaut 2022-06-15 16:58:30 +02:00
parent 8e97317b57
commit 6654dcbb84
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
2 changed files with 12 additions and 7 deletions

View File

@ -315,7 +315,7 @@ class TableSeparatorToken(FinalSemanticType):
class TableCellSizeToken(FinalSemanticType):
label = ":cell_size"
label = "table:cell_size"
class OptionalToken(SemanticType):

View File

@ -187,19 +187,24 @@ def compare(me, other):
import rich
from bootstraparse.modules import syntax, context_mngr
rich.print(f"Comparing in : {me} and {other}")
if type(me) != type(other):
rich.print(f"Type: {type(me)} != {type(other)}")
return False
for e, f in zip(me, other):
if isinstance(e, context_mngr.BaseContainer) or isinstance(e, syntax.SemanticType):
compare(e, f)
if not compare(e, f):
return False
elif e != f:
rich.print(f'elt:{e} != {f}')
rich.print(f'[{me}/{other}:elt]:{e} != {f}')
return False
if hasattr(me, "optionals"):
if hasattr(me, "optionals") or hasattr(other, "optionals"):
if me.optionals != other.optionals:
rich.print(f'opt:{me.optionals} != {other.optionals}')
rich.print(f'[{me.label}:opt]]:{me.optionals} != {other.optionals}')
return False
if hasattr(me, "others"):
if hasattr(me, "others") or hasattr(other, "others"):
if me.others != other.others:
rich.print(f'oth:{me.others} != {other.others}')
rich.print(f'[{me.label}:oth]:{me.others} != {other.others}')
return False
rich.print("No differences found")
return True