|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
start
|
|
|
|
|
= deriveTag
|
|
|
|
|
= _ root:deriveTag _ { return root; }
|
|
|
|
|
|
|
|
|
|
_
|
|
|
|
|
= [ \n\r\t]*
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
= deriveTag
|
|
|
|
@ -8,7 +11,7 @@ value
|
|
|
|
|
/ string
|
|
|
|
|
|
|
|
|
|
multipleItems
|
|
|
|
|
= item:value subsequentItems:("," value)* { return [item].concat(subsequentItems.map(subsequentItem => subsequentItem[1])); }
|
|
|
|
|
= item:value? subsequentItems:("," value)* { return (item != null) ? [item].concat(subsequentItems.map(subsequentItem => subsequentItem[1])) : []; }
|
|
|
|
|
|
|
|
|
|
deriveTag
|
|
|
|
|
= "Derive(" items:multipleItems ")" { return {type: "deriveTag", items: items}; }
|
|
|
|
@ -23,8 +26,9 @@ string
|
|
|
|
|
= '"' chars:stringCharacter* '"' { return chars.join(""); }
|
|
|
|
|
|
|
|
|
|
stringCharacter
|
|
|
|
|
= !('"' / "\\") char:. { return char; }
|
|
|
|
|
/ stringEscapedQuote { return '"'; }
|
|
|
|
|
= !('"' / "\\") char:. { return char; } // Prefer a non-backslash character...
|
|
|
|
|
/ stringEscapedQuote { return '"'; } // ... then an escaped quotation mark...
|
|
|
|
|
/ !('"') char:. { return char; } // ... and finally any other character that doesn't terminate the string.
|
|
|
|
|
|
|
|
|
|
stringEscapedQuote
|
|
|
|
|
= '\\"'
|
|
|
|
|