diff --git a/utils/convert_to_chordpro/latex_grammar.txt b/utils/convert_to_chordpro/latex_grammar.txt new file mode 100644 index 00000000..94fd1603 --- /dev/null +++ b/utils/convert_to_chordpro/latex_grammar.txt @@ -0,0 +1,399 @@ +/* +Parse Latex song into chordpro + */ + +{ + function megajoin(array){ + for(x in array) { + if(array[x] instanceof Array) { + array[x] = array[x].join(""); + } + } + return array.join(""); + } + function property(name, value){ + if(value instanceof Array) { + value = value.join(""); + } + return "{" + name +": " + value + "}"; + } + function tab_property(name, base, frets, special, ukulele){ + var content = ""; + content += name.replace("/b/g", "&"); + if(base > 0){ + content += " base-fret "; + content += base; + } + content += " frets "; + content += frets.join("").toUpperCase(); + if(special){ + content += " special"; + } + var define = "define"; + if(ukulele){ + define += "_ukulele"; + } + return property(define, content); + } + function blockify(name, content, newline){ + var start = "{start_of_"+name+"}"; + var end = "{end_of_"+name+"}"; + if(newline){ + start += "\r\n"; + end += "\r\n"; + } + return start + content + end; + } + function blockify_param(name, param, content, newline){ + if(param instanceof Array) { + param = param.join(""); + } + var start = "{start_of_"+name + ": "+param+"}"; + var end = "{end_of_"+name+"}"; + if(newline){ + start += "\r\n"; + end += "\r\n"; + } + return start + content + end; + } + function chordname_split(chordname){ + return chordname.split(" - ").join(" ").split(" ").join("][").replace("/b/g", "&"); + } +} + +start + = content:(language? newlines_merge columnsetting? newlines_merge song) {return content.join(""); } + + +// Basic characters +digits + = digits:[0-9]+ {return digits.join("")} +ndigits + = digits + / "-" digits +digit + = digit:[0-9] + +alpha + = chars:[a-zA-Z]+ {return chars.join("")} + +slug + = chars:[a-zA-Z0-9-_]+ {return chars.join("")} + +url + = chars:[a-zA-Z0-9-_$.+!*'(),/:]+ {return chars.join("")} + + +// Text patterns +inline_text + = content:inline_text_elt+ {return content.join("")} + +inline_text_elt + = safe_text + / inline_command + / empty_command + / ignored_command + / equation + +safe_text + = content:nonlatex_char+ {return content.join("")} + +nonlatex_char + = [^\\\n\r{}$%\[\]] + +inline_command + = "\\dots {" content:inline_text "}" {return "..." + content} + / "\\shrp{" content:inline_text "}" {return "#" + content} + +empty_command + = "\\" content:empty_command_name " "? "{}" {return content} + / "\\" content:empty_command_name {return content} + / "{\\" content:empty_command_name "}" {return content} + +empty_command_name + = "oe" { return "œ"} + / "ier" + / "ieme" + / "dots" { return "..."} + / "ldots" { return "..."} + / "og" { return "``"} // guillemets + / "fg" { return "''"} // guillemets + / "flt" { return "&"} + / "shrp" { return "#"} + / "&" + / "_" + / "%" + / "#" + / "," + / "'" + / " " + / removed_command_name { return ""} + +removed_command_name + = "{" + / "}" + / "newline" + / "MultiwordChords" + / "Adlib" + +ignored_command + = "\\" ignored_command_name "{" content:inline_text "}" {return content} + +ignored_command_name + = "emph" + / "Outro" + +equation + = "$" eq:equation_content "$" {return eq} + +equation_content + = "\\beta_1" { return "Beta1"} + / "\\beta_2" { return "Beta2"} + / "H_2O" { return "H20"} + / "H_2" { return "H2"} + / "O" + / "CO_2" { return "CO2"} + / "5m^2" { return "5m²"} + +block_standalone_command + = "\\capo{" digits:digits "}" { return property("capo", digits)} + / "\\meter{" num:digits "}{" denom:digits "}" { return property("meter", num + "/" + denom)} + / "\\cover" { return ""} + / "\\transposition{" digits:ndigits "}" {return property("transposition", digits)} + / "\\lilypond" " "? "{" file:slug "}" { return property("partition", [file + ".ly"])} + / "\\nolyrics{\\lilypond{" file:slug "}}" { return property("partition", [file + ".ly"])} + / "\\rep{" digits:digits "}" {return property("repeat", digits)} + / guitar_tab + / ukulele_tab + +guitar_tab + = "\\gtab{" name:inline_text "}{" base:basefret frets:([0-9xX]+) "}" { return tab_property(name, base, frets, false, false)} + / "\\gtab*{" name:inline_text "}{" base:basefret frets:([0-9xX]+) ":"? "}" { return tab_property(name, base, frets, true, false)} + / "\\gtab" "*"? "{" name:inline_text "}{}" { return ""} + +ukulele_tab + = "\\utab{" name:inline_text "}{" base:basefret frets:([0-9xX]+) "}" { return tab_property(name, base, frets, false, true)} + / "\\utab*{" name:inline_text "}{" base:basefret frets:([0-9xX]+) "}" { return tab_property(name, base, frets, true, true)} + +basefret + = digits:digits ":" " "? { return digits; } + / "" { return "0"} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + +language + = "\\selectlanguage{" lang:alpha "}" {return property("language", lang);} + +columnsetting + = "\\songcolumns{" num:digits "}" {return property("columns", num);} + +song + = content:(begin_song properties newlines_merge song_blocks newlines_merge end_song newlines_discard scripture_block? newlines_discard) {return content.join(""); } + +begin_song + = "\\beginsong{" title:inline_text "}" {return property("title", title);} +end_song + = "\\endsong" { return "";} + + +properties + = newlines_merge "[" newlines_merge props:property* "]" { return "\n" + props.join("\n")} + +property + = "by={" value:inline_text "}" prop_separator* { return property("artist", value)} + / "cov={" value:slug "}" prop_separator* { return property("cover", value)} + / "album={" value:inline_text "}" prop_separator* { return property("album", value)} + / "url={" value:url "}" prop_separator* { return property("url", value)} + / "original={" value:inline_text "}" prop_separator* { return property("original", value)} + +prop_separator + = "," + / " " + / "%"? newline + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// @ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +song_blocks + = content:(song_block newlines_merge)* {return megajoin(content)} + +song_block + = block_standalone_command + / verse + / chorus + / bridge + / latex_comment_block + / branching_block + / textnote_block + / musicnote_block + / tablature_block + / repeated_block + / nolyrics_block + / special_block + +song_block_parts + = content:(song_block_part newlines_merge)* {return megajoin(content)} + +song_block_part + = block_standalone_command + / repeated_block_part + / nolyrics_block_part + / musicnote_block_part + / textnote_block_part + / special_block_part + / paragraph_line + + +latex_comment_block + = "%" content:[^\r\n]* {return "#" + content.join("")} + +branching_block + = "\\if" condition:[^\r\n]+ newlines {return "#if" + condition.join("") + "\r\n"} + / "\\else" "%"? newlines {return "#else\r\n"} + / "\\fi" "%"? newlines {return "#fi\r\n"} + + + +repeated_block + = "\\begin{repeatedchords}" newlines c:song_blocks "\\end{repeatedchords}" newlines {return c} + +repeated_block_part + = "\\begin{repeatedchords}" newlines c:song_block_parts "\\end{repeatedchords}" newlines {return c} + +verse + = "\\begin{verse}" newlines c:song_block_parts "\\end{verse}" {return c} + / "\\beginverse" newlines c:song_block_parts "\\endverse" {return c} + / "\\begin{verse*}" newlines c:song_block_parts "\\end{verse*}" {return c} + +chorus + = "\\begin{chorus}" newlines c:song_block_parts "\\end{chorus}" {return blockify("chorus", c, true)} + / "\\beginchorus" newlines c:song_block_parts "\\endchorus" {return blockify("chorus", c, true)} + +bridge + = "\\begin{bridge}" newlines c:song_block_parts "\\end{bridge}" {return blockify("bridge", c, true)} + +nolyrics_block + = "{\\nolyrics " newlines c:song_block_parts "}" {return c} + / "\\nolyrics" "{" c:song_block_parts "}" {return c} + +nolyrics_block_part + = "{\\nolyrics " newlines c:song_block_parts "}" {return c} + / "\\nolyrics" " "? "{" c:song_block_parts "}" {return c} + / "\\nolyrics" {return ""} + +musicnote_block + = "\\musicnote" " "* "{" c:song_block_parts "}" {return blockify("musicnote", c, true)} + / "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return blockify_param("musicnote", lang, c, true)} + +musicnote_block_part + = "\\musicnote" " "* "{" c:song_block_parts "}" {return c} + / "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return c} + + +textnote_block + = "\\textnote" " "* "{" c:song_block_parts "}" {return blockify("textnote", c, false)} + / "\\textnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return blockify_param("textnote", lang, c, false)} + +textnote_block_part + = "\\textnote" " "* "{" c:song_block_parts "}" {return c} + / "\\textnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return c} + / "\\textbf" " "* "{" c:song_block_parts "}" {return "**" + c + "**"} + +scripture_block + = "\\beginscripture{}" "%"? newlines c:song_block_parts "\\endscripture" "%"? {return blockify("scripture", c, true)} + / "\\beginscripture{" comment:inline_text "}" newlines c:song_block_parts "\\endscripture" "%"? {return blockify_param("scripture", comment, c, true)} + +special_block + = "\\Bridge" {return blockify("textnote", "Bridge", false)} + / "\\image[" [^\]]+ "]{" [^}]+ "}" {return ""} + / "\\MultiwordChords" { return ""} + +special_block_part + = "\\Outro : " "{" newlines c:song_block_parts "}" {return c} + / "\\ifrepeatchords" c:song_block_parts "\\fi" {return c} + / "\\ifchorded" newline c:song_block_parts "\\fi" {return c} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Line +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +paragraph_line + = content:paragraph_line_elt+ paragraph_line_elt_comment? {return content.join("")} + / paragraph_line_elt_comment + +paragraph_line_elt_comment + = "%" newline { return ""} + / "%" c:[^\r\n]+ newline { return "\r\n#" + c.join("")} + +paragraph_line_elt + = inline_text + / chord + / command_in_paragraph + +command_in_paragraph + = "\\emph{" c:paragraph_line "}" {return c} + / "\\echo{" c:song_block_parts "}" {return blockify("echo", c, false)} + / "\\" c:ignored_command_in_paragraph "{}"? { return c} + +ignored_command_in_paragraph + = "Intro" + / "Chorus" + / "Bridge" + / "Verse" + / "Rythm" + / "Outro" + / "Solo" + / "Pattern" + + +chord + = "\\[" chordname:inline_text "]" " "? "{" text:inline_text "}" {return "[" + chordname_split(chordname) + "]" + text} + / "\\[" chordname:inline_text "]" {return "[" + chordname_split(chordname) + "]"} + + + +newlines_discard + = newlines {return ""; } + +newlines_merge + = lines:newline* {return (lines.length>0)?"\r\n":""; } + +newlines + = lines:newline* {return lines.join(""); } + +newline + = " "* newline_char " "* + +newline_char + = "\r\n" + / "\r" + / "\n" + + +tablature_block + = " "* "\\begin{tab}" content:tablature_block_line+ "\\end{tab}" {return "#Tabs\n# " +content.join("# ")} + +tablature_block_line + = newlines t:tablature_command newlines { return t + "\r\n"} + +tablature_command + = "\\single " chord:digit " " fret:digits { return "single chord:" + chord + " fret:" + fret} + / "\\bar" { return "bar"} \ No newline at end of file diff --git a/utils/convert_to_chordpro/parser_latex.js b/utils/convert_to_chordpro/parser_latex.js new file mode 100644 index 00000000..2045e8ff --- /dev/null +++ b/utils/convert_to_chordpro/parser_latex.js @@ -0,0 +1,6400 @@ +parser = (function() { + /* + * Generated by PEG.js 0.8.0. + * + * http://pegjs.majda.cz/ + */ + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function SyntaxError(message, expected, found, offset, line, column) { + this.message = message; + this.expected = expected; + this.found = found; + this.offset = offset; + this.line = line; + this.column = column; + + this.name = "SyntaxError"; + } + + peg$subclass(SyntaxError, Error); + + function parse(input) { + var options = arguments.length > 1 ? arguments[1] : {}, + + peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = peg$FAILED, + peg$c1 = null, + peg$c2 = function(content) {return content.join(""); }, + peg$c3 = [], + peg$c4 = /^[0-9]/, + peg$c5 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c6 = function(digits) {return digits.join("")}, + peg$c7 = "-", + peg$c8 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c9 = /^[a-zA-Z]/, + peg$c10 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" }, + peg$c11 = function(chars) {return chars.join("")}, + peg$c12 = /^[a-zA-Z0-9\-_]/, + peg$c13 = { type: "class", value: "[a-zA-Z0-9\\-_]", description: "[a-zA-Z0-9\\-_]" }, + peg$c14 = /^[a-zA-Z0-9\-_$.+!*'(),\/:]/, + peg$c15 = { type: "class", value: "[a-zA-Z0-9\\-_$.+!*'(),\\/:]", description: "[a-zA-Z0-9\\-_$.+!*'(),\\/:]" }, + peg$c16 = function(content) {return content.join("")}, + peg$c17 = /^[^\\\n\r{}$%[\]]/, + peg$c18 = { type: "class", value: "[^\\\\\\n\\r{}$%[\\]]", description: "[^\\\\\\n\\r{}$%[\\]]" }, + peg$c19 = "\\dots {", + peg$c20 = { type: "literal", value: "\\dots {", description: "\"\\\\dots {\"" }, + peg$c21 = "}", + peg$c22 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c23 = function(content) {return "..." + content}, + peg$c24 = "\\shrp{", + peg$c25 = { type: "literal", value: "\\shrp{", description: "\"\\\\shrp{\"" }, + peg$c26 = function(content) {return "#" + content}, + peg$c27 = "\\", + peg$c28 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c29 = " ", + peg$c30 = { type: "literal", value: " ", description: "\" \"" }, + peg$c31 = "{}", + peg$c32 = { type: "literal", value: "{}", description: "\"{}\"" }, + peg$c33 = function(content) {return content}, + peg$c34 = "{\\", + peg$c35 = { type: "literal", value: "{\\", description: "\"{\\\\\"" }, + peg$c36 = "oe", + peg$c37 = { type: "literal", value: "oe", description: "\"oe\"" }, + peg$c38 = function() { return "œ"}, + peg$c39 = "ier", + peg$c40 = { type: "literal", value: "ier", description: "\"ier\"" }, + peg$c41 = "ieme", + peg$c42 = { type: "literal", value: "ieme", description: "\"ieme\"" }, + peg$c43 = "dots", + peg$c44 = { type: "literal", value: "dots", description: "\"dots\"" }, + peg$c45 = function() { return "..."}, + peg$c46 = "ldots", + peg$c47 = { type: "literal", value: "ldots", description: "\"ldots\"" }, + peg$c48 = "og", + peg$c49 = { type: "literal", value: "og", description: "\"og\"" }, + peg$c50 = function() { return "``"}, + peg$c51 = "fg", + peg$c52 = { type: "literal", value: "fg", description: "\"fg\"" }, + peg$c53 = function() { return "''"}, + peg$c54 = "flt", + peg$c55 = { type: "literal", value: "flt", description: "\"flt\"" }, + peg$c56 = function() { return "&"}, + peg$c57 = "shrp", + peg$c58 = { type: "literal", value: "shrp", description: "\"shrp\"" }, + peg$c59 = function() { return "#"}, + peg$c60 = "&", + peg$c61 = { type: "literal", value: "&", description: "\"&\"" }, + peg$c62 = "_", + peg$c63 = { type: "literal", value: "_", description: "\"_\"" }, + peg$c64 = "%", + peg$c65 = { type: "literal", value: "%", description: "\"%\"" }, + peg$c66 = "#", + peg$c67 = { type: "literal", value: "#", description: "\"#\"" }, + peg$c68 = ",", + peg$c69 = { type: "literal", value: ",", description: "\",\"" }, + peg$c70 = "'", + peg$c71 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c72 = function() { return ""}, + peg$c73 = "{", + peg$c74 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c75 = "newline", + peg$c76 = { type: "literal", value: "newline", description: "\"newline\"" }, + peg$c77 = "MultiwordChords", + peg$c78 = { type: "literal", value: "MultiwordChords", description: "\"MultiwordChords\"" }, + peg$c79 = "Adlib", + peg$c80 = { type: "literal", value: "Adlib", description: "\"Adlib\"" }, + peg$c81 = "emph", + peg$c82 = { type: "literal", value: "emph", description: "\"emph\"" }, + peg$c83 = "Outro", + peg$c84 = { type: "literal", value: "Outro", description: "\"Outro\"" }, + peg$c85 = "$", + peg$c86 = { type: "literal", value: "$", description: "\"$\"" }, + peg$c87 = function(eq) {return eq}, + peg$c88 = "\\beta_1", + peg$c89 = { type: "literal", value: "\\beta_1", description: "\"\\\\beta_1\"" }, + peg$c90 = function() { return "Beta1"}, + peg$c91 = "\\beta_2", + peg$c92 = { type: "literal", value: "\\beta_2", description: "\"\\\\beta_2\"" }, + peg$c93 = function() { return "Beta2"}, + peg$c94 = "H_2O", + peg$c95 = { type: "literal", value: "H_2O", description: "\"H_2O\"" }, + peg$c96 = function() { return "H20"}, + peg$c97 = "H_2", + peg$c98 = { type: "literal", value: "H_2", description: "\"H_2\"" }, + peg$c99 = function() { return "H2"}, + peg$c100 = "O", + peg$c101 = { type: "literal", value: "O", description: "\"O\"" }, + peg$c102 = "CO_2", + peg$c103 = { type: "literal", value: "CO_2", description: "\"CO_2\"" }, + peg$c104 = function() { return "CO2"}, + peg$c105 = "5m^2", + peg$c106 = { type: "literal", value: "5m^2", description: "\"5m^2\"" }, + peg$c107 = function() { return "5m²"}, + peg$c108 = "\\capo{", + peg$c109 = { type: "literal", value: "\\capo{", description: "\"\\\\capo{\"" }, + peg$c110 = function(digits) { return property("capo", digits)}, + peg$c111 = "\\meter{", + peg$c112 = { type: "literal", value: "\\meter{", description: "\"\\\\meter{\"" }, + peg$c113 = "}{", + peg$c114 = { type: "literal", value: "}{", description: "\"}{\"" }, + peg$c115 = function(num, denom) { return property("meter", num + "/" + denom)}, + peg$c116 = "\\cover", + peg$c117 = { type: "literal", value: "\\cover", description: "\"\\\\cover\"" }, + peg$c118 = "\\transposition{", + peg$c119 = { type: "literal", value: "\\transposition{", description: "\"\\\\transposition{\"" }, + peg$c120 = function(digits) {return property("transposition", digits)}, + peg$c121 = "\\lilypond", + peg$c122 = { type: "literal", value: "\\lilypond", description: "\"\\\\lilypond\"" }, + peg$c123 = function(file) { return property("partition", [file + ".ly"])}, + peg$c124 = "\\nolyrics{\\lilypond{", + peg$c125 = { type: "literal", value: "\\nolyrics{\\lilypond{", description: "\"\\\\nolyrics{\\\\lilypond{\"" }, + peg$c126 = "}}", + peg$c127 = { type: "literal", value: "}}", description: "\"}}\"" }, + peg$c128 = "\\rep{", + peg$c129 = { type: "literal", value: "\\rep{", description: "\"\\\\rep{\"" }, + peg$c130 = function(digits) {return property("repeat", digits)}, + peg$c131 = "\\gtab{", + peg$c132 = { type: "literal", value: "\\gtab{", description: "\"\\\\gtab{\"" }, + peg$c133 = /^[0-9xX]/, + peg$c134 = { type: "class", value: "[0-9xX]", description: "[0-9xX]" }, + peg$c135 = function(name, base, frets) { return tab_property(name, base, frets, false, false)}, + peg$c136 = "\\gtab*{", + peg$c137 = { type: "literal", value: "\\gtab*{", description: "\"\\\\gtab*{\"" }, + peg$c138 = ":", + peg$c139 = { type: "literal", value: ":", description: "\":\"" }, + peg$c140 = function(name, base, frets) { return tab_property(name, base, frets, true, false)}, + peg$c141 = "\\gtab", + peg$c142 = { type: "literal", value: "\\gtab", description: "\"\\\\gtab\"" }, + peg$c143 = "*", + peg$c144 = { type: "literal", value: "*", description: "\"*\"" }, + peg$c145 = "}{}", + peg$c146 = { type: "literal", value: "}{}", description: "\"}{}\"" }, + peg$c147 = function(name) { return ""}, + peg$c148 = "\\utab{", + peg$c149 = { type: "literal", value: "\\utab{", description: "\"\\\\utab{\"" }, + peg$c150 = function(name, base, frets) { return tab_property(name, base, frets, false, true)}, + peg$c151 = "\\utab*{", + peg$c152 = { type: "literal", value: "\\utab*{", description: "\"\\\\utab*{\"" }, + peg$c153 = function(name, base, frets) { return tab_property(name, base, frets, true, true)}, + peg$c154 = function(digits) { return digits; }, + peg$c155 = "", + peg$c156 = function() { return "0"}, + peg$c157 = "\\selectlanguage{", + peg$c158 = { type: "literal", value: "\\selectlanguage{", description: "\"\\\\selectlanguage{\"" }, + peg$c159 = function(lang) {return property("language", lang);}, + peg$c160 = "\\songcolumns{", + peg$c161 = { type: "literal", value: "\\songcolumns{", description: "\"\\\\songcolumns{\"" }, + peg$c162 = function(num) {return property("columns", num);}, + peg$c163 = "\\beginsong{", + peg$c164 = { type: "literal", value: "\\beginsong{", description: "\"\\\\beginsong{\"" }, + peg$c165 = function(title) {return property("title", title);}, + peg$c166 = "\\endsong", + peg$c167 = { type: "literal", value: "\\endsong", description: "\"\\\\endsong\"" }, + peg$c168 = function() { return "";}, + peg$c169 = "[", + peg$c170 = { type: "literal", value: "[", description: "\"[\"" }, + peg$c171 = "]", + peg$c172 = { type: "literal", value: "]", description: "\"]\"" }, + peg$c173 = function(props) { return "\n" + props.join("\n")}, + peg$c174 = "by={", + peg$c175 = { type: "literal", value: "by={", description: "\"by={\"" }, + peg$c176 = function(value) { return property("artist", value)}, + peg$c177 = "cov={", + peg$c178 = { type: "literal", value: "cov={", description: "\"cov={\"" }, + peg$c179 = function(value) { return property("cover", value)}, + peg$c180 = "album={", + peg$c181 = { type: "literal", value: "album={", description: "\"album={\"" }, + peg$c182 = function(value) { return property("album", value)}, + peg$c183 = "url={", + peg$c184 = { type: "literal", value: "url={", description: "\"url={\"" }, + peg$c185 = function(value) { return property("url", value)}, + peg$c186 = "original={", + peg$c187 = { type: "literal", value: "original={", description: "\"original={\"" }, + peg$c188 = function(value) { return property("original", value)}, + peg$c189 = function(content) {return megajoin(content)}, + peg$c190 = /^[^\r\n]/, + peg$c191 = { type: "class", value: "[^\\r\\n]", description: "[^\\r\\n]" }, + peg$c192 = function(content) {return "#" + content.join("")}, + peg$c193 = "\\if", + peg$c194 = { type: "literal", value: "\\if", description: "\"\\\\if\"" }, + peg$c195 = function(condition) {return "#if" + condition.join("") + "\r\n"}, + peg$c196 = "\\else", + peg$c197 = { type: "literal", value: "\\else", description: "\"\\\\else\"" }, + peg$c198 = function() {return "#else\r\n"}, + peg$c199 = "\\fi", + peg$c200 = { type: "literal", value: "\\fi", description: "\"\\\\fi\"" }, + peg$c201 = function() {return "#fi\r\n"}, + peg$c202 = "\\begin{repeatedchords}", + peg$c203 = { type: "literal", value: "\\begin{repeatedchords}", description: "\"\\\\begin{repeatedchords}\"" }, + peg$c204 = "\\end{repeatedchords}", + peg$c205 = { type: "literal", value: "\\end{repeatedchords}", description: "\"\\\\end{repeatedchords}\"" }, + peg$c206 = function(c) {return c}, + peg$c207 = "\\begin{verse}", + peg$c208 = { type: "literal", value: "\\begin{verse}", description: "\"\\\\begin{verse}\"" }, + peg$c209 = "\\end{verse}", + peg$c210 = { type: "literal", value: "\\end{verse}", description: "\"\\\\end{verse}\"" }, + peg$c211 = "\\beginverse", + peg$c212 = { type: "literal", value: "\\beginverse", description: "\"\\\\beginverse\"" }, + peg$c213 = "\\endverse", + peg$c214 = { type: "literal", value: "\\endverse", description: "\"\\\\endverse\"" }, + peg$c215 = "\\begin{verse*}", + peg$c216 = { type: "literal", value: "\\begin{verse*}", description: "\"\\\\begin{verse*}\"" }, + peg$c217 = "\\end{verse*}", + peg$c218 = { type: "literal", value: "\\end{verse*}", description: "\"\\\\end{verse*}\"" }, + peg$c219 = "\\begin{chorus}", + peg$c220 = { type: "literal", value: "\\begin{chorus}", description: "\"\\\\begin{chorus}\"" }, + peg$c221 = "\\end{chorus}", + peg$c222 = { type: "literal", value: "\\end{chorus}", description: "\"\\\\end{chorus}\"" }, + peg$c223 = function(c) {return blockify("chorus", c, true)}, + peg$c224 = "\\beginchorus", + peg$c225 = { type: "literal", value: "\\beginchorus", description: "\"\\\\beginchorus\"" }, + peg$c226 = "\\endchorus", + peg$c227 = { type: "literal", value: "\\endchorus", description: "\"\\\\endchorus\"" }, + peg$c228 = "\\begin{bridge}", + peg$c229 = { type: "literal", value: "\\begin{bridge}", description: "\"\\\\begin{bridge}\"" }, + peg$c230 = "\\end{bridge}", + peg$c231 = { type: "literal", value: "\\end{bridge}", description: "\"\\\\end{bridge}\"" }, + peg$c232 = function(c) {return blockify("bridge", c, true)}, + peg$c233 = "{\\nolyrics ", + peg$c234 = { type: "literal", value: "{\\nolyrics ", description: "\"{\\\\nolyrics \"" }, + peg$c235 = "\\nolyrics", + peg$c236 = { type: "literal", value: "\\nolyrics", description: "\"\\\\nolyrics\"" }, + peg$c237 = function() {return ""}, + peg$c238 = "\\musicnote", + peg$c239 = { type: "literal", value: "\\musicnote", description: "\"\\\\musicnote\"" }, + peg$c240 = function(c) {return blockify("musicnote", c, true)}, + peg$c241 = "\\musicnote[", + peg$c242 = { type: "literal", value: "\\musicnote[", description: "\"\\\\musicnote[\"" }, + peg$c243 = function(lang, c) {return blockify_param("musicnote", lang, c, true)}, + peg$c244 = function(lang, c) {return c}, + peg$c245 = "\\textnote", + peg$c246 = { type: "literal", value: "\\textnote", description: "\"\\\\textnote\"" }, + peg$c247 = function(c) {return blockify("textnote", c, false)}, + peg$c248 = "\\textnote[", + peg$c249 = { type: "literal", value: "\\textnote[", description: "\"\\\\textnote[\"" }, + peg$c250 = function(lang, c) {return blockify_param("textnote", lang, c, false)}, + peg$c251 = "\\textbf", + peg$c252 = { type: "literal", value: "\\textbf", description: "\"\\\\textbf\"" }, + peg$c253 = function(c) {return "**" + c + "**"}, + peg$c254 = "\\beginscripture{}", + peg$c255 = { type: "literal", value: "\\beginscripture{}", description: "\"\\\\beginscripture{}\"" }, + peg$c256 = "\\endscripture", + peg$c257 = { type: "literal", value: "\\endscripture", description: "\"\\\\endscripture\"" }, + peg$c258 = function(c) {return blockify("scripture", c, true)}, + peg$c259 = "\\beginscripture{", + peg$c260 = { type: "literal", value: "\\beginscripture{", description: "\"\\\\beginscripture{\"" }, + peg$c261 = function(comment, c) {return blockify_param("scripture", comment, c, true)}, + peg$c262 = "\\Bridge", + peg$c263 = { type: "literal", value: "\\Bridge", description: "\"\\\\Bridge\"" }, + peg$c264 = function() {return blockify("textnote", "Bridge", false)}, + peg$c265 = "\\image[", + peg$c266 = { type: "literal", value: "\\image[", description: "\"\\\\image[\"" }, + peg$c267 = /^[^\]]/, + peg$c268 = { type: "class", value: "[^\\]]", description: "[^\\]]" }, + peg$c269 = "]{", + peg$c270 = { type: "literal", value: "]{", description: "\"]{\"" }, + peg$c271 = /^[^}]/, + peg$c272 = { type: "class", value: "[^}]", description: "[^}]" }, + peg$c273 = "\\MultiwordChords", + peg$c274 = { type: "literal", value: "\\MultiwordChords", description: "\"\\\\MultiwordChords\"" }, + peg$c275 = "\\Outro : ", + peg$c276 = { type: "literal", value: "\\Outro : ", description: "\"\\\\Outro : \"" }, + peg$c277 = "\\ifrepeatchords", + peg$c278 = { type: "literal", value: "\\ifrepeatchords", description: "\"\\\\ifrepeatchords\"" }, + peg$c279 = "\\ifchorded", + peg$c280 = { type: "literal", value: "\\ifchorded", description: "\"\\\\ifchorded\"" }, + peg$c281 = function(c) { return "\r\n#" + c.join("")}, + peg$c282 = "\\emph{", + peg$c283 = { type: "literal", value: "\\emph{", description: "\"\\\\emph{\"" }, + peg$c284 = "\\echo{", + peg$c285 = { type: "literal", value: "\\echo{", description: "\"\\\\echo{\"" }, + peg$c286 = function(c) {return blockify("echo", c, false)}, + peg$c287 = function(c) { return c}, + peg$c288 = "Intro", + peg$c289 = { type: "literal", value: "Intro", description: "\"Intro\"" }, + peg$c290 = "Chorus", + peg$c291 = { type: "literal", value: "Chorus", description: "\"Chorus\"" }, + peg$c292 = "Bridge", + peg$c293 = { type: "literal", value: "Bridge", description: "\"Bridge\"" }, + peg$c294 = "Verse", + peg$c295 = { type: "literal", value: "Verse", description: "\"Verse\"" }, + peg$c296 = "Rythm", + peg$c297 = { type: "literal", value: "Rythm", description: "\"Rythm\"" }, + peg$c298 = "Solo", + peg$c299 = { type: "literal", value: "Solo", description: "\"Solo\"" }, + peg$c300 = "Pattern", + peg$c301 = { type: "literal", value: "Pattern", description: "\"Pattern\"" }, + peg$c302 = "\\[", + peg$c303 = { type: "literal", value: "\\[", description: "\"\\\\[\"" }, + peg$c304 = function(chordname, text) {return "[" + chordname_split(chordname) + "]" + text}, + peg$c305 = function(chordname) {return "[" + chordname_split(chordname) + "]"}, + peg$c306 = function() {return ""; }, + peg$c307 = function(lines) {return (lines.length>0)?"\r\n":""; }, + peg$c308 = function(lines) {return lines.join(""); }, + peg$c309 = "\r\n", + peg$c310 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" }, + peg$c311 = "\r", + peg$c312 = { type: "literal", value: "\r", description: "\"\\r\"" }, + peg$c313 = "\n", + peg$c314 = { type: "literal", value: "\n", description: "\"\\n\"" }, + peg$c315 = "\\begin{tab}", + peg$c316 = { type: "literal", value: "\\begin{tab}", description: "\"\\\\begin{tab}\"" }, + peg$c317 = "\\end{tab}", + peg$c318 = { type: "literal", value: "\\end{tab}", description: "\"\\\\end{tab}\"" }, + peg$c319 = function(content) {return "#Tabs\n# " +content.join("# ")}, + peg$c320 = function(t) { return t + "\r\n"}, + peg$c321 = "\\single ", + peg$c322 = { type: "literal", value: "\\single ", description: "\"\\\\single \"" }, + peg$c323 = function(chord, fret) { return "single chord:" + chord + " fret:" + fret}, + peg$c324 = "\\bar", + peg$c325 = { type: "literal", value: "\\bar", description: "\"\\\\bar\"" }, + peg$c326 = function() { return "bar"}, + + peg$currPos = 0, + peg$reportedPos = 0, + peg$cachedPos = 0, + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$cache = {}, + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$reportedPos, peg$currPos); + } + + function offset() { + return peg$reportedPos; + } + + function line() { + return peg$computePosDetails(peg$reportedPos).line; + } + + function column() { + return peg$computePosDetails(peg$reportedPos).column; + } + + function expected(description) { + throw peg$buildException( + null, + [{ type: "other", description: description }], + peg$reportedPos + ); + } + + function error(message) { + throw peg$buildException(message, null, peg$reportedPos); + } + + function peg$computePosDetails(pos) { + function advance(details, startPos, endPos) { + var p, ch; + + for (p = startPos; p < endPos; p++) { + ch = input.charAt(p); + if (ch === "\n") { + if (!details.seenCR) { details.line++; } + details.column = 1; + details.seenCR = false; + } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + details.line++; + details.column = 1; + details.seenCR = true; + } else { + details.column++; + details.seenCR = false; + } + } + } + + if (peg$cachedPos !== pos) { + if (peg$cachedPos > pos) { + peg$cachedPos = 0; + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + } + advance(peg$cachedPosDetails, peg$cachedPos, pos); + peg$cachedPos = pos; + } + + return peg$cachedPosDetails; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildException(message, expected, pos) { + function cleanupExpected(expected) { + var i = 1; + + expected.sort(function(a, b) { + if (a.description < b.description) { + return -1; + } else if (a.description > b.description) { + return 1; + } else { + return 0; + } + }); + + while (i < expected.length) { + if (expected[i - 1] === expected[i]) { + expected.splice(i, 1); + } else { + i++; + } + } + } + + function buildMessage(expected, found) { + function stringEscape(s) { + function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } + + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\x08/g, '\\b') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) + .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) + .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); + } + + var expectedDescs = new Array(expected.length), + expectedDesc, foundDesc, i; + + for (i = 0; i < expected.length; i++) { + expectedDescs[i] = expected[i].description; + } + + expectedDesc = expected.length > 1 + ? expectedDescs.slice(0, -1).join(", ") + + " or " + + expectedDescs[expected.length - 1] + : expectedDescs[0]; + + foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + + return "Expected " + expectedDesc + " but " + foundDesc + " found."; + } + + var posDetails = peg$computePosDetails(pos), + found = pos < input.length ? input.charAt(pos) : null; + + if (expected !== null) { + cleanupExpected(expected); + } + + return new SyntaxError( + message !== null ? message : buildMessage(expected, found), + expected, + found, + pos, + posDetails.line, + posDetails.column + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 65 + 0, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parselanguage(); + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines_merge(); + if (s3 !== peg$FAILED) { + s4 = peg$parsecolumnsetting(); + if (s4 === peg$FAILED) { + s4 = peg$c1; + } + if (s4 !== peg$FAILED) { + s5 = peg$parsenewlines_merge(); + if (s5 !== peg$FAILED) { + s6 = peg$parsesong(); + if (s6 !== peg$FAILED) { + s2 = [s2, s3, s4, s5, s6]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c2(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsedigits() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 1, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c6(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsendigits() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 2, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parsedigits(); + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c7; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c8); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsedigit() { + var s0; + + var key = peg$currPos * 65 + 3, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (peg$c4.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsealpha() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 4, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c9.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c9.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c11(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseslug() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 5, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c12.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c12.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c11(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseurl() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 6, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c14.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c15); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c14.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c15); } + } + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c11(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseinline_text() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 7, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseinline_text_elt(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseinline_text_elt(); + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c16(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseinline_text_elt() { + var s0; + + var key = peg$currPos * 65 + 8, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parsesafe_text(); + if (s0 === peg$FAILED) { + s0 = peg$parseinline_command(); + if (s0 === peg$FAILED) { + s0 = peg$parseempty_command(); + if (s0 === peg$FAILED) { + s0 = peg$parseignored_command(); + if (s0 === peg$FAILED) { + s0 = peg$parseequation(); + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesafe_text() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 9, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsenonlatex_char(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsenonlatex_char(); + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c16(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenonlatex_char() { + var s0; + + var key = peg$currPos * 65 + 10, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (peg$c17.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseinline_command() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 11, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c19) { + s1 = peg$c19; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c20); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c23(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c24) { + s1 = peg$c24; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c26(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseempty_command() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 12, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseempty_command_name(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s3 === peg$FAILED) { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c31) { + s4 = peg$c31; + peg$currPos += 2; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c32); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c33(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseempty_command_name(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c33(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c34) { + s1 = peg$c34; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c35); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseempty_command_name(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c33(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseempty_command_name() { + var s0, s1; + + var key = peg$currPos * 65 + 13, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c36) { + s1 = peg$c36; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c37); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c38(); + } + s0 = s1; + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c39) { + s0 = peg$c39; + peg$currPos += 3; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c40); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 4) === peg$c41) { + s0 = peg$c41; + peg$currPos += 4; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c43) { + s1 = peg$c43; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c44); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c45(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c46) { + s1 = peg$c46; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c45(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c48) { + s1 = peg$c48; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c49); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c50(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c51) { + s1 = peg$c51; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c53(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c54) { + s1 = peg$c54; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c55); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c56(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c57) { + s1 = peg$c57; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c58); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c59(); + } + s0 = s1; + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 38) { + s0 = peg$c60; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 95) { + s0 = peg$c62; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c63); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s0 = peg$c64; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 35) { + s0 = peg$c66; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s0 = peg$c68; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s0 = peg$c70; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c71); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s0 = peg$c29; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseremoved_command_name(); + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c72(); + } + s0 = s1; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseremoved_command_name() { + var s0; + + var key = peg$currPos * 65 + 14, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (input.charCodeAt(peg$currPos) === 123) { + s0 = peg$c73; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s0 = peg$c21; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 7) === peg$c75) { + s0 = peg$c75; + peg$currPos += 7; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 15) === peg$c77) { + s0 = peg$c77; + peg$currPos += 15; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c78); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c79) { + s0 = peg$c79; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c80); } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseignored_command() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 15, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseignored_command_name(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseinline_text(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c33(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseignored_command_name() { + var s0; + + var key = peg$currPos * 65 + 16, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (input.substr(peg$currPos, 4) === peg$c81) { + s0 = peg$c81; + peg$currPos += 4; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c83) { + s0 = peg$c83; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c84); } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseequation() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 17, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 36) { + s1 = peg$c85; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c86); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseequation_content(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 36) { + s3 = peg$c85; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c86); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c87(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseequation_content() { + var s0, s1; + + var key = peg$currPos * 65 + 18, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c88) { + s1 = peg$c88; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c89); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c90(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c91) { + s1 = peg$c91; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c92); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c93(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c94) { + s1 = peg$c94; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c95); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c96(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c97) { + s1 = peg$c97; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c99(); + } + s0 = s1; + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 79) { + s0 = peg$c100; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c101); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c102) { + s1 = peg$c102; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c103); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c104(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c105) { + s1 = peg$c105; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c106); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c107(); + } + s0 = s1; + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseblock_standalone_command() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 19, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c108) { + s1 = peg$c108; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c109); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c110(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c111) { + s1 = peg$c111; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c112); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c113) { + s3 = peg$c113; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsedigits(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c115(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c116) { + s1 = peg$c116; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c117); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c72(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 15) === peg$c118) { + s1 = peg$c118; + peg$currPos += 15; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c119); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsendigits(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c120(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c121) { + s1 = peg$c121; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c122); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseslug(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c123(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 20) === peg$c124) { + s1 = peg$c124; + peg$currPos += 20; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c125); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseslug(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c126) { + s3 = peg$c126; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c127); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c123(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c128) { + s1 = peg$c128; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c129); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c130(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$parseguitar_tab(); + if (s0 === peg$FAILED) { + s0 = peg$parseukulele_tab(); + } + } + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseguitar_tab() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 20, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c131) { + s1 = peg$c131; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c132); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c113) { + s3 = peg$c113; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsebasefret(); + if (s4 !== peg$FAILED) { + s5 = []; + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + } + } else { + s5 = peg$c0; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s6 = peg$c21; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c135(s2, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c136) { + s1 = peg$c136; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c137); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c113) { + s3 = peg$c113; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsebasefret(); + if (s4 !== peg$FAILED) { + s5 = []; + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + } + } else { + s5 = peg$c0; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s6 = peg$c138; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c139); } + } + if (s6 === peg$FAILED) { + s6 = peg$c1; + } + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c140(s2, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c141) { + s1 = peg$c141; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c142); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 42) { + s2 = peg$c143; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c144); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseinline_text(); + if (s4 !== peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c145) { + s5 = peg$c145; + peg$currPos += 3; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c146); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c147(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseukulele_tab() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 65 + 21, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c148) { + s1 = peg$c148; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c149); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c113) { + s3 = peg$c113; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsebasefret(); + if (s4 !== peg$FAILED) { + s5 = []; + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + } + } else { + s5 = peg$c0; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s6 = peg$c21; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c150(s2, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c151) { + s1 = peg$c151; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c152); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c113) { + s3 = peg$c113; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsebasefret(); + if (s4 !== peg$FAILED) { + s5 = []; + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + if (s6 !== peg$FAILED) { + while (s6 !== peg$FAILED) { + s5.push(s6); + if (peg$c133.test(input.charAt(peg$currPos))) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c134); } + } + } + } else { + s5 = peg$c0; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s6 = peg$c21; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c153(s2, s4, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebasefret() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 22, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsedigits(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c138; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c139); } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s3 === peg$FAILED) { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c154(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$c155; + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c156(); + } + s0 = s1; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselanguage() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 23, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c157) { + s1 = peg$c157; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c158); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsealpha(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c159(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsecolumnsetting() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 24, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 13) === peg$c160) { + s1 = peg$c160; + peg$currPos += 13; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c161); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigits(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c162(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesong() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + + var key = peg$currPos * 65 + 25, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parsebegin_song(); + if (s2 !== peg$FAILED) { + s3 = peg$parseproperties(); + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines_merge(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesong_blocks(); + if (s5 !== peg$FAILED) { + s6 = peg$parsenewlines_merge(); + if (s6 !== peg$FAILED) { + s7 = peg$parseend_song(); + if (s7 !== peg$FAILED) { + s8 = peg$parsenewlines_discard(); + if (s8 !== peg$FAILED) { + s9 = peg$parsescripture_block(); + if (s9 === peg$FAILED) { + s9 = peg$c1; + } + if (s9 !== peg$FAILED) { + s10 = peg$parsenewlines_discard(); + if (s10 !== peg$FAILED) { + s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c2(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebegin_song() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 26, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c163) { + s1 = peg$c163; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c164); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c165(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseend_song() { + var s0, s1; + + var key = peg$currPos * 65 + 27, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8) === peg$c166) { + s1 = peg$c166; + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c167); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c168(); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseproperties() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 28, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsenewlines_merge(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 91) { + s2 = peg$c169; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c170); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines_merge(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseproperty(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseproperty(); + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c171; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c173(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseproperty() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 29, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c174) { + s1 = peg$c174; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c175); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseprop_separator(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseprop_separator(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c176(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c177) { + s1 = peg$c177; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c178); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseslug(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseprop_separator(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseprop_separator(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c179(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c180) { + s1 = peg$c180; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c181); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseprop_separator(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseprop_separator(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c182(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c183) { + s1 = peg$c183; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c184); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseurl(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseprop_separator(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseprop_separator(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c185(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c186) { + s1 = peg$c186; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c187); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parseprop_separator(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseprop_separator(); + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c188(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseprop_separator() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 30, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (input.charCodeAt(peg$currPos) === 44) { + s0 = peg$c68; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s0 = peg$c29; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c64; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s1 === peg$FAILED) { + s1 = peg$c1; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewline(); + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesong_blocks() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 31, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$currPos; + s3 = peg$parsesong_block(); + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines_merge(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parsesong_block(); + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines_merge(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c189(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesong_block() { + var s0; + + var key = peg$currPos * 65 + 32, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parseblock_standalone_command(); + if (s0 === peg$FAILED) { + s0 = peg$parseverse(); + if (s0 === peg$FAILED) { + s0 = peg$parsechorus(); + if (s0 === peg$FAILED) { + s0 = peg$parsebridge(); + if (s0 === peg$FAILED) { + s0 = peg$parselatex_comment_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsebranching_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsetextnote_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsemusicnote_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsetablature_block(); + if (s0 === peg$FAILED) { + s0 = peg$parserepeated_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsenolyrics_block(); + if (s0 === peg$FAILED) { + s0 = peg$parsespecial_block(); + } + } + } + } + } + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesong_block_parts() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 33, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$currPos; + s3 = peg$parsesong_block_part(); + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines_merge(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$currPos; + s3 = peg$parsesong_block_part(); + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines_merge(); + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c189(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesong_block_part() { + var s0; + + var key = peg$currPos * 65 + 34, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parseblock_standalone_command(); + if (s0 === peg$FAILED) { + s0 = peg$parserepeated_block_part(); + if (s0 === peg$FAILED) { + s0 = peg$parsenolyrics_block_part(); + if (s0 === peg$FAILED) { + s0 = peg$parsemusicnote_block_part(); + if (s0 === peg$FAILED) { + s0 = peg$parsetextnote_block_part(); + if (s0 === peg$FAILED) { + s0 = peg$parsespecial_block_part(); + if (s0 === peg$FAILED) { + s0 = peg$parseparagraph_line(); + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselatex_comment_block() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 35, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c64; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c192(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebranching_block() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 36, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c193) { + s1 = peg$c193; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c194); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + } + } else { + s2 = peg$c0; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c195(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c196) { + s1 = peg$c196; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c197); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s2 = peg$c64; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c198(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c199) { + s1 = peg$c199; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c200); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s2 = peg$c64; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c201(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parserepeated_block() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 37, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 22) === peg$c202) { + s1 = peg$c202; + peg$currPos += 22; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c203); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_blocks(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 20) === peg$c204) { + s4 = peg$c204; + peg$currPos += 20; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c205); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsenewlines(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parserepeated_block_part() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 38, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 22) === peg$c202) { + s1 = peg$c202; + peg$currPos += 22; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c203); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 20) === peg$c204) { + s4 = peg$c204; + peg$currPos += 20; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c205); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsenewlines(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseverse() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 39, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 13) === peg$c207) { + s1 = peg$c207; + peg$currPos += 13; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c208); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 11) === peg$c209) { + s4 = peg$c209; + peg$currPos += 11; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c210); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c211) { + s1 = peg$c211; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c212); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 9) === peg$c213) { + s4 = peg$c213; + peg$currPos += 9; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c214); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 14) === peg$c215) { + s1 = peg$c215; + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c216); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 12) === peg$c217) { + s4 = peg$c217; + peg$currPos += 12; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c218); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsechorus() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 40, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 14) === peg$c219) { + s1 = peg$c219; + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c220); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 12) === peg$c221) { + s4 = peg$c221; + peg$currPos += 12; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c222); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c223(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 12) === peg$c224) { + s1 = peg$c224; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c225); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 10) === peg$c226) { + s4 = peg$c226; + peg$currPos += 10; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c227); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c223(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebridge() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 41, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 14) === peg$c228) { + s1 = peg$c228; + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c229); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 12) === peg$c230) { + s4 = peg$c230; + peg$currPos += 12; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c231); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c232(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenolyrics_block() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 42, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c233) { + s1 = peg$c233; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c234); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s4 = peg$c21; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c235) { + s1 = peg$c235; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c236); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c73; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s4 = peg$c21; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenolyrics_block_part() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 43, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c233) { + s1 = peg$c233; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c234); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewlines(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s4 = peg$c21; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c235) { + s1 = peg$c235; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c236); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c235) { + s1 = peg$c235; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c236); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c237(); + } + s0 = s1; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsemusicnote_block() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 44, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c238) { + s1 = peg$c238; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c239); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c240(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c241) { + s1 = peg$c241; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c242); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsealpha(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsesong_block_parts(); + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c243(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsemusicnote_block_part() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 45, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c238) { + s1 = peg$c238; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c239); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c241) { + s1 = peg$c241; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c242); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsealpha(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsesong_block_parts(); + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c244(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetextnote_block() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 46, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c245) { + s1 = peg$c245; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c246); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c247(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c248) { + s1 = peg$c248; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c249); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsealpha(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsesong_block_parts(); + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c250(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetextnote_block_part() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 47, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c245) { + s1 = peg$c245; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c246); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c248) { + s1 = peg$c248; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c249); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsealpha(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (input.charCodeAt(peg$currPos) === 32) { + s5 = peg$c29; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsesong_block_parts(); + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c244(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c251) { + s1 = peg$c251; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c252); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s3 = peg$c73; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c253(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsescripture_block() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 48, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 17) === peg$c254) { + s1 = peg$c254; + peg$currPos += 17; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c255); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s2 = peg$c64; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.substr(peg$currPos, 13) === peg$c256) { + s5 = peg$c256; + peg$currPos += 13; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c257); } + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s6 = peg$c64; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s6 === peg$FAILED) { + s6 = peg$c1; + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c258(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c259) { + s1 = peg$c259; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c260); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsenewlines(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesong_block_parts(); + if (s5 !== peg$FAILED) { + if (input.substr(peg$currPos, 13) === peg$c256) { + s6 = peg$c256; + peg$currPos += 13; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c257); } + } + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 37) { + s7 = peg$c64; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s7 === peg$FAILED) { + s7 = peg$c1; + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c261(s2, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsespecial_block() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 49, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c262) { + s1 = peg$c262; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c263); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c264(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c265) { + s1 = peg$c265; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c266); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c267.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c268); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c267.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c268); } + } + } + } else { + s2 = peg$c0; + } + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c269) { + s3 = peg$c269; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c270); } + } + if (s3 !== peg$FAILED) { + s4 = []; + if (peg$c271.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c272); } + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + if (peg$c271.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c272); } + } + } + } else { + s4 = peg$c0; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c237(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c273) { + s1 = peg$c273; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c274); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c72(); + } + s0 = s1; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsespecial_block_part() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 65 + 50, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c275) { + s1 = peg$c275; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c276); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c73; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + s4 = peg$parsesong_block_parts(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c21; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 15) === peg$c277) { + s1 = peg$c277; + peg$currPos += 15; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c278); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsesong_block_parts(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c199) { + s3 = peg$c199; + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c200); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 10) === peg$c279) { + s1 = peg$c279; + peg$currPos += 10; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c280); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewline(); + if (s2 !== peg$FAILED) { + s3 = peg$parsesong_block_parts(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c199) { + s4 = peg$c199; + peg$currPos += 3; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c200); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseparagraph_line() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 51, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseparagraph_line_elt(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseparagraph_line_elt(); + } + } else { + s1 = peg$c0; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseparagraph_line_elt_comment(); + if (s2 === peg$FAILED) { + s2 = peg$c1; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c16(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$parseparagraph_line_elt_comment(); + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseparagraph_line_elt_comment() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 52, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c64; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewline(); + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c72(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c64; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c190.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c191); } + } + } + } else { + s2 = peg$c0; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsenewline(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c281(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseparagraph_line_elt() { + var s0; + + var key = peg$currPos * 65 + 53, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parseinline_text(); + if (s0 === peg$FAILED) { + s0 = peg$parsechord(); + if (s0 === peg$FAILED) { + s0 = peg$parsecommand_in_paragraph(); + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsecommand_in_paragraph() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 54, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c282) { + s1 = peg$c282; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c283); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseparagraph_line(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 6) === peg$c284) { + s1 = peg$c284; + peg$currPos += 6; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c285); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsesong_block_parts(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c21; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c286(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseignored_command_in_paragraph(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c31) { + s3 = peg$c31; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c32); } + } + if (s3 === peg$FAILED) { + s3 = peg$c1; + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c287(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseignored_command_in_paragraph() { + var s0; + + var key = peg$currPos * 65 + 55, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (input.substr(peg$currPos, 5) === peg$c288) { + s0 = peg$c288; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c289); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 6) === peg$c290) { + s0 = peg$c290; + peg$currPos += 6; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c291); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 6) === peg$c292) { + s0 = peg$c292; + peg$currPos += 6; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c293); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c294) { + s0 = peg$c294; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c295); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c296) { + s0 = peg$c296; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c297); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 5) === peg$c83) { + s0 = peg$c83; + peg$currPos += 5; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c84); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 4) === peg$c298) { + s0 = peg$c298; + peg$currPos += 4; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c299); } + } + if (s0 === peg$FAILED) { + if (input.substr(peg$currPos, 7) === peg$c300) { + s0 = peg$c300; + peg$currPos += 7; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c301); } + } + } + } + } + } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsechord() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 65 + 56, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c302) { + s1 = peg$c302; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c303); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s4 = peg$c29; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s4 === peg$FAILED) { + s4 = peg$c1; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s5 = peg$c73; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseinline_text(); + if (s6 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c21; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s7 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c304(s2, s6); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c302) { + s1 = peg$c302; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c303); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseinline_text(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c171; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c172); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c305(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenewlines_discard() { + var s0, s1; + + var key = peg$currPos * 65 + 57, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsenewlines(); + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c306(); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenewlines_merge() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 58, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsenewline(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsenewline(); + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c307(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenewlines() { + var s0, s1, s2; + + var key = peg$currPos * 65 + 59, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsenewline(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsenewline(); + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c308(s1); + } + s0 = s1; + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenewline() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 60, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsenewline_char(); + if (s2 !== peg$FAILED) { + s3 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s4 = peg$c29; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s4 !== peg$FAILED) { + s3.push(s4); + if (input.charCodeAt(peg$currPos) === 32) { + s4 = peg$c29; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenewline_char() { + var s0; + + var key = peg$currPos * 65 + 61, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + if (input.substr(peg$currPos, 2) === peg$c309) { + s0 = peg$c309; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c310); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 13) { + s0 = peg$c311; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c312); } + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 10) { + s0 = peg$c313; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c314); } + } + } + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetablature_block() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 62, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + while (s2 !== peg$FAILED) { + s1.push(s2); + if (input.charCodeAt(peg$currPos) === 32) { + s2 = peg$c29; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 11) === peg$c315) { + s2 = peg$c315; + peg$currPos += 11; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c316); } + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$parsetablature_block_line(); + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$parsetablature_block_line(); + } + } else { + s3 = peg$c0; + } + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 9) === peg$c317) { + s4 = peg$c317; + peg$currPos += 9; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c318); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c319(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetablature_block_line() { + var s0, s1, s2, s3; + + var key = peg$currPos * 65 + 63, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsenewlines(); + if (s1 !== peg$FAILED) { + s2 = peg$parsetablature_command(); + if (s2 !== peg$FAILED) { + s3 = peg$parsenewlines(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c320(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetablature_command() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 65 + 64, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 8) === peg$c321) { + s1 = peg$c321; + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c322); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsedigit(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 32) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsedigits(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c323(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 4) === peg$c324) { + s1 = peg$c324; + peg$currPos += 4; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c325); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c326(); + } + s0 = s1; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + + function megajoin(array){ + for(x in array) { + if(array[x] instanceof Array) { + array[x] = array[x].join(""); + } + } + return array.join(""); + } + function property(name, value){ + if(value instanceof Array) { + value = value.join(""); + } + return "{" + name +": " + value + "}"; + } + function tab_property(name, base, frets, special, ukulele){ + var content = ""; + content += name.replace("/b/g", "&"); + if(base > 0){ + content += " base-fret "; + content += base; + } + content += " frets "; + content += frets.join("").toUpperCase(); + if(special){ + content += " special"; + } + var define = "define"; + if(ukulele){ + define += "_ukulele"; + } + return property(define, content); + } + function blockify(name, content, newline){ + var start = "{start_of_"+name+"}"; + var end = "{end_of_"+name+"}"; + if(newline){ + start += "\r\n"; + end += "\r\n"; + } + return start + content + end; + } + function blockify_param(name, param, content, newline){ + if(param instanceof Array) { + param = param.join(""); + } + var start = "{start_of_"+name + ": "+param+"}"; + var end = "{end_of_"+name+"}"; + if(newline){ + start += "\r\n"; + end += "\r\n"; + } + return start + content + end; + } + function chordname_split(chordname){ + return chordname.split(" - ").join(" ").split(" ").join("][").replace("/b/g", "&"); + } + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail({ type: "end", description: "end of input" }); + } + + throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + } + } + + return { + SyntaxError: SyntaxError, + parse: parse + }; +})(); diff --git a/utils/convert_to_chordpro/readme.txt b/utils/convert_to_chordpro/readme.txt new file mode 100644 index 00000000..fd9401d8 --- /dev/null +++ b/utils/convert_to_chordpro/readme.txt @@ -0,0 +1,6 @@ +Include the parser_latex.js file. +run parser.parse(content); to convert the latex content to chordpro. + +You can test it online at: +http://pegjs.org/online +Just copy and paste the grammar \ No newline at end of file