Comments (6)
Ok, got it working now - I used
[\\]
instead.
According to http://flex.sourceforge.net/manual/Patterns.html#Patterns, Flex used backslashes for escaping, like Perl/JavaScript. The forward slashes are indeed for positive lookaheads, so it looks like they've been correctly mapped. My guess would be that the backslashes are checked individually, replacing successive pairs of backslashes for one, until the final one is replaced by the character following it - so they all disappear.
Cheers,
Marcus.
from jison.
Hey simpl,
I'm surprised about #2 -- I'd expect some tests to fail. I'll adress that and #1.
For #3, the Flex (Bison's scanner generator) syntax is a forward slash (/). I'll probably allow both so people coming from either style aren't thrown off. This is essentially the reason I don't copy the regex directly, because I want to support Flex' syntax too.
Thanks for the report. The regex syntax has been out of mind for a while but obviously needs some updates.
from jison.
I just realized that Github ate my backslashes too. Sorry about that.
I'm trying the forward slashes now, but again it doesn't appear to be doing what I want. Forward slashes appear to translate to ?=, i.e. positive lookaheads.
Is it possible to get a double-backslash in the resulting JavaScript regex (i.e. matching a single literal backslash)? If so, could you tell me how.
I think that it would be a good idea to allow both Flex and JavaScript regexes. You could perhaps have a setting somewhere to let the users choose between the two. Also, if you do that, then you might want to mention the version of the regex that is being matched in any error messages.
Thanks,
Marcus.
from jison.
When trying to input the following regex:
[']([^\\']+|[\\](\n|.))*?['] return 'SINGLE_STR';
I get the error:
Error: Parse error on line 80:
...\n|.))*?['] return 'SINGLE_STR';
-----------------------^
Expecting '|', ')'
Even though it's properly balanced in terms of parentheses.
What I really want to enter is:
'([^\\']+|\\(\n|.))*?'
But as mentioned before, the single quotes don't place nicely.
I don't know if this will be useful to you or not.
Cheers,
Marcus.
from jison.
These should be adressed as of v0.2.9. Try your original quotes and backslash regex again, though quotes need a slash in front.
from jison.
Thanks for fixing this.
Will let you know if there are any more problems.
from jison.
Related Issues (20)
- jison: command not found HOT 1
- %empty directive doesn't execute semantic actions, /* empty */ does HOT 2
- Using "constructor" as a literal causes a parse error
- Try online version should be updated to the latest current version
- It generates incorrect FOLLOWs and parsing table when using LL(1) algorithm.
- Security issue HOT 8
- Security Notice & Bug Bounty - Command Injection - huntr.dev HOT 1
- Create jison grammar
- Jison not assuming correct grammar HOT 1
- Generating code from parser result and grammar
- Missing tag
- Insufficient input validation in npm package jison <= 0.4.18 may lead to OS command injection attacks.
- A pathological example that blows up
- Tests generate SyntaxError: Function statements require a function name HOT 2
- Docs are offline HOT 7
- LALR(1) implementation is not LALR(1)
- Yacc/Lex compatible online editor/tester
- EOF token is returned only once in recursive grammar
- Enhance `showPosition()` to Accurately Display Error Position by Line Number
- Bug in docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jison.