|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
|
# pylint: disable=too-few-public-methods |
|
|
# pylint: disable=too-few-public-methods |
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_LANGUAGE = "english" |
|
|
|
|
|
|
|
|
class AST: |
|
|
class AST: |
|
|
"""Base class for the tree.""" |
|
|
"""Base class for the tree.""" |
|
|
# pylint: disable=no-init |
|
|
# pylint: disable=no-init |
|
@ -16,7 +18,7 @@ class AST: |
|
|
parsing. |
|
|
parsing. |
|
|
""" |
|
|
""" |
|
|
cls.metadata = { |
|
|
cls.metadata = { |
|
|
'@languages': set(), |
|
|
'@language': DEFAULT_LANGUAGE, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class Expression(AST): |
|
|
class Expression(AST): |
|
@ -44,7 +46,7 @@ class Command(AST): |
|
|
self.optional = optional |
|
|
self.optional = optional |
|
|
|
|
|
|
|
|
if name == r'\selectlanguage': |
|
|
if name == r'\selectlanguage': |
|
|
self.metadata['@languages'] |= set(self.mandatory) |
|
|
self.metadata['@language'] = self.mandatory |
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
def __str__(self): |
|
|
if self.name in [r'\emph']: |
|
|
if self.name in [r'\emph']: |
|
|