Comments (2)
The problem is that the criteria token includes "relation | and | or" which all begin with a '[' token and the parfser automaticaly selects the first one ("relation") so next expects an "op, operand, operand". No matter what. This happens because the parsing is greedy, it does not backtrack (it is impossible for this type of grammars). One thing you can do is factor the grammar like the following part:
"relation" : "op ',' operand ',' operand",
"op" : "'\"=\"' | '\">\"' | '\">=\"' | '\"<\"' | '\"<=\"'",
"operand" : "identifier | date | string | number | boolean",
"criteria" : "'[' (relation | and | or) ']'",
"and" : "'\"and\"' (',' criteria)+",
"or" : "'\"or\"' (',' criteria)+",
This parses correctly what you expect (you can try it here http://foo123.github.io/examples/codemirror-grammar/)
from editor-grammar.
Many thanks for this!
from editor-grammar.
Related Issues (7)
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 editor-grammar.