Fix export default regexs - #1799
Conversation
a211db9 to
690eb53
Compare
690eb53 to
25a38bd
Compare
| /* jsjjddjksj | ||
| */ // Too many comments lol | ||
|
|
||
| async /* [no LineTerminator here] */ function |
There was a problem hiding this comment.
acorn@5.2.1 parse of this source file yields:
Unexpected token (13:37)
There was a problem hiding this comment.
Nevermind - I forgot the --ecma2018 flag.
|
Note that Acorn doesn't parse async iterators yet (since they are stage3), but I wrote a plugin for it. |
|
I didn't write a test for async generators, but that regex should work for them. |
lukastaegert
left a comment
There was a problem hiding this comment.
Although complex regexes are always a little dangerous I think your approach makes it possible to at least understand and more importantly modify what is happening here with some confidence, so I think this is good to go.
Maybe in the future we find a way to use more of the AST here (i.e. acorn already did the hard work of parsing for us so maybe we can reuse more of what is already known?). Nevertheless I plan on putting this into the next release as is.
Fixes #1798
I updated the regular expressions to match comments, async functions and generators.
They are built at runtime to make them more readable; they are built only once so the performance overhead shouldn't be noticeable.
The built regexes are these: