Commits

Ned Batchelder committed 1e983f1

More nasty regexes

Comments (0)

Files changed (1)

             "punct ;", "id y", "punct <", "regex /g/i", "punct )", "punct {",
             "id xyz", "punct (", "id x", "punct ++", "punct )", "punct ;", "punct }"]),
 
+        # Various "illegal" regexes that are valid according to the std.
+        (r"""/????/, /++++/, /[----]/ """, ["regex /????/", "punct ,", "regex /++++/", "punct ,", "regex /[----]/"]),
+
         # Stress cases from http://stackoverflow.com/questions/5533925/what-javascript-constructs-does-jslex-incorrectly-lex/5573409#5573409
+        (r"""/\[/""", [r"""regex /\[/"""]),
+        (r"""/[i]/""", [r"""regex /[i]/"""]),
+        (r"""/[\]]/""", [r"""regex /[\]]/"""]),
+        (r"""/a[\]]/""", [r"""regex /a[\]]/"""]),
+        (r"""/a[\]]b/""", [r"""regex /a[\]]b/"""]),
+        (r"""/[\]/]/gi""", [r"""regex /[\]/]/gi"""]),
         (r"""/\[[^\]]+\]/gi""", [r"""regex /\[[^\]]+\]/gi"""]),
         ("""
             rexl.re = {
          "id NUMERIC_LITERAL", "punct :", r"""regex /^[0-9]+(?:\.[0-9]*(?:[eE][-+][0-9]+)?)?/""", "punct ,",
          "id SYMBOL", "punct :", r"""regex /^(?:==|=|<>|<=|<|>=|>|!~~|!~|~~|~|!==|!=|!~=|!~|!|&|\||\.|\:|,|\(|\)|\[|\]|\{|\}|\?|\:|;|@|\^|\/\+|\/|\*|\+|-)/""",
          "punct }", "punct ;",
-         "id str", "punct =", """string '"'""",
+         "id str", "punct =", """string '"'""", "punct ;",
          ]),
 
         (r""" this._js = "e.str(\"" + this.value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\")"; """,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.