From 1032fc8e766958f2cdd2830866573c572e271690 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Sat, 10 Sep 2022 17:22:37 -0700 Subject: [PATCH] No point in a separate _parse() function. --- implementations/Python/simplejoy.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/implementations/Python/simplejoy.py b/implementations/Python/simplejoy.py index 416d546..833a277 100755 --- a/implementations/Python/simplejoy.py +++ b/implementations/Python/simplejoy.py @@ -326,8 +326,6 @@ literal value (integer, Boolean, or quoted Joy expression) or a function symbol. Function symbols are sequences of non-blanks and cannot contain square brackets. Terms must be separated by blanks, which can be omitted around square brackets. - - ''' @@ -360,16 +358,9 @@ def text_to_expression(text): :rtype: stack :raises ParseError: if the parse fails. ''' - return _parse(text.replace('[', ' [ ').replace(']', ' ] ').split()) - - -def _parse(tokens): - ''' - Return a stack/list expression of the tokens. - ''' frame = [] stack = [] - for tok in tokens: + for tok in text.replace('[', ' [ ').replace(']', ' ] ').split(): if tok == '[': stack.append(frame) frame = [] -- 2.11.0