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

redux
David Majda 13 years ago
parent c04af99df8
commit c639c1fc83

@ -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) {

@ -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