| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,15 @@ | |||
| 1 | 1 | Babel Changelog | |
| 2 | 2 | =============== | |
| 3 | 3 | ||
| 4 | + Next version | ||
| 5 | + -------------- | ||
| 6 | + | ||
| 7 | + Bugfixes | ||
| 8 | + ~~~~~~~~ | ||
| 9 | + | ||
| 10 | + * Regex for parsing JavaScript regexes improved. Before this, the lexer couldn't recognize certain regexes, | ||
| 11 | + breaking the parsing of JS files. | ||
| 12 | + | ||
| 4 | 13 | Version 2.9.1 | |
| 5 | 14 | ------------- | |
| 6 | 15 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,57 @@ | |||
| 24 | 24 | name_re = re.compile(r'[\w$_][\w\d$_]*', re.UNICODE) | |
| 25 | 25 | dotted_name_re = re.compile(r'[\w$_][\w\d$_.]*[\w\d$_.]', re.UNICODE) | |
| 26 | 26 | division_re = re.compile(r'/=?') | |
| 27 | - regex_re = re.compile(r'/(?:[^/\\]*(?:\\.[^/\\]*)*)/[a-zA-Z]*', re.DOTALL) | ||
| 27 | + | ||
| 28 | + regex_re = re.compile( | ||
| 29 | + r''' | ||
| 30 | + | ||
| 31 | + # Opening slash of the regex | ||
| 32 | + / | ||
| 33 | + | ||
| 34 | + (?: | ||
| 35 | + | ||
| 36 | + # 1) Blackslashed character | ||
| 37 | + # | ||
| 38 | + # Match a backslash `\` and then it's following character, allowing | ||
| 39 | + # to blackslash the `/` for example. | ||
| 40 | + (?:\\.)? | ||
| 41 | + | ||
| 42 | + | | ||
| 43 | + | ||
| 44 | + # 2) Regex character class `[a-z]` | ||
| 45 | + # | ||
| 46 | + # Match regex character class, like `[a-z]`. Inside a character | ||
| 47 | + # class, a `/` character may appear, which does not close the | ||
| 48 | + # regex. Therefore we allow it here inside a character class. | ||
| 49 | + \[ | ||
| 50 | + (?: | ||
| 51 | + [^\]]* | ||
| 52 | + | | ||
| 53 | + \\\] | ||
| 54 | + )* | ||
| 55 | + \] | ||
| 56 | + | ||
| 57 | + | | ||
| 58 | + | ||
| 59 | + # 3) Other characters | ||
| 60 | + # | ||
| 61 | + # Match anything except a closing slash `/`, a backslash `\`, or a | ||
| 62 | + # opening bracket `[`. Those last two will be handled by the other | ||
| 63 | + # matchers. | ||
| 64 | + [^/\\\[]* | ||
| 65 | + | ||
| 66 | + )* | ||
| 67 | + | ||
| 68 | + # Closing slash of the regex | ||
| 69 | + / | ||
| 70 | + | ||
| 71 | + # regex flags | ||
| 72 | + [a-zA-Z]* | ||
| 73 | + | ||
| 74 | + ''', | ||
| 75 | + re.DOTALL + re.VERBOSE | ||
| 76 | + ) | ||
| 77 | + | ||
| 28 | 78 | line_re = re.compile(r'(\r\n|\n|\r)') | |
| 29 | 79 | line_join_re = re.compile(r'\\' + line_re.pattern) | |
| 30 | 80 | uni_escape_re = re.compile(r'[a-fA-F0-9]{1,4}') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments