From 996e066f343541eb5c0ce5a36732024ab741578d Mon Sep 17 00:00:00 2001 From: Robert Spralja Date: Thu, 3 Mar 2022 17:19:52 +0100 Subject: [PATCH] Updated run_prompt to handle multiline statements Previously multiline statements were not possible because the scanner automatically appends the EOF token Originally I thought fixing this might involve complicate syntax checking like makin sure that all '(' are closed etc. I think this solution is the simplest to implement, that is every statement is ended with a empty input (newline). --- src/pychart/runner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pychart/runner.py b/src/pychart/runner.py index 89e990d..dbede81 100644 --- a/src/pychart/runner.py +++ b/src/pychart/runner.py @@ -25,11 +25,13 @@ def run_prompt(): try: while True: line = input("$ : ") + statement = line + while line: + line = input('... ') + statement += '\n' + line - if line == ".exit": - break + run(statement) - run(line) except KeyboardInterrupt: print() exit()