Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 ( If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 2a9bea38 authored by di68kap's avatar di68kap
Browse files

- DHParser/ Source code wird dem Compile-object beim Aufruf mit übergeben

parent 4ac99699
......@@ -97,6 +97,8 @@ class Compiler:
context: A list of parent nodes that ends with the currently
compiled node.
tree: The root of the abstract syntax tree.
source: The source code.
_dirty_flag: A flag indicating that the compiler has already been
called at least once and that therefore all compilation
......@@ -107,11 +109,12 @@ class Compiler:
def _reset(self):
self.source = ''
self.tree = ROOTNODE_PLACEHOLDER # type: RootNode
self.context = [] # type: List[Node]
self._dirty_flag = False
def __call__(self, root: RootNode) -> Any:
def __call__(self, root: RootNode, source: str='') -> Any:
Compiles the abstract syntax tree with the root node `node` and
returns the compiled code. It is up to subclasses implementing
......@@ -123,7 +126,8 @@ class Compiler:
if self._dirty_flag:
self._dirty_flag = True
self.tree = root
self.tree = root # type: Node
self.source = source # type: str
result = self.compile(root)
return result
......@@ -242,7 +246,7 @@ def compile_source(source: str,
if not is_error(syntax_tree.error_flag):
if preserve_ast:
ast = copy.deepcopy(syntax_tree)
result = compiler(syntax_tree)
result = compiler(syntax_tree, original_text)
# print(syntax_tree.as_sxpr())
# messages.extend(syntax_tree.errors())
# syntax_tree.error_flag = max(syntax_tree.error_flag, efl)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment