summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-07-17 18:22:53 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-07-17 18:22:53 -0400
commit83186531c103a84fd98a2310d17f106f2f07f0fb (patch)
tree6a117bc972c98a4df893528faa62c89bb99c7c83 /cmd2
parente87c675aad8198aac07cd15394c69ff41341ffaf (diff)
parent9df22b9305b918034217dee6721dc348a4610e65 (diff)
downloadcmd2-git-83186531c103a84fd98a2310d17f106f2f07f0fb.tar.gz
Merged master with bug fix for #474
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/parsing.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index 0d480f0f..475554b0 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -152,25 +152,23 @@ class StatementParser:
# double or single quotes.
#
# this big regular expression can be broken down into 3 regular
- # expressions that are OR'ed together.
+ # expressions that are OR'ed together with a pipe character
#
- # /\*.*?(\*/|$) matches C-style comments, with an optional
- # closing '*/'. The optional closing '*/' is
- # there to retain backward compatibility with
- # the pyparsing implementation of cmd2 < 0.9.0
- # \'(?:\\.|[^\\\'])*\' matches a single quoted string, allowing
+ # /\*.*\*/ Matches C-style comments (i.e. /* comment */)
+ # does not match unclosed comments.
+ # \'(?:\\.|[^\\\'])*\' Matches a single quoted string, allowing
# for embedded backslash escaped single quote
- # marks
- # "(?:\\.|[^\\"])*" matches a double quoted string, allowing
+ # marks.
+ # "(?:\\.|[^\\"])*" Matches a double quoted string, allowing
# for embedded backslash escaped double quote
- # marks
+ # marks.
#
# by way of reminder the (?:...) regular expression syntax is just
# a non-capturing version of regular parenthesis. We need the non-
# capturing syntax because _comment_replacer() looks at match
# groups
self.comment_pattern = re.compile(
- r'/\*.*?(\*/|$)|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
+ r'/\*.*\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE
)