diff --git a/grammarinator/runtime/serializer.py b/grammarinator/runtime/serializer.py index 6965339..0d116de 100644 --- a/grammarinator/runtime/serializer.py +++ b/grammarinator/runtime/serializer.py @@ -1,12 +1,10 @@ -# Copyright (c) 2017-2023 Renata Hodovan, Akos Kiss. +# Copyright (c) 2017-2024 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # . # This file may not be copied, modified, or distributed except # according to those terms. -from .rule import ParentRule - def simple_space_serializer(root): """ @@ -17,14 +15,4 @@ def simple_space_serializer(root): :return: The serialized tree as string. :rtype: str """ - - def _tokens(): - stack = [root] - while stack: - node = stack.pop() - if isinstance(node, ParentRule): - stack.extend(reversed(node.children)) - else: - yield node.src - - return ' '.join(token for token in _tokens()) + return ' '.join(root.tokens())