-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for RegExp literals #78
Conversation
I think this may be out of scope. What do you think, @EricSmekens? |
src/jsep.js
Outdated
ch === 105 || // i | ||
ch === 109 || // m | ||
ch === 117 || // u | ||
ch === 121 // y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
123 | ch === 121 // y
^ Missing semicolon.
src/jsep.js
Outdated
try { | ||
re = new RegExp(pattern, flags); | ||
} catch (e) { | ||
throwError(e.message, start) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
422 | throwError(e.message, start)
^ Missing semicolon.
@ianchi Could you add a test so it demonstrates the use of this feature and it will not break use of multiple divide operators. We're still thinking of the use of regexp in this library however, if you can convince us but use-cases, go ahead :) |
@LeaVerou Yes, I'm not sure yet. I think it would be a nice feature, but if we keep adding nice features it will become more complex and turns into a more advanced parser. See http://esprima.org/demo/parse.html?code=%2F123*(w)%2Fg%0D%0A |
fixed linting problems, |
Signed-off-by: Adrian Panella <ianchi74@outlook.com>
Regarding the scope, I'm not sure of your goal. Please tell me if you are interested in these PR, or you prefer that I fork the project. |
@EricSmekens Because different people have different needs and different definitions of what an "expression" is and we'll keep running into such dilemmas, I think we should instead support plugins. The main idea is:
If you agree with the idea, I can work towards it. |
I ended up writing a new expression parser, inspired by jsep. It's designed to be completely configurable, so that it can be made to parse the same way as jsep, add additional operators to complete the ES5 expressions (except for function expressions, which would require parsing statements) and output compatible to current esprima, and also to parse jsonPath syntax. |
No description provided.