Browse Source

PEG.js grammar: Replace two instances of |string / ""| by |string?|

redux
David Majda 10 years ago
parent
commit
c639c1fc83
  1. 8
      src/parser.js
  2. 4
      src/parser.pegjs

8
src/parser.js

@ -273,9 +273,7 @@ PEG.parser = (function(){
result0 = parse_identifier();
if (result0 !== null) {
result1 = parse_string();
if (result1 === null) {
result1 = "";
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_equals();
if (result2 !== null) {
@ -799,9 +797,7 @@ PEG.parser = (function(){
reportFailures++;
pos3 = pos;
result1 = parse_string();
if (result1 === null) {
result1 = "";
}
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
result2 = parse_equals();
if (result2 !== null) {

4
src/parser.pegjs

@ -20,7 +20,7 @@ initializer
}
rule
= name:identifier displayName:(string / "") equals expression:expression semicolon? {
= name:identifier displayName:string? equals expression:expression semicolon? {
return {
type: "rule",
name: name,
@ -130,7 +130,7 @@ suffixed
/ primary
primary
= name:identifier !(( string / "") equals) {
= name:identifier !(string? equals) {
return {
type: "rule_ref",
name: name

Loading…
Cancel
Save