summaryrefslogtreecommitdiff
path: root/src/pyparsing.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2016-04-29 15:15:27 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2016-04-29 15:15:27 +0000
commit8c60454b5e0bdd8eac426c2a14544bf5c24a3486 (patch)
tree82c6118f2c875349da34398c12882a5ba2d60aa7 /src/pyparsing.py
parenta89d65a321cab49fe72b682ba9c916a4c6601226 (diff)
downloadpyparsing-git-8c60454b5e0bdd8eac426c2a14544bf5c24a3486.tar.gz
Fixed similar backtracking issues in the C and C++ style comments
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r--src/pyparsing.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py
index fc6a439..988419b 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "2.1.2"
-__versionTime__ = "28 Apr 2016 22:32 UTC"
+__versionTime__ = "29 Apr 2016 15:10 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -3815,12 +3815,12 @@ def replaceHTMLEntity(t):
return _htmlEntityMap.get(t.entity)
# it's easy to get these comment structures wrong - they're very common, so may as well make them available
-cStyleComment = Regex(r"/\*(?:[^*]*\*+)+?/").setName("C style comment")
+cStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/').setName("C style comment")
htmlComment = Regex(r"<!--[\s\S]*?-->").setName("HTML comment")
restOfLine = Regex(r".*").leaveWhitespace().setName("rest of line")
-dblSlashComment = Regex(r"\/\/(\\\n|.)*").setName("// comment")
-cppStyleComment = Regex(r"/(?:\*(?:[^*]*\*+)+?/|/[^\n]*(?:\n[^\n]*)*?(?:(?<!\\)|\Z))").setName("C++ style comment")
+dblSlashComment = Regex(r"//(?:\\\n|[^\n])*").setName("// comment")
+cppStyleComment = Combine(Regex(r"/\*(?:[^*]|\*(?!/))*") + '*/'| dblSlashComment).setName("C++ style comment")
javaStyleComment = cppStyleComment
pythonStyleComment = Regex(r"#.*").setName("Python style comment")