Skip to content

Commit

Permalink
Merge pull request #506 from Flamenco/patch-1
Browse files Browse the repository at this point in the history
Update documentation.html
  • Loading branch information
hildjj committed Apr 4, 2024
2 parents 6e1f0fb + f6bfbfc commit 7cac9a3
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ markw65 <mark@replayroutes.com> (https://github.com/markw65/)
Andy (https://github.com/AndrewRayCode)
Kristian Dupont <kristian@kristiandupont.com> (https://github.com/kristiandupont/)
Lumi Pakkanen <lumi.pakkanen@gmail.com> (https://github.com/frostburn/)
Steven Spungin <steven@spungin.tv> (https://github.com/flamenco/)
XenoS (https://github.com/XenoS-ITA)
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Unreleased

### Bug fixes

### Documentation
- Added END OF INPUT (`!.`).

4.0.2
-----

Expand Down
34 changes: 34 additions & 0 deletions docs/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,40 @@ <h3 id="grammar-syntax-and-semantics-parsing-expression-types">Parsing Expressio
</div>
</dd>

<dt><code>!.</code> (END OF INPUT)</dt>

<dd>
<p>Match END OF INPUT. This <em>Bang Dot</em> sequence
will specify that the end of input should be matched.
<code>"f" !.</code> will test for end of input
after the character "f".</p>
<div class="example">
<div>
<div><em>Example:</em> <code>no_input = !.</code></div>
<div><em>Matches:</em> <code>""</code></div>
<div><em>Does not match:</em> <code>"f"</code></div>
</div>
<div class="try">
<em>Try it:</em>
<input type="text" value="" class="exampleInput" name="no_input">
<div class="result"></div>
</div>
</div>

<div class="example">
<div>
<div><em>Example:</em> <code>end_of_input = "f" !.</code></div>
<div><em>Matches:</em> <code>"f[EOI]"</code></div>
<div><em>Does not match:</em> <code>"f [EOI]"</code>, <code>""</code></div>
</div>
<div class="try">
<em>Try it:</em>
<input type="text" value="f" class="exampleInput" name="end_of_input">
<div class="result"></div>
</div>
</div>
</dd>

<dt><code>[<em>characters</em>]</code></dt>

<dd>
Expand Down
96 changes: 92 additions & 4 deletions docs/js/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function peg$parse(input, options) {
var peg$FAILED = {};
var peg$source = options.grammarSource;

var peg$startRuleFunctions = { literal: peg$parseliteral, literal_i: peg$parseliteral_i, any: peg$parseany, class: peg$parseclass, not_class_i: peg$parsenot_class_i, rule: peg$parserule, child: peg$parsechild, paren: peg$parseparen, paren_pluck: peg$parseparen_pluck, star: peg$parsestar, plus: peg$parseplus, repetition: peg$parserepetition, maybe: peg$parsemaybe, posAssertion: peg$parseposAssertion, negAssertion: peg$parsenegAssertion, posPredicate: peg$parseposPredicate, negPredicate: peg$parsenegPredicate, dollar: peg$parsedollar, label: peg$parselabel, pluck_1: peg$parsepluck_1, pluck_2: peg$parsepluck_2, sequence: peg$parsesequence, action: peg$parseaction, alt: peg$parsealt, rest: peg$parserest };
var peg$startRuleFunctions = { literal: peg$parseliteral, literal_i: peg$parseliteral_i, any: peg$parseany, class: peg$parseclass, not_class_i: peg$parsenot_class_i, rule: peg$parserule, child: peg$parsechild, paren: peg$parseparen, paren_pluck: peg$parseparen_pluck, star: peg$parsestar, plus: peg$parseplus, repetition: peg$parserepetition, maybe: peg$parsemaybe, posAssertion: peg$parseposAssertion, negAssertion: peg$parsenegAssertion, posPredicate: peg$parseposPredicate, negPredicate: peg$parsenegPredicate, dollar: peg$parsedollar, label: peg$parselabel, pluck_1: peg$parsepluck_1, pluck_2: peg$parsepluck_2, sequence: peg$parsesequence, action: peg$parseaction, alt: peg$parsealt, no_input: peg$parseno_input, end_of_input: peg$parseend_of_input, rest: peg$parserest };
var peg$startRuleFunction = peg$parseliteral;

var peg$c0 = "foo";
Expand All @@ -184,6 +184,7 @@ function peg$parse(input, options) {
var peg$c5 = "bar";
var peg$c6 = " ";
var peg$c7 = "c";
var peg$c8 = "f";

var peg$r0 = /^[a-z]/;
var peg$r1 = /^[^a-z]/i;
Expand All @@ -204,7 +205,8 @@ function peg$parse(input, options) {
var peg$e11 = peg$literalExpectation(" ", false);
var peg$e12 = peg$literalExpectation("c", false);
var peg$e13 = peg$classExpectation([["a", "c"]], false, false);
var peg$e14 = peg$otherExpectation("The rest of the input");
var peg$e14 = peg$literalExpectation("f", false);
var peg$e15 = peg$otherExpectation("The rest of the input");

var peg$f0 = function(match, rest) { return {match, rest}; };
var peg$f1 = function(match, rest) { return {match, rest}; };
Expand Down Expand Up @@ -235,6 +237,8 @@ function peg$parse(input, options) {
var peg$f26 = function() { return location(); };
var peg$f27 = function(match, rest) { return {match, rest}; };
var peg$f28 = function(match, rest) { return {match, rest}; };
var peg$f29 = function(match, rest) { return {match, rest}; };
var peg$f30 = function(match, rest) { return {match, rest}; };
var peg$currPos = options.peg$currPos | 0;
var peg$savedPos = peg$currPos;
var peg$posDetailsCache = [{ line: 1, column: 1 }];
Expand Down Expand Up @@ -1477,6 +1481,90 @@ function peg$parse(input, options) {
return s0;
}

function peg$parseno_input() {
var s0, s1, s2;

s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.length > peg$currPos) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = undefined;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parserest();
peg$savedPos = s0;
s0 = peg$f29(s1, s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}

return s0;
}

function peg$parseend_of_input() {
var s0, s1, s2, s3, s4;

s0 = peg$currPos;
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 102) {
s2 = peg$c8;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
if (input.length > peg$currPos) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = undefined;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parserest();
peg$savedPos = s0;
s0 = peg$f30(s1, s2);
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}

return s0;
}

function peg$parserest() {
var s0, s1, s2;

Expand All @@ -1503,7 +1591,7 @@ function peg$parse(input, options) {
s0 = input.substring(s0, peg$currPos);
peg$silentFails--;
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e14); }
if (peg$silentFails === 0) { peg$fail(peg$e15); }

return s0;
}
Expand Down Expand Up @@ -1537,7 +1625,7 @@ function peg$parse(input, options) {
}

root.peggyExamples = {
StartRules: ["literal", "literal_i", "any", "class", "not_class_i", "rule", "child", "paren", "paren_pluck", "star", "plus", "repetition", "maybe", "posAssertion", "negAssertion", "posPredicate", "negPredicate", "dollar", "label", "pluck_1", "pluck_2", "sequence", "action", "alt", "rest"],
StartRules: ["literal", "literal_i", "any", "class", "not_class_i", "rule", "child", "paren", "paren_pluck", "star", "plus", "repetition", "maybe", "posAssertion", "negAssertion", "posPredicate", "negPredicate", "dollar", "label", "pluck_1", "pluck_2", "sequence", "action", "alt", "no_input", "end_of_input", "rest"],
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
Expand Down
5 changes: 5 additions & 0 deletions docs/js/examples.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ action = match:(" "+ "a" { return location(); }) rest:rest { return {match, rest

alt = match:("a" / "b" / "c") rest:rest { return {match, rest}; }

no_input = match:!. rest:rest { return {match, rest}; }

end_of_input = match:("f" !.) rest:rest { return {match, rest}; }

rest "The rest of the input" = $.*

2 changes: 1 addition & 1 deletion docs/js/test-bundle.min.js

Large diffs are not rendered by default.

0 comments on commit 7cac9a3

Please sign in to comment.