diff options
author | kotfu <kotfu@kotfu.net> | 2018-04-22 19:11:29 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-04-22 19:11:29 -0600 |
commit | f83154e2749d90bf4ec24c7c84b45dc0860e8b13 (patch) | |
tree | a5e3db489b3ae69320eabb296eb01311dac9dd02 /cmd2/parsing.py | |
parent | 829c36cb22fd7f3b71548c1b742d40e7609a3aca (diff) | |
download | cmd2-git-f83154e2749d90bf4ec24c7c84b45dc0860e8b13.tar.gz |
args has to be ‘’ not None
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r-- | cmd2/parsing.py | 9 |
1 files changed, 6 insertions, 3 deletions
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] |