From f83154e2749d90bf4ec24c7c84b45dc0860e8b13 Mon Sep 17 00:00:00 2001 From: kotfu Date: Sun, 22 Apr 2018 19:11:29 -0600 Subject: =?UTF-8?q?args=20has=20to=20be=20=E2=80=98=E2=80=99=20not=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd2/parsing.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd2/parsing.py') diff --git a/cmd2/parsing.py b/cmd2/parsing.py index 164c7735..79d57a32 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -22,7 +22,8 @@ class Statement(str): self.raw = str(object) self.command = None self.multilineCommand = None - self.args = None + # has to be an empty string for compatibility with standard library cmd + self.args = '' self.terminator = None self.suffix = None self.pipeTo = None @@ -58,7 +59,8 @@ class CommandParser(): else: return s pattern = re.compile( - r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', + #r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', + r'/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE ) rawinput = re.sub(pattern, replacer, rawinput) @@ -146,6 +148,7 @@ class CommandParser(): multilineCommand = None result = Statement(args) + result.raw = rawinput result.command = command result.args = args result.terminator = terminator @@ -162,7 +165,7 @@ class CommandParser(): and the args as a string. """ command = None - args = None + args = '' if tokens: command = tokens[0] -- cgit v1.2.1