Comments (3)
Additional Info:
In my fork this code also fails:
var actionKnowsEndPositionInsideParser = PEG.buildParser(
'start = "e" "d" ([bc]* { return 4; }) "a"'
);
parses(actionKnowsEndPositionInsideParser, "edcba", ["e", "d", 4, "a"]);
And I can help it to pass with changing [bc]*
to [b-c]*
.
However, both this variants ([bc]*
and [b-c]*
) pass ok in a clean clone of https://github.com/dmajda/pegjs.git
from pegjs.
I've tried to go deep with these issues (issue #55 is directly related), and, it seems, this is the very deep thing. The parser result block in my case is:
if (/^[bc]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[bc]");
}
}
}
}
while (result3 !== null) {
result2.push(result3);
if (/^[bc]/.test(input.charAt(pos))) {
result3 = input.charAt(pos);
pos++;
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[bc]");
}
}
}
_chunk.pos = pos1;
_chunk.end = pos;
_chunk.match = input.substring(pos1,pos);
i f (result2 !== null) {
result2 = (function(_chunk) { return _chunk.end; })(_chunk);
}
You see the incorrect indent at start and broken i f
in the end.
- May be the unindent/indent mechanics fail in Codie, but why they fail only for this concrete rule among all 480+?
- May be the problem is in
literal
(more possible) orzero_or_more
(less possible,one_or_more
fails in your branch) templates, but the code for them seems right (I've tried grouping if-s and aligning indents in different ways and nothing helped) - May be the problem is somewhere else, only you know where)
In conclusion, I suppose that the reason is that complex if-else-nested rule in literal
template (it was introduced only in last commits with ignoreCase
flag) and indentation fails on parsing of that.
from pegjs.
This is a duplicate of #55 which was fixed. Thanks for digging into the issue.
from pegjs.
Related Issues (20)
- Up-to-date JavaScript grammar HOT 2
- Using PEG.js at runtime works, but generated grammer fails to work? HOT 2
- Operator precedence tree compiling extremely slowly HOT 2
- Merging multiple single-character expressions
- Fork of the online editor with inline errors HOT 1
- Ignore me -- wrong project
- [composable, declarative, typescript] react-peg: parser generator based on pegjs
- Bug with context-sensitive grammar HOT 1
- option to generate an es module instead of commonjs module HOT 12
- Cannot use parseFloat inside grammar HOT 4
- literalEscape HOT 1
- Support for runtime context object? HOT 3
- [META] Switch to Peggy HOT 9
- Grammar action errors need to be more informative HOT 4
- Allow access to different rules in code blocks HOT 2
- Using same rule in pattern HOT 2
- Pegjs online can't parser parser.pegjs HOT 2
- Variables in parentheses can't be accessed
- Documentation should describe all features of the grammar specification language (e.g., dollar sign "$", "text()") HOT 3
- Deprecate/archive and recommend peggy.js as official successor project? HOT 4
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 pegjs.