Comments (2)
Here is an example from the Simple-CIL-compiler project,
The identifier has to catch single words except the ones listed, which means you have to include the exception token's in to the identifier
IDENTIFIER-> @"[a-zA-Z_][a-zA-Z0-9_]*(?<!(^)(end|else|do|while|for|true|false|return|to|incby|global|or|and|not|write|readnum|readstr|call))(?!\w)";
Hope that helps.
from tinypg.
First of all, sorry for my english which is far from perfect. I hope this post is still understandable.
I had the same issue. But because I wasn't attempting to match a particular grammar, I just modified it as a workaround (here, I would just replace LIST and END tokens by something like [ and ]). But I looked in the code why this wasn't working. It is because of the "Partial Context Sensitive/Ambiguous Grammars" feature (take a look at the documentation here). The parser asks to the scanner to look ahead for expected tokens but, if the rule has a OneOrMultiple cardinality (+), the expected token list does not contains the following rules first terminal tokens. That means that, in this example, while parsing the IDENTIFIER+ rule, the lookahead only looks for IDENTIFIER tokens, matches the END token as an identifier and consumes it.
The solution here would be to provide too the next rule(s?) first terminals list as expected token. I will give it a try and, if working, propose it as a pull request.
Edit: Pull request submited
from tinypg.
Related Issues (12)
- "fileName" argument to Parser.Parse causes problems in the IDE HOT 5
- Console outputs not displayed when running from command line
- Add Better Generated File Warning
- add generic code generation
- add generic compilation
- add vs code generator with extension
- problem with grammar HOT 1
- VB.NET template is not updated
- Command Line Generation
- Add Unit Tests To Build
- Documentation
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 tinypg.