From 423145e1aa6b3061b85392b651794e099cece57e Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 16 May 2016 13:27:46 -0400 Subject: [PATCH] Update --- dist/syndicatecompiler.js | 1053 +++++++++------------------------ dist/syndicatecompiler.min.js | 12 +- examples/motion/index.html | 26 + examples/motion/index.js | 58 ++ examples/motion/style.css | 7 + examples/motion/tinycolor.js | 897 ++++++++++++++++++++++++++++ 6 files changed, 1278 insertions(+), 775 deletions(-) create mode 100644 examples/motion/index.html create mode 100644 examples/motion/index.js create mode 100644 examples/motion/style.css create mode 100644 examples/motion/tinycolor.js diff --git a/dist/syndicatecompiler.js b/dist/syndicatecompiler.js index c072ef5..408040d 100644 --- a/dist/syndicatecompiler.js +++ b/dist/syndicatecompiler.js @@ -2788,75 +2788,64 @@ module.exports = ohm.makeRecipe(function() { var ohm = require('..'); module.exports = ohm.makeRecipe(function() { var decl = this.newGrammar("Ohm") - .withSource("Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? \"{\" Rule* \"}\"\n\n SuperGrammar\n = \"<:\" ident\n\n Rule\n = ident Formals? ruleDescr? \"=\" \"|\"? Alt -- define\n | ident Formals? \":=\" \"|\"? Alt -- override\n | ident Formals? \"+=\" \"|\"? Alt -- extend\n\n Formals\n = \"<\" ListOf \">\"\n\n Params\n = \"<\" ListOf \">\"\n\n Alt\n = Term (\"|\" Term)*\n\n Term\n = Seq caseName -- inline\n | Seq\n\n Seq\n = Iter*\n\n Iter\n = Pred \"*\" -- star\n | Pred \"+\" -- plus\n | Pred \"?\" -- opt\n | Pred\n\n Pred\n = \"~\" Modifier -- not\n | \"&\" Modifier -- lookahead\n | Modifier\n\n Modifier\n = \"#\" Base -- lex\n | \"$\" Base -- val\n | Base\n\n Base\n = ident Params? ~(ruleDescr? \"=\" | \":=\" | \"+=\") -- application\n | Prim \"..\" Prim -- range\n | Prim -- prim\n | \"(\" Alt \")\" -- paren\n | \"[\" Alt \"]\" -- arr\n | \"{\" \"...\"? \"}\" -- obj\n | \"{\" Props (\",\" \"...\")? \"}\" -- objWithProps\n\n Prim\n = keyword\n | string\n | number\n\n Props\n = Prop (\",\" Prop)*\n\n Prop\n = (name | string) \":\" Alt\n\n ruleDescr (a rule description)\n = \"(\" ruleDescrText \")\"\n\n ruleDescrText\n = (~\")\" any)*\n\n caseName\n = \"--\" (~\"\\n\" space)* name (~\"\\n\" space)* (\"\\n\" | &\"}\")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = \"_\"\n | letter\n\n nameRest\n = \"_\"\n | alnum\n\n ident (an identifier)\n = ~keyword name\n\n keyword\n = \"null\" ~nameRest -- null\n | \"true\" ~nameRest -- true\n | \"false\" ~nameRest -- false\n\n string\n = \"\\\"\" strChar* \"\\\"\"\n\n strChar\n = escapeChar\n | ~\"\\\\\" ~\"\\\"\" ~\"\\n\" any\n\n escapeChar (an escape sequence)\n = \"\\\\\\\\\" -- backslash\n | \"\\\\\\\"\" -- doubleQuote\n | \"\\\\\\'\" -- singleQuote\n | \"\\\\b\" -- backspace\n | \"\\\\n\" -- lineFeed\n | \"\\\\r\" -- carriageReturn\n | \"\\\\t\" -- tab\n | \"\\\\u\" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | \"\\\\x\" hexDigit hexDigit -- hexEscape\n\n number (a number)\n = \"-\"? digit+\n\n space\n += comment\n\n comment\n = \"//\" (~\"\\n\" any)* \"\\n\" -- singleLine\n | \"/*\" (~\"*/\" any)* \"*/\" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | keyword | number | operator | punctuation | string | any\n\n operator = \"<:\" | \"=\" | \":=\" | \"+=\" | \"*\" | \"+\" | \"?\" | \"~\" | \"&\"\n\n punctuation = \"<\" | \">\" | \",\" | \"--\"\n}") + .withSource("Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? \"{\" Rule* \"}\"\n\n SuperGrammar\n = \"<:\" ident\n\n Rule\n = ident Formals? ruleDescr? \"=\" RuleBody -- define\n | ident Formals? \":=\" RuleBody -- override\n | ident Formals? \"+=\" RuleBody -- extend\n\n RuleBody\n = \"|\"? TopLevelTerm (\"|\" TopLevelTerm)*\n\n TopLevelTerm\n = Seq caseName -- inline\n | Seq\n\n Formals\n = \"<\" ListOf \">\"\n\n Params\n = \"<\" ListOf \">\"\n\n Alt\n = Seq (\"|\" Seq)*\n\n Seq\n = Iter*\n\n Iter\n = Pred \"*\" -- star\n | Pred \"+\" -- plus\n | Pred \"?\" -- opt\n | Pred\n\n Pred\n = \"~\" Lex -- not\n | \"&\" Lex -- lookahead\n | Lex\n\n Lex\n = \"#\" Base -- lex\n | Base\n\n Base\n = ident Params? ~(ruleDescr? \"=\" | \":=\" | \"+=\") -- application\n | terminal \"..\" terminal -- range\n | terminal -- terminal\n | \"(\" Alt \")\" -- paren\n\n ruleDescr (a rule description)\n = \"(\" ruleDescrText \")\"\n\n ruleDescrText\n = (~\")\" any)*\n\n caseName\n = \"--\" (~\"\\n\" space)* name (~\"\\n\" space)* (\"\\n\" | &\"}\")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = \"_\"\n | letter\n\n nameRest\n = \"_\"\n | alnum\n\n ident (an identifier)\n = name\n\n terminal\n = \"\\\"\" terminalChar* \"\\\"\"\n\n terminalChar\n = escapeChar\n | ~\"\\\\\" ~\"\\\"\" ~\"\\n\" any\n\n escapeChar (an escape sequence)\n = \"\\\\\\\\\" -- backslash\n | \"\\\\\\\"\" -- doubleQuote\n | \"\\\\\\'\" -- singleQuote\n | \"\\\\b\" -- backspace\n | \"\\\\n\" -- lineFeed\n | \"\\\\r\" -- carriageReturn\n | \"\\\\t\" -- tab\n | \"\\\\u\" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | \"\\\\x\" hexDigit hexDigit -- hexEscape\n\n space\n += comment\n\n comment\n = \"//\" (~\"\\n\" any)* \"\\n\" -- singleLine\n | \"/*\" (~\"*/\" any)* \"*/\" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | operator | punctuation | terminal | any\n\n operator = \"<:\" | \"=\" | \":=\" | \"+=\" | \"*\" | \"+\" | \"?\" | \"~\" | \"&\"\n\n punctuation = \"<\" | \">\" | \",\" | \"--\"\n}") .withDefaultStartRule("Grammars") return decl .define("Grammars", [], this.star(this.app("Grammar").withInterval(decl.sourceInterval(24, 31))).withInterval(decl.sourceInterval(24, 32))) - .define("Grammar", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(50, 55)), this.opt(this.app("SuperGrammar").withInterval(decl.sourceInterval(56, 68))).withInterval(decl.sourceInterval(56, 69)), this.prim("{").withInterval(decl.sourceInterval(70, 73)), this.star(this.app("Rule").withInterval(decl.sourceInterval(74, 78))).withInterval(decl.sourceInterval(74, 79)), this.prim("}").withInterval(decl.sourceInterval(80, 83))).withInterval(decl.sourceInterval(50, 83))) - .define("SuperGrammar", [], this.seq(this.prim("<:").withInterval(decl.sourceInterval(106, 110)), this.app("ident").withInterval(decl.sourceInterval(111, 116))).withInterval(decl.sourceInterval(106, 116))) - .define("Rule_define", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(131, 136)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(137, 144))).withInterval(decl.sourceInterval(137, 145)), this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(146, 155))).withInterval(decl.sourceInterval(146, 156)), this.prim("=").withInterval(decl.sourceInterval(157, 160)), this.opt(this.prim("|").withInterval(decl.sourceInterval(162, 165))).withInterval(decl.sourceInterval(162, 166)), this.app("Alt").withInterval(decl.sourceInterval(167, 170))).withInterval(decl.sourceInterval(131, 170))) - .define("Rule_override", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(188, 193)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(194, 201))).withInterval(decl.sourceInterval(194, 202)), this.prim(":=").withInterval(decl.sourceInterval(214, 218)), this.opt(this.prim("|").withInterval(decl.sourceInterval(219, 222))).withInterval(decl.sourceInterval(219, 223)), this.app("Alt").withInterval(decl.sourceInterval(224, 227))).withInterval(decl.sourceInterval(188, 227))) - .define("Rule_extend", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(247, 252)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(253, 260))).withInterval(decl.sourceInterval(253, 261)), this.prim("+=").withInterval(decl.sourceInterval(273, 277)), this.opt(this.prim("|").withInterval(decl.sourceInterval(278, 281))).withInterval(decl.sourceInterval(278, 282)), this.app("Alt").withInterval(decl.sourceInterval(283, 286))).withInterval(decl.sourceInterval(247, 286))) + .define("Grammar", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(50, 55)), this.opt(this.app("SuperGrammar").withInterval(decl.sourceInterval(56, 68))).withInterval(decl.sourceInterval(56, 69)), this.terminal("{").withInterval(decl.sourceInterval(70, 73)), this.star(this.app("Rule").withInterval(decl.sourceInterval(74, 78))).withInterval(decl.sourceInterval(74, 79)), this.terminal("}").withInterval(decl.sourceInterval(80, 83))).withInterval(decl.sourceInterval(50, 83))) + .define("SuperGrammar", [], this.seq(this.terminal("<:").withInterval(decl.sourceInterval(106, 110)), this.app("ident").withInterval(decl.sourceInterval(111, 116))).withInterval(decl.sourceInterval(106, 116))) + .define("Rule_define", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(131, 136)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(137, 144))).withInterval(decl.sourceInterval(137, 145)), this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(146, 155))).withInterval(decl.sourceInterval(146, 156)), this.terminal("=").withInterval(decl.sourceInterval(157, 160)), this.app("RuleBody").withInterval(decl.sourceInterval(162, 170))).withInterval(decl.sourceInterval(131, 170))) + .define("Rule_override", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(188, 193)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(194, 201))).withInterval(decl.sourceInterval(194, 202)), this.terminal(":=").withInterval(decl.sourceInterval(214, 218)), this.app("RuleBody").withInterval(decl.sourceInterval(219, 227))).withInterval(decl.sourceInterval(188, 227))) + .define("Rule_extend", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(247, 252)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(253, 260))).withInterval(decl.sourceInterval(253, 261)), this.terminal("+=").withInterval(decl.sourceInterval(273, 277)), this.app("RuleBody").withInterval(decl.sourceInterval(278, 286))).withInterval(decl.sourceInterval(247, 286))) .define("Rule", [], this.alt(this.app("Rule_define").withInterval(decl.sourceInterval(131, 170)), this.app("Rule_override").withInterval(decl.sourceInterval(188, 227)), this.app("Rule_extend").withInterval(decl.sourceInterval(247, 286))).withInterval(decl.sourceInterval(131, 297))) - .define("Formals", [], this.seq(this.prim("<").withInterval(decl.sourceInterval(315, 318)), this.app("ListOf", [this.app("ident").withInterval(decl.sourceInterval(326, 331)), this.prim(",").withInterval(decl.sourceInterval(333, 336))]).withInterval(decl.sourceInterval(319, 337)), this.prim(">").withInterval(decl.sourceInterval(338, 341))).withInterval(decl.sourceInterval(315, 341))) - .define("Params", [], this.seq(this.prim("<").withInterval(decl.sourceInterval(358, 361)), this.app("ListOf", [this.app("Seq").withInterval(decl.sourceInterval(369, 372)), this.prim(",").withInterval(decl.sourceInterval(374, 377))]).withInterval(decl.sourceInterval(362, 378)), this.prim(">").withInterval(decl.sourceInterval(379, 382))).withInterval(decl.sourceInterval(358, 382))) - .define("Alt", [], this.seq(this.app("Term").withInterval(decl.sourceInterval(396, 400)), this.star(this.seq(this.prim("|").withInterval(decl.sourceInterval(402, 405)), this.app("Term").withInterval(decl.sourceInterval(406, 410))).withInterval(decl.sourceInterval(402, 410))).withInterval(decl.sourceInterval(401, 412))).withInterval(decl.sourceInterval(396, 412))) - .define("Term_inline", [], this.seq(this.app("Seq").withInterval(decl.sourceInterval(427, 430)), this.app("caseName").withInterval(decl.sourceInterval(431, 439))).withInterval(decl.sourceInterval(427, 439))) - .define("Term", [], this.alt(this.app("Term_inline").withInterval(decl.sourceInterval(427, 439)), this.app("Seq").withInterval(decl.sourceInterval(456, 459))).withInterval(decl.sourceInterval(427, 459))) - .define("Seq", [], this.star(this.app("Iter").withInterval(decl.sourceInterval(473, 477))).withInterval(decl.sourceInterval(473, 478))) - .define("Iter_star", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(493, 497)), this.prim("*").withInterval(decl.sourceInterval(498, 501))).withInterval(decl.sourceInterval(493, 501))) - .define("Iter_plus", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(517, 521)), this.prim("+").withInterval(decl.sourceInterval(522, 525))).withInterval(decl.sourceInterval(517, 525))) - .define("Iter_opt", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(541, 545)), this.prim("?").withInterval(decl.sourceInterval(546, 549))).withInterval(decl.sourceInterval(541, 549))) - .define("Iter", [], this.alt(this.app("Iter_star").withInterval(decl.sourceInterval(493, 501)), this.app("Iter_plus").withInterval(decl.sourceInterval(517, 525)), this.app("Iter_opt").withInterval(decl.sourceInterval(541, 549)), this.app("Pred").withInterval(decl.sourceInterval(564, 568))).withInterval(decl.sourceInterval(493, 568))) - .define("Pred_not", [], this.seq(this.prim("~").withInterval(decl.sourceInterval(583, 586)), this.app("Modifier").withInterval(decl.sourceInterval(587, 595))).withInterval(decl.sourceInterval(583, 595))) - .define("Pred_lookahead", [], this.seq(this.prim("&").withInterval(decl.sourceInterval(610, 613)), this.app("Modifier").withInterval(decl.sourceInterval(614, 622))).withInterval(decl.sourceInterval(610, 622))) - .define("Pred", [], this.alt(this.app("Pred_not").withInterval(decl.sourceInterval(583, 595)), this.app("Pred_lookahead").withInterval(decl.sourceInterval(610, 622)), this.app("Modifier").withInterval(decl.sourceInterval(643, 651))).withInterval(decl.sourceInterval(583, 651))) - .define("Modifier_lex", [], this.seq(this.prim("#").withInterval(decl.sourceInterval(670, 673)), this.app("Base").withInterval(decl.sourceInterval(674, 678))).withInterval(decl.sourceInterval(670, 678))) - .define("Modifier_val", [], this.seq(this.prim("$").withInterval(decl.sourceInterval(693, 696)), this.app("Base").withInterval(decl.sourceInterval(697, 701))).withInterval(decl.sourceInterval(693, 701))) - .define("Modifier", [], this.alt(this.app("Modifier_lex").withInterval(decl.sourceInterval(670, 678)), this.app("Modifier_val").withInterval(decl.sourceInterval(693, 701)), this.app("Base").withInterval(decl.sourceInterval(716, 720))).withInterval(decl.sourceInterval(670, 720))) - .define("Base_application", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(735, 740)), this.opt(this.app("Params").withInterval(decl.sourceInterval(741, 747))).withInterval(decl.sourceInterval(741, 748)), this.not(this.alt(this.seq(this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(751, 760))).withInterval(decl.sourceInterval(751, 761)), this.prim("=").withInterval(decl.sourceInterval(762, 765))).withInterval(decl.sourceInterval(751, 765)), this.prim(":=").withInterval(decl.sourceInterval(768, 772)), this.prim("+=").withInterval(decl.sourceInterval(775, 779))).withInterval(decl.sourceInterval(751, 779))).withInterval(decl.sourceInterval(749, 780))).withInterval(decl.sourceInterval(735, 780))) - .define("Base_range", [], this.seq(this.app("Prim").withInterval(decl.sourceInterval(803, 807)), this.prim("..").withInterval(decl.sourceInterval(808, 812)), this.app("Prim").withInterval(decl.sourceInterval(813, 817))).withInterval(decl.sourceInterval(803, 817))) - .define("Base_prim", [], this.app("Prim").withInterval(decl.sourceInterval(865, 869))) - .define("Base_paren", [], this.seq(this.prim("(").withInterval(decl.sourceInterval(926, 929)), this.app("Alt").withInterval(decl.sourceInterval(930, 933)), this.prim(")").withInterval(decl.sourceInterval(934, 937))).withInterval(decl.sourceInterval(926, 937))) - .define("Base_arr", [], this.seq(this.prim("[").withInterval(decl.sourceInterval(988, 991)), this.app("Alt").withInterval(decl.sourceInterval(992, 995)), this.prim("]").withInterval(decl.sourceInterval(996, 999))).withInterval(decl.sourceInterval(988, 999))) - .define("Base_obj", [], this.seq(this.prim("{").withInterval(decl.sourceInterval(1048, 1051)), this.opt(this.prim("...").withInterval(decl.sourceInterval(1052, 1057))).withInterval(decl.sourceInterval(1052, 1058)), this.prim("}").withInterval(decl.sourceInterval(1059, 1062))).withInterval(decl.sourceInterval(1048, 1062))) - .define("Base_objWithProps", [], this.seq(this.prim("{").withInterval(decl.sourceInterval(1108, 1111)), this.app("Props").withInterval(decl.sourceInterval(1112, 1117)), this.opt(this.seq(this.prim(",").withInterval(decl.sourceInterval(1119, 1122)), this.prim("...").withInterval(decl.sourceInterval(1123, 1128))).withInterval(decl.sourceInterval(1119, 1128))).withInterval(decl.sourceInterval(1118, 1130)), this.prim("}").withInterval(decl.sourceInterval(1131, 1134))).withInterval(decl.sourceInterval(1108, 1134))) - .define("Base", [], this.alt(this.app("Base_application").withInterval(decl.sourceInterval(735, 780)), this.app("Base_range").withInterval(decl.sourceInterval(803, 817)), this.app("Base_prim").withInterval(decl.sourceInterval(865, 869)), this.app("Base_paren").withInterval(decl.sourceInterval(926, 937)), this.app("Base_arr").withInterval(decl.sourceInterval(988, 999)), this.app("Base_obj").withInterval(decl.sourceInterval(1048, 1062)), this.app("Base_objWithProps").withInterval(decl.sourceInterval(1108, 1134))).withInterval(decl.sourceInterval(735, 1170))) - .define("Prim", [], this.alt(this.app("keyword").withInterval(decl.sourceInterval(1185, 1192)), this.app("string").withInterval(decl.sourceInterval(1199, 1205)), this.app("number").withInterval(decl.sourceInterval(1212, 1218))).withInterval(decl.sourceInterval(1185, 1218))) - .define("Props", [], this.seq(this.app("Prop").withInterval(decl.sourceInterval(1234, 1238)), this.star(this.seq(this.prim(",").withInterval(decl.sourceInterval(1240, 1243)), this.app("Prop").withInterval(decl.sourceInterval(1244, 1248))).withInterval(decl.sourceInterval(1240, 1248))).withInterval(decl.sourceInterval(1239, 1250))).withInterval(decl.sourceInterval(1234, 1250))) - .define("Prop", [], this.seq(this.alt(this.app("name").withInterval(decl.sourceInterval(1266, 1270)), this.app("string").withInterval(decl.sourceInterval(1273, 1279))).withInterval(decl.sourceInterval(1266, 1279)), this.prim(":").withInterval(decl.sourceInterval(1281, 1284)), this.app("Alt").withInterval(decl.sourceInterval(1285, 1288))).withInterval(decl.sourceInterval(1265, 1288))) - .define("ruleDescr", [], this.seq(this.prim("(").withInterval(decl.sourceInterval(1330, 1333)), this.app("ruleDescrText").withInterval(decl.sourceInterval(1334, 1347)), this.prim(")").withInterval(decl.sourceInterval(1348, 1351))).withInterval(decl.sourceInterval(1330, 1351)), "a rule description") - .define("ruleDescrText", [], this.star(this.seq(this.not(this.prim(")").withInterval(decl.sourceInterval(1377, 1380))).withInterval(decl.sourceInterval(1376, 1380)), this.app("any").withInterval(decl.sourceInterval(1381, 1384))).withInterval(decl.sourceInterval(1376, 1384))).withInterval(decl.sourceInterval(1375, 1386))) - .define("caseName", [], this.seq(this.prim("--").withInterval(decl.sourceInterval(1405, 1409)), this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(1412, 1416))).withInterval(decl.sourceInterval(1411, 1416)), this.app("space").withInterval(decl.sourceInterval(1417, 1422))).withInterval(decl.sourceInterval(1411, 1422))).withInterval(decl.sourceInterval(1410, 1424)), this.app("name").withInterval(decl.sourceInterval(1425, 1429)), this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(1432, 1436))).withInterval(decl.sourceInterval(1431, 1436)), this.app("space").withInterval(decl.sourceInterval(1437, 1442))).withInterval(decl.sourceInterval(1431, 1442))).withInterval(decl.sourceInterval(1430, 1444)), this.alt(this.prim("\n").withInterval(decl.sourceInterval(1446, 1450)), this.la(this.prim("}").withInterval(decl.sourceInterval(1454, 1457))).withInterval(decl.sourceInterval(1453, 1457))).withInterval(decl.sourceInterval(1446, 1457))).withInterval(decl.sourceInterval(1405, 1458))) - .define("name", [], this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(1483, 1492)), this.star(this.app("nameRest").withInterval(decl.sourceInterval(1493, 1501))).withInterval(decl.sourceInterval(1493, 1502))).withInterval(decl.sourceInterval(1483, 1502)), "a name") - .define("nameFirst", [], this.alt(this.prim("_").withInterval(decl.sourceInterval(1522, 1525)), this.app("letter").withInterval(decl.sourceInterval(1532, 1538))).withInterval(decl.sourceInterval(1522, 1538))) - .define("nameRest", [], this.alt(this.prim("_").withInterval(decl.sourceInterval(1557, 1560)), this.app("alnum").withInterval(decl.sourceInterval(1567, 1572))).withInterval(decl.sourceInterval(1557, 1572))) - .define("ident", [], this.seq(this.not(this.app("keyword").withInterval(decl.sourceInterval(1606, 1613))).withInterval(decl.sourceInterval(1605, 1613)), this.app("name").withInterval(decl.sourceInterval(1614, 1618))).withInterval(decl.sourceInterval(1605, 1618)), "an identifier") - .define("keyword_null", [], this.seq(this.prim("null").withInterval(decl.sourceInterval(1636, 1642)), this.not(this.app("nameRest").withInterval(decl.sourceInterval(1644, 1652))).withInterval(decl.sourceInterval(1643, 1652))).withInterval(decl.sourceInterval(1636, 1652))) - .define("keyword_true", [], this.seq(this.prim("true").withInterval(decl.sourceInterval(1669, 1675)), this.not(this.app("nameRest").withInterval(decl.sourceInterval(1677, 1685))).withInterval(decl.sourceInterval(1676, 1685))).withInterval(decl.sourceInterval(1669, 1685))) - .define("keyword_false", [], this.seq(this.prim("false").withInterval(decl.sourceInterval(1702, 1709)), this.not(this.app("nameRest").withInterval(decl.sourceInterval(1711, 1719))).withInterval(decl.sourceInterval(1710, 1719))).withInterval(decl.sourceInterval(1702, 1719))) - .define("keyword", [], this.alt(this.app("keyword_null").withInterval(decl.sourceInterval(1636, 1652)), this.app("keyword_true").withInterval(decl.sourceInterval(1669, 1685)), this.app("keyword_false").withInterval(decl.sourceInterval(1702, 1719))).withInterval(decl.sourceInterval(1636, 1729))) - .define("string", [], this.seq(this.prim("\"").withInterval(decl.sourceInterval(1746, 1750)), this.star(this.app("strChar").withInterval(decl.sourceInterval(1751, 1758))).withInterval(decl.sourceInterval(1751, 1759)), this.prim("\"").withInterval(decl.sourceInterval(1760, 1764))).withInterval(decl.sourceInterval(1746, 1764))) - .define("strChar", [], this.alt(this.app("escapeChar").withInterval(decl.sourceInterval(1782, 1792)), this.seq(this.not(this.prim("\\").withInterval(decl.sourceInterval(1800, 1804))).withInterval(decl.sourceInterval(1799, 1804)), this.not(this.prim("\"").withInterval(decl.sourceInterval(1806, 1810))).withInterval(decl.sourceInterval(1805, 1810)), this.not(this.prim("\n").withInterval(decl.sourceInterval(1812, 1816))).withInterval(decl.sourceInterval(1811, 1816)), this.app("any").withInterval(decl.sourceInterval(1817, 1820))).withInterval(decl.sourceInterval(1799, 1820))).withInterval(decl.sourceInterval(1782, 1820))) - .define("escapeChar_backslash", [], this.prim("\\\\").withInterval(decl.sourceInterval(1863, 1869))) - .define("escapeChar_doubleQuote", [], this.prim("\\\"").withInterval(decl.sourceInterval(1925, 1931))) - .define("escapeChar_singleQuote", [], this.prim("\\'").withInterval(decl.sourceInterval(1989, 1995))) - .define("escapeChar_backspace", [], this.prim("\\b").withInterval(decl.sourceInterval(2053, 2058))) - .define("escapeChar_lineFeed", [], this.prim("\\n").withInterval(decl.sourceInterval(2115, 2120))) - .define("escapeChar_carriageReturn", [], this.prim("\\r").withInterval(decl.sourceInterval(2176, 2181))) - .define("escapeChar_tab", [], this.prim("\\t").withInterval(decl.sourceInterval(2243, 2248))) - .define("escapeChar_unicodeEscape", [], this.seq(this.prim("\\u").withInterval(decl.sourceInterval(2299, 2304)), this.app("hexDigit").withInterval(decl.sourceInterval(2305, 2313)), this.app("hexDigit").withInterval(decl.sourceInterval(2314, 2322)), this.app("hexDigit").withInterval(decl.sourceInterval(2323, 2331)), this.app("hexDigit").withInterval(decl.sourceInterval(2332, 2340))).withInterval(decl.sourceInterval(2299, 2340))) - .define("escapeChar_hexEscape", [], this.seq(this.prim("\\x").withInterval(decl.sourceInterval(2365, 2370)), this.app("hexDigit").withInterval(decl.sourceInterval(2371, 2379)), this.app("hexDigit").withInterval(decl.sourceInterval(2380, 2388))).withInterval(decl.sourceInterval(2365, 2388))) - .define("escapeChar", [], this.alt(this.app("escapeChar_backslash").withInterval(decl.sourceInterval(1863, 1869)), this.app("escapeChar_doubleQuote").withInterval(decl.sourceInterval(1925, 1931)), this.app("escapeChar_singleQuote").withInterval(decl.sourceInterval(1989, 1995)), this.app("escapeChar_backspace").withInterval(decl.sourceInterval(2053, 2058)), this.app("escapeChar_lineFeed").withInterval(decl.sourceInterval(2115, 2120)), this.app("escapeChar_carriageReturn").withInterval(decl.sourceInterval(2176, 2181)), this.app("escapeChar_tab").withInterval(decl.sourceInterval(2243, 2248)), this.app("escapeChar_unicodeEscape").withInterval(decl.sourceInterval(2299, 2340)), this.app("escapeChar_hexEscape").withInterval(decl.sourceInterval(2365, 2388))).withInterval(decl.sourceInterval(1863, 2420)), "an escape sequence") - .define("number", [], this.seq(this.opt(this.prim("-").withInterval(decl.sourceInterval(2449, 2452))).withInterval(decl.sourceInterval(2449, 2453)), this.plus(this.app("digit").withInterval(decl.sourceInterval(2454, 2459))).withInterval(decl.sourceInterval(2454, 2460))).withInterval(decl.sourceInterval(2449, 2460)), "a number") - .extend("space", [], this.app("comment").withInterval(decl.sourceInterval(2476, 2483))) - .define("comment_singleLine", [], this.seq(this.prim("//").withInterval(decl.sourceInterval(2501, 2505)), this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(2508, 2512))).withInterval(decl.sourceInterval(2507, 2512)), this.app("any").withInterval(decl.sourceInterval(2513, 2516))).withInterval(decl.sourceInterval(2507, 2516))).withInterval(decl.sourceInterval(2506, 2518)), this.prim("\n").withInterval(decl.sourceInterval(2519, 2523))).withInterval(decl.sourceInterval(2501, 2523))) - .define("comment_multiLine", [], this.seq(this.prim("/*").withInterval(decl.sourceInterval(2545, 2549)), this.star(this.seq(this.not(this.prim("*/").withInterval(decl.sourceInterval(2552, 2556))).withInterval(decl.sourceInterval(2551, 2556)), this.app("any").withInterval(decl.sourceInterval(2557, 2560))).withInterval(decl.sourceInterval(2551, 2560))).withInterval(decl.sourceInterval(2550, 2562)), this.prim("*/").withInterval(decl.sourceInterval(2563, 2567))).withInterval(decl.sourceInterval(2545, 2567))) - .define("comment", [], this.alt(this.app("comment_singleLine").withInterval(decl.sourceInterval(2501, 2523)), this.app("comment_multiLine").withInterval(decl.sourceInterval(2545, 2567))).withInterval(decl.sourceInterval(2501, 2581))) - .define("tokens", [], this.star(this.app("token").withInterval(decl.sourceInterval(2594, 2599))).withInterval(decl.sourceInterval(2594, 2600))) - .define("token", [], this.alt(this.app("caseName").withInterval(decl.sourceInterval(2612, 2620)), this.app("comment").withInterval(decl.sourceInterval(2623, 2630)), this.app("ident").withInterval(decl.sourceInterval(2633, 2638)), this.app("keyword").withInterval(decl.sourceInterval(2641, 2648)), this.app("number").withInterval(decl.sourceInterval(2651, 2657)), this.app("operator").withInterval(decl.sourceInterval(2660, 2668)), this.app("punctuation").withInterval(decl.sourceInterval(2671, 2682)), this.app("string").withInterval(decl.sourceInterval(2685, 2691)), this.app("any").withInterval(decl.sourceInterval(2694, 2697))).withInterval(decl.sourceInterval(2612, 2697))) - .define("operator", [], this.alt(this.prim("<:").withInterval(decl.sourceInterval(2712, 2716)), this.prim("=").withInterval(decl.sourceInterval(2719, 2722)), this.prim(":=").withInterval(decl.sourceInterval(2725, 2729)), this.prim("+=").withInterval(decl.sourceInterval(2732, 2736)), this.prim("*").withInterval(decl.sourceInterval(2739, 2742)), this.prim("+").withInterval(decl.sourceInterval(2745, 2748)), this.prim("?").withInterval(decl.sourceInterval(2751, 2754)), this.prim("~").withInterval(decl.sourceInterval(2757, 2760)), this.prim("&").withInterval(decl.sourceInterval(2763, 2766))).withInterval(decl.sourceInterval(2712, 2766))) - .define("punctuation", [], this.alt(this.prim("<").withInterval(decl.sourceInterval(2784, 2787)), this.prim(">").withInterval(decl.sourceInterval(2790, 2793)), this.prim(",").withInterval(decl.sourceInterval(2796, 2799)), this.prim("--").withInterval(decl.sourceInterval(2802, 2806))).withInterval(decl.sourceInterval(2784, 2806))) + .define("RuleBody", [], this.seq(this.opt(this.terminal("|").withInterval(decl.sourceInterval(316, 319))).withInterval(decl.sourceInterval(316, 320)), this.app("TopLevelTerm").withInterval(decl.sourceInterval(321, 333)), this.star(this.seq(this.terminal("|").withInterval(decl.sourceInterval(335, 338)), this.app("TopLevelTerm").withInterval(decl.sourceInterval(339, 351))).withInterval(decl.sourceInterval(335, 351))).withInterval(decl.sourceInterval(334, 353))).withInterval(decl.sourceInterval(316, 353))) + .define("TopLevelTerm_inline", [], this.seq(this.app("Seq").withInterval(decl.sourceInterval(376, 379)), this.app("caseName").withInterval(decl.sourceInterval(380, 388))).withInterval(decl.sourceInterval(376, 388))) + .define("TopLevelTerm", [], this.alt(this.app("TopLevelTerm_inline").withInterval(decl.sourceInterval(376, 388)), this.app("Seq").withInterval(decl.sourceInterval(406, 409))).withInterval(decl.sourceInterval(376, 409))) + .define("Formals", [], this.seq(this.terminal("<").withInterval(decl.sourceInterval(427, 430)), this.app("ListOf", [this.app("ident").withInterval(decl.sourceInterval(438, 443)), this.terminal(",").withInterval(decl.sourceInterval(445, 448))]).withInterval(decl.sourceInterval(431, 449)), this.terminal(">").withInterval(decl.sourceInterval(450, 453))).withInterval(decl.sourceInterval(427, 453))) + .define("Params", [], this.seq(this.terminal("<").withInterval(decl.sourceInterval(470, 473)), this.app("ListOf", [this.app("Seq").withInterval(decl.sourceInterval(481, 484)), this.terminal(",").withInterval(decl.sourceInterval(486, 489))]).withInterval(decl.sourceInterval(474, 490)), this.terminal(">").withInterval(decl.sourceInterval(491, 494))).withInterval(decl.sourceInterval(470, 494))) + .define("Alt", [], this.seq(this.app("Seq").withInterval(decl.sourceInterval(508, 511)), this.star(this.seq(this.terminal("|").withInterval(decl.sourceInterval(513, 516)), this.app("Seq").withInterval(decl.sourceInterval(517, 520))).withInterval(decl.sourceInterval(513, 520))).withInterval(decl.sourceInterval(512, 522))).withInterval(decl.sourceInterval(508, 522))) + .define("Seq", [], this.star(this.app("Iter").withInterval(decl.sourceInterval(536, 540))).withInterval(decl.sourceInterval(536, 541))) + .define("Iter_star", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(556, 560)), this.terminal("*").withInterval(decl.sourceInterval(561, 564))).withInterval(decl.sourceInterval(556, 564))) + .define("Iter_plus", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(580, 584)), this.terminal("+").withInterval(decl.sourceInterval(585, 588))).withInterval(decl.sourceInterval(580, 588))) + .define("Iter_opt", [], this.seq(this.app("Pred").withInterval(decl.sourceInterval(604, 608)), this.terminal("?").withInterval(decl.sourceInterval(609, 612))).withInterval(decl.sourceInterval(604, 612))) + .define("Iter", [], this.alt(this.app("Iter_star").withInterval(decl.sourceInterval(556, 564)), this.app("Iter_plus").withInterval(decl.sourceInterval(580, 588)), this.app("Iter_opt").withInterval(decl.sourceInterval(604, 612)), this.app("Pred").withInterval(decl.sourceInterval(627, 631))).withInterval(decl.sourceInterval(556, 631))) + .define("Pred_not", [], this.seq(this.terminal("~").withInterval(decl.sourceInterval(646, 649)), this.app("Lex").withInterval(decl.sourceInterval(650, 653))).withInterval(decl.sourceInterval(646, 653))) + .define("Pred_lookahead", [], this.seq(this.terminal("&").withInterval(decl.sourceInterval(668, 671)), this.app("Lex").withInterval(decl.sourceInterval(672, 675))).withInterval(decl.sourceInterval(668, 675))) + .define("Pred", [], this.alt(this.app("Pred_not").withInterval(decl.sourceInterval(646, 653)), this.app("Pred_lookahead").withInterval(decl.sourceInterval(668, 675)), this.app("Lex").withInterval(decl.sourceInterval(696, 699))).withInterval(decl.sourceInterval(646, 699))) + .define("Lex_lex", [], this.seq(this.terminal("#").withInterval(decl.sourceInterval(713, 716)), this.app("Base").withInterval(decl.sourceInterval(717, 721))).withInterval(decl.sourceInterval(713, 721))) + .define("Lex", [], this.alt(this.app("Lex_lex").withInterval(decl.sourceInterval(713, 721)), this.app("Base").withInterval(decl.sourceInterval(736, 740))).withInterval(decl.sourceInterval(713, 740))) + .define("Base_application", [], this.seq(this.app("ident").withInterval(decl.sourceInterval(755, 760)), this.opt(this.app("Params").withInterval(decl.sourceInterval(761, 767))).withInterval(decl.sourceInterval(761, 768)), this.not(this.alt(this.seq(this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(771, 780))).withInterval(decl.sourceInterval(771, 781)), this.terminal("=").withInterval(decl.sourceInterval(782, 785))).withInterval(decl.sourceInterval(771, 785)), this.terminal(":=").withInterval(decl.sourceInterval(788, 792)), this.terminal("+=").withInterval(decl.sourceInterval(795, 799))).withInterval(decl.sourceInterval(771, 799))).withInterval(decl.sourceInterval(769, 800))).withInterval(decl.sourceInterval(755, 800))) + .define("Base_range", [], this.seq(this.app("terminal").withInterval(decl.sourceInterval(823, 831)), this.terminal("..").withInterval(decl.sourceInterval(832, 836)), this.app("terminal").withInterval(decl.sourceInterval(837, 845))).withInterval(decl.sourceInterval(823, 845))) + .define("Base_terminal", [], this.app("terminal").withInterval(decl.sourceInterval(885, 893))) + .define("Base_paren", [], this.seq(this.terminal("(").withInterval(decl.sourceInterval(950, 953)), this.app("Alt").withInterval(decl.sourceInterval(954, 957)), this.terminal(")").withInterval(decl.sourceInterval(958, 961))).withInterval(decl.sourceInterval(950, 961))) + .define("Base", [], this.alt(this.app("Base_application").withInterval(decl.sourceInterval(755, 800)), this.app("Base_range").withInterval(decl.sourceInterval(823, 845)), this.app("Base_terminal").withInterval(decl.sourceInterval(885, 893)), this.app("Base_paren").withInterval(decl.sourceInterval(950, 961))).withInterval(decl.sourceInterval(755, 1005))) + .define("ruleDescr", [], this.seq(this.terminal("(").withInterval(decl.sourceInterval(1047, 1050)), this.app("ruleDescrText").withInterval(decl.sourceInterval(1051, 1064)), this.terminal(")").withInterval(decl.sourceInterval(1065, 1068))).withInterval(decl.sourceInterval(1047, 1068)), "a rule description") + .define("ruleDescrText", [], this.star(this.seq(this.not(this.terminal(")").withInterval(decl.sourceInterval(1094, 1097))).withInterval(decl.sourceInterval(1093, 1097)), this.app("any").withInterval(decl.sourceInterval(1098, 1101))).withInterval(decl.sourceInterval(1093, 1101))).withInterval(decl.sourceInterval(1092, 1103))) + .define("caseName", [], this.seq(this.terminal("--").withInterval(decl.sourceInterval(1122, 1126)), this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(1129, 1133))).withInterval(decl.sourceInterval(1128, 1133)), this.app("space").withInterval(decl.sourceInterval(1134, 1139))).withInterval(decl.sourceInterval(1128, 1139))).withInterval(decl.sourceInterval(1127, 1141)), this.app("name").withInterval(decl.sourceInterval(1142, 1146)), this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(1149, 1153))).withInterval(decl.sourceInterval(1148, 1153)), this.app("space").withInterval(decl.sourceInterval(1154, 1159))).withInterval(decl.sourceInterval(1148, 1159))).withInterval(decl.sourceInterval(1147, 1161)), this.alt(this.terminal("\n").withInterval(decl.sourceInterval(1163, 1167)), this.la(this.terminal("}").withInterval(decl.sourceInterval(1171, 1174))).withInterval(decl.sourceInterval(1170, 1174))).withInterval(decl.sourceInterval(1163, 1174))).withInterval(decl.sourceInterval(1122, 1175))) + .define("name", [], this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(1200, 1209)), this.star(this.app("nameRest").withInterval(decl.sourceInterval(1210, 1218))).withInterval(decl.sourceInterval(1210, 1219))).withInterval(decl.sourceInterval(1200, 1219)), "a name") + .define("nameFirst", [], this.alt(this.terminal("_").withInterval(decl.sourceInterval(1239, 1242)), this.app("letter").withInterval(decl.sourceInterval(1249, 1255))).withInterval(decl.sourceInterval(1239, 1255))) + .define("nameRest", [], this.alt(this.terminal("_").withInterval(decl.sourceInterval(1274, 1277)), this.app("alnum").withInterval(decl.sourceInterval(1284, 1289))).withInterval(decl.sourceInterval(1274, 1289))) + .define("ident", [], this.app("name").withInterval(decl.sourceInterval(1322, 1326)), "an identifier") + .define("terminal", [], this.seq(this.terminal("\"").withInterval(decl.sourceInterval(1345, 1349)), this.star(this.app("terminalChar").withInterval(decl.sourceInterval(1350, 1362))).withInterval(decl.sourceInterval(1350, 1363)), this.terminal("\"").withInterval(decl.sourceInterval(1364, 1368))).withInterval(decl.sourceInterval(1345, 1368))) + .define("terminalChar", [], this.alt(this.app("escapeChar").withInterval(decl.sourceInterval(1391, 1401)), this.seq(this.not(this.terminal("\\").withInterval(decl.sourceInterval(1409, 1413))).withInterval(decl.sourceInterval(1408, 1413)), this.not(this.terminal("\"").withInterval(decl.sourceInterval(1415, 1419))).withInterval(decl.sourceInterval(1414, 1419)), this.not(this.terminal("\n").withInterval(decl.sourceInterval(1421, 1425))).withInterval(decl.sourceInterval(1420, 1425)), this.app("any").withInterval(decl.sourceInterval(1426, 1429))).withInterval(decl.sourceInterval(1408, 1429))).withInterval(decl.sourceInterval(1391, 1429))) + .define("escapeChar_backslash", [], this.terminal("\\\\").withInterval(decl.sourceInterval(1472, 1478))) + .define("escapeChar_doubleQuote", [], this.terminal("\\\"").withInterval(decl.sourceInterval(1534, 1540))) + .define("escapeChar_singleQuote", [], this.terminal("\\'").withInterval(decl.sourceInterval(1598, 1604))) + .define("escapeChar_backspace", [], this.terminal("\\b").withInterval(decl.sourceInterval(1662, 1667))) + .define("escapeChar_lineFeed", [], this.terminal("\\n").withInterval(decl.sourceInterval(1724, 1729))) + .define("escapeChar_carriageReturn", [], this.terminal("\\r").withInterval(decl.sourceInterval(1785, 1790))) + .define("escapeChar_tab", [], this.terminal("\\t").withInterval(decl.sourceInterval(1852, 1857))) + .define("escapeChar_unicodeEscape", [], this.seq(this.terminal("\\u").withInterval(decl.sourceInterval(1908, 1913)), this.app("hexDigit").withInterval(decl.sourceInterval(1914, 1922)), this.app("hexDigit").withInterval(decl.sourceInterval(1923, 1931)), this.app("hexDigit").withInterval(decl.sourceInterval(1932, 1940)), this.app("hexDigit").withInterval(decl.sourceInterval(1941, 1949))).withInterval(decl.sourceInterval(1908, 1949))) + .define("escapeChar_hexEscape", [], this.seq(this.terminal("\\x").withInterval(decl.sourceInterval(1974, 1979)), this.app("hexDigit").withInterval(decl.sourceInterval(1980, 1988)), this.app("hexDigit").withInterval(decl.sourceInterval(1989, 1997))).withInterval(decl.sourceInterval(1974, 1997))) + .define("escapeChar", [], this.alt(this.app("escapeChar_backslash").withInterval(decl.sourceInterval(1472, 1478)), this.app("escapeChar_doubleQuote").withInterval(decl.sourceInterval(1534, 1540)), this.app("escapeChar_singleQuote").withInterval(decl.sourceInterval(1598, 1604)), this.app("escapeChar_backspace").withInterval(decl.sourceInterval(1662, 1667)), this.app("escapeChar_lineFeed").withInterval(decl.sourceInterval(1724, 1729)), this.app("escapeChar_carriageReturn").withInterval(decl.sourceInterval(1785, 1790)), this.app("escapeChar_tab").withInterval(decl.sourceInterval(1852, 1857)), this.app("escapeChar_unicodeEscape").withInterval(decl.sourceInterval(1908, 1949)), this.app("escapeChar_hexEscape").withInterval(decl.sourceInterval(1974, 1997))).withInterval(decl.sourceInterval(1472, 2029)), "an escape sequence") + .extend("space", [], this.app("comment").withInterval(decl.sourceInterval(2045, 2052))) + .define("comment_singleLine", [], this.seq(this.terminal("//").withInterval(decl.sourceInterval(2070, 2074)), this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(2077, 2081))).withInterval(decl.sourceInterval(2076, 2081)), this.app("any").withInterval(decl.sourceInterval(2082, 2085))).withInterval(decl.sourceInterval(2076, 2085))).withInterval(decl.sourceInterval(2075, 2087)), this.terminal("\n").withInterval(decl.sourceInterval(2088, 2092))).withInterval(decl.sourceInterval(2070, 2092))) + .define("comment_multiLine", [], this.seq(this.terminal("/*").withInterval(decl.sourceInterval(2114, 2118)), this.star(this.seq(this.not(this.terminal("*/").withInterval(decl.sourceInterval(2121, 2125))).withInterval(decl.sourceInterval(2120, 2125)), this.app("any").withInterval(decl.sourceInterval(2126, 2129))).withInterval(decl.sourceInterval(2120, 2129))).withInterval(decl.sourceInterval(2119, 2131)), this.terminal("*/").withInterval(decl.sourceInterval(2132, 2136))).withInterval(decl.sourceInterval(2114, 2136))) + .define("comment", [], this.alt(this.app("comment_singleLine").withInterval(decl.sourceInterval(2070, 2092)), this.app("comment_multiLine").withInterval(decl.sourceInterval(2114, 2136))).withInterval(decl.sourceInterval(2070, 2150))) + .define("tokens", [], this.star(this.app("token").withInterval(decl.sourceInterval(2163, 2168))).withInterval(decl.sourceInterval(2163, 2169))) + .define("token", [], this.alt(this.app("caseName").withInterval(decl.sourceInterval(2181, 2189)), this.app("comment").withInterval(decl.sourceInterval(2192, 2199)), this.app("ident").withInterval(decl.sourceInterval(2202, 2207)), this.app("operator").withInterval(decl.sourceInterval(2210, 2218)), this.app("punctuation").withInterval(decl.sourceInterval(2221, 2232)), this.app("terminal").withInterval(decl.sourceInterval(2235, 2243)), this.app("any").withInterval(decl.sourceInterval(2246, 2249))).withInterval(decl.sourceInterval(2181, 2249))) + .define("operator", [], this.alt(this.terminal("<:").withInterval(decl.sourceInterval(2264, 2268)), this.terminal("=").withInterval(decl.sourceInterval(2271, 2274)), this.terminal(":=").withInterval(decl.sourceInterval(2277, 2281)), this.terminal("+=").withInterval(decl.sourceInterval(2284, 2288)), this.terminal("*").withInterval(decl.sourceInterval(2291, 2294)), this.terminal("+").withInterval(decl.sourceInterval(2297, 2300)), this.terminal("?").withInterval(decl.sourceInterval(2303, 2306)), this.terminal("~").withInterval(decl.sourceInterval(2309, 2312)), this.terminal("&").withInterval(decl.sourceInterval(2315, 2318))).withInterval(decl.sourceInterval(2264, 2318))) + .define("punctuation", [], this.alt(this.terminal("<").withInterval(decl.sourceInterval(2336, 2339)), this.terminal(">").withInterval(decl.sourceInterval(2342, 2345)), this.terminal(",").withInterval(decl.sourceInterval(2348, 2351)), this.terminal("--").withInterval(decl.sourceInterval(2354, 2358))).withInterval(decl.sourceInterval(2336, 2358))) .build(); }); @@ -2870,10 +2859,10 @@ module.exports = ohm.makeRecipe(function() { return decl .define("AttributeSignature", [], this.app("name").withInterval(decl.sourceInterval(54, 58))) .define("OperationSignature", [], this.seq(this.app("name").withInterval(decl.sourceInterval(87, 91)), this.opt(this.app("Formals").withInterval(decl.sourceInterval(92, 99))).withInterval(decl.sourceInterval(92, 100))).withInterval(decl.sourceInterval(87, 100))) - .define("Formals", [], this.seq(this.prim("(").withInterval(decl.sourceInterval(118, 121)), this.app("ListOf", [this.app("name").withInterval(decl.sourceInterval(129, 133)), this.prim(",").withInterval(decl.sourceInterval(135, 138))]).withInterval(decl.sourceInterval(122, 139)), this.prim(")").withInterval(decl.sourceInterval(140, 143))).withInterval(decl.sourceInterval(118, 143))) + .define("Formals", [], this.seq(this.terminal("(").withInterval(decl.sourceInterval(118, 121)), this.app("ListOf", [this.app("name").withInterval(decl.sourceInterval(129, 133)), this.terminal(",").withInterval(decl.sourceInterval(135, 138))]).withInterval(decl.sourceInterval(122, 139)), this.terminal(")").withInterval(decl.sourceInterval(140, 143))).withInterval(decl.sourceInterval(118, 143))) .define("name", [], this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(168, 177)), this.star(this.app("nameRest").withInterval(decl.sourceInterval(178, 186))).withInterval(decl.sourceInterval(178, 187))).withInterval(decl.sourceInterval(168, 187)), "a name") - .define("nameFirst", [], this.alt(this.prim("_").withInterval(decl.sourceInterval(207, 210)), this.app("letter").withInterval(decl.sourceInterval(217, 223))).withInterval(decl.sourceInterval(207, 223))) - .define("nameRest", [], this.alt(this.prim("_").withInterval(decl.sourceInterval(242, 245)), this.app("alnum").withInterval(decl.sourceInterval(252, 257))).withInterval(decl.sourceInterval(242, 257))) + .define("nameFirst", [], this.alt(this.terminal("_").withInterval(decl.sourceInterval(207, 210)), this.app("letter").withInterval(decl.sourceInterval(217, 223))).withInterval(decl.sourceInterval(207, 223))) + .define("nameRest", [], this.alt(this.terminal("_").withInterval(decl.sourceInterval(242, 245)), this.app("alnum").withInterval(decl.sourceInterval(252, 257))).withInterval(decl.sourceInterval(242, 257))) .build(); }); @@ -3030,7 +3019,7 @@ module.exports = { semantics: semanticsForToAST }; -},{"../src/Grammar":38,"../src/MatchResult":42,"../src/pexprs":69,"util-extend":35}],15:[function(require,module,exports){ +},{"../src/Grammar":38,"../src/MatchResult":42,"../src/pexprs":67,"util-extend":35}],15:[function(require,module,exports){ 'use strict'; module.exports = require('./is-implemented')() ? Symbol : require('./polyfill'); @@ -3444,8 +3433,8 @@ Builder.prototype = { return new GrammarDecl(name); }, - prim: function(x) { - return new pexprs.Prim(x); + terminal: function(x) { + return new pexprs.Terminal(x); }, range: function(from, to) { @@ -3506,22 +3495,6 @@ Builder.prototype = { return new pexprs.Lex(expr); }, - val: function(expr) { - return new pexprs.Value(expr); - }, - - arr: function(expr) { - return new pexprs.Arr(expr); - }, - - str: function(expr) { - return new pexprs.Str(expr); - }, - - obj: function(properties, isLenient) { - return new pexprs.Obj(properties, !!isLenient); - }, - app: function(ruleName, optParams) { return new pexprs.Apply(ruleName, optParams); } @@ -3533,7 +3506,7 @@ Builder.prototype = { module.exports = Builder; -},{"./GrammarDecl":39,"./pexprs":69}],37:[function(require,module,exports){ +},{"./GrammarDecl":39,"./pexprs":67}],37:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -3667,7 +3640,6 @@ function Grammar( } this.defaultStartRule = optDefaultStartRule; } - this.constructors = this.ctors = this.createConstructors(); } var ohmGrammar; @@ -3680,66 +3652,25 @@ Grammar.initApplicationParser = function(grammar, builderFn) { }; Grammar.prototype = { - construct: function(ruleName, children) { - var body = this.ruleBodies[ruleName]; - if (!body) { - throw errors.undeclaredRule(ruleName, this.name); - } - - var ans = this._constructByMatching(ruleName, children); - if (!ans) { - throw errors.invalidConstructorCall(this, ruleName, children); - } - return ans; - }, - - // Try to match `ctorArgs` with the body of the rule given by `ruleName`. - // Return the resulting CST node if it succeeds, otherwise return null. - _constructByMatching: function(ruleName, ctorArgs) { - var state = this._match(ctorArgs, {startApplication: ruleName, matchNodes: true}); - if (state.bindings.length > 0) { - return state.bindings[0]; - } - return null; - }, - - createConstructors: function() { - var self = this; - var constructors = {}; - - function makeConstructor(ruleName) { - return function(/* val1, val2, ... */) { - return self.construct(ruleName, Array.prototype.slice.call(arguments)); - }; - } - - for (var ruleName in this.ruleBodies) { - // We want *all* properties, not just own properties, because of - // supergrammars. - constructors[ruleName] = makeConstructor(ruleName); - } - return constructors; - }, - // Return true if the grammar is a built-in grammar, otherwise false. // NOTE: This might give an unexpected result if called before BuiltInRules is defined! isBuiltIn: function() { return this === Grammar.ProtoBuiltInRules || this === Grammar.BuiltInRules; }, - _match: function(values, opts) { - var state = new State(this, values, opts); + _match: function(input, opts) { + var state = new State(this, input, opts); state.evalFromStart(); return state; }, - match: function(obj, optStartApplication) { - var state = this._match([obj], {startApplication: optStartApplication}); + match: function(input, optStartApplication) { + var state = this._match(input, {startApplication: optStartApplication}); return MatchResult.newFor(state); }, - trace: function(obj, optStartApplication) { - var state = this._match([obj], {startApplication: optStartApplication, trace: true}); + trace: function(input, optStartApplication) { + var state = this._match(input, {startApplication: optStartApplication, trace: true}); // The trace node for the start rule is always the last entry. If it is a syntactic rule, // the first entry is for an application of 'spaces'. @@ -3994,7 +3925,7 @@ Grammar.ProtoBuiltInRules = new Grammar( module.exports = Grammar; -},{"./MatchResult":42,"./Semantics":45,"./State":46,"./common":48,"./errors":49,"./pexprs":69}],39:[function(require,module,exports){ +},{"./MatchResult":42,"./Semantics":45,"./State":46,"./common":48,"./errors":49,"./pexprs":67}],39:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -4084,7 +4015,7 @@ GrammarDecl.prototype.withDefaultStartRule = function(ruleName) { }; GrammarDecl.prototype.withSource = function(source) { - this.interval = InputStream.newFor(source).interval(0, source.length); + this.interval = new InputStream(source).interval(0, source.length); return this; }; @@ -4127,16 +4058,6 @@ GrammarDecl.prototype.build = function() { } catch (e) { grammarErrors.push(e); } - // For now, only check the bodies of unparameterized rules, because the checks can't deal - // properly with parameters that don't have a concrete value. - // TODO: Fix this. - if (grammar.ruleFormals[ruleName].length === 0) { - try { - body.assertValuesAndStringsAreNotMixed(grammar, ruleName); - } catch (e) { - grammarErrors.push(e); - } - } }); } if (grammarErrors.length > 0) { @@ -4191,51 +4112,41 @@ GrammarDecl.prototype.extend = function(name, formals, fragment) { module.exports = GrammarDecl; -},{"./Grammar":38,"./InputStream":40,"./common":48,"./errors":49,"./pexprs":69}],40:[function(require,module,exports){ +},{"./Grammar":38,"./InputStream":40,"./common":48,"./errors":49,"./pexprs":67}],40:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- // Imports // -------------------------------------------------------------------- -var inherits = require('inherits'); - -var common = require('./common'); var Interval = require('./Interval'); // -------------------------------------------------------------------- // Private stuff // -------------------------------------------------------------------- -function InputStream() { - throw new Error('InputStream cannot be instantiated -- it\'s abstract'); +function InputStream(source) { + this.source = source; + this.pos = 0; + this.posInfos = []; } -InputStream.newFor = function(arrOrStr) { - return Array.isArray(arrOrStr) ? new ListInputStream(arrOrStr) : new StringInputStream(arrOrStr); -}; - InputStream.prototype = { - init: function(source) { - this.source = source; - this.pos = 0; - this.posInfos = []; - }, - atEnd: function() { return this.pos === this.source.length; }, next: function() { - if (this.atEnd()) { - return common.fail; - } else { - return this.source[this.pos++]; - } + return this.source[this.pos++]; }, - matchExactly: function(x) { - return this.next() === x ? true : common.fail; + matchString: function(s) { + for (var idx = 0; idx < s.length; idx++) { + if (this.next() !== s[idx]) { + return false; + } + } + return true; }, sourceSlice: function(startIdx, endIdx) { @@ -4247,36 +4158,13 @@ InputStream.prototype = { } }; -function StringInputStream(source) { - this.init(source); -} -inherits(StringInputStream, InputStream); - -StringInputStream.prototype.matchString = function(s) { - for (var idx = 0; idx < s.length; idx++) { - if (this.matchExactly(s[idx]) === common.fail) { - return common.fail; - } - } - return true; -}; - -function ListInputStream(source) { - this.init(source); -} -inherits(ListInputStream, InputStream); - -ListInputStream.prototype.matchString = function(s) { - return this.matchExactly(s); -}; - // -------------------------------------------------------------------- // Exports // -------------------------------------------------------------------- module.exports = InputStream; -},{"./Interval":41,"./common":48,"inherits":33}],41:[function(require,module,exports){ +},{"./Interval":41}],41:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -4409,7 +4297,7 @@ Object.defineProperties(Interval.prototype, { module.exports = Interval; -},{"./common":48,"./errors":49,"./util":70}],42:[function(require,module,exports){ +},{"./common":48,"./errors":49,"./util":68}],42:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -4618,7 +4506,7 @@ MatchFailure.prototype.getInterval = function() { module.exports = MatchResult; -},{"./Interval":41,"./common":48,"./nodes":51,"./util":70,"inherits":33}],43:[function(require,module,exports){ +},{"./Interval":41,"./common":48,"./nodes":51,"./util":68,"inherits":33}],43:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -4963,6 +4851,71 @@ Semantics.prototype.checkActionDicts = function() { } }; +Semantics.prototype.toRecipe = function(semanticsOnly) { + function hasSuperSemantics(s) { + return s.super !== Semantics.BuiltInSemantics._getSemantics(); + } + + var str = '(function(g) {\n'; + if (hasSuperSemantics(this)) { + str += ' var semantics = ' + this.super.toRecipe(true) + '(g'; + + var superSemanticsGrammar = this.super.grammar; + var relatedGrammar = this.grammar; + while (relatedGrammar !== superSemanticsGrammar) { + str += '.superGrammar'; + relatedGrammar = relatedGrammar.superGrammar; + } + + str += ');\n'; + str += ' return g.extendSemantics(semantics)'; + } else { + str += ' return g.semantics()'; + } + ['Operation', 'Attribute'].forEach(function(type) { + var semanticOperations = this[type.toLowerCase() + 's']; + Object.keys(semanticOperations).forEach(function(name) { + var signature = name; + if (semanticOperations[name].formals.length > 0) { + signature += '(' + semanticOperations[name].formals.join(', ') + ')'; + } + + var method; + if (hasSuperSemantics(this) && this.super[type.toLowerCase() + 's'][name]) { + method = 'extend' + type; + } else { + method = 'add' + type; + } + str += '\n .' + method + '(' + JSON.stringify(signature) + ', {'; + + var actions = semanticOperations[name].actionDict; + var srcArray = []; + Object.keys(actions).forEach(function(actionName) { + if (semanticOperations[name].builtInDefault !== actions[actionName]) { + srcArray.push('\n ' + JSON.stringify(actionName) + ': ' + + actions[actionName].toString()); + } + }); + str += srcArray.join(','); + + str += '\n })'; + }, this); + }, this); + str += ';\n })'; + + if (!semanticsOnly) { + str = + '(function() {\n' + + ' var buildGrammar = ' + this.grammar.toRecipe() + + ' var grammar = buildGrammar.call(this);\n' + + ' var semantics = ' + str + '(grammar);\n' + + ' return semantics;\n' + + '});\n'; + } + + return str; +}; + var prototypeGrammar; var prototypeGrammarSemantics; @@ -5013,6 +4966,36 @@ function parseSignature(signature, type) { return prototypeGrammarSemantics(r).parse(); } +function newDefaultAction(type, name, doIt) { + return function(children) { + var self = this; + var thisThing = this._semantics.operations[name] || this._semantics.attributes[name]; + var args = thisThing.formals.map(function(formal) { + return self.args[formal]; + }); + + if (this.isIteration()) { + // This CST node corresponds to an iteration expression in the grammar (*, +, or ?). The + // default behavior is to map this operation or attribute over all of its child nodes. + return children.map(function(child) { return doIt.apply(child, args); }); + } + + // This CST node corresponds to a non-terminal in the grammar (e.g., AddExpr). The fact that + // we got here means that this action dictionary doesn't have an action for this particular + // non-terminal or a generic `_nonterminal` action. + if (children.length === 1) { + // As a convenience, if this node only has one child, we just return the result of + // applying this operation / attribute to the child node. + return doIt.apply(children[0], args); + } else { + // Otherwise, we throw an exception to let the programmer know that we don't know what + // to do with this node. + throw new Error( + 'Missing semantic action for ' + this.ctorName + ' in ' + name + ' ' + type); + } + }; +} + Semantics.prototype.addOperationOrAttribute = function(type, signature, actionDict) { var typePlural = type + 's'; @@ -5026,35 +5009,8 @@ Semantics.prototype.addOperationOrAttribute = function(type, signature, actionDi // Create the action dictionary for this operation / attribute that contains a `_default` action // which defines the default behavior of iteration, terminal, and non-terminal nodes... - var realActionDict = { - _default: function(children) { - var self = this; - var thisThing = this._semantics[typePlural][name]; - var args = thisThing.formals.map(function(formal) { - return self.args[formal]; - }); - - if (this.isIteration()) { - // This CST node corresponds to an iteration expression in the grammar (*, +, or ?). The - // default behavior is to map this operation or attribute over all of its child nodes. - return children.map(function(child) { return doIt.apply(child, args); }); - } - - // This CST node corresponds to a non-terminal in the grammar (e.g., AddExpr). The fact that - // we got here means that this action dictionary doesn't have an action for this particular - // non-terminal or a generic `_nonterminal` action. - if (children.length === 1) { - // As a convenience, if this node only has one child, we just return the result of - // applying this operation / attribute to the child node. - return doIt.apply(children[0], args); - } else { - // Otherwise, we throw an exception to let the programmer know that we don't know what - // to do with this node. - throw new Error( - 'Missing semantic action for ' + this.ctorName + ' in ' + name + ' ' + type); - } - } - }; + var builtInDefault = newDefaultAction(type, name, doIt); + var realActionDict = {_default: builtInDefault}; // ... and add in the actions supplied by the programmer, which may override some or all of the // default ones. Object.keys(actionDict).forEach(function(name) { @@ -5062,8 +5018,8 @@ Semantics.prototype.addOperationOrAttribute = function(type, signature, actionDi }); var entry = type === 'operation' ? - new Operation(name, formals, realActionDict) : - new Attribute(name, realActionDict); + new Operation(name, formals, realActionDict, builtInDefault) : + new Attribute(name, realActionDict, builtInDefault); // The following check is not strictly necessary (it will happen later anyway) but it's better to // catch errors early. @@ -5220,6 +5176,18 @@ Semantics.createSemantics = function(grammar, optSuperSemantics) { } return action.actionDict; }; + proxy.getOperationNames = function() { + return Object.keys(s.operations); + }; + proxy.getAttributeNames = function() { + return Object.keys(s.attributes); + }; + proxy.getGrammar = function() { + return s.grammar; + }; + proxy.toRecipe = function(semanticsOnly) { + return s.toRecipe(semanticsOnly); + }; // Make the proxy's toString() work. proxy.toString = s.toString.bind(s); @@ -5259,10 +5227,11 @@ Semantics.initBuiltInSemantics = function(builtInRules) { // recursively walking the CST, and at each node, invoking the matching semantic action from // `actionDict`. See `Operation.prototype.execute` for details of how a CST node's matching semantic // action is found. -function Operation(name, formals, actionDict) { +function Operation(name, formals, actionDict, builtInDefault) { this.name = name; this.formals = formals; this.actionDict = actionDict; + this.builtInDefault = builtInDefault; } Operation.prototype.typeName = 'operation'; @@ -5311,10 +5280,11 @@ Operation.prototype.doAction = function(semantics, nodeWrapper, actionFn, optPas // Attributes are Operations whose results are memoized. This means that, for any given semantics, // the semantic action for a CST node will be invoked no more than once. -function Attribute(name, actionDict) { +function Attribute(name, actionDict, builtInDefault) { this.name = name; this.formals = []; this.actionDict = actionDict; + this.builtInDefault = builtInDefault; } inherits(Attribute, Operation); @@ -5343,6 +5313,7 @@ module.exports = Semantics; // Imports // -------------------------------------------------------------------- +var InputStream = require('./InputStream'); var PosInfo = require('./PosInfo'); var Trace = require('./Trace'); var pexprs = require('./pexprs'); @@ -5359,7 +5330,7 @@ var applySpaces = new pexprs.Apply('spaces'); function State(grammar, input, opts) { this.grammar = grammar; this.startExpr = this._getStartExpr(grammar, opts.startApplication); - this.origInputStream = this.startExpr.newInputStreamFor(input, this.grammar); + this.inputStream = new InputStream(input); this.tracingEnabled = opts.trace || false; this.matchNodes = opts.matchNodes || false; this.init(RM_RIGHTMOST_FAILURE_POSITION); @@ -5367,12 +5338,8 @@ function State(grammar, input, opts) { State.prototype = { init: function(recordingMode) { + this.posInfos = []; this.bindings = []; - - this.inputStreamStack = []; - this.posInfosStack = []; - this.pushInputStream(this.origInputStream); - this.applicationStack = []; this.inLexifiedContextStack = [false]; @@ -5464,18 +5431,6 @@ State.prototype = { } }, - pushInputStream: function(inputStream) { - this.inputStreamStack.push(this.inputStream); - this.posInfosStack.push(this.posInfos); - this.inputStream = inputStream; - this.posInfos = []; - }, - - popInputStream: function() { - this.inputStream = this.inputStreamStack.pop(); - this.posInfos = this.posInfosStack.pop(); - }, - getCurrentPosInfo: function() { return this.getPosInfo(this.inputStream.pos); }, @@ -5687,7 +5642,7 @@ State.prototype = { module.exports = State; -},{"./PosInfo":44,"./Trace":47,"./pexprs":69}],47:[function(require,module,exports){ +},{"./InputStream":40,"./PosInfo":44,"./Trace":47,"./pexprs":67}],47:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -5960,8 +5915,6 @@ exports.copyWithoutDuplicates = function(array) { return noDuplicates; }; -exports.fail = {}; - exports.isSyntactic = function(ruleName) { var firstChar = ruleName[0]; return firstChar === firstChar.toUpperCase(); @@ -6188,13 +6141,6 @@ function applicationOfSyntacticRuleFromLexicalContext(ruleName, applyExpr) { applyExpr.interval); } -function exprMixesValueAndStringExpressions(expr, optRuleName) { - // TODO: Improve the reporting here. - var desc = - (optRuleName ? 'Rule ' + optRuleName : 'Expression') + ' mixes value and string expressions'; - return createError(desc, expr.interval); -} - // ----------------- Kleene operators ----------------- function kleeneExprHasNullableOperand(kleeneExpr) { @@ -6247,7 +6193,6 @@ module.exports = { duplicateParameterNames: duplicateParameterNames, duplicatePropertyNames: duplicatePropertyNames, duplicateRuleDeclaration: duplicateRuleDeclaration, - exprMixesValueAndStringExpressions: exprMixesValueAndStringExpressions, inconsistentArity: inconsistentArity, intervalSourcesDontMatch: intervalSourcesDontMatch, invalidConstructorCall: invalidConstructorCall, @@ -6374,7 +6319,7 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { } }, - Rule_define: function(n, fs, d, _equals, _optBar, b) { + Rule_define: function(n, fs, d, _, b) { currentRuleName = n.visit(); currentRuleFormals = fs.visit()[0] || []; // If there is no default start rule yet, set it now. This must be done before visiting @@ -6387,7 +6332,7 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { var description = d.visit()[0]; return decl.define(currentRuleName, currentRuleFormals, body, description); }, - Rule_override: function(n, fs, _colonEquals, _optBar, b) { + Rule_override: function(n, fs, _, b) { currentRuleName = n.visit(); currentRuleFormals = fs.visit()[0] || []; overriding = true; @@ -6397,7 +6342,7 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { overriding = false; return ans; }, - Rule_extend: function(n, fs, _plusEquals, _optBar, b) { + Rule_extend: function(n, fs, _, b) { currentRuleName = n.visit(); currentRuleFormals = fs.visit()[0] || []; var body = b.visit(); @@ -6405,6 +6350,10 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { decl.ruleBodies[currentRuleName].definitionInterval = this.interval.trimmed(); return ans; }, + RuleBody: function(_, term, _bars, terms) { + var args = [term.visit()].concat(terms.visit()); + return builder.alt.apply(builder, args).withInterval(this.interval); + }, Formals: function(opointy, fs, cpointy) { return fs.visit(); @@ -6414,12 +6363,12 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { return ps.visit(); }, - Alt: function(term, _, terms) { - var args = [term.visit()].concat(terms.visit()); + Alt: function(seq, _, seqs) { + var args = [seq.visit()].concat(seqs.visit()); return builder.alt.apply(builder, args).withInterval(this.interval); }, - Term_inline: function(b, n) { + TopLevelTerm_inline: function(b, n) { var inlineRuleName = currentRuleName + '_' + n.visit(); var body = b.visit(); body.definitionInterval = this.interval.trimmed(); @@ -6455,12 +6404,9 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { return builder.la(x.visit()).withInterval(this.interval); }, - Modifier_lex: function(_, x) { + Lex_lex: function(_, x) { return builder.lex(x.visit()).withInterval(this.interval); }, - Modifier_val: function(_, x) { - return builder.val(x.visit()).withInterval(this.interval); - }, Base_application: function(rule, ps) { return builder.app(rule.visit(), ps.visit()[0] || []).withInterval(this.interval); @@ -6468,29 +6414,12 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { Base_range: function(from, _, to) { return builder.range(from.visit(), to.visit()).withInterval(this.interval); }, - Base_prim: function(expr) { - return builder.prim(expr.visit()).withInterval(this.interval); + Base_terminal: function(expr) { + return builder.terminal(expr.visit()).withInterval(this.interval); }, Base_paren: function(open, x, close) { return x.visit(); }, - Base_arr: function(open, x, close) { - return builder.arr(x.visit()).withInterval(this.interval); - }, - Base_obj: function(open, lenient, close) { - return builder.obj([], lenient.visit()[0]); - }, - - Base_objWithProps: function(open, ps, _, lenient, close) { - return builder.obj(ps.visit(), lenient.visit()[0]).withInterval(this.interval); - }, - - Props: function(p, _, ps) { - return [p.visit()].concat(ps.visit()); - }, - Prop: function(n, _, p) { - return {name: n.visit(), pattern: p.visit()}; - }, ruleDescr: function(open, t, close) { return t.visit(); @@ -6509,21 +6438,11 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { nameFirst: function(expr) {}, nameRest: function(expr) {}, - keyword_null: function(_) { - return null; - }, - keyword_true: function(_) { - return true; - }, - keyword_false: function(_) { - return false; - }, - - string: function(open, cs, close) { + terminal: function(open, cs, close) { return cs.visit().map(function(c) { return common.unescapeChar(c); }).join(''); }, - strChar: function(_) { + terminalChar: function(_) { return this.interval.contents; }, @@ -6531,10 +6450,6 @@ function buildGrammar(match, namespace, optOhmGrammarForTesting) { return this.interval.contents; }, - number: function(_, digits) { - return parseInt(this.interval.contents); - }, - NonemptyListOf: function(x, _, xs) { return [x.visit()].concat(xs.visit()); }, @@ -6672,7 +6587,7 @@ Semantics.initPrototypeParser(operationsAndAttributesGrammar); // requires Buil module.exports.ohmGrammar = ohmGrammar = require('../dist/ohm-grammar'); Grammar.initApplicationParser(ohmGrammar, buildGrammar); -},{"../dist/built-in-rules":10,"../dist/ohm-grammar":11,"../dist/operations-and-attributes":12,"../extras":13,"./Builder":36,"./Grammar":38,"./Namespace":43,"./Semantics":45,"./common":48,"./errors":49,"./pexprs":69,"./util":70,"is-buffer":34}],51:[function(require,module,exports){ +},{"../dist/built-in-rules":10,"../dist/ohm-grammar":11,"../dist/operations-and-attributes":12,"../extras":13,"./Builder":36,"./Grammar":38,"./Namespace":43,"./Semantics":45,"./common":48,"./errors":49,"./pexprs":67,"./util":68,"is-buffer":34}],51:[function(require,module,exports){ 'use strict'; var inherits = require('inherits'); @@ -6866,7 +6781,7 @@ pexprs.PExpr.prototype.allowsSkippingPrecedingSpace = common.abstract; pexprs.any.allowsSkippingPrecedingSpace = pexprs.end.allowsSkippingPrecedingSpace = pexprs.Apply.prototype.allowsSkippingPrecedingSpace = -pexprs.Prim.prototype.allowsSkippingPrecedingSpace = +pexprs.Terminal.prototype.allowsSkippingPrecedingSpace = pexprs.Range.prototype.allowsSkippingPrecedingSpace = pexprs.UnicodeChar.prototype.allowsSkippingPrecedingSpace = function() { return true; @@ -6877,19 +6792,16 @@ pexprs.UnicodeChar.prototype.allowsSkippingPrecedingSpace = function() { don't operate on string input streams (e.g. Obj and Arr). */ pexprs.Alt.prototype.allowsSkippingPrecedingSpace = -pexprs.Arr.prototype.allowsSkippingPrecedingSpace = pexprs.Iter.prototype.allowsSkippingPrecedingSpace = pexprs.Lex.prototype.allowsSkippingPrecedingSpace = pexprs.Lookahead.prototype.allowsSkippingPrecedingSpace = pexprs.Not.prototype.allowsSkippingPrecedingSpace = -pexprs.Obj.prototype.allowsSkippingPrecedingSpace = pexprs.Param.prototype.allowsSkippingPrecedingSpace = -pexprs.Seq.prototype.allowsSkippingPrecedingSpace = -pexprs.Value.prototype.allowsSkippingPrecedingSpace = function() { +pexprs.Seq.prototype.allowsSkippingPrecedingSpace = function() { return false; }; -},{"./common":48,"./pexprs":69}],53:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],53:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -6915,7 +6827,7 @@ pexprs.PExpr.prototype._assertAllApplicationsAreValid = common.abstract; pexprs.any._assertAllApplicationsAreValid = pexprs.end._assertAllApplicationsAreValid = -pexprs.Prim.prototype._assertAllApplicationsAreValid = +pexprs.Terminal.prototype._assertAllApplicationsAreValid = pexprs.Range.prototype._assertAllApplicationsAreValid = pexprs.Param.prototype._assertAllApplicationsAreValid = pexprs.UnicodeChar.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) { @@ -6942,18 +6854,10 @@ pexprs.Seq.prototype._assertAllApplicationsAreValid = function(ruleName, grammar pexprs.Iter.prototype._assertAllApplicationsAreValid = pexprs.Not.prototype._assertAllApplicationsAreValid = -pexprs.Lookahead.prototype._assertAllApplicationsAreValid = -pexprs.Value.prototype._assertAllApplicationsAreValid = -pexprs.Arr.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) { +pexprs.Lookahead.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) { this.expr._assertAllApplicationsAreValid(ruleName, grammar); }; -pexprs.Obj.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) { - for (var idx = 0; idx < this.properties.length; idx++) { - this.properties[idx].pattern._assertAllApplicationsAreValid(ruleName, grammar); - } -}; - pexprs.Apply.prototype._assertAllApplicationsAreValid = function(ruleName, grammar) { var body = grammar.ruleBodies[this.ruleName]; @@ -6984,7 +6888,7 @@ pexprs.Apply.prototype._assertAllApplicationsAreValid = function(ruleName, gramm }); }; -},{"./common":48,"./errors":49,"./pexprs":69}],54:[function(require,module,exports){ +},{"./common":48,"./errors":49,"./pexprs":67}],54:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -7003,7 +6907,7 @@ pexprs.PExpr.prototype.assertChoicesHaveUniformArity = common.abstract; pexprs.any.assertChoicesHaveUniformArity = pexprs.end.assertChoicesHaveUniformArity = -pexprs.Prim.prototype.assertChoicesHaveUniformArity = +pexprs.Terminal.prototype.assertChoicesHaveUniformArity = pexprs.Range.prototype.assertChoicesHaveUniformArity = pexprs.Param.prototype.assertChoicesHaveUniformArity = pexprs.Lex.prototype.assertChoicesHaveUniformArity = @@ -7050,24 +6954,16 @@ pexprs.Not.prototype.assertChoicesHaveUniformArity = function(ruleName) { // no-op (not required b/c the nested expr doesn't show up in the CST) }; -pexprs.Lookahead.prototype.assertChoicesHaveUniformArity = -pexprs.Arr.prototype.assertChoicesHaveUniformArity = -pexprs.Value.prototype.assertChoicesHaveUniformArity = function(ruleName) { +pexprs.Lookahead.prototype.assertChoicesHaveUniformArity = function(ruleName) { this.expr.assertChoicesHaveUniformArity(ruleName); }; -pexprs.Obj.prototype.assertChoicesHaveUniformArity = function(ruleName) { - for (var idx = 0; idx < this.properties.length; idx++) { - this.properties[idx].pattern.assertChoicesHaveUniformArity(ruleName); - } -}; - pexprs.Apply.prototype.assertChoicesHaveUniformArity = function(ruleName) { // The arities of the parameter expressions is required to be 1 by // `assertAllApplicationsAreValid()`. }; -},{"./common":48,"./errors":49,"./pexprs":69}],55:[function(require,module,exports){ +},{"./common":48,"./errors":49,"./pexprs":67}],55:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -7086,7 +6982,7 @@ pexprs.PExpr.prototype.assertIteratedExprsAreNotNullable = common.abstract; pexprs.any.assertIteratedExprsAreNotNullable = pexprs.end.assertIteratedExprsAreNotNullable = -pexprs.Prim.prototype.assertIteratedExprsAreNotNullable = +pexprs.Terminal.prototype.assertIteratedExprsAreNotNullable = pexprs.Range.prototype.assertIteratedExprsAreNotNullable = pexprs.Param.prototype.assertIteratedExprsAreNotNullable = pexprs.UnicodeChar.prototype.assertIteratedExprsAreNotNullable = function(grammar, ruleName) { @@ -7117,46 +7013,17 @@ pexprs.Iter.prototype.assertIteratedExprsAreNotNullable = function(grammar, rule pexprs.Opt.prototype.assertIteratedExprsAreNotNullable = pexprs.Not.prototype.assertIteratedExprsAreNotNullable = pexprs.Lookahead.prototype.assertIteratedExprsAreNotNullable = -pexprs.Lex.prototype.assertIteratedExprsAreNotNullable = -pexprs.Value.prototype.assertIteratedExprsAreNotNullable = -pexprs.Arr.prototype.assertIteratedExprsAreNotNullable = function(grammar, ruleName) { +pexprs.Lex.prototype.assertIteratedExprsAreNotNullable = function(grammar, ruleName) { this.expr.assertIteratedExprsAreNotNullable(grammar, ruleName); }; -pexprs.Obj.prototype.assertIteratedExprsAreNotNullable = function(grammar, ruleName) { - for (var idx = 0; idx < this.properties.length; idx++) { - this.properties[idx].pattern.assertIteratedExprsAreNotNullable(grammar, ruleName); - } -}; - pexprs.Apply.prototype.assertIteratedExprsAreNotNullable = function(grammar, ruleName) { this.args.forEach(function(arg) { arg.assertIteratedExprsAreNotNullable(grammar, ruleName); }); }; -},{"./common":48,"./errors":49,"./pexprs":69}],56:[function(require,module,exports){ -'use strict'; - -// -------------------------------------------------------------------- -// Imports -// -------------------------------------------------------------------- - -var pexprs = require('./pexprs'); - -// -------------------------------------------------------------------- -// Operations -// -------------------------------------------------------------------- - -// Checks that no PExpr combines a value expression (e.g., `null`, `3`) with a string fragment -// expression (e.g., `"blah"`). -pexprs.PExpr.prototype.assertValuesAndStringsAreNotMixed = function(grammar, ruleName) { - var memo = Object.create(null); - memo[ruleName] = pexprs.TYPE_ANY; // Initialize memo table for the rule we are checking. - this.getExprType(grammar, memo); -}; - -},{"./pexprs":69}],57:[function(require,module,exports){ +},{"./common":48,"./errors":49,"./pexprs":67}],56:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -7183,7 +7050,7 @@ pexprs.end.check = function(grammar, vals) { vals[0].primitiveValue === undefined; }; -pexprs.Prim.prototype.check = function(grammar, vals) { +pexprs.Terminal.prototype.check = function(grammar, vals) { return vals[0] instanceof nodes.Node && vals[0].isTerminal() && vals[0].primitiveValue === this.obj; @@ -7254,31 +7121,10 @@ pexprs.Not.prototype.check = function(grammar, vals) { }; pexprs.Lookahead.prototype.check = -pexprs.Lex.prototype.check = -pexprs.Value.prototype.check = -pexprs.Arr.prototype.check = function(grammar, vals) { +pexprs.Lex.prototype.check = function(grammar, vals) { return this.expr.check(grammar, vals); }; -pexprs.Obj.prototype.check = function(grammar, vals) { - var fixedArity = this.getArity(); - if (this.isLenient) { - fixedArity--; - } - - var pos = 0; - for (var i = 0; i < fixedArity; i++) { - var pattern = this.properties[i].pattern; - if (pattern.check(grammar, vals.slice(pos))) { - pos += pattern.getArity(); - } else { - return false; - } - } - - return this.isLenient ? typeof vals[pos] === 'object' && vals[pos] : true; -}; - pexprs.Apply.prototype.check = function(grammar, vals) { if (!(vals[0] instanceof nodes.Node && vals[0].grammar === grammar && @@ -7299,14 +7145,13 @@ pexprs.UnicodeChar.prototype.check = function(grammar, vals) { typeof vals[0].primitiveValue === 'string'; }; -},{"./common":48,"./nodes":51,"./pexprs":69}],58:[function(require,module,exports){ +},{"./common":48,"./nodes":51,"./pexprs":67}],57:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- // Imports // -------------------------------------------------------------------- -var InputStream = require('./InputStream'); var Trace = require('./Trace'); var common = require('./common'); var nodes = require('./nodes'); @@ -7320,9 +7165,6 @@ var IterationNode = nodes.IterationNode; // Operations // -------------------------------------------------------------------- -// A safer version of hasOwnProperty. -var hasOwnProp = Object.prototype.hasOwnProperty; - /* Evaluate the expression and return `true` if it succeeds, `false` otherwise. This method should only be called directly by `State.prototype.eval(expr)`, which also updates the data structures @@ -7344,14 +7186,14 @@ pexprs.PExpr.prototype.eval = common.abstract; // function(state) { ... } pexprs.any.eval = function(state) { var inputStream = state.inputStream; var origPos = inputStream.pos; - var value = inputStream.next(); - if (value === common.fail) { + var ch = inputStream.next(); + if (ch) { + var interval = inputStream.interval(origPos); + state.bindings.push(new TerminalNode(state.grammar, ch, interval)); + return true; + } else { state.processFailure(origPos, this); return false; - } else { - var interval = inputStream.interval(origPos); - state.bindings.push(new TerminalNode(state.grammar, value, interval)); - return true; } }; @@ -7368,10 +7210,10 @@ pexprs.end.eval = function(state) { } }; -pexprs.Prim.prototype.eval = function(state) { +pexprs.Terminal.prototype.eval = function(state) { var inputStream = state.inputStream; var origPos = inputStream.pos; - if (this.match(inputStream) === common.fail) { + if (!inputStream.matchString(this.obj)) { state.processFailure(origPos, this); return false; } else { @@ -7382,19 +7224,13 @@ pexprs.Prim.prototype.eval = function(state) { } }; -pexprs.Prim.prototype.match = function(inputStream) { - return typeof this.obj === 'string' ? - inputStream.matchString(this.obj) : - inputStream.matchExactly(this.obj); -}; - pexprs.Range.prototype.eval = function(state) { var inputStream = state.inputStream; var origPos = inputStream.pos; - var obj = inputStream.next(); - if (typeof obj === typeof this.from && this.from <= obj && obj <= this.to) { + var ch = inputStream.next(); + if (ch && this.from <= ch && ch <= this.to) { var interval = inputStream.interval(origPos); - state.bindings.push(new TerminalNode(state.grammar, obj, interval)); + state.bindings.push(new TerminalNode(state.grammar, ch, interval)); return true; } else { state.processFailure(origPos, this); @@ -7506,69 +7342,6 @@ pexprs.Lookahead.prototype.eval = function(state) { } }; -pexprs.Arr.prototype.eval = function(state) { - var obj = state.inputStream.next(); - if (Array.isArray(obj)) { - state.pushInputStream(InputStream.newFor(obj)); - var ans = state.eval(this.expr) && state.inputStream.atEnd(); - state.popInputStream(); - return ans; - } else { - return false; - } -}; - -pexprs.Value.prototype.eval = function(state) { - var obj = state.inputStream.next(); - if (typeof obj === 'string') { - state.pushInputStream(InputStream.newFor(obj)); - var ans = state.eval(this.expr) && state.inputStream.atEnd(); - state.popInputStream(); - return ans; - } else { - return false; - } -}; - -pexprs.Obj.prototype.eval = function(state) { - var inputStream = state.inputStream; - var origPos = inputStream.pos; - var obj = inputStream.next(); - if (obj !== common.fail && obj && (typeof obj === 'object' || typeof obj === 'function')) { - var numOwnPropertiesMatched = 0; - for (var idx = 0; idx < this.properties.length; idx++) { - var property = this.properties[idx]; - if (!hasOwnProp.call(obj, property.name)) { - return false; - } - var value = obj[property.name]; - var expr = property.pattern; - state.pushInputStream(expr.newInputStreamFor([value], state.grammar)); - var matched = state.eval(expr) && state.inputStream.atEnd(); - state.popInputStream(); - if (!matched) { - return false; - } - numOwnPropertiesMatched++; - } - if (this.isLenient) { - var remainder = {}; - for (var p in obj) { - if (hasOwnProp.call(obj, p) && this.properties.indexOf(p) < 0) { - remainder[p] = obj[p]; - } - } - var interval = inputStream.interval(origPos); - state.bindings.push(new TerminalNode(state.grammar, remainder, interval)); - return true; - } else { - return numOwnPropertiesMatched === Object.keys(obj).length; - } - } else { - return false; - } -}; - pexprs.Apply.prototype.eval = function(state) { var caller = state.currentApplication(); var actuals = caller ? caller.args : []; @@ -7672,19 +7445,6 @@ pexprs.Apply.prototype.evalOnce = function(expr, state) { var inputStream = state.inputStream; var origPos = inputStream.pos; - // If `matchNodes` is true and the next thing in the input stream is a Node whose type matches - // this rule, then accept that as a valid match -- but not for the top-level application. - if (state.matchNodes && state.applicationStack.length > 1) { - var node = inputStream.next(); - if (node instanceof nodes.Node && - node.grammar === state.grammar && - node.ctorName === this.ruleName) { - return node; - } else { - inputStream.pos = origPos; - } - } - if (state.eval(expr)) { var arity = expr.getArity(); var bindings = state.bindings.splice(state.bindings.length - arity, arity); @@ -7733,18 +7493,18 @@ pexprs.Apply.prototype.growSeedResult = function(body, state, origPos, lrMemoRec pexprs.UnicodeChar.prototype.eval = function(state) { var inputStream = state.inputStream; var origPos = inputStream.pos; - var value = inputStream.next(); - if (value === common.fail || !this.pattern.test(value)) { + var ch = inputStream.next(); + if (ch && this.pattern.test(ch)) { + var interval = inputStream.interval(origPos); + state.bindings.push(new TerminalNode(state.grammar, ch, interval)); + return true; + } else { state.processFailure(origPos, this); return false; - } else { - var interval = inputStream.interval(origPos); - state.bindings.push(new TerminalNode(state.grammar, value, interval)); - return true; } }; -},{"./InputStream":40,"./Trace":47,"./common":48,"./nodes":51,"./pexprs":69}],59:[function(require,module,exports){ +},{"./Trace":47,"./common":48,"./nodes":51,"./pexprs":67}],58:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -7762,7 +7522,7 @@ pexprs.PExpr.prototype.getArity = common.abstract; pexprs.any.getArity = pexprs.end.getArity = -pexprs.Prim.prototype.getArity = +pexprs.Terminal.prototype.getArity = pexprs.Range.prototype.getArity = pexprs.Param.prototype.getArity = pexprs.Apply.prototype.getArity = @@ -7793,137 +7553,11 @@ pexprs.Not.prototype.getArity = function() { }; pexprs.Lookahead.prototype.getArity = -pexprs.Lex.prototype.getArity = -pexprs.Value.prototype.getArity = -pexprs.Arr.prototype.getArity = function() { +pexprs.Lex.prototype.getArity = function() { return this.expr.getArity(); }; -pexprs.Obj.prototype.getArity = function() { - var arity = this.isLenient ? 1 : 0; - for (var idx = 0; idx < this.properties.length; idx++) { - arity += this.properties[idx].pattern.getArity(); - } - return arity; -}; - -},{"./common":48,"./pexprs":69}],60:[function(require,module,exports){ -'use strict'; - -// -------------------------------------------------------------------- -// Imports -// -------------------------------------------------------------------- - -var common = require('./common'); -var errors = require('./errors'); -var pexprs = require('./pexprs'); - -// -------------------------------------------------------------------- -// Operations -// -------------------------------------------------------------------- - -function typeFromPrimitive(prim) { - return typeof prim === 'string' ? pexprs.TYPE_STRING : pexprs.TYPE_VALUE; -} - -/* - Returns the type of this PExpr -- one of `TYPE_STRING`, `TYPE_VALUE`, or `TYPE_ANY`. - String expressions (e.g. `"foo"`) and value expressions (e.g., `null`, `3`) cannot be combined - with each other, but they may be combined with TYPE_ANY expressions. An exception is thrown if - an expression with inconsistent types is encountered. - - The result of this method is cached as a property on the node. For rule applications, the - result is cached in a separate memo table, so that the result can be shared for all `Apply` - nodes having the same parameters. -*/ -pexprs.PExpr.prototype.getExprType = function(grammar, optMemo) { - if (!this.hasOwnProperty('_exprType')) { - var memo = optMemo || Object.create(null); - Object.defineProperty(this, '_exprType', { - value: this._calculateExprType(grammar, memo) - }); - } - return this._exprType; -}; - -/* - The actual implementation of getExprType, with no caching logic. These implementations - should only be invoked directly by the implementation of getExprType above. -*/ -pexprs.PExpr.prototype._calculateExprType = common.abstract; - -pexprs.any._calculateExprType = -pexprs.UnicodeChar.prototype._calculateExprType = function(grammar, memo) { - return pexprs.TYPE_STRING; -}; - -pexprs.end._calculateExprType = function(grammar, memo) { - return pexprs.TYPE_ANY; -}; - -pexprs.Range.prototype._calculateExprType = function(grammar, memo) { - return typeFromPrimitive(this.from) | typeFromPrimitive(this.to); -}; - -pexprs.Arr.prototype._calculateExprType = -pexprs.Obj.prototype._calculateExprType = -pexprs.Value.prototype._calculateExprType = function(grammar, memo) { - return pexprs.TYPE_VALUE; -}; - -pexprs.Prim.prototype._calculateExprType = function(grammar, memo) { - return typeFromPrimitive(this.obj); -}; - -pexprs.Alt.prototype._calculateExprType = function(grammar, memo) { - var ans = this.terms.reduce(function(acc, t) { - return acc | t.getExprType(grammar, memo); - }, 0); - if (ans === pexprs.TYPE_INCONSISTENT) { - throw errors.exprMixesValueAndStringExpressions(this); - } - return ans; -}; - -pexprs.Seq.prototype._calculateExprType = function(grammar, memo) { - var ans = this.factors.reduce(function(acc, f) { - return acc | f.getExprType(grammar, memo); - }, 0); - if (ans === pexprs.TYPE_INCONSISTENT) { - throw errors.exprMixesValueAndStringExpressions(this); - } - return ans; -}; - -pexprs.Iter.prototype._calculateExprType = -pexprs.Not.prototype._calculateExprType = -pexprs.Lookahead.prototype._calculateExprType = -pexprs.Lex.prototype._calculateExprType = function(grammar, memo) { - return this.expr.getExprType(grammar, memo); -}; - -pexprs.Param.prototype._calculateExprType = function(grammar, memo) { - // Throwing an error here ensures that we never calculate and cache the result of an - // expression containing unbound parameters, because it could be incorrect. - throw new Error('Cannot calculate _calculateExprType for unbound parameter'); -}; - -pexprs.Apply.prototype._calculateExprType = function(grammar, memo) { - var key = this.toMemoKey(); - if (!Object.prototype.hasOwnProperty.call(memo, key)) { - var inlinedBody = grammar.ruleBodies[this.ruleName].substituteParams(this.args); - - // Initialize a memo value to prevent infinite recursion for recursive rules. - // Use TYPE_ANY because it is the identity of the bitwise 'or' operator, ensuring that a rule - // like 'x = x | String' will return `TYPE_STRING`. - memo[key] = pexprs.TYPE_ANY; - - memo[key] = inlinedBody.getExprType(grammar, memo); - } - return memo[key]; -}; - -},{"./common":48,"./errors":49,"./pexprs":69}],61:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],59:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -7946,7 +7580,7 @@ pexprs.PExpr.prototype.introduceParams = common.abstract; pexprs.any.introduceParams = pexprs.end.introduceParams = -pexprs.Prim.prototype.introduceParams = +pexprs.Terminal.prototype.introduceParams = pexprs.Range.prototype.introduceParams = pexprs.Param.prototype.introduceParams = pexprs.UnicodeChar.prototype.introduceParams = function(formals) { @@ -7970,20 +7604,11 @@ pexprs.Seq.prototype.introduceParams = function(formals) { pexprs.Iter.prototype.introduceParams = pexprs.Not.prototype.introduceParams = pexprs.Lookahead.prototype.introduceParams = -pexprs.Lex.prototype.introduceParams = -pexprs.Value.prototype.introduceParams = -pexprs.Arr.prototype.introduceParams = function(formals) { +pexprs.Lex.prototype.introduceParams = function(formals) { this.expr = this.expr.introduceParams(formals); return this; }; -pexprs.Obj.prototype.introduceParams = function(formals) { - this.properties.forEach(function(property, idx) { - property.pattern = property.pattern.introduceParams(formals); - }); - return this; -}; - pexprs.Apply.prototype.introduceParams = function(formals) { var index = formals.indexOf(this.ruleName); if (index >= 0) { @@ -8000,7 +7625,7 @@ pexprs.Apply.prototype.introduceParams = function(formals) { } }; -},{"./common":48,"./pexprs":69}],62:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],60:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8025,9 +7650,6 @@ pexprs.any._isNullable = pexprs.Range.prototype._isNullable = pexprs.Param.prototype._isNullable = pexprs.Plus.prototype._isNullable = -pexprs.Value.prototype._isNullable = -pexprs.Arr.prototype._isNullable = -pexprs.Obj.prototype._isNullable = pexprs.UnicodeChar.prototype._isNullable = function(grammar, memo) { return false; }; @@ -8036,7 +7658,7 @@ pexprs.end._isNullable = function(grammar, memo) { return true; }; -pexprs.Prim.prototype._isNullable = function(grammar, memo) { +pexprs.Terminal.prototype._isNullable = function(grammar, memo) { if (typeof this.obj === 'string') { // This is an over-simplification: it's only correct if the input is a string. If it's an array // or an object, then the empty string parsing expression is not nullable. @@ -8077,7 +7699,7 @@ pexprs.Apply.prototype._isNullable = function(grammar, memo) { return memo[key]; }; -},{"./common":48,"./pexprs":69}],63:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],61:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8124,8 +7746,8 @@ pexprs.end.outputRecipe = function(sb, formals, grammarInterval) { throw new Error('should never output a recipe for `end` expression'); }; -pexprs.Prim.prototype.outputRecipe = function(sb, formals, grammarInterval) { - sb.append('this.prim('); +pexprs.Terminal.prototype.outputRecipe = function(sb, formals, grammarInterval) { + sb.append('this.terminal('); sb.append(typeof this.obj === 'string' ? escapeString(this.obj) : '' + this.obj); sb.append(')' + getIntervalInfo(this, grammarInterval)); }; @@ -8173,8 +7795,7 @@ pexprs.Star.prototype.outputRecipe = pexprs.Plus.prototype.outputRecipe = pexprs.Opt.prototype.outputRecipe = pexprs.Not.prototype.outputRecipe = -pexprs.Lex.prototype.outputRecipe = -pexprs.Arr.prototype.outputRecipe = function(sb, formals, grammarInterval) { +pexprs.Lex.prototype.outputRecipe = function(sb, formals, grammarInterval) { sb.append('this.' + this.constructor.name.toLowerCase() + '('); this.expr.outputRecipe(sb, formals, grammarInterval); sb.append(')' + getIntervalInfo(this, grammarInterval)); @@ -8186,33 +7807,6 @@ pexprs.Lookahead.prototype.outputRecipe = function(sb, formals, grammarInterval) sb.append(')' + getIntervalInfo(this, grammarInterval)); }; -pexprs.Value.prototype.outputRecipe = function(sb, formals, grammarInterval) { - sb.append('this.val('); - this.expr.outputRecipe(sb, formals, grammarInterval); - sb.append(')' + getIntervalInfo(this, grammarInterval)); -}; - -pexprs.Obj.prototype.outputRecipe = function(sb, formals, grammarInterval) { - function outputPropertyRecipe(prop) { - sb.append('{name: '); - sb.append(JSON.stringify(prop.name)); - sb.append(', pattern: '); - prop.pattern.outputRecipe(sb, formals, grammarInterval); - sb.append('}'); - } - - sb.append('this.obj(['); - for (var idx = 0; idx < this.properties.length; idx++) { - if (idx > 0) { - sb.append(', '); - } - outputPropertyRecipe(this.properties[idx]); - } - sb.append('], '); - sb.append(!!this.isLenient); - sb.append(')' + getIntervalInfo(this, grammarInterval)); -}; - pexprs.Apply.prototype.outputRecipe = function(sb, formals, grammarInterval) { sb.append('this.app('); sb.append(JSON.stringify(this.ruleName)); @@ -8233,7 +7827,7 @@ pexprs.Apply.prototype.outputRecipe = function(sb, formals, grammarInterval) { sb.append(')' + getIntervalInfo(this, grammarInterval)); }; -},{"./common":48,"./pexprs":69}],64:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],62:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8257,9 +7851,9 @@ pexprs.PExpr.prototype.substituteParams = common.abstract; // function(actuals) pexprs.any.substituteParams = pexprs.end.substituteParams = -pexprs.Prim.prototype.substituteParams = +pexprs.Terminal.prototype.substituteParams = pexprs.Range.prototype.substituteParams = -pexprs.Prim.prototype.substituteParams = +pexprs.Terminal.prototype.substituteParams = pexprs.UnicodeChar.prototype.substituteParams = function(actuals) { return this; }; @@ -8281,22 +7875,10 @@ pexprs.Seq.prototype.substituteParams = function(actuals) { pexprs.Iter.prototype.substituteParams = pexprs.Not.prototype.substituteParams = pexprs.Lookahead.prototype.substituteParams = -pexprs.Lex.prototype.substituteParams = -pexprs.Value.prototype.substituteParams = -pexprs.Arr.prototype.substituteParams = function(actuals) { +pexprs.Lex.prototype.substituteParams = function(actuals) { return new this.constructor(this.expr.substituteParams(actuals)); }; -pexprs.Obj.prototype.substituteParams = function(actuals) { - var properties = this.properties.map(function(property) { - return { - name: property.name, - pattern: property.pattern.substituteParams(actuals) - }; - }); - return new pexprs.Obj(properties, this.isLenient); -}; - pexprs.Apply.prototype.substituteParams = function(actuals) { if (this.args.length === 0) { // Avoid making a copy of this application, as an optimization @@ -8307,7 +7889,7 @@ pexprs.Apply.prototype.substituteParams = function(actuals) { } }; -},{"./common":48,"./pexprs":69}],65:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],63:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8354,7 +7936,7 @@ pexprs.end.toArgumentNameList = function(firstArgIndex) { return ['end']; }; -pexprs.Prim.prototype.toArgumentNameList = function(firstArgIndex) { +pexprs.Terminal.prototype.toArgumentNameList = function(firstArgIndex) { if (typeof this.obj === 'string' && /^[_a-zA-Z0-9]+$/.test(this.obj)) { // If this terminal is a valid suffix for a JS identifier, just prepend it with '_' return ['_' + this.obj]; @@ -8458,7 +8040,7 @@ pexprs.UnicodeChar.prototype.toArgumentNameList = function(firstArgIndex) { // "Value pexprs" (Value, Str, Arr, Obj) are going away soon, so we don't worry about them here. -},{"./common":48,"./pexprs":69}],66:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],64:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8480,10 +8062,7 @@ pexprs.Seq.prototype.toDisplayString = pexprs.Iter.prototype.toDisplayString = pexprs.Not.prototype.toDisplayString = pexprs.Lookahead.prototype.toDisplayString = -pexprs.Lex.prototype.toDisplayString = -pexprs.Value.prototype.toDisplayString = -pexprs.Arr.prototype.toDisplayString = -pexprs.Obj.prototype.toDisplayString = function() { +pexprs.Lex.prototype.toDisplayString = function() { if (this.interval) { return this.interval.trimmed().contents; } @@ -8498,7 +8077,7 @@ pexprs.end.toDisplayString = function() { return 'end'; }; -pexprs.Prim.prototype.toDisplayString = function() { +pexprs.Terminal.prototype.toDisplayString = function() { return JSON.stringify(this.obj); }; @@ -8518,7 +8097,7 @@ pexprs.UnicodeChar.prototype.toDisplayString = function() { return 'Unicode {' + this.category + '} character'; }; -},{"./common":48,"./pexprs":69}],67:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],65:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8543,7 +8122,7 @@ pexprs.end.toFailure = function(grammar) { return new Failure('end of input', 'description'); }; -pexprs.Prim.prototype.toFailure = function(grammar) { +pexprs.Terminal.prototype.toFailure = function(grammar) { return typeof this.obj === 'string' ? new Failure(this.obj, 'string') : new Failure(JSON.stringify(this.obj), 'code'); @@ -8576,7 +8155,7 @@ pexprs.UnicodeChar.prototype.toFailure = function(grammar) { return new Failure(this.toDisplayString(), 'description'); }; -},{"./Failure":37,"./common":48,"./pexprs":69}],68:[function(require,module,exports){ +},{"./Failure":37,"./common":48,"./pexprs":67}],66:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -8607,7 +8186,7 @@ pexprs.end.toString = function() { return 'end'; }; -pexprs.Prim.prototype.toString = function() { +pexprs.Terminal.prototype.toString = function() { return JSON.stringify(this.obj); }; @@ -8623,10 +8202,6 @@ pexprs.Lex.prototype.toString = function() { return '#(' + this.expr.toString() + ')'; }; -pexprs.Value.prototype.toString = function() { - return '$(' + this.expr.toString() + ')'; -}; - pexprs.Alt.prototype.toString = function() { return this.terms.length === 1 ? this.terms[0].toString() : @@ -8651,34 +8226,6 @@ pexprs.Lookahead.prototype.toString = function() { return '&' + this.expr; }; -pexprs.Arr.prototype.toString = function() { - return '[' + this.expr.toString() + ']'; -}; - -pexprs.Obj.prototype.toString = function() { - var parts = ['{']; - - var first = true; - function emit(part) { - if (first) { - first = false; - } else { - parts.push(', '); - } - parts.push(part); - } - - this.properties.forEach(function(property) { - emit(JSON.stringify(property.name) + ': ' + property.pattern.toString()); - }); - if (this.isLenient) { - emit('...'); - } - - parts.push('}'); - return parts.join(''); -}; - pexprs.Apply.prototype.toString = function() { if (this.args.length > 0) { var ps = this.args.map(function(arg) { return arg.toString(); }); @@ -8692,14 +8239,13 @@ pexprs.UnicodeChar.prototype.toString = function() { return '\\p{' + this.category + '}'; }; -},{"./common":48,"./pexprs":69}],69:[function(require,module,exports){ +},{"./common":48,"./pexprs":67}],67:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- // Imports // -------------------------------------------------------------------- -var InputStream = require('./InputStream'); var UnicodeCategories = require('../third_party/UnicodeCategories'); var common = require('./common'); var errors = require('./errors'); @@ -8711,12 +8257,6 @@ var inherits = require('inherits'); // General stuff -// Constants representing the type of a PExpr. See pexprs-getExprType.js for -// more information. -var TYPE_ANY = 0; -var TYPE_STRING = 1; -var TYPE_VALUE = 2; - function PExpr() { throw new Error("PExpr cannot be instantiated -- it's abstract"); } @@ -8729,16 +8269,6 @@ PExpr.prototype.withInterval = function(interval) { return this; }; -// Allocate the appropriate input stream for this expression and the given values. -PExpr.prototype.newInputStreamFor = function(values, grammar) { - var exprType = this.getExprType(grammar); - if (values.length === 1 && typeof values[0] === 'string' && exprType !== TYPE_VALUE) { - return InputStream.newFor(values[0]); - } else { - return InputStream.newFor(values); - } -}; - // Any var any = Object.create(PExpr.prototype); @@ -8747,12 +8277,12 @@ var any = Object.create(PExpr.prototype); var end = Object.create(PExpr.prototype); -// Primitives +// Terminals -function Prim(obj) { +function Terminal(obj) { this.obj = obj; } -inherits(Prim, PExpr); +inherits(Terminal, PExpr); // Ranges @@ -8847,13 +8377,6 @@ function Lex(expr) { } inherits(Lex, PExpr); -// "Value-ification" - -function Value(expr) { - this.expr = expr; -} -inherits(Value, PExpr); - // Array decomposition function Arr(expr) { @@ -8914,15 +8437,10 @@ inherits(UnicodeChar, PExpr); // Exports // -------------------------------------------------------------------- -exports.TYPE_ANY = TYPE_ANY; -exports.TYPE_STRING = TYPE_STRING; -exports.TYPE_VALUE = TYPE_VALUE; -exports.TYPE_INCONSISTENT = TYPE_STRING | TYPE_VALUE; - exports.PExpr = PExpr; exports.any = any; exports.end = end; -exports.Prim = Prim; +exports.Terminal = Terminal; exports.Range = Range; exports.Param = Param; exports.Alt = Alt; @@ -8935,7 +8453,6 @@ exports.Opt = Opt; exports.Not = Not; exports.Lookahead = Lookahead; exports.Lex = Lex; -exports.Value = Value; exports.Arr = Arr; exports.Str = Str; exports.Obj = Obj; @@ -8950,11 +8467,9 @@ require('./pexprs-allowsSkippingPrecedingSpace'); require('./pexprs-assertAllApplicationsAreValid'); require('./pexprs-assertChoicesHaveUniformArity'); require('./pexprs-assertIteratedExprsAreNotNullable'); -require('./pexprs-assertValuesAndStringsAreNotMixed'); require('./pexprs-check'); require('./pexprs-eval'); require('./pexprs-getArity'); -require('./pexprs-getExprType'); require('./pexprs-outputRecipe'); require('./pexprs-introduceParams'); require('./pexprs-isNullable'); @@ -8964,7 +8479,7 @@ require('./pexprs-toArgumentNameList'); require('./pexprs-toFailure'); require('./pexprs-toString'); -},{"../third_party/UnicodeCategories":71,"./InputStream":40,"./common":48,"./errors":49,"./pexprs-allowsSkippingPrecedingSpace":52,"./pexprs-assertAllApplicationsAreValid":53,"./pexprs-assertChoicesHaveUniformArity":54,"./pexprs-assertIteratedExprsAreNotNullable":55,"./pexprs-assertValuesAndStringsAreNotMixed":56,"./pexprs-check":57,"./pexprs-eval":58,"./pexprs-getArity":59,"./pexprs-getExprType":60,"./pexprs-introduceParams":61,"./pexprs-isNullable":62,"./pexprs-outputRecipe":63,"./pexprs-substituteParams":64,"./pexprs-toArgumentNameList":65,"./pexprs-toDisplayString":66,"./pexprs-toFailure":67,"./pexprs-toString":68,"inherits":33}],70:[function(require,module,exports){ +},{"../third_party/UnicodeCategories":69,"./common":48,"./errors":49,"./pexprs-allowsSkippingPrecedingSpace":52,"./pexprs-assertAllApplicationsAreValid":53,"./pexprs-assertChoicesHaveUniformArity":54,"./pexprs-assertIteratedExprsAreNotNullable":55,"./pexprs-check":56,"./pexprs-eval":57,"./pexprs-getArity":58,"./pexprs-introduceParams":59,"./pexprs-isNullable":60,"./pexprs-outputRecipe":61,"./pexprs-substituteParams":62,"./pexprs-toArgumentNameList":63,"./pexprs-toDisplayString":64,"./pexprs-toFailure":65,"./pexprs-toString":66,"inherits":33}],68:[function(require,module,exports){ 'use strict'; // -------------------------------------------------------------------- @@ -9114,7 +8629,7 @@ exports.getLineAndColumnMessage = function(str, offset /* ...ranges */) { return sb.contents(); }; -},{"./common":48}],71:[function(require,module,exports){ +},{"./common":48}],69:[function(require,module,exports){ // Based on https://github.com/tvcutsem/es-lab/blob/master/src/parser/unicode.js. // These are just categories that are used in ES5. // The full list of Unicode categories is here: http://www.fileformat.info/info/unicode/category/index.htm. diff --git a/dist/syndicatecompiler.min.js b/dist/syndicatecompiler.min.js index 4e00ce6..a81e8f4 100644 --- a/dist/syndicatecompiler.min.js +++ b/dist/syndicatecompiler.min.js @@ -1,8 +1,8 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SyndicateCompiler=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o1){switch(this.args.mode){case"pattern":rhsExpr.buildSubscription(this.args.acc,this.args.mode);break;case"instantiated":lhsExpr.buildSubscription(this.args.acc,this.args.mode);break;case"projection":{this.args.acc.push("(Syndicate._$("+JSON.stringify(i.slice(1))+",");rhsExpr.buildSubscription(this.args.acc,this.args.mode);this.args.acc.push("))");break}default:throw new Error("Unexpected buildSubscription mode "+this.args.mode)}}else{lhsExpr.buildSubscription(this.args.acc,this.args.mode);_assignmentOperator.buildSubscription(this.args.acc,this.args.mode);rhsExpr.buildSubscription(this.args.acc,this.args.mode)}},identifier:function(_name){var i=this.interval.contents;if(i[0]==="$"&&i.length>1){switch(this.args.mode){case"pattern":this.args.acc.push("_");break;case"instantiated":this.args.acc.push(i.slice(1));break;case"projection":this.args.acc.push("(Syndicate._$("+JSON.stringify(i.slice(1))+"))");break;default:throw new Error("Unexpected buildSubscription mode "+this.args.mode)}}else{this.args.acc.push(i)}},_terminal:function(){this.args.acc.push(this.interval.contents)},_nonterminal:function(children){var self=this;forEachChild(children,function(c){c.buildSubscription(self.args.acc,self.args.mode)})}});semantics.addAttribute("bindings",{_default:function(children){var result=[];this.pushBindings(result);return result}});semantics.addOperation("pushBindings(accumulator)",{identifier:function(_name){var i=this.interval.contents;if(i[0]==="$"&&i.length>1){this.args.accumulator.push(i.slice(1))}},_terminal:function(){},_nonterminal:function(children){var self=this;children.forEach(function(c){c.pushBindings(self.args.accumulator)})}});function compileSyndicateSource(inputSource,onError){var parseResult=grammar.match(inputSource);if(parseResult.failed()){if(onError){return onError(parseResult.message,parseResult)}else{console.error(parseResult.message);return false}}else{return'"use strict";\n'+semantics(parseResult).asES5}}module.exports.grammar=grammar;module.exports.semantics=semantics;module.exports.compileSyndicateSource=compileSyndicateSource}).call(this,require("buffer").Buffer)},{"./es5.js":2,buffer:4,"ohm-js":50,path:8}],2:[function(require,module,exports){(function(Buffer){"use strict";var path=require("path");var ohm=require("ohm-js");function isUndefined(x){return x===void 0}function flattenIterNodes(nodes){var result=[];for(var i=0;i=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset>>=0;if(this.length===0)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0)byteOffset=Math.max(this.length+byteOffset,0);if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(this,val,byteOffset,encoding)}if(typeof val==="number"){if(Buffer.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,val,byteOffset)}return arrayIndexOf(this,[val],byteOffset,encoding)}throw new TypeError("val must be string, number or Buffer")};Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;i--){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break; -dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":5,ieee754:6,isarray:7}],5:[function(require,module,exports){"use strict";exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;function init(){var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}placeHolders=b64[len-2]==="="?2:b64[len-1]==="="?1:0;arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],6:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],7:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],8:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i\n = NonemptyListOf\n | EmptyListOf\n\n NonemptyListOf\n = elem (sep elem)*\n\n EmptyListOf\n = /* nothing */\n\n listOf\n = nonemptyListOf\n | emptyListOf\n\n nonemptyListOf\n = elem (sep elem)*\n\n emptyListOf\n = /* nothing */\n\n}');return decl.define("alnum",[],this.alt(this.app("letter").withInterval(decl.sourceInterval(60,66)),this.app("digit").withInterval(decl.sourceInterval(73,78))).withInterval(decl.sourceInterval(60,78)),"an alpha-numeric character").define("letter",[],this.alt(this.app("lower").withInterval(decl.sourceInterval(107,112)),this.app("upper").withInterval(decl.sourceInterval(119,124)),this.app("unicodeLtmo").withInterval(decl.sourceInterval(131,142))).withInterval(decl.sourceInterval(107,142)),"a letter").define("digit",[],this.range("0","9").withInterval(decl.sourceInterval(169,177)),"a digit").define("hexDigit",[],this.alt(this.app("digit").withInterval(decl.sourceInterval(219,224)),this.range("a","f").withInterval(decl.sourceInterval(231,239)),this.range("A","F").withInterval(decl.sourceInterval(246,254))).withInterval(decl.sourceInterval(219,254)),"a hexadecimal digit").define("ListOf",["elem","sep"],this.alt(this.app("NonemptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(282,307)),this.app("EmptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(314,336))).withInterval(decl.sourceInterval(282,336))).define("NonemptyListOf",["elem","sep"],this.seq(this.param(0),this.star(this.seq(this.param(1),this.param(0)).withInterval(decl.sourceInterval(378,386))).withInterval(decl.sourceInterval(377,388))).withInterval(decl.sourceInterval(372,388))).define("EmptyListOf",["elem","sep"],this.seq().withInterval(decl.sourceInterval(438,438))).define("listOf",["elem","sep"],this.alt(this.app("nonemptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(462,487)),this.app("emptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(494,516))).withInterval(decl.sourceInterval(462,516))).define("nonemptyListOf",["elem","sep"],this.seq(this.param(0),this.star(this.seq(this.param(1),this.param(0)).withInterval(decl.sourceInterval(558,566))).withInterval(decl.sourceInterval(557,568))).withInterval(decl.sourceInterval(552,568))).define("emptyListOf",["elem","sep"],this.seq().withInterval(decl.sourceInterval(616,616))).build()})},{"..":50}],11:[function(require,module,exports){var ohm=require("..");module.exports=ohm.makeRecipe(function(){var decl=this.newGrammar("Ohm").withSource('Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? "{" Rule* "}"\n\n SuperGrammar\n = "<:" ident\n\n Rule\n = ident Formals? ruleDescr? "=" "|"? Alt -- define\n | ident Formals? ":=" "|"? Alt -- override\n | ident Formals? "+=" "|"? Alt -- extend\n\n Formals\n = "<" ListOf ">"\n\n Params\n = "<" ListOf ">"\n\n Alt\n = Term ("|" Term)*\n\n Term\n = Seq caseName -- inline\n | Seq\n\n Seq\n = Iter*\n\n Iter\n = Pred "*" -- star\n | Pred "+" -- plus\n | Pred "?" -- opt\n | Pred\n\n Pred\n = "~" Modifier -- not\n | "&" Modifier -- lookahead\n | Modifier\n\n Modifier\n = "#" Base -- lex\n | "$" Base -- val\n | Base\n\n Base\n = ident Params? ~(ruleDescr? "=" | ":=" | "+=") -- application\n | Prim ".." Prim -- range\n | Prim -- prim\n | "(" Alt ")" -- paren\n | "[" Alt "]" -- arr\n | "{" "..."? "}" -- obj\n | "{" Props ("," "...")? "}" -- objWithProps\n\n Prim\n = keyword\n | string\n | number\n\n Props\n = Prop ("," Prop)*\n\n Prop\n = (name | string) ":" Alt\n\n ruleDescr (a rule description)\n = "(" ruleDescrText ")"\n\n ruleDescrText\n = (~")" any)*\n\n caseName\n = "--" (~"\\n" space)* name (~"\\n" space)* ("\\n" | &"}")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n ident (an identifier)\n = ~keyword name\n\n keyword\n = "null" ~nameRest -- null\n | "true" ~nameRest -- true\n | "false" ~nameRest -- false\n\n string\n = "\\"" strChar* "\\""\n\n strChar\n = escapeChar\n | ~"\\\\" ~"\\"" ~"\\n" any\n\n escapeChar (an escape sequence)\n = "\\\\\\\\" -- backslash\n | "\\\\\\"" -- doubleQuote\n | "\\\\\\\'" -- singleQuote\n | "\\\\b" -- backspace\n | "\\\\n" -- lineFeed\n | "\\\\r" -- carriageReturn\n | "\\\\t" -- tab\n | "\\\\u" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | "\\\\x" hexDigit hexDigit -- hexEscape\n\n number (a number)\n = "-"? digit+\n\n space\n += comment\n\n comment\n = "//" (~"\\n" any)* "\\n" -- singleLine\n | "/*" (~"*/" any)* "*/" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | keyword | number | operator | punctuation | string | any\n\n operator = "<:" | "=" | ":=" | "+=" | "*" | "+" | "?" | "~" | "&"\n\n punctuation = "<" | ">" | "," | "--"\n}').withDefaultStartRule("Grammars");return decl.define("Grammars",[],this.star(this.app("Grammar").withInterval(decl.sourceInterval(24,31))).withInterval(decl.sourceInterval(24,32))).define("Grammar",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(50,55)),this.opt(this.app("SuperGrammar").withInterval(decl.sourceInterval(56,68))).withInterval(decl.sourceInterval(56,69)),this.prim("{").withInterval(decl.sourceInterval(70,73)),this.star(this.app("Rule").withInterval(decl.sourceInterval(74,78))).withInterval(decl.sourceInterval(74,79)),this.prim("}").withInterval(decl.sourceInterval(80,83))).withInterval(decl.sourceInterval(50,83))).define("SuperGrammar",[],this.seq(this.prim("<:").withInterval(decl.sourceInterval(106,110)),this.app("ident").withInterval(decl.sourceInterval(111,116))).withInterval(decl.sourceInterval(106,116))).define("Rule_define",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(131,136)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(137,144))).withInterval(decl.sourceInterval(137,145)),this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(146,155))).withInterval(decl.sourceInterval(146,156)),this.prim("=").withInterval(decl.sourceInterval(157,160)),this.opt(this.prim("|").withInterval(decl.sourceInterval(162,165))).withInterval(decl.sourceInterval(162,166)),this.app("Alt").withInterval(decl.sourceInterval(167,170))).withInterval(decl.sourceInterval(131,170))).define("Rule_override",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(188,193)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(194,201))).withInterval(decl.sourceInterval(194,202)),this.prim(":=").withInterval(decl.sourceInterval(214,218)),this.opt(this.prim("|").withInterval(decl.sourceInterval(219,222))).withInterval(decl.sourceInterval(219,223)),this.app("Alt").withInterval(decl.sourceInterval(224,227))).withInterval(decl.sourceInterval(188,227))).define("Rule_extend",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(247,252)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(253,260))).withInterval(decl.sourceInterval(253,261)),this.prim("+=").withInterval(decl.sourceInterval(273,277)),this.opt(this.prim("|").withInterval(decl.sourceInterval(278,281))).withInterval(decl.sourceInterval(278,282)),this.app("Alt").withInterval(decl.sourceInterval(283,286))).withInterval(decl.sourceInterval(247,286))).define("Rule",[],this.alt(this.app("Rule_define").withInterval(decl.sourceInterval(131,170)),this.app("Rule_override").withInterval(decl.sourceInterval(188,227)),this.app("Rule_extend").withInterval(decl.sourceInterval(247,286))).withInterval(decl.sourceInterval(131,297))).define("Formals",[],this.seq(this.prim("<").withInterval(decl.sourceInterval(315,318)),this.app("ListOf",[this.app("ident").withInterval(decl.sourceInterval(326,331)),this.prim(",").withInterval(decl.sourceInterval(333,336))]).withInterval(decl.sourceInterval(319,337)),this.prim(">").withInterval(decl.sourceInterval(338,341))).withInterval(decl.sourceInterval(315,341))).define("Params",[],this.seq(this.prim("<").withInterval(decl.sourceInterval(358,361)),this.app("ListOf",[this.app("Seq").withInterval(decl.sourceInterval(369,372)),this.prim(",").withInterval(decl.sourceInterval(374,377))]).withInterval(decl.sourceInterval(362,378)),this.prim(">").withInterval(decl.sourceInterval(379,382))).withInterval(decl.sourceInterval(358,382))).define("Alt",[],this.seq(this.app("Term").withInterval(decl.sourceInterval(396,400)),this.star(this.seq(this.prim("|").withInterval(decl.sourceInterval(402,405)),this.app("Term").withInterval(decl.sourceInterval(406,410))).withInterval(decl.sourceInterval(402,410))).withInterval(decl.sourceInterval(401,412))).withInterval(decl.sourceInterval(396,412))).define("Term_inline",[],this.seq(this.app("Seq").withInterval(decl.sourceInterval(427,430)),this.app("caseName").withInterval(decl.sourceInterval(431,439))).withInterval(decl.sourceInterval(427,439))).define("Term",[],this.alt(this.app("Term_inline").withInterval(decl.sourceInterval(427,439)),this.app("Seq").withInterval(decl.sourceInterval(456,459))).withInterval(decl.sourceInterval(427,459))).define("Seq",[],this.star(this.app("Iter").withInterval(decl.sourceInterval(473,477))).withInterval(decl.sourceInterval(473,478))).define("Iter_star",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(493,497)),this.prim("*").withInterval(decl.sourceInterval(498,501))).withInterval(decl.sourceInterval(493,501))).define("Iter_plus",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(517,521)),this.prim("+").withInterval(decl.sourceInterval(522,525))).withInterval(decl.sourceInterval(517,525))).define("Iter_opt",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(541,545)),this.prim("?").withInterval(decl.sourceInterval(546,549))).withInterval(decl.sourceInterval(541,549))).define("Iter",[],this.alt(this.app("Iter_star").withInterval(decl.sourceInterval(493,501)),this.app("Iter_plus").withInterval(decl.sourceInterval(517,525)),this.app("Iter_opt").withInterval(decl.sourceInterval(541,549)),this.app("Pred").withInterval(decl.sourceInterval(564,568))).withInterval(decl.sourceInterval(493,568))).define("Pred_not",[],this.seq(this.prim("~").withInterval(decl.sourceInterval(583,586)),this.app("Modifier").withInterval(decl.sourceInterval(587,595))).withInterval(decl.sourceInterval(583,595))).define("Pred_lookahead",[],this.seq(this.prim("&").withInterval(decl.sourceInterval(610,613)),this.app("Modifier").withInterval(decl.sourceInterval(614,622))).withInterval(decl.sourceInterval(610,622))).define("Pred",[],this.alt(this.app("Pred_not").withInterval(decl.sourceInterval(583,595)),this.app("Pred_lookahead").withInterval(decl.sourceInterval(610,622)),this.app("Modifier").withInterval(decl.sourceInterval(643,651))).withInterval(decl.sourceInterval(583,651))).define("Modifier_lex",[],this.seq(this.prim("#").withInterval(decl.sourceInterval(670,673)),this.app("Base").withInterval(decl.sourceInterval(674,678))).withInterval(decl.sourceInterval(670,678))).define("Modifier_val",[],this.seq(this.prim("$").withInterval(decl.sourceInterval(693,696)),this.app("Base").withInterval(decl.sourceInterval(697,701))).withInterval(decl.sourceInterval(693,701))).define("Modifier",[],this.alt(this.app("Modifier_lex").withInterval(decl.sourceInterval(670,678)),this.app("Modifier_val").withInterval(decl.sourceInterval(693,701)),this.app("Base").withInterval(decl.sourceInterval(716,720))).withInterval(decl.sourceInterval(670,720))).define("Base_application",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(735,740)),this.opt(this.app("Params").withInterval(decl.sourceInterval(741,747))).withInterval(decl.sourceInterval(741,748)),this.not(this.alt(this.seq(this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(751,760))).withInterval(decl.sourceInterval(751,761)),this.prim("=").withInterval(decl.sourceInterval(762,765))).withInterval(decl.sourceInterval(751,765)),this.prim(":=").withInterval(decl.sourceInterval(768,772)),this.prim("+=").withInterval(decl.sourceInterval(775,779))).withInterval(decl.sourceInterval(751,779))).withInterval(decl.sourceInterval(749,780))).withInterval(decl.sourceInterval(735,780))).define("Base_range",[],this.seq(this.app("Prim").withInterval(decl.sourceInterval(803,807)),this.prim("..").withInterval(decl.sourceInterval(808,812)),this.app("Prim").withInterval(decl.sourceInterval(813,817))).withInterval(decl.sourceInterval(803,817))).define("Base_prim",[],this.app("Prim").withInterval(decl.sourceInterval(865,869))).define("Base_paren",[],this.seq(this.prim("(").withInterval(decl.sourceInterval(926,929)),this.app("Alt").withInterval(decl.sourceInterval(930,933)),this.prim(")").withInterval(decl.sourceInterval(934,937))).withInterval(decl.sourceInterval(926,937))).define("Base_arr",[],this.seq(this.prim("[").withInterval(decl.sourceInterval(988,991)),this.app("Alt").withInterval(decl.sourceInterval(992,995)),this.prim("]").withInterval(decl.sourceInterval(996,999))).withInterval(decl.sourceInterval(988,999))).define("Base_obj",[],this.seq(this.prim("{").withInterval(decl.sourceInterval(1048,1051)),this.opt(this.prim("...").withInterval(decl.sourceInterval(1052,1057))).withInterval(decl.sourceInterval(1052,1058)),this.prim("}").withInterval(decl.sourceInterval(1059,1062))).withInterval(decl.sourceInterval(1048,1062))).define("Base_objWithProps",[],this.seq(this.prim("{").withInterval(decl.sourceInterval(1108,1111)),this.app("Props").withInterval(decl.sourceInterval(1112,1117)),this.opt(this.seq(this.prim(",").withInterval(decl.sourceInterval(1119,1122)),this.prim("...").withInterval(decl.sourceInterval(1123,1128))).withInterval(decl.sourceInterval(1119,1128))).withInterval(decl.sourceInterval(1118,1130)),this.prim("}").withInterval(decl.sourceInterval(1131,1134))).withInterval(decl.sourceInterval(1108,1134))).define("Base",[],this.alt(this.app("Base_application").withInterval(decl.sourceInterval(735,780)),this.app("Base_range").withInterval(decl.sourceInterval(803,817)),this.app("Base_prim").withInterval(decl.sourceInterval(865,869)),this.app("Base_paren").withInterval(decl.sourceInterval(926,937)),this.app("Base_arr").withInterval(decl.sourceInterval(988,999)),this.app("Base_obj").withInterval(decl.sourceInterval(1048,1062)),this.app("Base_objWithProps").withInterval(decl.sourceInterval(1108,1134))).withInterval(decl.sourceInterval(735,1170))).define("Prim",[],this.alt(this.app("keyword").withInterval(decl.sourceInterval(1185,1192)),this.app("string").withInterval(decl.sourceInterval(1199,1205)),this.app("number").withInterval(decl.sourceInterval(1212,1218))).withInterval(decl.sourceInterval(1185,1218))).define("Props",[],this.seq(this.app("Prop").withInterval(decl.sourceInterval(1234,1238)),this.star(this.seq(this.prim(",").withInterval(decl.sourceInterval(1240,1243)),this.app("Prop").withInterval(decl.sourceInterval(1244,1248))).withInterval(decl.sourceInterval(1240,1248))).withInterval(decl.sourceInterval(1239,1250))).withInterval(decl.sourceInterval(1234,1250))).define("Prop",[],this.seq(this.alt(this.app("name").withInterval(decl.sourceInterval(1266,1270)),this.app("string").withInterval(decl.sourceInterval(1273,1279))).withInterval(decl.sourceInterval(1266,1279)),this.prim(":").withInterval(decl.sourceInterval(1281,1284)),this.app("Alt").withInterval(decl.sourceInterval(1285,1288))).withInterval(decl.sourceInterval(1265,1288))).define("ruleDescr",[],this.seq(this.prim("(").withInterval(decl.sourceInterval(1330,1333)),this.app("ruleDescrText").withInterval(decl.sourceInterval(1334,1347)),this.prim(")").withInterval(decl.sourceInterval(1348,1351))).withInterval(decl.sourceInterval(1330,1351)),"a rule description").define("ruleDescrText",[],this.star(this.seq(this.not(this.prim(")").withInterval(decl.sourceInterval(1377,1380))).withInterval(decl.sourceInterval(1376,1380)),this.app("any").withInterval(decl.sourceInterval(1381,1384))).withInterval(decl.sourceInterval(1376,1384))).withInterval(decl.sourceInterval(1375,1386))).define("caseName",[],this.seq(this.prim("--").withInterval(decl.sourceInterval(1405,1409)),this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(1412,1416))).withInterval(decl.sourceInterval(1411,1416)),this.app("space").withInterval(decl.sourceInterval(1417,1422))).withInterval(decl.sourceInterval(1411,1422))).withInterval(decl.sourceInterval(1410,1424)),this.app("name").withInterval(decl.sourceInterval(1425,1429)),this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(1432,1436))).withInterval(decl.sourceInterval(1431,1436)),this.app("space").withInterval(decl.sourceInterval(1437,1442))).withInterval(decl.sourceInterval(1431,1442))).withInterval(decl.sourceInterval(1430,1444)),this.alt(this.prim("\n").withInterval(decl.sourceInterval(1446,1450)),this.la(this.prim("}").withInterval(decl.sourceInterval(1454,1457))).withInterval(decl.sourceInterval(1453,1457))).withInterval(decl.sourceInterval(1446,1457))).withInterval(decl.sourceInterval(1405,1458))).define("name",[],this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(1483,1492)),this.star(this.app("nameRest").withInterval(decl.sourceInterval(1493,1501))).withInterval(decl.sourceInterval(1493,1502))).withInterval(decl.sourceInterval(1483,1502)),"a name").define("nameFirst",[],this.alt(this.prim("_").withInterval(decl.sourceInterval(1522,1525)),this.app("letter").withInterval(decl.sourceInterval(1532,1538))).withInterval(decl.sourceInterval(1522,1538))).define("nameRest",[],this.alt(this.prim("_").withInterval(decl.sourceInterval(1557,1560)),this.app("alnum").withInterval(decl.sourceInterval(1567,1572))).withInterval(decl.sourceInterval(1557,1572))).define("ident",[],this.seq(this.not(this.app("keyword").withInterval(decl.sourceInterval(1606,1613))).withInterval(decl.sourceInterval(1605,1613)),this.app("name").withInterval(decl.sourceInterval(1614,1618))).withInterval(decl.sourceInterval(1605,1618)),"an identifier").define("keyword_null",[],this.seq(this.prim("null").withInterval(decl.sourceInterval(1636,1642)),this.not(this.app("nameRest").withInterval(decl.sourceInterval(1644,1652))).withInterval(decl.sourceInterval(1643,1652))).withInterval(decl.sourceInterval(1636,1652))).define("keyword_true",[],this.seq(this.prim("true").withInterval(decl.sourceInterval(1669,1675)),this.not(this.app("nameRest").withInterval(decl.sourceInterval(1677,1685))).withInterval(decl.sourceInterval(1676,1685))).withInterval(decl.sourceInterval(1669,1685))).define("keyword_false",[],this.seq(this.prim("false").withInterval(decl.sourceInterval(1702,1709)),this.not(this.app("nameRest").withInterval(decl.sourceInterval(1711,1719))).withInterval(decl.sourceInterval(1710,1719))).withInterval(decl.sourceInterval(1702,1719))).define("keyword",[],this.alt(this.app("keyword_null").withInterval(decl.sourceInterval(1636,1652)),this.app("keyword_true").withInterval(decl.sourceInterval(1669,1685)),this.app("keyword_false").withInterval(decl.sourceInterval(1702,1719))).withInterval(decl.sourceInterval(1636,1729))).define("string",[],this.seq(this.prim('"').withInterval(decl.sourceInterval(1746,1750)),this.star(this.app("strChar").withInterval(decl.sourceInterval(1751,1758))).withInterval(decl.sourceInterval(1751,1759)),this.prim('"').withInterval(decl.sourceInterval(1760,1764))).withInterval(decl.sourceInterval(1746,1764))).define("strChar",[],this.alt(this.app("escapeChar").withInterval(decl.sourceInterval(1782,1792)),this.seq(this.not(this.prim("\\").withInterval(decl.sourceInterval(1800,1804))).withInterval(decl.sourceInterval(1799,1804)),this.not(this.prim('"').withInterval(decl.sourceInterval(1806,1810))).withInterval(decl.sourceInterval(1805,1810)),this.not(this.prim("\n").withInterval(decl.sourceInterval(1812,1816))).withInterval(decl.sourceInterval(1811,1816)),this.app("any").withInterval(decl.sourceInterval(1817,1820))).withInterval(decl.sourceInterval(1799,1820))).withInterval(decl.sourceInterval(1782,1820))).define("escapeChar_backslash",[],this.prim("\\\\").withInterval(decl.sourceInterval(1863,1869))).define("escapeChar_doubleQuote",[],this.prim('\\"').withInterval(decl.sourceInterval(1925,1931))).define("escapeChar_singleQuote",[],this.prim("\\'").withInterval(decl.sourceInterval(1989,1995))).define("escapeChar_backspace",[],this.prim("\\b").withInterval(decl.sourceInterval(2053,2058))).define("escapeChar_lineFeed",[],this.prim("\\n").withInterval(decl.sourceInterval(2115,2120))).define("escapeChar_carriageReturn",[],this.prim("\\r").withInterval(decl.sourceInterval(2176,2181))).define("escapeChar_tab",[],this.prim("\\t").withInterval(decl.sourceInterval(2243,2248))).define("escapeChar_unicodeEscape",[],this.seq(this.prim("\\u").withInterval(decl.sourceInterval(2299,2304)),this.app("hexDigit").withInterval(decl.sourceInterval(2305,2313)),this.app("hexDigit").withInterval(decl.sourceInterval(2314,2322)),this.app("hexDigit").withInterval(decl.sourceInterval(2323,2331)),this.app("hexDigit").withInterval(decl.sourceInterval(2332,2340))).withInterval(decl.sourceInterval(2299,2340))).define("escapeChar_hexEscape",[],this.seq(this.prim("\\x").withInterval(decl.sourceInterval(2365,2370)),this.app("hexDigit").withInterval(decl.sourceInterval(2371,2379)),this.app("hexDigit").withInterval(decl.sourceInterval(2380,2388))).withInterval(decl.sourceInterval(2365,2388))).define("escapeChar",[],this.alt(this.app("escapeChar_backslash").withInterval(decl.sourceInterval(1863,1869)),this.app("escapeChar_doubleQuote").withInterval(decl.sourceInterval(1925,1931)),this.app("escapeChar_singleQuote").withInterval(decl.sourceInterval(1989,1995)),this.app("escapeChar_backspace").withInterval(decl.sourceInterval(2053,2058)),this.app("escapeChar_lineFeed").withInterval(decl.sourceInterval(2115,2120)),this.app("escapeChar_carriageReturn").withInterval(decl.sourceInterval(2176,2181)),this.app("escapeChar_tab").withInterval(decl.sourceInterval(2243,2248)),this.app("escapeChar_unicodeEscape").withInterval(decl.sourceInterval(2299,2340)),this.app("escapeChar_hexEscape").withInterval(decl.sourceInterval(2365,2388))).withInterval(decl.sourceInterval(1863,2420)),"an escape sequence").define("number",[],this.seq(this.opt(this.prim("-").withInterval(decl.sourceInterval(2449,2452))).withInterval(decl.sourceInterval(2449,2453)),this.plus(this.app("digit").withInterval(decl.sourceInterval(2454,2459))).withInterval(decl.sourceInterval(2454,2460))).withInterval(decl.sourceInterval(2449,2460)),"a number").extend("space",[],this.app("comment").withInterval(decl.sourceInterval(2476,2483))).define("comment_singleLine",[],this.seq(this.prim("//").withInterval(decl.sourceInterval(2501,2505)),this.star(this.seq(this.not(this.prim("\n").withInterval(decl.sourceInterval(2508,2512))).withInterval(decl.sourceInterval(2507,2512)),this.app("any").withInterval(decl.sourceInterval(2513,2516))).withInterval(decl.sourceInterval(2507,2516))).withInterval(decl.sourceInterval(2506,2518)),this.prim("\n").withInterval(decl.sourceInterval(2519,2523))).withInterval(decl.sourceInterval(2501,2523))).define("comment_multiLine",[],this.seq(this.prim("/*").withInterval(decl.sourceInterval(2545,2549)),this.star(this.seq(this.not(this.prim("*/").withInterval(decl.sourceInterval(2552,2556))).withInterval(decl.sourceInterval(2551,2556)),this.app("any").withInterval(decl.sourceInterval(2557,2560))).withInterval(decl.sourceInterval(2551,2560))).withInterval(decl.sourceInterval(2550,2562)),this.prim("*/").withInterval(decl.sourceInterval(2563,2567))).withInterval(decl.sourceInterval(2545,2567))).define("comment",[],this.alt(this.app("comment_singleLine").withInterval(decl.sourceInterval(2501,2523)),this.app("comment_multiLine").withInterval(decl.sourceInterval(2545,2567))).withInterval(decl.sourceInterval(2501,2581))).define("tokens",[],this.star(this.app("token").withInterval(decl.sourceInterval(2594,2599))).withInterval(decl.sourceInterval(2594,2600))).define("token",[],this.alt(this.app("caseName").withInterval(decl.sourceInterval(2612,2620)),this.app("comment").withInterval(decl.sourceInterval(2623,2630)),this.app("ident").withInterval(decl.sourceInterval(2633,2638)),this.app("keyword").withInterval(decl.sourceInterval(2641,2648)),this.app("number").withInterval(decl.sourceInterval(2651,2657)),this.app("operator").withInterval(decl.sourceInterval(2660,2668)),this.app("punctuation").withInterval(decl.sourceInterval(2671,2682)),this.app("string").withInterval(decl.sourceInterval(2685,2691)),this.app("any").withInterval(decl.sourceInterval(2694,2697))).withInterval(decl.sourceInterval(2612,2697))).define("operator",[],this.alt(this.prim("<:").withInterval(decl.sourceInterval(2712,2716)),this.prim("=").withInterval(decl.sourceInterval(2719,2722)),this.prim(":=").withInterval(decl.sourceInterval(2725,2729)),this.prim("+=").withInterval(decl.sourceInterval(2732,2736)),this.prim("*").withInterval(decl.sourceInterval(2739,2742)),this.prim("+").withInterval(decl.sourceInterval(2745,2748)),this.prim("?").withInterval(decl.sourceInterval(2751,2754)),this.prim("~").withInterval(decl.sourceInterval(2757,2760)),this.prim("&").withInterval(decl.sourceInterval(2763,2766))).withInterval(decl.sourceInterval(2712,2766))).define("punctuation",[],this.alt(this.prim("<").withInterval(decl.sourceInterval(2784,2787)),this.prim(">").withInterval(decl.sourceInterval(2790,2793)),this.prim(",").withInterval(decl.sourceInterval(2796,2799)),this.prim("--").withInterval(decl.sourceInterval(2802,2806))).withInterval(decl.sourceInterval(2784,2806))).build(); -})},{"..":50}],12:[function(require,module,exports){var ohm=require("..");module.exports=ohm.makeRecipe(function(){var decl=this.newGrammar("OperationsAndAttributes").withSource('OperationsAndAttributes {\n\n AttributeSignature =\n name\n\n OperationSignature =\n name Formals?\n\n Formals\n = "(" ListOf ")"\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n}').withDefaultStartRule("AttributeSignature");return decl.define("AttributeSignature",[],this.app("name").withInterval(decl.sourceInterval(54,58))).define("OperationSignature",[],this.seq(this.app("name").withInterval(decl.sourceInterval(87,91)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(92,99))).withInterval(decl.sourceInterval(92,100))).withInterval(decl.sourceInterval(87,100))).define("Formals",[],this.seq(this.prim("(").withInterval(decl.sourceInterval(118,121)),this.app("ListOf",[this.app("name").withInterval(decl.sourceInterval(129,133)),this.prim(",").withInterval(decl.sourceInterval(135,138))]).withInterval(decl.sourceInterval(122,139)),this.prim(")").withInterval(decl.sourceInterval(140,143))).withInterval(decl.sourceInterval(118,143))).define("name",[],this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(168,177)),this.star(this.app("nameRest").withInterval(decl.sourceInterval(178,186))).withInterval(decl.sourceInterval(178,187))).withInterval(decl.sourceInterval(168,187)),"a name").define("nameFirst",[],this.alt(this.prim("_").withInterval(decl.sourceInterval(207,210)),this.app("letter").withInterval(decl.sourceInterval(217,223))).withInterval(decl.sourceInterval(207,223))).define("nameRest",[],this.alt(this.prim("_").withInterval(decl.sourceInterval(242,245)),this.app("alnum").withInterval(decl.sourceInterval(252,257))).withInterval(decl.sourceInterval(242,257))).build()})},{"..":50}],13:[function(require,module,exports){"use strict";module.exports={toAST:require("./semantics-toAST").helper,semanticsForToAST:require("./semantics-toAST").semantics}},{"./semantics-toAST":14}],14:[function(require,module,exports){"use strict";var pexprs=require("../src/pexprs");var MatchResult=require("../src/MatchResult");var Grammar=require("../src/Grammar");var extend=require("util-extend");var defaultOperation={_terminal:function(){return this.primitiveValue},_nonterminal:function(children){var ctorName=this._node.ctorName;var mapping=this.args.mapping;if(!mapping.hasOwnProperty(ctorName)){if(this._node instanceof pexprs.Alt||this._node instanceof pexprs.Apply){return children[0].toAST(mapping)}if(this.isLexical()){return this.interval.contents}var realChildren=children.filter(function(child){return!child.isTerminal()});if(realChildren.length===1){return realChildren[0].toAST(mapping)}}if(typeof mapping[ctorName]==="number"){return children[mapping[ctorName]].toAST(mapping)}var propMap=mapping[ctorName]||children;var node={type:ctorName};for(var prop in propMap){var mappedProp=mapping[ctorName]&&mapping[ctorName][prop];if(typeof mappedProp==="number"){node[prop]=children[mappedProp].toAST(mapping)}else if(typeof mappedProp==="string"||typeof mappedProp==="boolean"||mappedProp===null){node[prop]=mappedProp}else if(typeof mappedProp==="object"&&mappedProp instanceof Number){node[prop]=Number(mappedProp)}else if(typeof mappedProp==="function"){node[prop]=mappedProp.call(this,children)}else if(mappedProp===undefined){if(children[prop]&&!children[prop].isTerminal()){node[prop]=children[prop].toAST(mapping)}else{delete node[prop]}}}return node},_iter:function(children){if(this._node.isOptional()){if(this.numChildren===0){return null}else{return children[0].toAST(this.args.mapping)}}return children.map(function(child){return child.toAST(this.args.mapping)},this)},NonemptyListOf:function(first,sep,rest){return[first.toAST(this.args.mapping)].concat(rest.toAST(this.args.mapping))},EmptyListOf:function(){return[]}};function toAST(res,mapping){if(!(res instanceof MatchResult)||res.failed()){throw new Error("toAST() expects a succesfull MatchResult as first parameter")}mapping=extend({},mapping);var operation=extend({},defaultOperation);for(var termName in mapping){if(typeof mapping[termName]==="function"){operation[termName]=mapping[termName];delete mapping[termName]}}var g=res._cst.grammar;var s=g.semantics().addOperation("toAST(mapping)",operation);return s(res).toAST(mapping)}function semanticsForToAST(g){if(!(g instanceof Grammar)){throw new Error("semanticsToAST() expects a Grammar as parameter")}return g.semantics().addOperation("toAST(mapping)",defaultOperation)}module.exports={helper:toAST,semantics:semanticsForToAST}},{"../src/Grammar":38,"../src/MatchResult":42,"../src/pexprs":69,"util-extend":35}],15:[function(require,module,exports){"use strict";module.exports=require("./is-implemented")()?Symbol:require("./polyfill")},{"./is-implemented":16,"./polyfill":31}],16:[function(require,module,exports){"use strict";module.exports=function(){var symbol;if(typeof Symbol!=="function")return false;symbol=Symbol("test symbol");try{String(symbol)}catch(e){return false}if(typeof Symbol.iterator==="symbol")return true;if(typeof Symbol.isConcatSpreadable!=="object")return false;if(typeof Symbol.iterator!=="object")return false;if(typeof Symbol.toPrimitive!=="object")return false;if(typeof Symbol.toStringTag!=="object")return false;if(typeof Symbol.unscopables!=="object")return false;return true}},{}],17:[function(require,module,exports){"use strict";module.exports=function(x){return x&&(typeof x==="symbol"||x["@@toStringTag"]==="Symbol")||false}},{}],18:[function(require,module,exports){"use strict";var assign=require("es5-ext/object/assign"),normalizeOpts=require("es5-ext/object/normalize-options"),isCallable=require("es5-ext/object/is-callable"),contains=require("es5-ext/string/#/contains"),d;d=module.exports=function(dscr,value){var c,e,w,options,desc;if(arguments.length<2||typeof dscr!=="string"){options=value;value=dscr;dscr=null}else{options=arguments[2]}if(dscr==null){c=w=true;e=false}else{c=contains.call(dscr,"c");e=contains.call(dscr,"e");w=contains.call(dscr,"w")}desc={value:value,configurable:c,enumerable:e,writable:w};return!options?desc:assign(normalizeOpts(options),desc)};d.gs=function(dscr,get,set){var c,e,options,desc;if(typeof dscr!=="string"){options=set;set=get;get=dscr;dscr=null}else{options=arguments[3]}if(get==null){get=undefined}else if(!isCallable(get)){options=get;get=set=undefined}else if(set==null){set=undefined}else if(!isCallable(set)){options=set;set=undefined}if(dscr==null){c=true;e=false}else{c=contains.call(dscr,"c");e=contains.call(dscr,"e")}desc={get:get,set:set,configurable:c,enumerable:e};return!options?desc:assign(normalizeOpts(options),desc)}},{"es5-ext/object/assign":19,"es5-ext/object/is-callable":22,"es5-ext/object/normalize-options":26,"es5-ext/string/#/contains":28}],19:[function(require,module,exports){"use strict";module.exports=require("./is-implemented")()?Object.assign:require("./shim")},{"./is-implemented":20,"./shim":21}],20:[function(require,module,exports){"use strict";module.exports=function(){var assign=Object.assign,obj;if(typeof assign!=="function")return false;obj={foo:"raz"};assign(obj,{bar:"dwa"},{trzy:"trzy"});return obj.foo+obj.bar+obj.trzy==="razdwatrzy"}},{}],21:[function(require,module,exports){"use strict";var keys=require("../keys"),value=require("../valid-value"),max=Math.max;module.exports=function(dest,src){var error,i,l=max(arguments.length,2),assign;dest=Object(value(dest));assign=function(key){try{dest[key]=src[key]}catch(e){if(!error)error=e}};for(i=1;i-1}},{}],31:[function(require,module,exports){"use strict";var d=require("d"),validateSymbol=require("./validate-symbol"),create=Object.create,defineProperties=Object.defineProperties,defineProperty=Object.defineProperty,objPrototype=Object.prototype,Symbol,HiddenSymbol,globalSymbols=create(null);var generateName=function(){var created=create(null);return function(desc){var postfix=0,name;while(created[desc+(postfix||"")])++postfix;desc+=postfix||"";created[desc]=true;name="@@"+desc;defineProperty(objPrototype,name,d.gs(null,function(value){defineProperty(this,name,d(value))}));return name}}();HiddenSymbol=function Symbol(description){if(this instanceof HiddenSymbol)throw new TypeError("TypeError: Symbol is not a constructor");return Symbol(description)};module.exports=Symbol=function Symbol(description){var symbol;if(this instanceof Symbol)throw new TypeError("TypeError: Symbol is not a constructor");symbol=create(HiddenSymbol.prototype);description=description===undefined?"":String(description);return defineProperties(symbol,{__description__:d("",description),__name__:d("",generateName(description))})};defineProperties(Symbol,{"for":d(function(key){if(globalSymbols[key])return globalSymbols[key];return globalSymbols[key]=Symbol(String(key))}),keyFor:d(function(s){var key;validateSymbol(s);for(key in globalSymbols)if(globalSymbols[key]===s)return key}),hasInstance:d("",Symbol("hasInstance")),isConcatSpreadable:d("",Symbol("isConcatSpreadable")),iterator:d("",Symbol("iterator")),match:d("",Symbol("match")),replace:d("",Symbol("replace")),search:d("",Symbol("search")),species:d("",Symbol("species")),split:d("",Symbol("split")),toPrimitive:d("",Symbol("toPrimitive")),toStringTag:d("",Symbol("toStringTag")),unscopables:d("",Symbol("unscopables"))});defineProperties(HiddenSymbol.prototype,{constructor:d(Symbol),toString:d("",function(){return this.__name__})});defineProperties(Symbol.prototype,{toString:d(function(){return"Symbol ("+validateSymbol(this).__description__+")"}),valueOf:d(function(){return validateSymbol(this)})});defineProperty(Symbol.prototype,Symbol.toPrimitive,d("",function(){return validateSymbol(this)}));defineProperty(Symbol.prototype,Symbol.toStringTag,d("c","Symbol"));defineProperty(HiddenSymbol.prototype,Symbol.toPrimitive,d("c",Symbol.prototype[Symbol.toPrimitive]));defineProperty(HiddenSymbol.prototype,Symbol.toStringTag,d("c",Symbol.prototype[Symbol.toStringTag]))},{"./validate-symbol":32,d:18}],32:[function(require,module,exports){"use strict";var isSymbol=require("./is-symbol");module.exports=function(value){if(!isSymbol(value))throw new TypeError(value+" is not a symbol");return value}},{"./is-symbol":17}],33:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],34:[function(require,module,exports){module.exports=function(obj){return!!(obj!=null&&obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj))}},{}],35:[function(require,module,exports){module.exports=extend;function extend(origin,add){if(!add||typeof add!=="object")return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin}},{}],36:[function(require,module,exports){"use strict";var GrammarDecl=require("./GrammarDecl");var pexprs=require("./pexprs");function Builder(){}Builder.prototype={newGrammar:function(name){return new GrammarDecl(name)},prim:function(x){return new pexprs.Prim(x)},range:function(from,to){return new pexprs.Range(from,to)},param:function(index){return new pexprs.Param(index)},alt:function(){var terms=[];for(var idx=0;idx0){return state.bindings[0]}return null},createConstructors:function(){var self=this;var constructors={};function makeConstructor(ruleName){return function(){return self.construct(ruleName,Array.prototype.slice.call(arguments))}}for(var ruleName in this.ruleBodies){constructors[ruleName]=makeConstructor(ruleName)}return constructors},isBuiltIn:function(){return this===Grammar.ProtoBuiltInRules||this===Grammar.BuiltInRules},_match:function(values,opts){var state=new State(this,values,opts);state.evalFromStart();return state},match:function(obj,optStartApplication){var state=this._match([obj],{startApplication:optStartApplication});return MatchResult.newFor(state)},trace:function(obj,optStartApplication){var state=this._match([obj],{startApplication:optStartApplication,trace:true});var rootTrace=state.trace[state.trace.length-1];rootTrace.state=state;rootTrace.result=MatchResult.newFor(state);return rootTrace},semantics:function(){return Semantics.createSemantics(this)},extendSemantics:function(superSemantics){return Semantics.createSemantics(this,superSemantics._getSemantics())},_checkTopDownActionDict:function(what,name,actionDict){function isSpecialAction(a){return a==="_iter"||a==="_terminal"||a==="_nonterminal"||a==="_default"}var problems=[];for(var k in actionDict){var v=actionDict[k];if(!isSpecialAction(k)&&!(k in this.ruleBodies)){problems.push("'"+k+"' is not a valid semantic action for '"+this.name+"'")}else if(typeof v!=="function"){problems.push("'"+k+"' must be a function in an action dictionary for '"+this.name+"'")}else{var actual=v.length;var expected=this._topDownActionArity(k);if(actual!==expected){problems.push("Semantic action '"+k+"' has the wrong arity: "+"expected "+expected+", got "+actual)}}}if(problems.length>0){var prettyProblems=problems.map(function(problem){return"- "+problem});var error=new Error("Found errors in the action dictionary of the '"+name+"' "+what+":\n"+prettyProblems.join("\n"));error.problems=problems;throw error}},_topDownActionArity:function(actionName){if(actionName==="_iter"||actionName==="_nonterminal"||actionName==="_default"){return 1}else if(actionName==="_terminal"){return 0}return this.ruleBodies[actionName].getArity()},_inheritsFrom:function(grammar){var g=this.superGrammar;while(g){if(g===grammar){return true}g=g.superGrammar}return false},toRecipe:function(optVarName){if(this.isBuiltIn()){throw new Error("Why would anyone want to generate a recipe for the "+this.name+" grammar?!?!")}var sb=new common.StringBuffer;if(optVarName){sb.append("var "+optVarName+" = ")}sb.append("(function() {\n");var superGrammarDecl="";if(!this.superGrammar.isBuiltIn()){sb.append(this.superGrammar.toRecipe("buildSuperGrammar"));superGrammarDecl=" .withSuperGrammar(buildSuperGrammar.call(this))\n"}sb.append(" var decl = this.newGrammar("+JSON.stringify(this.name)+")\n");if(this.definitionInterval){sb.append(" .withSource("+JSON.stringify(this.definitionInterval.contents)+")\n")}sb.append(superGrammarDecl);if(this.defaultStartRule){sb.append(' .withDefaultStartRule("'+this.defaultStartRule+'")\n')}sb.append(" return decl\n");var self=this;Object.keys(this.ruleBodies).forEach(function(ruleName){var body=self.ruleBodies[ruleName];sb.append(" .");if(self.superGrammar.ruleBodies[ruleName]){sb.append(body instanceof pexprs.Extend?"extend":"override")}else{sb.append("define")}var formals=self.ruleFormals[ruleName];var formalsString="["+formals.map(JSON.stringify).join(", ")+"]";sb.append("("+JSON.stringify(ruleName)+", "+formalsString+", ");body.outputRecipe(sb,formals,self.definitionInterval);if(!self.superGrammar.ruleBodies[ruleName]&&self.ruleDescriptions[ruleName]){sb.append(", "+JSON.stringify(self.ruleDescriptions[ruleName]))}sb.append(")\n")});sb.append(" .build();\n});\n");return sb.contents()},toOperationActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},toAttributeActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},_toOperationOrAttributeActionDictionaryTemplate:function(){var sb=new common.StringBuffer;sb.append("{");var first=true;for(var ruleName in this.ruleBodies){var body=this.ruleBodies[ruleName];if(first){first=false}else{sb.append(",")}sb.append("\n");sb.append(" ");this.addSemanticActionTemplate(ruleName,body,sb)}sb.append("\n}");return sb.contents()},addSemanticActionTemplate:function(ruleName,body,sb){sb.append(ruleName);sb.append(": function(");var arity=this._topDownActionArity(ruleName);sb.append(common.repeat("_",arity).join(", "));sb.append(") {\n");sb.append(" }")},parseApplication:function(str){var app;if(str.indexOf("<")===-1){app=new pexprs.Apply(str)}else{var cst=ohmGrammar.match(str,"Base_application");app=buildGrammar(cst,{})}if(!(app.ruleName in this.ruleBodies)){throw errors.undeclaredRule(app.ruleName,this.name)}else if(this.ruleFormals[app.ruleName].length!==app.args.length){throw errors.wrongNumberOfParameters(app.ruleName,this.ruleFormals[app.ruleName].length,app.args.length)}return app}};Grammar.ProtoBuiltInRules=new Grammar("ProtoBuiltInRules",undefined,{any:pexprs.any,end:pexprs.end,spaces:new pexprs.Star(new pexprs.Apply("space")),space:new pexprs.Range("\x00"," "),lower:new pexprs.UnicodeChar("Ll"),upper:new pexprs.UnicodeChar("Lu"),unicodeLtmo:new pexprs.UnicodeChar("Ltmo")},{any:[],end:[],spaces:[],space:[],lower:[],upper:[],unicodeLtmo:[]},{any:"any object",end:"end of input",space:"a space",lower:"a lowercase letter",upper:"an uppercase letter"});module.exports=Grammar},{"./MatchResult":42,"./Semantics":45,"./State":46,"./common":48,"./errors":49,"./pexprs":69}],39:[function(require,module,exports){"use strict";var Grammar=require("./Grammar");var InputStream=require("./InputStream");var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");function GrammarDecl(name){this.name=name}GrammarDecl.prototype.sourceInterval=function(startIdx,endIdx){var inputStream=this.interval.inputStream;return inputStream.interval(startIdx,endIdx)};GrammarDecl.prototype.ensureSuperGrammar=function(){if(!this.superGrammar){this.withSuperGrammar(this.name==="BuiltInRules"?Grammar.ProtoBuiltInRules:Grammar.BuiltInRules)}return this.superGrammar};GrammarDecl.prototype.installOverriddenOrExtendedRule=function(name,formals,body){var duplicateParameterNames=common.getDuplicates(formals);if(duplicateParameterNames.length>0){throw errors.duplicateParameterNames(name,duplicateParameterNames,body)}var expectedFormals=this.ensureSuperGrammar().ruleFormals[name];var expectedNumFormals=expectedFormals?expectedFormals.length:0;if(formals.length!==expectedNumFormals){throw errors.wrongNumberOfParameters(name,expectedNumFormals,formals.length,body)}return this.install(name,formals,body)};GrammarDecl.prototype.install=function(name,formals,body,optDescription){body=body.introduceParams(formals);this.ruleFormals[name]=formals;if(optDescription){this.ruleDescriptions[name]=optDescription}this.ruleBodies[name]=body;return this};GrammarDecl.prototype.withSuperGrammar=function(superGrammar){if(this.superGrammar){throw new Error("the super grammar of a GrammarDecl cannot be set more than once")}this.superGrammar=superGrammar;this.ruleBodies=Object.create(superGrammar.ruleBodies);this.ruleFormals=Object.create(superGrammar.ruleFormals);this.ruleDescriptions=Object.create(superGrammar.ruleDescriptions);if(!superGrammar.isBuiltIn()){this.defaultStartRule=superGrammar.defaultStartRule}return this};GrammarDecl.prototype.withDefaultStartRule=function(ruleName){this.defaultStartRule=ruleName;return this};GrammarDecl.prototype.withSource=function(source){this.interval=InputStream.newFor(source).interval(0,source.length);return this};GrammarDecl.prototype.build=function(){var grammar=new Grammar(this.name,this.ensureSuperGrammar(),this.ruleBodies,this.ruleFormals,this.ruleDescriptions,this.defaultStartRule);var grammarErrors=[];var grammarHasInvalidApplications=false;Object.keys(grammar.ruleBodies).forEach(function(ruleName){var body=grammar.ruleBodies[ruleName];try{body.assertChoicesHaveUniformArity(ruleName)}catch(e){grammarErrors.push(e)}try{body.assertAllApplicationsAreValid(ruleName,grammar)}catch(e){grammarErrors.push(e);grammarHasInvalidApplications=true}});if(!grammarHasInvalidApplications){Object.keys(grammar.ruleBodies).forEach(function(ruleName){var body=grammar.ruleBodies[ruleName];try{body.assertIteratedExprsAreNotNullable(grammar,ruleName)}catch(e){grammarErrors.push(e)}if(grammar.ruleFormals[ruleName].length===0){try{body.assertValuesAndStringsAreNotMixed(grammar,ruleName)}catch(e){grammarErrors.push(e)}}})}if(grammarErrors.length>0){errors.throwErrors(grammarErrors)}if(this.interval){grammar.definitionInterval=this.interval}return grammar};GrammarDecl.prototype.define=function(name,formals,body,optDescr){this.ensureSuperGrammar();if(this.superGrammar.ruleBodies[name]){throw errors.duplicateRuleDeclaration(name,this.name,this.superGrammar.name,body)}else if(this.ruleBodies[name]){throw errors.duplicateRuleDeclaration(name,this.name,this.name,body)}var duplicateParameterNames=common.getDuplicates(formals);if(duplicateParameterNames.length>0){throw errors.duplicateParameterNames(name,duplicateParameterNames,body)}return this.install(name,formals,body,optDescr)};GrammarDecl.prototype.override=function(name,formals,body){var baseRule=this.ensureSuperGrammar().ruleBodies[name];if(!baseRule){throw errors.cannotOverrideUndeclaredRule(name,this.superGrammar.name,body)}this.installOverriddenOrExtendedRule(name,formals,body);return this};GrammarDecl.prototype.extend=function(name,formals,fragment){var baseRule=this.ensureSuperGrammar().ruleBodies[name];if(!baseRule){throw errors.cannotExtendUndeclaredRule(name,this.superGrammar.name,fragment)}var body=new pexprs.Extend(this.superGrammar,name,fragment);body.interval=fragment.interval;this.installOverriddenOrExtendedRule(name,formals,body);return this};module.exports=GrammarDecl},{"./Grammar":38,"./InputStream":40,"./common":48,"./errors":49,"./pexprs":69}],40:[function(require,module,exports){"use strict";var inherits=require("inherits");var common=require("./common");var Interval=require("./Interval");function InputStream(){throw new Error("InputStream cannot be instantiated -- it's abstract")}InputStream.newFor=function(arrOrStr){return Array.isArray(arrOrStr)?new ListInputStream(arrOrStr):new StringInputStream(arrOrStr)};InputStream.prototype={init:function(source){this.source=source;this.pos=0;this.posInfos=[]},atEnd:function(){return this.pos===this.source.length},next:function(){if(this.atEnd()){return common.fail}else{return this.source[this.pos++]}},matchExactly:function(x){return this.next()===x?true:common.fail},sourceSlice:function(startIdx,endIdx){return this.source.slice(startIdx,endIdx)},interval:function(startIdx,optEndIdx){return new Interval(this,startIdx,optEndIdx?optEndIdx:this.pos)}};function StringInputStream(source){this.init(source)}inherits(StringInputStream,InputStream);StringInputStream.prototype.matchString=function(s){for(var idx=0;idx=that.startIdx&&this.endIdx<=that.endIdx,"other interval does not cover this one");return new Interval(newInputStream,this.startIdx-that.startIdx,this.endIdx-that.startIdx)},trimmed:function(){var contents=this.contents;var startIdx=this.startIdx+contents.match(/^\s*/)[0].length;var endIdx=this.endIdx-contents.match(/\s*$/)[0].length;return new Interval(this.inputStream,startIdx,endIdx)}};Object.defineProperties(Interval.prototype,{contents:{get:function(){if(this._contents===undefined){this._contents=this.inputStream.sourceSlice(this.startIdx,this.endIdx)}return this._contents},enumerable:true}});module.exports=Interval},{"./common":48,"./errors":49,"./util":70}],42:[function(require,module,exports){"use strict";var inherits=require("inherits");var common=require("./common");var nodes=require("./nodes");var util=require("./util");var Interval=require("./Interval");function getShortMatchErrorMessage(pos,source,detail){var errorInfo=util.getLineAndColumn(source,pos);return"Line "+errorInfo.lineNum+", col "+errorInfo.colNum+": "+detail}function MatchResult(state){this.state=state;this._cst=state.bindings[0]}MatchResult.newFor=function(state){var succeeded=state.bindings.length>0;return succeeded?new MatchResult(state):new MatchFailure(state)};MatchResult.prototype.failed=function(){return false};MatchResult.prototype.succeeded=function(){return!this.failed()};MatchResult.prototype.getDiscardedSpaces=function(){if(this.failed()){ -return[]}var state=this.state;var grammar=state.grammar;var inputStream=state.inputStream;var intervals=[new Interval(inputStream,0,inputStream.source.length)];var s=grammar.semantics().addOperation("subtractTerminals",{_nonterminal:function(children){children.forEach(function(child){child.subtractTerminals()})},_terminal:function(){var t=this;intervals=intervals.map(function(interval){return interval.minus(t.interval)}).reduce(function(xs,ys){return xs.concat(ys)},[])}});s(this).subtractTerminals();s.addOperation("fixIntervals(idxOffset)",{_default:function(children){var idxOffset=this.args.idxOffset;this.interval.inputStream=inputStream;this.interval.startIdx+=idxOffset;this.interval.endIdx+=idxOffset;if(!this.isTerminal()){children.forEach(function(child){child.fixIntervals(idxOffset)})}}});var discardedNodes=intervals.map(function(interval){var r=grammar.match(interval.contents,"spaces");s(r).fixIntervals(interval.startIdx);return r._cst});discardedNodes=new nodes.IterationNode(grammar,discardedNodes,discardedNodes.length===0?new Interval(inputStream,0,0):new Interval(inputStream,discardedNodes[0].interval.startIdx,discardedNodes[discardedNodes.length-1].interval.endIdx));var r=Object.create(this);r._cst=discardedNodes;r.getDiscardedSpaces=function(){return r};return r};function MatchFailure(state){this.state=state;common.defineLazyProperty(this,"_failures",function(){return this.state.getFailures()});common.defineLazyProperty(this,"message",function(){var source=this.state.inputStream.source;if(typeof source!=="string"){return"match failed at position "+this.getRightmostFailurePosition()}var detail="Expected "+this.getExpectedText();return util.getLineAndColumnMessage(source,this.getRightmostFailurePosition())+detail});common.defineLazyProperty(this,"shortMessage",function(){if(typeof this.state.inputStream.source!=="string"){return"match failed at position "+this.getRightmostFailurePosition()}var detail="expected "+this.getExpectedText();return getShortMatchErrorMessage(this.getRightmostFailurePosition(),this.state.inputStream.source,detail)})}inherits(MatchFailure,MatchResult);MatchFailure.prototype.toString=function(){return"[MatchFailure at position "+this.getRightmostFailurePosition()+"]"};MatchFailure.prototype.failed=function(){return true};MatchFailure.prototype.getRightmostFailurePosition=function(){return this.state.getRightmostFailurePosition()};MatchFailure.prototype.getRightmostFailures=function(){return this._failures};MatchFailure.prototype.getExpectedText=function(){var sb=new common.StringBuffer;var failures=this.getRightmostFailures();failures=failures.filter(function(failure){return!failure.isFluffy()});for(var idx=0;idx0){if(idx===failures.length-1){sb.append(failures.length>2?", or ":" or ")}else{sb.append(", ")}}sb.append(failures[idx].toString())}return sb.contents()};MatchFailure.prototype.getInterval=function(){var pos=this.state.getRightmostFailurePosition();return new Interval(this.state.inputStream,pos,pos)};module.exports=MatchResult},{"./Interval":41,"./common":48,"./nodes":51,"./util":70,inherits:33}],43:[function(require,module,exports){"use strict";var extend=require("util-extend");function Namespace(){}Namespace.prototype=Object.create(null);Namespace.asNamespace=function(objOrNamespace){if(objOrNamespace instanceof Namespace){return objOrNamespace}return Namespace.createNamespace(objOrNamespace)};Namespace.createNamespace=function(optProps){return Namespace.extend(Namespace.prototype,optProps)};Namespace.extend=function(namespace,optProps){if(namespace!==Namespace.prototype&&!(namespace instanceof Namespace)){throw new TypeError("not a Namespace object: "+namespace)}var ns=Object.create(namespace,{constructor:{value:Namespace,enumerable:false,writable:true,configurable:true}});return extend(ns,optProps)};Namespace.toString=function(ns){return Object.prototype.toString.call(ns)};module.exports=Namespace},{"util-extend":35}],44:[function(require,module,exports){"use strict";function PosInfo(state){this.state=state;this.applicationMemoKeyStack=[];this.memo={};this.currentLeftRecursion=undefined}PosInfo.prototype={isActive:function(application){return this.applicationMemoKeyStack.indexOf(application.toMemoKey())>=0},enter:function(application){this.state.enter(application);this.applicationMemoKeyStack.push(application.toMemoKey())},exit:function(){this.state.exit();this.applicationMemoKeyStack.pop()},startLeftRecursion:function(headApplication,memoRec){memoRec.isLeftRecursion=true;memoRec.headApplication=headApplication;memoRec.nextLeftRecursion=this.currentLeftRecursion;this.currentLeftRecursion=memoRec;var applicationMemoKeyStack=this.applicationMemoKeyStack;var indexOfFirstInvolvedRule=applicationMemoKeyStack.indexOf(headApplication.toMemoKey())+1;var involvedApplicationMemoKeys=applicationMemoKeyStack.slice(indexOfFirstInvolvedRule);memoRec.isInvolved=function(applicationMemoKey){return involvedApplicationMemoKeys.indexOf(applicationMemoKey)>=0};memoRec.updateInvolvedApplicationMemoKeys=function(){for(var idx=indexOfFirstInvolvedRule;idxnewLength){this.bindings.pop()}},pushInputStream:function(inputStream){this.inputStreamStack.push(this.inputStream);this.posInfosStack.push(this.posInfos);this.inputStream=inputStream;this.posInfos=[]},popInputStream:function(){this.inputStream=this.inputStreamStack.pop();this.posInfos=this.posInfosStack.pop()},getCurrentPosInfo:function(){return this.getPosInfo(this.inputStream.pos)},getPosInfo:function(pos){var posInfo=this.posInfos[pos];return posInfo||(this.posInfos[pos]=new PosInfo(this))},processFailure:function(pos,expr){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){if(pos>this.rightmostFailurePosition){this.rightmostFailurePosition=pos}}else if(pos===this.rightmostFailurePosition){this.addRightmostFailure(expr.toFailure(this.grammar),false)}},ensureRightmostFailures:function(){if(!this.rightmostFailures){this.rightmostFailures=Object.create(null)}},addRightmostFailure:function(failure,shouldCloneIfNew){this.ensureRightmostFailures();var key=failure.toKey();if(!this.rightmostFailures[key]){this.rightmostFailures[key]=shouldCloneIfNew?failure.clone():failure}else if(this.rightmostFailures[key].isFluffy()&&!failure.isFluffy()){this.rightmostFailures[key].clearFluffy()}},addRightmostFailures:function(failures,shouldCloneIfNew){var self=this;Object.keys(failures).forEach(function(key){self.addRightmostFailure(failures[key],shouldCloneIfNew)})},cloneRightmostFailures:function(){if(!this.rightmostFailures){return undefined}var ans=Object.create(null);var self=this;Object.keys(this.rightmostFailures).forEach(function(key){ans[key]=self.rightmostFailures[key].clone()});return ans},getRightmostFailurePosition:function(){return this.rightmostFailurePosition},getFailures:function(){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){this.init(RM_RIGHTMOST_FAILURES);this.evalFromStart()}this.ensureRightmostFailures();var self=this;return Object.keys(this.rightmostFailures).map(function(key){return self.rightmostFailures[key]})},getMemoizedTraceEntry:function(pos,expr){var posInfo=this.posInfos[pos];if(posInfo&&expr.ruleName){var memoRec=posInfo.memo[expr.toMemoKey()];if(memoRec){return memoRec.traceEntry}}return null},getTraceEntry:function(pos,expr,succeeded,bindings){var memoEntry=this.getMemoizedTraceEntry(pos,expr);return memoEntry?memoEntry.cloneWithExpr(expr):new Trace(this.inputStream,pos,expr,succeeded,bindings,this.trace)},isTracing:function(){return this.tracingEnabled},useMemoizedResult:function(memoRec){if(this.isTracing()){this.trace.push(memoRec.traceEntry)}if(this.recordingMode===RM_RIGHTMOST_FAILURES&&memoRec.failuresAtRightmostPosition){this.addRightmostFailures(memoRec.failuresAtRightmostPosition,true)}if(memoRec.value){this.inputStream.pos=memoRec.pos;this.bindings.push(memoRec.value);return true}return false},eval:function(expr){var inputStream=this.inputStream;var origNumBindings=this.bindings.length;if(this.recordingMode===RM_RIGHTMOST_FAILURES){var origFailures=this.rightmostFailures;this.rightmostFailures=undefined}var origPos=inputStream.pos;var memoPos=this.maybeSkipSpacesBefore(expr);if(this.isTracing()){var origTrace=this.trace;this.trace=[]}var ans=expr.eval(this);if(this.isTracing()){var bindings=this.bindings.slice(origNumBindings);var traceEntry=this.getTraceEntry(memoPos,expr,ans,bindings);traceEntry.isImplicitSpaces=expr===applySpaces;traceEntry.isRootNode=expr===this.startExpr;origTrace.push(traceEntry);this.trace=origTrace}if(ans){if(this.rightmostFailures&&(inputStream.pos===this.rightmostFailurePosition||this.skipSpacesIfInSyntacticContext()===this.rightmostFailurePosition)){var self=this;Object.keys(this.rightmostFailures).forEach(function(key){self.rightmostFailures[key].makeFluffy()})}}else{inputStream.pos=origPos;this.truncateBindings(origNumBindings)}if(this.recordingMode===RM_RIGHTMOST_FAILURES&&origFailures){this.addRightmostFailures(origFailures,false)}return ans},_getStartExpr:function(grammar,optStartApplication){var applicationStr=optStartApplication||grammar.defaultStartRule;if(!applicationStr){throw new Error("Missing start rule argument -- the grammar has no default start rule.")}var startApp=grammar.parseApplication(applicationStr);return new pexprs.Seq([startApp,pexprs.end])},evalFromStart:function(){this.eval(this.startExpr)},getFailuresInfo:function(){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){return this.rightmostFailurePosition}else{return this.rightmostFailures}},restoreFailuresInfo:function(failuresInfo){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){this.rightmostFailurePosition=failuresInfo}else{this.rightmostFailures=failuresInfo}}};module.exports=State},{"./PosInfo":44,"./Trace":47,"./pexprs":69}],47:[function(require,module,exports){"use strict";var Interval=require("./Interval");var common=require("./common");var BALLOT_X="✗";var CHECK_MARK="✓";var DOT_OPERATOR="⋅";var RIGHTWARDS_DOUBLE_ARROW="⇒";var SYMBOL_FOR_HORIZONTAL_TABULATION="␉";var SYMBOL_FOR_LINE_FEED="␊";var SYMBOL_FOR_CARRIAGE_RETURN="␍";function spaces(n){return common.repeat(" ",n).join("")}function getInputExcerpt(inputStream,pos,len){var excerpt=asEscapedString(inputStream.sourceSlice(pos,pos+len));if(excerpt.length0){arr.push(fn())}return arr};exports.repeatStr=function(str,n){return new Array(n+1).join(str)};exports.repeat=function(x,n){return exports.repeatFn(function(){return x},n)};exports.getDuplicates=function(array){var duplicates=[];for(var idx=0;idx1){throw multipleErrors(errors)}}}},{"./Namespace":43}],50:[function(require,module,exports){"use strict";var Builder=require("./Builder");var Grammar=require("./Grammar");var Namespace=require("./Namespace");var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");var util=require("./util");var isBuffer=require("is-buffer");var ohmGrammar;var documentInterface={querySelector:function(sel){return document.querySelector(sel)},querySelectorAll:function(sel){return document.querySelectorAll(sel)}};function isElement(obj){return!!(obj&&obj.nodeType===1)}function isUndefined(obj){return obj===void 0}var MAX_ARRAY_INDEX=Math.pow(2,53)-1;function isArrayLike(obj){if(obj==null){return false}var length=obj.length;return typeof length==="number"&&length>=0&&length<=MAX_ARRAY_INDEX}function load(url){var req=new XMLHttpRequest;req.open("GET",url,false);try{req.send();if(req.status===0||req.status===200){return req.responseText}}catch(e){}throw new Error("unable to load url "+url)}function buildGrammar(match,namespace,optOhmGrammarForTesting){var builder=new Builder;var decl;var currentRuleName;var currentRuleFormals;var overriding=false;var metaGrammar=optOhmGrammarForTesting||ohmGrammar;var helpers=metaGrammar.semantics().addOperation("visit",{Grammar:function(n,s,open,rs,close){var grammarName=n.visit();decl=builder.newGrammar(grammarName,namespace);s.visit();rs.visit();var g=decl.build();g.definitionInterval=this.interval.trimmed();if(grammarName in namespace){throw errors.duplicateGrammarDeclaration(g,namespace)}namespace[grammarName]=g;return g},SuperGrammar:function(_,n){var superGrammarName=n.visit();if(superGrammarName==="null"){decl.withSuperGrammar(null)}else{if(!namespace||!(superGrammarName in namespace)){throw errors.undeclaredGrammar(superGrammarName,namespace,n.interval)}decl.withSuperGrammar(namespace[superGrammarName])}},Rule_define:function(n,fs,d,_equals,_optBar,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];if(!decl.defaultStartRule&&decl.ensureSuperGrammar()!==Grammar.ProtoBuiltInRules){decl.withDefaultStartRule(currentRuleName)}var body=b.visit();body.definitionInterval=this.interval.trimmed();var description=d.visit()[0];return decl.define(currentRuleName,currentRuleFormals,body,description)},Rule_override:function(n,fs,_colonEquals,_optBar,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];overriding=true;var body=b.visit();body.definitionInterval=this.interval.trimmed();var ans=decl.override(currentRuleName,currentRuleFormals,body);overriding=false;return ans},Rule_extend:function(n,fs,_plusEquals,_optBar,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];var body=b.visit();var ans=decl.extend(currentRuleName,currentRuleFormals,body);decl.ruleBodies[currentRuleName].definitionInterval=this.interval.trimmed();return ans},Formals:function(opointy,fs,cpointy){return fs.visit()},Params:function(opointy,ps,cpointy){return ps.visit()},Alt:function(term,_,terms){var args=[term.visit()].concat(terms.visit());return builder.alt.apply(builder,args).withInterval(this.interval)},Term_inline:function(b,n){var inlineRuleName=currentRuleName+"_"+n.visit();var body=b.visit();body.definitionInterval=this.interval.trimmed();var isNewRuleDeclaration=!(decl.superGrammar&&decl.superGrammar.ruleBodies[inlineRuleName]);if(overriding&&!isNewRuleDeclaration){decl.override(inlineRuleName,currentRuleFormals,body)}else{decl.define(inlineRuleName,currentRuleFormals,body)}var params=currentRuleFormals.map(function(formal){return builder.app(formal)});return builder.app(inlineRuleName,params).withInterval(body.interval)},Seq:function(expr){return builder.seq.apply(builder,expr.visit()).withInterval(this.interval)},Iter_star:function(x,_){return builder.star(x.visit()).withInterval(this.interval)},Iter_plus:function(x,_){return builder.plus(x.visit()).withInterval(this.interval)},Iter_opt:function(x,_){return builder.opt(x.visit()).withInterval(this.interval)},Pred_not:function(_,x){return builder.not(x.visit()).withInterval(this.interval)},Pred_lookahead:function(_,x){return builder.la(x.visit()).withInterval(this.interval)},Modifier_lex:function(_,x){return builder.lex(x.visit()).withInterval(this.interval)},Modifier_val:function(_,x){return builder.val(x.visit()).withInterval(this.interval)},Base_application:function(rule,ps){return builder.app(rule.visit(),ps.visit()[0]||[]).withInterval(this.interval)},Base_range:function(from,_,to){return builder.range(from.visit(),to.visit()).withInterval(this.interval)},Base_prim:function(expr){return builder.prim(expr.visit()).withInterval(this.interval)},Base_paren:function(open,x,close){return x.visit()},Base_arr:function(open,x,close){return builder.arr(x.visit()).withInterval(this.interval)},Base_obj:function(open,lenient,close){return builder.obj([],lenient.visit()[0])},Base_objWithProps:function(open,ps,_,lenient,close){return builder.obj(ps.visit(),lenient.visit()[0]).withInterval(this.interval)},Props:function(p,_,ps){return[p.visit()].concat(ps.visit())},Prop:function(n,_,p){return{name:n.visit(),pattern:p.visit()}},ruleDescr:function(open,t,close){return t.visit()},ruleDescrText:function(_){return this.interval.contents.trim()},caseName:function(_,space1,n,space2,end){return n.visit()},name:function(first,rest){return this.interval.contents},nameFirst:function(expr){},nameRest:function(expr){},keyword_null:function(_){return null},keyword_true:function(_){return true},keyword_false:function(_){return false},string:function(open,cs,close){return cs.visit().map(function(c){return common.unescapeChar(c)}).join("")},strChar:function(_){return this.interval.contents},escapeChar:function(_){return this.interval.contents},number:function(_,digits){return parseInt(this.interval.contents)},NonemptyListOf:function(x,_,xs){return[x.visit()].concat(xs.visit())},EmptyListOf:function(){return[]},_terminal:function(){return this.primitiveValue}});return helpers(match).visit()}function compileAndLoad(source,namespace){var m=ohmGrammar.match(source,"Grammars");if(m.failed()){throw errors.grammarSyntaxError(m)}return buildGrammar(m,namespace)}function getScriptElementContents(el){if(!isElement(el)){throw new TypeError("Expected a DOM Node, got "+common.unexpectedObjToString(el))}if(el.type!=="text/ohm-js"){throw new Error('Expected a script tag with type="text/ohm-js", got '+el)}return el.getAttribute("src")?load(el.getAttribute("src")):el.innerHTML}function grammar(source,optNamespace){var ns=grammars(source,optNamespace);var grammarNames=Object.keys(ns);if(grammarNames.length===0){throw new Error("Missing grammar definition")}else if(grammarNames.length>1){var secondGrammar=ns[grammarNames[1]];var interval=secondGrammar.definitionInterval;throw new Error(util.getLineAndColumnMessage(interval.inputStream.source,interval.startIdx)+"Found more than one grammar definition -- use ohm.grammars() instead.")}return ns[grammarNames[0]]}function grammars(source,optNamespace){var ns=Namespace.extend(Namespace.asNamespace(optNamespace));if(typeof source!=="string"){if(isBuffer(source)){source=source.toString()}else{throw new TypeError("Expected string as first argument, got "+common.unexpectedObjToString(source))}}compileAndLoad(source,ns);return ns}function grammarFromScriptElement(optNode){var node=optNode;if(isUndefined(node)){var nodeList=documentInterface.querySelectorAll('script[type="text/ohm-js"]');if(nodeList.length!==1){throw new Error('Expected exactly one script tag with type="text/ohm-js", found '+nodeList.length)}node=nodeList[0]}return grammar(getScriptElementContents(node))}function grammarsFromScriptElements(optNodeOrNodeList){if(isElement(optNodeOrNodeList)){return grammars(optNodeOrNodeList)}var nodeList=optNodeOrNodeList;if(isUndefined(nodeList)){nodeList=documentInterface.querySelectorAll('script[type="text/ohm-js"]')}else if(typeof nodeList==="string"||!isElement(nodeList)&&!isArrayLike(nodeList)){throw new TypeError("Expected a Node, NodeList, or Array, but got "+nodeList)}var ns=Namespace.createNamespace();for(var i=0;i0};Node.prototype.hasNoChildren=function(){return!this.hasChildren()};Node.prototype.onlyChild=function(){if(this.children.length!==1){throw new Error("cannot get only child of a node of type "+this.ctorName+" (it has "+this.numChildren()+" children)")}else{return this.firstChild()}};Node.prototype.firstChild=function(){if(this.hasNoChildren()){throw new Error("cannot get first child of a "+this.ctorName+" node, which has no children")}else{return this.childAt(0)}};Node.prototype.lastChild=function(){if(this.hasNoChildren()){throw new Error("cannot get last child of a "+this.ctorName+" node, which has no children")}else{return this.childAt(this.numChildren()-1)}};Node.prototype.childBefore=function(child){var childIdx=this.indexOfChild(child);if(childIdx<0){throw new Error("Node.childBefore() called w/ an argument that is not a child")}else if(childIdx===0){throw new Error("cannot get child before first child")}else{return this.childAt(childIdx-1)}};Node.prototype.childAfter=function(child){var childIdx=this.indexOfChild(child);if(childIdx<0){throw new Error("Node.childAfter() called w/ an argument that is not a child")}else if(childIdx===this.numChildren()-1){throw new Error("cannot get child after last child")}else{return this.childAt(childIdx+1)}};Node.prototype.isTerminal=function(){return false};Node.prototype.isNonterminal=function(){return false};Node.prototype.isIteration=function(){return false};Node.prototype.isOptional=function(){return false};Node.prototype.toJSON=function(){var r={};r[this.ctorName]=this.children;return r};function TerminalNode(grammar,value,interval){Node.call(this,grammar,"_terminal",[],interval);this.primitiveValue=value}inherits(TerminalNode,Node);TerminalNode.prototype.isTerminal=function(){return true};function NonterminalNode(grammar,ruleName,children,interval){Node.call(this,grammar,ruleName,children,interval)}inherits(NonterminalNode,Node);NonterminalNode.prototype.isNonterminal=function(){return true};NonterminalNode.prototype.isLexical=function(){return common.isLexical(this.ctorName)};NonterminalNode.prototype.isSyntactic=function(){return common.isSyntactic(this.ctorName)};function IterationNode(grammar,children,interval,optional){Node.call(this,grammar,"_iter",children,interval);this.optional=optional}inherits(IterationNode,Node);IterationNode.prototype.isIteration=function(){return true};IterationNode.prototype.isOptional=function(){return this.optional};module.exports={Node:Node,TerminalNode:TerminalNode,NonterminalNode:NonterminalNode,IterationNode:IterationNode}},{"./common":48,inherits:33}],52:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.allowsSkippingPrecedingSpace=common.abstract;pexprs.any.allowsSkippingPrecedingSpace=pexprs.end.allowsSkippingPrecedingSpace=pexprs.Apply.prototype.allowsSkippingPrecedingSpace=pexprs.Prim.prototype.allowsSkippingPrecedingSpace=pexprs.Range.prototype.allowsSkippingPrecedingSpace=pexprs.UnicodeChar.prototype.allowsSkippingPrecedingSpace=function(){return true};pexprs.Alt.prototype.allowsSkippingPrecedingSpace=pexprs.Arr.prototype.allowsSkippingPrecedingSpace=pexprs.Iter.prototype.allowsSkippingPrecedingSpace=pexprs.Lex.prototype.allowsSkippingPrecedingSpace=pexprs.Lookahead.prototype.allowsSkippingPrecedingSpace=pexprs.Not.prototype.allowsSkippingPrecedingSpace=pexprs.Obj.prototype.allowsSkippingPrecedingSpace=pexprs.Param.prototype.allowsSkippingPrecedingSpace=pexprs.Seq.prototype.allowsSkippingPrecedingSpace=pexprs.Value.prototype.allowsSkippingPrecedingSpace=function(){return false}},{"./common":48,"./pexprs":69}],53:[function(require,module,exports){"use strict";var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");var lexifyCount;pexprs.PExpr.prototype.assertAllApplicationsAreValid=function(ruleName,grammar){lexifyCount=0;this._assertAllApplicationsAreValid(ruleName,grammar)};pexprs.PExpr.prototype._assertAllApplicationsAreValid=common.abstract;pexprs.any._assertAllApplicationsAreValid=pexprs.end._assertAllApplicationsAreValid=pexprs.Prim.prototype._assertAllApplicationsAreValid=pexprs.Range.prototype._assertAllApplicationsAreValid=pexprs.Param.prototype._assertAllApplicationsAreValid=pexprs.UnicodeChar.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){};pexprs.Lex.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){lexifyCount++;this.expr._assertAllApplicationsAreValid(ruleName,grammar);lexifyCount--};pexprs.Alt.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){for(var idx=0;idx0)){throw errors.applicationOfSyntacticRuleFromLexicalContext(this.ruleName,this)}var actual=this.args.length;var expected=grammar.ruleFormals[this.ruleName].length;if(actual!==expected){throw errors.wrongNumberOfArguments(this.ruleName,expected,actual,this)}var self=this;this.args.forEach(function(arg){arg._assertAllApplicationsAreValid(ruleName,grammar);if(arg.getArity()!==1){throw errors.invalidParameter(self.ruleName,arg)}})}},{"./common":48,"./errors":49,"./pexprs":69}],54:[function(require,module,exports){"use strict";var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");pexprs.PExpr.prototype.assertChoicesHaveUniformArity=common.abstract;pexprs.any.assertChoicesHaveUniformArity=pexprs.end.assertChoicesHaveUniformArity=pexprs.Prim.prototype.assertChoicesHaveUniformArity=pexprs.Range.prototype.assertChoicesHaveUniformArity=pexprs.Param.prototype.assertChoicesHaveUniformArity=pexprs.Lex.prototype.assertChoicesHaveUniformArity=pexprs.UnicodeChar.prototype.assertChoicesHaveUniformArity=function(ruleName){};pexprs.Alt.prototype.assertChoicesHaveUniformArity=function(ruleName){if(this.terms.length===0){return}var arity=this.terms[0].getArity();for(var idx=0;idx=1};pexprs.end.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&vals[0].primitiveValue===undefined};pexprs.Prim.prototype.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&vals[0].primitiveValue===this.obj};pexprs.Range.prototype.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&typeof vals[0].primitiveValue===typeof this.from};pexprs.Param.prototype.check=function(grammar,vals){return vals.length>=1};pexprs.Alt.prototype.check=function(grammar,vals){for(var i=0;i1){var node=inputStream.next();if(node instanceof nodes.Node&&node.grammar===state.grammar&&node.ctorName===this.ruleName){return node}else{inputStream.pos=origPos}}if(state.eval(expr)){var arity=expr.getArity();var bindings=state.bindings.splice(state.bindings.length-arity,arity);var ans=new NonterminalNode(state.grammar,this.ruleName,bindings,inputStream.interval(origPos));return ans}else{return false}};pexprs.Apply.prototype.growSeedResult=function(body,state,origPos,lrMemoRec,newValue){if(!newValue){return false}var inputStream=state.inputStream;while(true){lrMemoRec.pos=inputStream.pos;lrMemoRec.value=newValue;lrMemoRec.failuresAtRightmostPosition=state.cloneRightmostFailures();if(state.isTracing()){var children=state.trace.slice(-1);lrMemoRec.traceEntry=new Trace(state.inputStream,origPos,this,true,[newValue],children)}inputStream.pos=origPos;newValue=this.evalOnce(body,state);if(inputStream.pos<=lrMemoRec.pos){break}}if(state.isTracing()){state.trace.pop();lrMemoRec.traceEntry=null}inputStream.pos=lrMemoRec.pos;return lrMemoRec.value};pexprs.UnicodeChar.prototype.eval=function(state){var inputStream=state.inputStream;var origPos=inputStream.pos;var value=inputStream.next();if(value===common.fail||!this.pattern.test(value)){state.processFailure(origPos,this);return false}else{var interval=inputStream.interval(origPos);state.bindings.push(new TerminalNode(state.grammar,value,interval));return true}}},{"./InputStream":40,"./Trace":47,"./common":48,"./nodes":51,"./pexprs":69}],59:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.getArity=common.abstract;pexprs.any.getArity=pexprs.end.getArity=pexprs.Prim.prototype.getArity=pexprs.Range.prototype.getArity=pexprs.Param.prototype.getArity=pexprs.Apply.prototype.getArity=pexprs.UnicodeChar.prototype.getArity=function(){return 1};pexprs.Alt.prototype.getArity=function(){return this.terms.length===0?0:this.terms[0].getArity()};pexprs.Seq.prototype.getArity=function(){var arity=0;for(var idx=0;idx=0){if(this.args.length>0){throw new Error("Parameterized rules cannot be passed as arguments to another rule.")}return new pexprs.Param(index)}else{this.args.forEach(function(arg,idx,args){args[idx]=arg.introduceParams(formals)});return this}}},{"./common":48,"./pexprs":69}],62:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.isNullable=function(grammar){return this._isNullable(grammar,Object.create(null))};pexprs.PExpr.prototype._isNullable=common.abstract;pexprs.any._isNullable=pexprs.Range.prototype._isNullable=pexprs.Param.prototype._isNullable=pexprs.Plus.prototype._isNullable=pexprs.Value.prototype._isNullable=pexprs.Arr.prototype._isNullable=pexprs.Obj.prototype._isNullable=pexprs.UnicodeChar.prototype._isNullable=function(grammar,memo){return false};pexprs.end._isNullable=function(grammar,memo){return true};pexprs.Prim.prototype._isNullable=function(grammar,memo){if(typeof this.obj==="string"){return this.obj===""}else{return false}};pexprs.Alt.prototype._isNullable=function(grammar,memo){return this.terms.length===0||this.terms.some(function(term){return term._isNullable(grammar,memo)})};pexprs.Seq.prototype._isNullable=function(grammar,memo){return this.factors.every(function(factor){return factor._isNullable(grammar,memo)})};pexprs.Star.prototype._isNullable=pexprs.Opt.prototype._isNullable=pexprs.Not.prototype._isNullable=pexprs.Lookahead.prototype._isNullable=function(grammar,memo){return true};pexprs.Lex.prototype._isNullable=function(grammar,memo){return this.expr._isNullable(grammar,memo)};pexprs.Apply.prototype._isNullable=function(grammar,memo){var key=this.toMemoKey();if(!Object.prototype.hasOwnProperty.call(memo,key)){var body=grammar.ruleBodies[this.ruleName];var inlined=body.substituteParams(this.args);memo[key]=false;memo[key]=inlined._isNullable(grammar,memo)}return memo[key]}},{"./common":48,"./pexprs":69}],63:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");function escapeString(str){var output=JSON.stringify(str);output=output.replace(/[\u2028\u2029]/g,function(char,pos,str){var hex=char.codePointAt(0).toString(16);return"\\u"+"0000".slice(hex.length)+hex});return output}function getIntervalInfo(expr,grammarInterval){if(expr.interval&&grammarInterval){var adjusted=expr.interval.relativeTo(grammarInterval);var start=adjusted.startIdx;var end=adjusted.endIdx;return".withInterval(decl.sourceInterval("+start+", "+end+"))"}return""}pexprs.PExpr.prototype.outputRecipe=common.abstract;pexprs.any.outputRecipe=function(sb,formals,grammarInterval){throw new Error("should never output a recipe for `any` expression")};pexprs.end.outputRecipe=function(sb,formals,grammarInterval){throw new Error("should never output a recipe for `end` expression")};pexprs.Prim.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.prim(");sb.append(typeof this.obj==="string"?escapeString(this.obj):""+this.obj);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Range.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.range(");sb.append(JSON.stringify(this.from));sb.append(", ");sb.append(JSON.stringify(this.to));sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Param.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.param("+this.index+")"+getIntervalInfo(this,grammarInterval))};pexprs.Alt.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.alt(");for(var idx=0;idx0){sb.append(", ")}this.terms[idx].outputRecipe(sb,formals,grammarInterval)}sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Extend.prototype.outputRecipe=function(sb,formals,grammarInterval){var extension=this.terms[0];extension.outputRecipe(sb,formals,grammarInterval)};pexprs.Seq.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.seq(");for(var idx=0;idx0){sb.append(", ")}this.factors[idx].outputRecipe(sb,formals,grammarInterval)}sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Star.prototype.outputRecipe=pexprs.Plus.prototype.outputRecipe=pexprs.Opt.prototype.outputRecipe=pexprs.Not.prototype.outputRecipe=pexprs.Lex.prototype.outputRecipe=pexprs.Arr.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this."+this.constructor.name.toLowerCase()+"(");this.expr.outputRecipe(sb,formals,grammarInterval);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Lookahead.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.la(");this.expr.outputRecipe(sb,formals,grammarInterval);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Value.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.val(");this.expr.outputRecipe(sb,formals,grammarInterval);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Obj.prototype.outputRecipe=function(sb,formals,grammarInterval){function outputPropertyRecipe(prop){sb.append("{name: ");sb.append(JSON.stringify(prop.name));sb.append(", pattern: ");prop.pattern.outputRecipe(sb,formals,grammarInterval);sb.append("}")}sb.append("this.obj([");for(var idx=0;idx0){sb.append(", ")}outputPropertyRecipe(this.properties[idx])}sb.append("], ");sb.append(!!this.isLenient);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Apply.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.app(");sb.append(JSON.stringify(this.ruleName));if(this.ruleName.indexOf("_")>=0&&formals.length>0){var apps=formals.map(function(_,idx){return"this.param("+idx+")"});sb.append(", ["+apps.join(", ")+"]")}else if(this.args.length>0){sb.append(", [");this.args.forEach(function(arg,idx){if(idx>0){sb.append(", ")}arg.outputRecipe(sb,formals,grammarInterval)});sb.append("]")}sb.append(")"+getIntervalInfo(this,grammarInterval))}},{"./common":48,"./pexprs":69}],64:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.substituteParams=common.abstract;pexprs.any.substituteParams=pexprs.end.substituteParams=pexprs.Prim.prototype.substituteParams=pexprs.Range.prototype.substituteParams=pexprs.Prim.prototype.substituteParams=pexprs.UnicodeChar.prototype.substituteParams=function(actuals){return this};pexprs.Param.prototype.substituteParams=function(actuals){return actuals[this.index]};pexprs.Alt.prototype.substituteParams=function(actuals){return new pexprs.Alt(this.terms.map(function(term){return term.substituteParams(actuals)}))};pexprs.Seq.prototype.substituteParams=function(actuals){return new pexprs.Seq(this.factors.map(function(factor){return factor.substituteParams(actuals)}))};pexprs.Iter.prototype.substituteParams=pexprs.Not.prototype.substituteParams=pexprs.Lookahead.prototype.substituteParams=pexprs.Lex.prototype.substituteParams=pexprs.Value.prototype.substituteParams=pexprs.Arr.prototype.substituteParams=function(actuals){return new this.constructor(this.expr.substituteParams(actuals))};pexprs.Obj.prototype.substituteParams=function(actuals){var properties=this.properties.map(function(property){return{name:property.name,pattern:property.pattern.substituteParams(actuals)}});return new pexprs.Obj(properties,this.isLenient)};pexprs.Apply.prototype.substituteParams=function(actuals){if(this.args.length===0){return this}else{var args=this.args.map(function(arg){return arg.substituteParams(actuals)});return new pexprs.Apply(this.ruleName,args)}}},{"./common":48,"./pexprs":69}],65:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");var copyWithoutDuplicates=common.copyWithoutDuplicates;pexprs.PExpr.prototype.toArgumentNameList=common.abstract;pexprs.any.toArgumentNameList=function(firstArgIndex){return["any"]};pexprs.end.toArgumentNameList=function(firstArgIndex){return["end"]};pexprs.Prim.prototype.toArgumentNameList=function(firstArgIndex){if(typeof this.obj==="string"&&/^[_a-zA-Z0-9]+$/.test(this.obj)){return["_"+this.obj]}else{return["$"+firstArgIndex]}};pexprs.Range.prototype.toArgumentNameList=function(firstArgIndex){return[this.from+"_to_"+this.to]};pexprs.Alt.prototype.toArgumentNameList=function(firstArgIndex){var termArgNameLists=this.terms.map(function(term){return term.toArgumentNameList(firstArgIndex)});var argumentNameList=[];var numArgs=termArgNameLists[0].length;for(var colIdx=0;colIdx0){var ps=this.args.map(function(arg){return arg.toString()});return this.ruleName+"<"+ps.join(",")+">"}else{return this.ruleName}};pexprs.UnicodeChar.prototype.toString=function(){return"\\p{"+this.category+"}"}},{"./common":48,"./pexprs":69}],69:[function(require,module,exports){"use strict";var InputStream=require("./InputStream");var UnicodeCategories=require("../third_party/UnicodeCategories");var common=require("./common");var errors=require("./errors");var inherits=require("inherits");var TYPE_ANY=0;var TYPE_STRING=1;var TYPE_VALUE=2;function PExpr(){throw new Error("PExpr cannot be instantiated -- it's abstract")}PExpr.prototype.withInterval=function(interval){if(interval){this.interval=interval.trimmed()}return this};PExpr.prototype.newInputStreamFor=function(values,grammar){var exprType=this.getExprType(grammar);if(values.length===1&&typeof values[0]==="string"&&exprType!==TYPE_VALUE){return InputStream.newFor(values[0])}else{return InputStream.newFor(values)}};var any=Object.create(PExpr.prototype);var end=Object.create(PExpr.prototype);function Prim(obj){this.obj=obj}inherits(Prim,PExpr);function Range(from,to){this.from=from;this.to=to}inherits(Range,PExpr);function Param(index){this.index=index}inherits(Param,PExpr);function Alt(terms){this.terms=terms}inherits(Alt,PExpr);function Extend(superGrammar,name,body){this.superGrammar=superGrammar;this.name=name;this.body=body;var origBody=superGrammar.ruleBodies[name];this.terms=[body,origBody]}inherits(Extend,Alt);function Seq(factors){this.factors=factors}inherits(Seq,PExpr);function Iter(expr){this.expr=expr}inherits(Iter,PExpr);function Star(expr){this.expr=expr}inherits(Star,Iter);function Plus(expr){this.expr=expr}inherits(Plus,Iter);function Opt(expr){this.expr=expr}inherits(Opt,Iter);Star.prototype.operator="*";Plus.prototype.operator="+";Opt.prototype.operator="?";Star.prototype.minNumMatches=0;Plus.prototype.minNumMatches=1;Opt.prototype.minNumMatches=0;Star.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Plus.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Opt.prototype.maxNumMatches=1;function Not(expr){this.expr=expr}inherits(Not,PExpr);function Lookahead(expr){this.expr=expr}inherits(Lookahead,PExpr);function Lex(expr){this.expr=expr}inherits(Lex,PExpr);function Value(expr){this.expr=expr}inherits(Value,PExpr);function Arr(expr){this.expr=expr}inherits(Arr,PExpr);function Str(expr){this.expr=expr}inherits(Str,PExpr);function Obj(properties,isLenient){var names=properties.map(function(property){return property.name});var duplicates=common.getDuplicates(names);if(duplicates.length>0){throw errors.duplicatePropertyNames(duplicates)}else{this.properties=properties;this.isLenient=isLenient}}inherits(Obj,PExpr);function Apply(ruleName,optArgs){this.ruleName=ruleName;this.args=optArgs||[]}inherits(Apply,PExpr);Apply.prototype.isSyntactic=function(){return common.isSyntactic(this.ruleName)};Apply.prototype.toMemoKey=function(){if(!this._memoKey){Object.defineProperty(this,"_memoKey",{value:this.toString()})}return this._memoKey};function UnicodeChar(category){this.category=category;this.pattern=UnicodeCategories[category]}inherits(UnicodeChar,PExpr);exports.TYPE_ANY=TYPE_ANY;exports.TYPE_STRING=TYPE_STRING;exports.TYPE_VALUE=TYPE_VALUE;exports.TYPE_INCONSISTENT=TYPE_STRING|TYPE_VALUE;exports.PExpr=PExpr;exports.any=any;exports.end=end;exports.Prim=Prim;exports.Range=Range;exports.Param=Param;exports.Alt=Alt;exports.Extend=Extend;exports.Seq=Seq;exports.Iter=Iter;exports.Star=Star;exports.Plus=Plus;exports.Opt=Opt;exports.Not=Not;exports.Lookahead=Lookahead;exports.Lex=Lex;exports.Value=Value;exports.Arr=Arr;exports.Str=Str;exports.Obj=Obj;exports.Apply=Apply;exports.UnicodeChar=UnicodeChar;require("./pexprs-allowsSkippingPrecedingSpace");require("./pexprs-assertAllApplicationsAreValid");require("./pexprs-assertChoicesHaveUniformArity");require("./pexprs-assertIteratedExprsAreNotNullable");require("./pexprs-assertValuesAndStringsAreNotMixed");require("./pexprs-check");require("./pexprs-eval");require("./pexprs-getArity");require("./pexprs-getExprType");require("./pexprs-outputRecipe");require("./pexprs-introduceParams");require("./pexprs-isNullable");require("./pexprs-substituteParams");require("./pexprs-toDisplayString");require("./pexprs-toArgumentNameList");require("./pexprs-toFailure");require("./pexprs-toString")},{"../third_party/UnicodeCategories":71,"./InputStream":40,"./common":48,"./errors":49,"./pexprs-allowsSkippingPrecedingSpace":52,"./pexprs-assertAllApplicationsAreValid":53,"./pexprs-assertChoicesHaveUniformArity":54,"./pexprs-assertIteratedExprsAreNotNullable":55,"./pexprs-assertValuesAndStringsAreNotMixed":56,"./pexprs-check":57,"./pexprs-eval":58,"./pexprs-getArity":59,"./pexprs-getExprType":60,"./pexprs-introduceParams":61,"./pexprs-isNullable":62,"./pexprs-outputRecipe":63,"./pexprs-substituteParams":64,"./pexprs-toArgumentNameList":65,"./pexprs-toDisplayString":66,"./pexprs-toFailure":67,"./pexprs-toString":68,inherits:33}],70:[function(require,module,exports){"use strict";var common=require("./common");function padNumbersToEqualLength(arr){var maxLen=0;var strings=arr.map(function(n){var str=n.toString();maxLen=Math.max(maxLen,str.length);return str});return strings.map(function(s){return common.padLeft(s,maxLen)})}function strcpy(dest,src,offset){var origDestLen=dest.length;var start=dest.slice(0,offset);var end=dest.slice(offset+src.length);return(start+src+end).substr(0,origDestLen)}exports.getLineAndColumn=function(str,offset){var lineNum=1;var colNum=1;var currOffset=0;var lineStartOffset=0;var nextLine=null;var prevLine=null;var prevLineStartOffset=-1;while(currOffset=0){prevLine=str.slice(prevLineStartOffset,lineStartOffset).replace(/\r?\n$/,"")}var line=str.slice(lineStartOffset,lineEndOffset).replace(/\r$/,"");return{lineNum:lineNum,colNum:colNum,line:line,prevLine:prevLine,nextLine:nextLine}};exports.getLineAndColumnMessage=function(str,offset){var repeatStr=common.repeatStr;var lineAndCol=exports.getLineAndColumn(str,offset);var sb=new common.StringBuffer;sb.append("Line "+lineAndCol.lineNum+", col "+lineAndCol.colNum+":\n");var lineNumbers=padNumbersToEqualLength([lineAndCol.prevLine==null?0:lineAndCol.lineNum-1,lineAndCol.lineNum,lineAndCol.nextLine==null?0:lineAndCol.lineNum+1]);function appendLine(num,content,prefix){sb.append(prefix+lineNumbers[num]+" | "+content+"\n")}if(lineAndCol.prevLine!=null){appendLine(0,lineAndCol.prevLine," ")}appendLine(1,lineAndCol.line,"> ");var lineLen=lineAndCol.line.length;var indicationLine=repeatStr(" ",lineLen+1);var ranges=Array.prototype.slice.call(arguments,2);for(var i=0;i=0&&startIdx<=endIdx,"range start must be >= 0 and <= end");var lineStartOffset=offset-lineAndCol.colNum+1;startIdx=Math.max(0,startIdx-lineStartOffset);endIdx=Math.min(endIdx-lineStartOffset,lineLen);indicationLine=strcpy(indicationLine,repeatStr("~",endIdx-startIdx),startIdx)}var gutterWidth=2+lineNumbers[1].length+3;sb.append(repeatStr(" ",gutterWidth));indicationLine=strcpy(indicationLine,"^",lineAndCol.colNum-1);sb.append(indicationLine.replace(/ +$/,"")+"\n");if(lineAndCol.nextLine!=null){appendLine(2,lineAndCol.nextLine," ")}return sb.contents()}},{"./common":48}],71:[function(require,module,exports){module.exports={Lu:/[\u0041-\u005A]|[\u00C0-\u00D6]|[\u00D8-\u00DE]|[\u0100-\u0100]|[\u0102-\u0102]|[\u0104-\u0104]|[\u0106-\u0106]|[\u0108-\u0108]|[\u010A-\u010A]|[\u010C-\u010C]|[\u010E-\u010E]|[\u0110-\u0110]|[\u0112-\u0112]|[\u0114-\u0114]|[\u0116-\u0116]|[\u0118-\u0118]|[\u011A-\u011A]|[\u011C-\u011C]|[\u011E-\u011E]|[\u0120-\u0120]|[\u0122-\u0122]|[\u0124-\u0124]|[\u0126-\u0126]|[\u0128-\u0128]|[\u012A-\u012A]|[\u012C-\u012C]|[\u012E-\u012E]|[\u0130-\u0130]|[\u0132-\u0132]|[\u0134-\u0134]|[\u0136-\u0136]|[\u0139-\u0139]|[\u013B-\u013B]|[\u013D-\u013D]|[\u013F-\u013F]|[\u0141-\u0141]|[\u0143-\u0143]|[\u0145-\u0145]|[\u0147-\u0147]|[\u014A-\u014A]|[\u014C-\u014C]|[\u014E-\u014E]|[\u0150-\u0150]|[\u0152-\u0152]|[\u0154-\u0154]|[\u0156-\u0156]|[\u0158-\u0158]|[\u015A-\u015A]|[\u015C-\u015C]|[\u015E-\u015E]|[\u0160-\u0160]|[\u0162-\u0162]|[\u0164-\u0164]|[\u0166-\u0166]|[\u0168-\u0168]|[\u016A-\u016A]|[\u016C-\u016C]|[\u016E-\u016E]|[\u0170-\u0170]|[\u0172-\u0172]|[\u0174-\u0174]|[\u0176-\u0176]|[\u0178-\u0179]|[\u017B-\u017B]|[\u017D-\u017D]|[\u0181-\u0182]|[\u0184-\u0184]|[\u0186-\u0187]|[\u0189-\u018B]|[\u018E-\u0191]|[\u0193-\u0194]|[\u0196-\u0198]|[\u019C-\u019D]|[\u019F-\u01A0]|[\u01A2-\u01A2]|[\u01A4-\u01A4]|[\u01A6-\u01A7]|[\u01A9-\u01A9]|[\u01AC-\u01AC]|[\u01AE-\u01AF]|[\u01B1-\u01B3]|[\u01B5-\u01B5]|[\u01B7-\u01B8]|[\u01BC-\u01BC]|[\u01C4-\u01C4]|[\u01C7-\u01C7]|[\u01CA-\u01CA]|[\u01CD-\u01CD]|[\u01CF-\u01CF]|[\u01D1-\u01D1]|[\u01D3-\u01D3]|[\u01D5-\u01D5]|[\u01D7-\u01D7]|[\u01D9-\u01D9]|[\u01DB-\u01DB]|[\u01DE-\u01DE]|[\u01E0-\u01E0]|[\u01E2-\u01E2]|[\u01E4-\u01E4]|[\u01E6-\u01E6]|[\u01E8-\u01E8]|[\u01EA-\u01EA]|[\u01EC-\u01EC]|[\u01EE-\u01EE]|[\u01F1-\u01F1]|[\u01F4-\u01F4]|[\u01FA-\u01FA]|[\u01FC-\u01FC]|[\u01FE-\u01FE]|[\u0200-\u0200]|[\u0202-\u0202]|[\u0204-\u0204]|[\u0206-\u0206]|[\u0208-\u0208]|[\u020A-\u020A]|[\u020C-\u020C]|[\u020E-\u020E]|[\u0210-\u0210]|[\u0212-\u0212]|[\u0214-\u0214]|[\u0216-\u0216]|[\u0386-\u0386]|[\u0388-\u038A]|[\u038C-\u038C]|[\u038E-\u038F]|[\u0391-\u03A1]|[\u03A3-\u03AB]|[\u03D2-\u03D4]|[\u03DA-\u03DA]|[\u03DC-\u03DC]|[\u03DE-\u03DE]|[\u03E0-\u03E0]|[\u03E2-\u03E2]|[\u03E4-\u03E4]|[\u03E6-\u03E6]|[\u03E8-\u03E8]|[\u03EA-\u03EA]|[\u03EC-\u03EC]|[\u03EE-\u03EE]|[\u0401-\u040C]|[\u040E-\u042F]|[\u0460-\u0460]|[\u0462-\u0462]|[\u0464-\u0464]|[\u0466-\u0466]|[\u0468-\u0468]|[\u046A-\u046A]|[\u046C-\u046C]|[\u046E-\u046E]|[\u0470-\u0470]|[\u0472-\u0472]|[\u0474-\u0474]|[\u0476-\u0476]|[\u0478-\u0478]|[\u047A-\u047A]|[\u047C-\u047C]|[\u047E-\u047E]|[\u0480-\u0480]|[\u0490-\u0490]|[\u0492-\u0492]|[\u0494-\u0494]|[\u0496-\u0496]|[\u0498-\u0498]|[\u049A-\u049A]|[\u049C-\u049C]|[\u049E-\u049E]|[\u04A0-\u04A0]|[\u04A2-\u04A2]|[\u04A4-\u04A4]|[\u04A6-\u04A6]|[\u04A8-\u04A8]|[\u04AA-\u04AA]|[\u04AC-\u04AC]|[\u04AE-\u04AE]|[\u04B0-\u04B0]|[\u04B2-\u04B2]|[\u04B4-\u04B4]|[\u04B6-\u04B6]|[\u04B8-\u04B8]|[\u04BA-\u04BA]|[\u04BC-\u04BC]|[\u04BE-\u04BE]|[\u04C1-\u04C1]|[\u04C3-\u04C3]|[\u04C7-\u04C7]|[\u04CB-\u04CB]|[\u04D0-\u04D0]|[\u04D2-\u04D2]|[\u04D4-\u04D4]|[\u04D6-\u04D6]|[\u04D8-\u04D8]|[\u04DA-\u04DA]|[\u04DC-\u04DC]|[\u04DE-\u04DE]|[\u04E0-\u04E0]|[\u04E2-\u04E2]|[\u04E4-\u04E4]|[\u04E6-\u04E6]|[\u04E8-\u04E8]|[\u04EA-\u04EA]|[\u04EE-\u04EE]|[\u04F0-\u04F0]|[\u04F2-\u04F2]|[\u04F4-\u04F4]|[\u04F8-\u04F8]|[\u0531-\u0556]|[\u10A0-\u10C5]|[\u1E00-\u1E00]|[\u1E02-\u1E02]|[\u1E04-\u1E04]|[\u1E06-\u1E06]|[\u1E08-\u1E08]|[\u1E0A-\u1E0A]|[\u1E0C-\u1E0C]|[\u1E0E-\u1E0E]|[\u1E10-\u1E10]|[\u1E12-\u1E12]|[\u1E14-\u1E14]|[\u1E16-\u1E16]|[\u1E18-\u1E18]|[\u1E1A-\u1E1A]|[\u1E1C-\u1E1C]|[\u1E1E-\u1E1E]|[\u1E20-\u1E20]|[\u1E22-\u1E22]|[\u1E24-\u1E24]|[\u1E26-\u1E26]|[\u1E28-\u1E28]|[\u1E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101]|[\u0103-\u0103]|[\u0105-\u0105]|[\u0107-\u0107]|[\u0109-\u0109]|[\u010B-\u010B]|[\u010D-\u010D]|[\u010F-\u010F]|[\u0111-\u0111]|[\u0113-\u0113]|[\u0115-\u0115]|[\u0117-\u0117]|[\u0119-\u0119]|[\u011B-\u011B]|[\u011D-\u011D]|[\u011F-\u011F]|[\u0121-\u0121]|[\u0123-\u0123]|[\u0125-\u0125]|[\u0127-\u0127]|[\u0129-\u0129]|[\u012B-\u012B]|[\u012D-\u012D]|[\u012F-\u012F]|[\u0131-\u0131]|[\u0133-\u0133]|[\u0135-\u0135]|[\u0137-\u0138]|[\u013A-\u013A]|[\u013C-\u013C]|[\u013E-\u013E]|[\u0140-\u0140]|[\u0142-\u0142]|[\u0144-\u0144]|[\u0146-\u0146]|[\u0148-\u0149]|[\u014B-\u014B]|[\u014D-\u014D]|[\u014F-\u014F]|[\u0151-\u0151]|[\u0153-\u0153]|[\u0155-\u0155]|[\u0157-\u0157]|[\u0159-\u0159]|[\u015B-\u015B]|[\u015D-\u015D]|[\u015F-\u015F]|[\u0161-\u0161]|[\u0163-\u0163]|[\u0165-\u0165]|[\u0167-\u0167]|[\u0169-\u0169]|[\u016B-\u016B]|[\u016D-\u016D]|[\u016F-\u016F]|[\u0171-\u0171]|[\u0173-\u0173]|[\u0175-\u0175]|[\u0177-\u0177]|[\u017A-\u017A]|[\u017C-\u017C]|[\u017E-\u0180]|[\u0183-\u0183]|[\u0185-\u0185]|[\u0188-\u0188]|[\u018C-\u018D]|[\u0192-\u0192]|[\u0195-\u0195]|[\u0199-\u019B]|[\u019E-\u019E]|[\u01A1-\u01A1]|[\u01A3-\u01A3]|[\u01A5-\u01A5]|[\u01A8-\u01A8]|[\u01AB-\u01AB]|[\u01AD-\u01AD]|[\u01B0-\u01B0]|[\u01B4-\u01B4]|[\u01B6-\u01B6]|[\u01B9-\u01BA]|[\u01BD-\u01BD]|[\u01C6-\u01C6]|[\u01C9-\u01C9]|[\u01CC-\u01CC]|[\u01CE-\u01CE]|[\u01D0-\u01D0]|[\u01D2-\u01D2]|[\u01D4-\u01D4]|[\u01D6-\u01D6]|[\u01D8-\u01D8]|[\u01DA-\u01DA]|[\u01DC-\u01DD]|[\u01DF-\u01DF]|[\u01E1-\u01E1]|[\u01E3-\u01E3]|[\u01E5-\u01E5]|[\u01E7-\u01E7]|[\u01E9-\u01E9]|[\u01EB-\u01EB]|[\u01ED-\u01ED]|[\u01EF-\u01F0]|[\u01F3-\u01F3]|[\u01F5-\u01F5]|[\u01FB-\u01FB]|[\u01FD-\u01FD]|[\u01FF-\u01FF]|[\u0201-\u0201]|[\u0203-\u0203]|[\u0205-\u0205]|[\u0207-\u0207]|[\u0209-\u0209]|[\u020B-\u020B]|[\u020D-\u020D]|[\u020F-\u020F]|[\u0211-\u0211]|[\u0213-\u0213]|[\u0215-\u0215]|[\u0217-\u0217]|[\u0250-\u02A8]|[\u0390-\u0390]|[\u03AC-\u03CE]|[\u03D0-\u03D1]|[\u03D5-\u03D6]|[\u03E3-\u03E3]|[\u03E5-\u03E5]|[\u03E7-\u03E7]|[\u03E9-\u03E9]|[\u03EB-\u03EB]|[\u03ED-\u03ED]|[\u03EF-\u03F2]|[\u0430-\u044F]|[\u0451-\u045C]|[\u045E-\u045F]|[\u0461-\u0461]|[\u0463-\u0463]|[\u0465-\u0465]|[\u0467-\u0467]|[\u0469-\u0469]|[\u046B-\u046B]|[\u046D-\u046D]|[\u046F-\u046F]|[\u0471-\u0471]|[\u0473-\u0473]|[\u0475-\u0475]|[\u0477-\u0477]|[\u0479-\u0479]|[\u047B-\u047B]|[\u047D-\u047D]|[\u047F-\u047F]|[\u0481-\u0481]|[\u0491-\u0491]|[\u0493-\u0493]|[\u0495-\u0495]|[\u0497-\u0497]|[\u0499-\u0499]|[\u049B-\u049B]|[\u049D-\u049D]|[\u049F-\u049F]|[\u04A1-\u04A1]|[\u04A3-\u04A3]|[\u04A5-\u04A5]|[\u04A7-\u04A7]|[\u04A9-\u04A9]|[\u04AB-\u04AB]|[\u04AD-\u04AD]|[\u04AF-\u04AF]|[\u04B1-\u04B1]|[\u04B3-\u04B3]|[\u04B5-\u04B5]|[\u04B7-\u04B7]|[\u04B9-\u04B9]|[\u04BB-\u04BB]|[\u04BD-\u04BD]|[\u04BF-\u04BF]|[\u04C2-\u04C2]|[\u04C4-\u04C4]|[\u04C8-\u04C8]|[\u04CC-\u04CC]|[\u04D1-\u04D1]|[\u04D3-\u04D3]|[\u04D5-\u04D5]|[\u04D7-\u04D7]|[\u04D9-\u04D9]|[\u04DB-\u04DB]|[\u04DD-\u04DD]|[\u04DF-\u04DF]|[\u04E1-\u04E1]|[\u04E3-\u04E3]|[\u04E5-\u04E5]|[\u04E7-\u04E7]|[\u04E9-\u04E9]|[\u04EB-\u04EB]|[\u04EF-\u04EF]|[\u04F1-\u04F1]|[\u04F3-\u04F3]|[\u04F5-\u04F5]|[\u04F9-\u04F9]|[\u0561-\u0587]|[\u10D0-\u10F6]|[\u1E01-\u1E01]|[\u1E03-\u1E03]|[\u1E05-\u1E05]|[\u1E07-\u1E07]|[\u1E09-\u1E09]|[\u1E0B-\u1E0B]|[\u1E0D-\u1E0D]|[\u1E0F-\u1E0F]|[\u1E11-\u1E11]|[\u1E13-\u1E13]|[\u1E15-\u1E15]|[\u1E17-\u1E17]|[\u1E19-\u1E19]|[\u1E1B-\u1E1B]|[\u1E1D-\u1E1D]|[\u1E1F-\u1E1F]|[\u1E21-\u1E21]|[\u1E23-\u1E23]|[\u1E25-\u1E25]|[\u1E27-\u1E27]|[\u1E29-\u1E29]|[\u1E2B-\u1E2B]|[\u1E2D-\u1E2D]|[\u1E2F-\u1E2F]|[\u1E31-\u1E31]|[\u1E33-\u1E33]|[\u1E35-\u1E35]|[\u1E37-\u1E37]|[\u1E39-\u1E39]|[\u1E3B-\u1E3B]|[\u1E3D-\u1E3D]|[\u1E3F-\u1E3F]|[\u1E41-\u1E41]|[\u1E43-\u1E43]|[\u1E45-\u1E45]|[\u1E47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A]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u0B0C]|[\u0B0F-\u0B10]|[\u0B13-\u0B28]|[\u0B2A-\u0B30]|[\u0B32-\u0B33]|[\u0B36-\u0B39]|[\u0B3D-\u0B3D]|[\u0B5C-\u0B5D]|[\u0B5F-\u0B61]|[\u0B85-\u0B8A]|[\u0B8E-\u0B90]|[\u0B92-\u0B95]|[\u0B99-\u0B9A]|[\u0B9C-\u0B9C]|[\u0B9E-\u0B9F]|[\u0BA3-\u0BA4]|[\u0BA8-\u0BAA]|[\u0BAE-\u0BB5]|[\u0BB7-\u0BB9]|[\u0C05-\u0C0C]|[\u0C0E-\u0C10]|[\u0C12-\u0C28]|[\u0C2A-\u0C33]|[\u0C35-\u0C39]|[\u0C60-\u0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]|[\u3007-\u3007]|[\u3021-\u3029]/,Nd:/[\u0030-\u0039]|[\u0660-\u0669]|[\u06F0-\u06F9]|[\u0966-\u096F]|[\u09E6-\u09EF]|[\u0A66-\u0A6F]|[\u0AE6-\u0AEF]|[\u0B66-\u0B6F]|[\u0BE7-\u0BEF]|[\u0C66-\u0C6F]|[\u0CE6-\u0CEF]|[\u0D66-\u0D6F]|[\u0E50-\u0E59]|[\u0ED0-\u0ED9]|[\u0F20-\u0F29]|[\uFF10-\uFF19]/,Mn:/[\u0300-\u0345]|[\u0360-\u0361]|[\u0483-\u0486]|[\u0591-\u05A1]|[\u05A3-\u05B9]|[\u05BB-\u05BD]|[\u05BF-\u05BF]|[\u05C1-\u05C2]|[\u05C4-\u05C4]|[\u064B-\u0652]|[\u0670-\u0670]|[\u06D6-\u06DC]|[\u06DF-\u06E4]|[\u06E7-\u06E8]|[\u06EA-\u06ED]|[\u0901-\u0902]|[\u093C-\u093C]|[\u0941-\u0948]|[\u094D-\u094D]|[\u0951-\u0954]|[\u0962-\u0963]|[\u0981-\u0981]|[\u09BC-\u09BC]|[\u09C1-\u09C4]|[\u09CD-\u09CD]|[\u09E2-\u09E3]|[\u0A02-\u0A02]|[\u0A3C-\u0A3C]|[\u0A41-\u0A42]|[\u0A47-\u0A48]|[\u0A4B-\u0A4D]|[\u0A70-\u0A71]|[\u0A81-\u0A82]|[\u0ABC-\u0ABC]|[\u0AC1-\u0AC5]|[\u0AC7-\u0AC8]|[\u0ACD-\u0ACD]|[\u0B01-\u0B01]|[\u0B3C-\u0B3C]|[\u0B3F-\u0B3F]|[\u0B41-\u0B43]|[\u0B4D-\u0B4D]|[\u0B56-\u0B56]|[\u0B82-\u0B82]|[\u0BC0-\u0BC0]|[\u0BCD-\u0BCD]|[\u0C3E-\u0C40]|[\u0C46-\u0C48]|[\u0C4A-\u0C4D]|[\u0C55-\u0C56]|[\u0CBF-\u0CBF]|[\u0CC6-\u0CC6]|[\u0CCC-\u0CCD]|[\u0D41-\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]|[\uFE33-\uFE34]|[\uFE4D-\uFE4F]|[\uFF3F-\uFF3F]|[\uFF65-\uFF65]/,Zs:/[\u2000-\u200B]|[\u3000-\u3000]/,L:/[\u0041-\u005A]|[\u00C0-\u00D6]|[\u00D8-\u00DE]|[\u0100-\u0100]|[\u0102-\u0102]|[\u0104-\u0104]|[\u0106-\u0106]|[\u0108-\u0108]|[\u010A-\u010A]|[\u010C-\u010C]|[\u010E-\u010E]|[\u0110-\u0110]|[\u0112-\u0112]|[\u0114-\u0114]|[\u0116-\u0116]|[\u0118-\u0118]|[\u011A-\u011A]|[\u011C-\u011C]|[\u011E-\u011E]|[\u0120-\u0120]|[\u0122-\u0122]|[\u0124-\u0124]|[\u0126-\u0126]|[\u0128-\u0128]|[\u012A-\u012A]|[\u012C-\u012C]|[\u012E-\u012E]|[\u0130-\u0130]|[\u0132-\u0132]|[\u0134-\u0134]|[\u0136-\u0136]|[\u0139-\u0139]|[\u013B-\u013B]|[\u013D-\u013D]|[\u013F-\u013F]|[\u0141-\u0141]|[\u0143-\u0143]|[\u0145-\u0145]|[\u0147-\u0147]|[\u014A-\u014A]|[\u014C-\u014C]|[\u014E-\u014E]|[\u0150-\u0150]|[\u0152-\u0152]|[\u0154-\u0154]|[\u0156-\u0156]|[\u0158-\u0158]|[\u015A-\u015A]|[\u015C-\u015C]|[\u015E-\u015E]|[\u0160-\u0160]|[\u0162-\u0162]|[\u0164-\u0164]|[\u0166-\u0166]|[\u0168-\u0168]|[\u016A-\u016A]|[\u016C-\u016C]|[\u016E-\u016E]|[\u0170-\u0170]|[\u0172-\u0172]|[\u0174-\u0174]|[\u0176-\u0176]|[\u0178-\u0179]|[\u017B-\u017B]|[\u017D-\u017D]|[\u0181-\u0182]|[\u0184-\u0184]|[\u0186-\u0187]|[\u0189-\u018B]|[\u018E-\u0191]|[\u0193-\u0194]|[\u0196-\u0198]|[\u019C-\u019D]|[\u019F-\u01A0]|[\u01A2-\u01A2]|[\u01A4-\u01A4]|[\u01A6-\u01A7]|[\u01A9-\u01A9]|[\u01AC-\u01AC]|[\u01AE-\u01AF]|[\u01B1-\u01B3]|[\u01B5-\u01B5]|[\u01B7-\u01B8]|[\u01BC-\u01BC]|[\u01C4-\u01C4]|[\u01C7-\u01C7]|[\u01CA-\u01CA]|[\u01CD-\u01CD]|[\u01CF-\u01CF]|[\u01D1-\u01D1]|[\u01D3-\u01D3]|[\u01D5-\u01D5]|[\u01D7-\u01D7]|[\u01D9-\u01D9]|[\u01DB-\u01DB]|[\u01DE-\u01DE]|[\u01E0-\u01E0]|[\u01E2-\u01E2]|[\u01E4-\u01E4]|[\u01E6-\u01E6]|[\u01E8-\u01E8]|[\u01EA-\u01EA]|[\u01EC-\u01EC]|[\u01EE-\u01EE]|[\u01F1-\u01F1]|[\u01F4-\u01F4]|[\u01FA-\u01FA]|[\u01FC-\u01FC]|[\u01FE-\u01FE]|[\u0200-\u0200]|[\u0202-\u0202]|[\u0204-\u0204]|[\u0206-\u0206]|[\u0208-\u0208]|[\u020A-\u020A]|[\u020C-\u020C]|[\u020E-\u020E]|[\u0210-\u0210]|[\u0212-\u0212]|[\u0214-\u0214]|[\u0216-\u0216]|[\u0386-\u0386]|[\u0388-\u038A]|[\u038C-\u038C]|[\u038E-\u038F]|[\u0391-\u03A1]|[\u03A3-\u03AB]|[\u03D2-\u03D4]|[\u03DA-\u03DA]|[\u03DC-\u03DC]|[\u03DE-\u03DE]|[\u03E0-\u03E0]|[\u03E2-\u03E2]|[\u03E4-\u03E4]|[\u03E6-\u03E6]|[\u03E8-\u03E8]|[\u03EA-\u03EA]|[\u03EC-\u03EC]|[\u03EE-\u03EE]|[\u0401-\u040C]|[\u040E-\u042F]|[\u0460-\u0460]|[\u0462-\u0462]|[\u0464-\u0464]|[\u0466-\u0466]|[\u0468-\u0468]|[\u046A-\u046A]|[\u046C-\u046C]|[\u046E-\u046E]|[\u0470-\u0470]|[\u0472-\u0472]|[\u0474-\u0474]|[\u0476-\u0476]|[\u0478-\u0478]|[\u047A-\u047A]|[\u047C-\u047C]|[\u047E-\u047E]|[\u0480-\u0480]|[\u0490-\u0490]|[\u0492-\u0492]|[\u0494-\u0494]|[\u0496-\u0496]|[\u0498-\u0498]|[\u049A-\u049A]|[\u049C-\u049C]|[\u049E-\u049E]|[\u04A0-\u04A0]|[\u04A2-\u04A2]|[\u04A4-\u04A4]|[\u04A6-\u04A6]|[\u04A8-\u04A8]|[\u04AA-\u04AA]|[\u04AC-\u04AC]|[\u04AE-\u04AE]|[\u04B0-\u04B0]|[\u04B2-\u04B2]|[\u04B4-\u04B4]|[\u04B6-\u04B6]|[\u04B8-\u04B8]|[\u04BA-\u04BA]|[\u04BC-\u04BC]|[\u04BE-\u04BE]|[\u04C1-\u04C1]|[\u04C3-\u04C3]|[\u04C7-\u04C7]|[\u04CB-\u04CB]|[\u04D0-\u04D0]|[\u04D2-\u04D2]|[\u04D4-\u04D4]|[\u04D6-\u04D6]|[\u04D8-\u04D8]|[\u04DA-\u04DA]|[\u04DC-\u04DC]|[\u04DE-\u04DE]|[\u04E0-\u04E0]|[\u04E2-\u04E2]|[\u04E4-\u04E4]|[\u04E6-\u04E6]|[\u04E8-\u04E8]|[\u04EA-\u04EA]|[\u04EE-\u04EE]|[\u04F0-\u04F0]|[\u04F2-\u04F2]|[\u04F4-\u04F4]|[\u04F8-\u04F8]|[\u0531-\u0556]|[\u10A0-\u10C5]|[\u1E00-\u1E00]|[\u1E02-\u1E02]|[\u1E04-\u1E04]|[\u1E06-\u1E06]|[\u1E08-\u1E08]|[\u1E0A-\u1E0A]|[\u1E0C-\u1E0C]|[\u1E0E-\u1E0E]|[\u1E10-\u1E10]|[\u1E12-\u1E12]|[\u1E14-\u1E14]|[\u1E16-\u1E16]|[\u1E18-\u1E18]|[\u1E1A-\u1E1A]|[\u1E1C-\u1E1C]|[\u1E1E-\u1E1E]|[\u1E20-\u1E20]|[\u1E22-\u1E22]|[\u1E24-\u1E24]|[\u1E26-\u1E26]|[\u1E28-\u1E28]|[\u1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0103-\u0103]|[\u0105-\u0105]|[\u0107-\u0107]|[\u0109-\u0109]|[\u010B-\u010B]|[\u010D-\u010D]|[\u010F-\u010F]|[\u0111-\u0111]|[\u0113-\u0113]|[\u0115-\u0115]|[\u0117-\u0117]|[\u0119-\u0119]|[\u011B-\u011B]|[\u011D-\u011D]|[\u011F-\u011F]|[\u0121-\u0121]|[\u0123-\u0123]|[\u0125-\u0125]|[\u0127-\u0127]|[\u0129-\u0129]|[\u012B-\u012B]|[\u012D-\u012D]|[\u012F-\u012F]|[\u0131-\u0131]|[\u0133-\u0133]|[\u0135-\u0135]|[\u0137-\u0138]|[\u013A-\u013A]|[\u013C-\u013C]|[\u013E-\u013E]|[\u0140-\u0140]|[\u0142-\u0142]|[\u0144-\u0144]|[\u0146-\u0146]|[\u0148-\u0149]|[\u014B-\u014B]|[\u014D-\u014D]|[\u014F-\u014F]|[\u0151-\u0151]|[\u0153-\u0153]|[\u0155-\u0155]|[\u0157-\u0157]|[\u0159-\u0159]|[\u015B-\u015B]|[\u015D-\u015D]|[\u015F-\u015F]|[\u0161-\u0161]|[\u0163-\u0163]|[\u0165-\u0165]|[\u0167-\u0167]|[\u0169-\u0169]|[\u016B-\u016B]|[\u016D-\u016D]|[\u016F-\u016F]|[\u0171-\u0171]|[\u0173-\u0173]|[\u0175-\u0175]|[\u0177-\u0177]|[\u017A-\u017A]|[\u017C-\u017C]|[\u017E-\u0180]|[\u0183-\u0183]|[\u0185-\u0185]|[\u0188-\u0188]|[\u018C-\u018D]|[\u0192-\u0192]|[\u0195-\u0195]|[\u0199-\u019B]|[\u019E-\u019E]|[\u01A1-\u01A1]|[\u01A3-\u01A3]|[\u01A5-\u01A5]|[\u01A8-\u01A8]|[\u01AB-\u01AB]|[\u01AD-\u01AD]|[\u01B0-\u01B0]|[\u01B4-\u01B4]|[\u01B6-\u01B6]|[\u01B9-\u01BA]|[\u01BD-\u01BD]|[\u01C6-\u01C6]|[\u01C9-\u01C9]|[\u01CC-\u01CC]|[\u01CE-\u01CE]|[\u01D0-\u01D0]|[\u01D2-\u01D2]|[\u01D4-\u01D4]|[\u01D6-\u01D6]|[\u01D8-\u01D8]|[\u01DA-\u01DA]|[\u01DC-\u01DD]|[\u01DF-\u01DF]|[\u01E1-\u01E1]|[\u01E3-\u01E3]|[\u01E5-\u01E5]|[\u01E7-\u01E7]|[\u01E9-\u01E9]|[\u01EB-\u01EB]|[\u01ED-\u01ED]|[\u01EF-\u01F0]|[\u01F3-\u01F3]|[\u01F5-\u01F5]|[\u01FB-\u01FB]|[\u01FD-\u01FD]|[\u01FF-\u01FF]|[\u0201-\u0201]|[\u0203-\u0203]|[\u0205-\u0205]|[\u0207-\u0207]|[\u0209-\u0209]|[\u020B-\u020B]|[\u020D-\u020D]|[\u020F-\u020F]|[\u0211-\u0211]|[\u0213-\u0213]|[\u0215-\u0215]|[\u0217-\u0217]|[\u0250-\u02A8]|[\u0390-\u0390]|[\u03AC-\u03CE]|[\u03D0-\u03D1]|[\u03D5-\u03D6]|[\u03E3-\u03E3]|[\u03E5-\u03E5]|[\u03E7-\u03E7]|[\u03E9-\u03E9]|[\u03EB-\u03EB]|[\u03ED-\u03ED]|[\u03EF-\u03F2]|[\u0430-\u044F]|[\u0451-\u045C]|[\u045E-\u045F]|[\u0461-\u0461]|[\u0463-\u0463]|[\u0465-\u0465]|[\u0467-\u0467]|[\u0469-\u0469]|[\u046B-\u046B]|[\u046D-\u046D]|[\u046F-\u046F]|[\u0471-\u0471]|[\u0473-\u0473]|[\u0475-\u0475]|[\u0477-\u0477]|[\u0479-\u0479]|[\u047B-\u047B]|[\u047D-\u047D]|[\u047F-\u047F]|[\u0481-\u0481]|[\u0491-\u0491]|[\u0493-\u0493]|[\u0495-\u0495]|[\u0497-\u0497]|[\u0499-\u0499]|[\u049B-\u049B]|[\u049D-\u049D]|[\u049F-\u049F]|[\u04A1-\u04A1]|[\u04A3-\u04A3]|[\u04A5-\u04A5]|[\u04A7-\u04A7]|[\u04A9-\u04A9]|[\u04AB-\u04AB]|[\u04AD-\u04AD]|[\u04AF-\u04AF]|[\u04B1-\u04B1]|[\u04B3-\u04B3]|[\u04B5-\u04B5]|[\u04B7-\u04B7]|[\u04B9-\u04B9]|[\u04BB-\u04BB]|[\u04BD-\u04BD]|[\u04BF-\u04BF]|[\u04C2-\u04C2]|[\u04C4-\u04C4]|[\u04C8-\u04C8]|[\u04CC-\u04CC]|[\u04D1-\u04D1]|[\u04D3-\u04D3]|[\u04D5-\u04D5]|[\u04D7-\u04D7]|[\u04D9-\u04D9]|[\u04DB-\u04DB]|[\u04DD-\u04DD]|[\u04DF-\u04DF]|[\u04E1-\u04E1]|[\u04E3-\u04E3]|[\u04E5-\u04E5]|[\u04E7-\u04E7]|[\u04E9-\u04E9]|[\u04EB-\u04EB]|[\u04EF-\u04EF]|[\u04F1-\u04F1]|[\u04F3-\u04F3]|[\u04F5-\u04F5]|[\u04F9-\u04F9]|[\u0561-\u0587]|[\u10D0-\u10F6]|[\u1E01-\u1E01]|[\u1E03-\u1E03]|[\u1E05-\u1E05]|[\u1E07-\u1E07]|[\u1E09-\u1E09]|[\u1E0B-\u1E0B]|[\u1E0D-\u1E0D]|[\u1E0F-\u1E0F]|[\u1E11-\u1E11]|[\u1E13-\u1E13]|[\u1E15-\u1E15]|[\u1E17-\u1E17]|[\u1E19-\u1E19]|[\u1E1B-\u1E1B]|[\u1E1D-\u1E1D]|[\u1E1F-\u1E1F]|[\u1E21-\u1E21]|[\u1E23-\u1E23]|[\u1E25-\u1E25]|[\u1E27-\u1E27]|[\u1E29-\u1E29]|[\u1E2B-\u1E2B]|[\u1E2D-\u1E2D]|[\u1E2F-\u1E2F]|[\u1E31-\u1E31]|[\u1E33-\u1E33]|[\u1E35-\u1E35]|[\u1E37-\u1E37]|[\u1E39-\u1E39]|[\u1E3B-\u1E3B]|[\u1E3D-\u1E3D]|[\u1E3F-\u1E3F]|[\u1E41-\u1E41]|[\u1E43-\u1E43]|[\u1E45-\u1E45]|[\u1E47-\u1E47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7]|[\u1ED9-\u1ED9]|[\u1EDB-\u1EDB]|[\u1EDD-\u1EDD]|[\u1EDF-\u1EDF]|[\u1EE1-\u1EE1]|[\u1EE3-\u1EE3]|[\u1EE5-\u1EE5]|[\u1EE7-\u1EE7]|[\u1EE9-\u1EE9]|[\u1EEB-\u1EEB]|[\u1EED-\u1EED]|[\u1EEF-\u1EEF]|[\u1EF1-\u1EF1]|[\u1EF3-\u1EF3]|[\u1EF5-\u1EF5]|[\u1EF7-\u1EF7]|[\u1EF9-\u1EF9]|[\u1F00-\u1F07]|[\u1F10-\u1F15]|[\u1F20-\u1F27]|[\u1F30-\u1F37]|[\u1F40-\u1F45]|[\u1F50-\u1F57]|[\u1F60-\u1F67]|[\u1F70-\u1F7D]|[\u1F80-\u1F87]|[\u1F90-\u1F97]|[\u1FA0-\u1FA7]|[\u1FB0-\u1FB4]|[\u1FB6-\u1FB7]|[\u1FBE-\u1FBE]|[\u1FC2-\u1FC4]|[\u1FC6-\u1FC7]|[\u1FD0-\u1FD3]|[\u1FD6-\u1FD7]|[\u1FE0-\u1FE7]|[\u1FF2-\u1FF4]|[\u1FF6-\u1FF7]|[\u207F-\u207F]|[\u210A-\u210A]|[\u210E-\u210F]|[\u2113-\u2113]|[\u2118-\u2118]|[\u212E-\u212F]|[\u2134-\u2134]|[\uFB00-\uFB06]|[\uFB13-\uFB17]|[\uFF41-\uFF5A]|[\u01C5-\u01C5]|[\u01C8-\u01C8]|[\u01CB-\u01CB]|[\u01F2-\u01F2]|[\u02B0-\u02B8]|[\u02BB-\u02C1]|[\u02D0-\u02D1]|[\u02E0-\u02E4]|[\u037A-\u037A]|[\u0559-\u0559]|[\u0640-\u0640]|[\u06E5-\u06E6]|[\u0E46-\u0E46]|[\u0EC6-\u0EC6]|[\u3005-\u3005]|[\u3031-\u3035]|[\u309D-\u309E]|[\u30FC-\u30FE]|[\uFF70-\uFF70]|[\uFF9E-\uFF9F]|[\u01AA-\u01AA]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u0B0C]|[\u0B0F-\u0B10]|[\u0B13-\u0B28]|[\u0B2A-\u0B30]|[\u0B32-\u0B33]|[\u0B36-\u0B39]|[\u0B3D-\u0B3D]|[\u0B5C-\u0B5D]|[\u0B5F-\u0B61]|[\u0B85-\u0B8A]|[\u0B8E-\u0B90]|[\u0B92-\u0B95]|[\u0B99-\u0B9A]|[\u0B9C-\u0B9C]|[\u0B9E-\u0B9F]|[\u0BA3-\u0BA4]|[\u0BA8-\u0BAA]|[\u0BAE-\u0BB5]|[\u0BB7-\u0BB9]|[\u0C05-\u0C0C]|[\u0C0E-\u0C10]|[\u0C12-\u0C28]|[\u0C2A-\u0C33]|[\u0C35-\u0C39]|[\u0C60-\u0C61]|[\u0C85-\u0C8C]|[\u0C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CB-\u01CB]|[\u01F2-\u01F2][\u02B0-\u02B8]|[\u02BB-\u02C1]|[\u02D0-\u02D1]|[\u02E0-\u02E4]|[\u037A-\u037A]|[\u0559-\u0559]|[\u0640-\u0640]|[\u06E5-\u06E6]|[\u0E46-\u0E46]|[\u0EC6-\u0EC6]|[\u3005-\u3005]|[\u3031-\u3035]|[\u309D-\u309E]|[\u30FC-\u30FE]|[\uFF70-\uFF70]|[\uFF9E-\uFF9F][\u01AA-\u01AA]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u0B0C]|[\u0B0F-\u0B10]|[\u0B13-\u0B28]|[\u0B2A-\u0B30]|[\u0B32-\u0B33]|[\u0B36-\u0B39]|[\u0B3D-\u0B3D]|[\u0B5C-\u0B5D]|[\u0B5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|[\uFB46-\uFBB1]|[\uFBD3-\uFD3D]|[\uFD50-\uFD8F]|[\uFD92-\uFDC7]|[\uFDF0-\uFDFB]|[\uFE70-\uFE72]|[\uFE74-\uFE74]|[\uFE76-\uFEFC]|[\uFF66-\uFF6F]|[\uFF71-\uFF9D]|[\uFFA0-\uFFBE]|[\uFFC2-\uFFC7]|[\uFFCA-\uFFCF]|[\uFFD2-\uFFD7]|[\uFFDA-\uFFDC]/}},{}]},{},[3])(3)}); \ No newline at end of file +dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":5,ieee754:6,isarray:7}],5:[function(require,module,exports){"use strict";exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;function init(){var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}placeHolders=b64[len-2]==="="?2:b64[len-1]==="="?1:0;arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],6:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],7:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],8:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i\n = NonemptyListOf\n | EmptyListOf\n\n NonemptyListOf\n = elem (sep elem)*\n\n EmptyListOf\n = /* nothing */\n\n listOf\n = nonemptyListOf\n | emptyListOf\n\n nonemptyListOf\n = elem (sep elem)*\n\n emptyListOf\n = /* nothing */\n\n}');return decl.define("alnum",[],this.alt(this.app("letter").withInterval(decl.sourceInterval(60,66)),this.app("digit").withInterval(decl.sourceInterval(73,78))).withInterval(decl.sourceInterval(60,78)),"an alpha-numeric character").define("letter",[],this.alt(this.app("lower").withInterval(decl.sourceInterval(107,112)),this.app("upper").withInterval(decl.sourceInterval(119,124)),this.app("unicodeLtmo").withInterval(decl.sourceInterval(131,142))).withInterval(decl.sourceInterval(107,142)),"a letter").define("digit",[],this.range("0","9").withInterval(decl.sourceInterval(169,177)),"a digit").define("hexDigit",[],this.alt(this.app("digit").withInterval(decl.sourceInterval(219,224)),this.range("a","f").withInterval(decl.sourceInterval(231,239)),this.range("A","F").withInterval(decl.sourceInterval(246,254))).withInterval(decl.sourceInterval(219,254)),"a hexadecimal digit").define("ListOf",["elem","sep"],this.alt(this.app("NonemptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(282,307)),this.app("EmptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(314,336))).withInterval(decl.sourceInterval(282,336))).define("NonemptyListOf",["elem","sep"],this.seq(this.param(0),this.star(this.seq(this.param(1),this.param(0)).withInterval(decl.sourceInterval(378,386))).withInterval(decl.sourceInterval(377,388))).withInterval(decl.sourceInterval(372,388))).define("EmptyListOf",["elem","sep"],this.seq().withInterval(decl.sourceInterval(438,438))).define("listOf",["elem","sep"],this.alt(this.app("nonemptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(462,487)),this.app("emptyListOf",[this.param(0),this.param(1)]).withInterval(decl.sourceInterval(494,516))).withInterval(decl.sourceInterval(462,516))).define("nonemptyListOf",["elem","sep"],this.seq(this.param(0),this.star(this.seq(this.param(1),this.param(0)).withInterval(decl.sourceInterval(558,566))).withInterval(decl.sourceInterval(557,568))).withInterval(decl.sourceInterval(552,568))).define("emptyListOf",["elem","sep"],this.seq().withInterval(decl.sourceInterval(616,616))).build()})},{"..":50}],11:[function(require,module,exports){var ohm=require("..");module.exports=ohm.makeRecipe(function(){var decl=this.newGrammar("Ohm").withSource('Ohm {\n\n Grammars\n = Grammar*\n\n Grammar\n = ident SuperGrammar? "{" Rule* "}"\n\n SuperGrammar\n = "<:" ident\n\n Rule\n = ident Formals? ruleDescr? "=" RuleBody -- define\n | ident Formals? ":=" RuleBody -- override\n | ident Formals? "+=" RuleBody -- extend\n\n RuleBody\n = "|"? TopLevelTerm ("|" TopLevelTerm)*\n\n TopLevelTerm\n = Seq caseName -- inline\n | Seq\n\n Formals\n = "<" ListOf ">"\n\n Params\n = "<" ListOf ">"\n\n Alt\n = Seq ("|" Seq)*\n\n Seq\n = Iter*\n\n Iter\n = Pred "*" -- star\n | Pred "+" -- plus\n | Pred "?" -- opt\n | Pred\n\n Pred\n = "~" Lex -- not\n | "&" Lex -- lookahead\n | Lex\n\n Lex\n = "#" Base -- lex\n | Base\n\n Base\n = ident Params? ~(ruleDescr? "=" | ":=" | "+=") -- application\n | terminal ".." terminal -- range\n | terminal -- terminal\n | "(" Alt ")" -- paren\n\n ruleDescr (a rule description)\n = "(" ruleDescrText ")"\n\n ruleDescrText\n = (~")" any)*\n\n caseName\n = "--" (~"\\n" space)* name (~"\\n" space)* ("\\n" | &"}")\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n ident (an identifier)\n = name\n\n terminal\n = "\\"" terminalChar* "\\""\n\n terminalChar\n = escapeChar\n | ~"\\\\" ~"\\"" ~"\\n" any\n\n escapeChar (an escape sequence)\n = "\\\\\\\\" -- backslash\n | "\\\\\\"" -- doubleQuote\n | "\\\\\\\'" -- singleQuote\n | "\\\\b" -- backspace\n | "\\\\n" -- lineFeed\n | "\\\\r" -- carriageReturn\n | "\\\\t" -- tab\n | "\\\\u" hexDigit hexDigit hexDigit hexDigit -- unicodeEscape\n | "\\\\x" hexDigit hexDigit -- hexEscape\n\n space\n += comment\n\n comment\n = "//" (~"\\n" any)* "\\n" -- singleLine\n | "/*" (~"*/" any)* "*/" -- multiLine\n\n tokens = token*\n\n token = caseName | comment | ident | operator | punctuation | terminal | any\n\n operator = "<:" | "=" | ":=" | "+=" | "*" | "+" | "?" | "~" | "&"\n\n punctuation = "<" | ">" | "," | "--"\n}').withDefaultStartRule("Grammars");return decl.define("Grammars",[],this.star(this.app("Grammar").withInterval(decl.sourceInterval(24,31))).withInterval(decl.sourceInterval(24,32))).define("Grammar",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(50,55)),this.opt(this.app("SuperGrammar").withInterval(decl.sourceInterval(56,68))).withInterval(decl.sourceInterval(56,69)),this.terminal("{").withInterval(decl.sourceInterval(70,73)),this.star(this.app("Rule").withInterval(decl.sourceInterval(74,78))).withInterval(decl.sourceInterval(74,79)),this.terminal("}").withInterval(decl.sourceInterval(80,83))).withInterval(decl.sourceInterval(50,83))).define("SuperGrammar",[],this.seq(this.terminal("<:").withInterval(decl.sourceInterval(106,110)),this.app("ident").withInterval(decl.sourceInterval(111,116))).withInterval(decl.sourceInterval(106,116))).define("Rule_define",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(131,136)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(137,144))).withInterval(decl.sourceInterval(137,145)),this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(146,155))).withInterval(decl.sourceInterval(146,156)),this.terminal("=").withInterval(decl.sourceInterval(157,160)),this.app("RuleBody").withInterval(decl.sourceInterval(162,170))).withInterval(decl.sourceInterval(131,170))).define("Rule_override",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(188,193)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(194,201))).withInterval(decl.sourceInterval(194,202)),this.terminal(":=").withInterval(decl.sourceInterval(214,218)),this.app("RuleBody").withInterval(decl.sourceInterval(219,227))).withInterval(decl.sourceInterval(188,227))).define("Rule_extend",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(247,252)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(253,260))).withInterval(decl.sourceInterval(253,261)),this.terminal("+=").withInterval(decl.sourceInterval(273,277)),this.app("RuleBody").withInterval(decl.sourceInterval(278,286))).withInterval(decl.sourceInterval(247,286))).define("Rule",[],this.alt(this.app("Rule_define").withInterval(decl.sourceInterval(131,170)),this.app("Rule_override").withInterval(decl.sourceInterval(188,227)),this.app("Rule_extend").withInterval(decl.sourceInterval(247,286))).withInterval(decl.sourceInterval(131,297))).define("RuleBody",[],this.seq(this.opt(this.terminal("|").withInterval(decl.sourceInterval(316,319))).withInterval(decl.sourceInterval(316,320)),this.app("TopLevelTerm").withInterval(decl.sourceInterval(321,333)),this.star(this.seq(this.terminal("|").withInterval(decl.sourceInterval(335,338)),this.app("TopLevelTerm").withInterval(decl.sourceInterval(339,351))).withInterval(decl.sourceInterval(335,351))).withInterval(decl.sourceInterval(334,353))).withInterval(decl.sourceInterval(316,353))).define("TopLevelTerm_inline",[],this.seq(this.app("Seq").withInterval(decl.sourceInterval(376,379)),this.app("caseName").withInterval(decl.sourceInterval(380,388))).withInterval(decl.sourceInterval(376,388))).define("TopLevelTerm",[],this.alt(this.app("TopLevelTerm_inline").withInterval(decl.sourceInterval(376,388)),this.app("Seq").withInterval(decl.sourceInterval(406,409))).withInterval(decl.sourceInterval(376,409))).define("Formals",[],this.seq(this.terminal("<").withInterval(decl.sourceInterval(427,430)),this.app("ListOf",[this.app("ident").withInterval(decl.sourceInterval(438,443)),this.terminal(",").withInterval(decl.sourceInterval(445,448))]).withInterval(decl.sourceInterval(431,449)),this.terminal(">").withInterval(decl.sourceInterval(450,453))).withInterval(decl.sourceInterval(427,453))).define("Params",[],this.seq(this.terminal("<").withInterval(decl.sourceInterval(470,473)),this.app("ListOf",[this.app("Seq").withInterval(decl.sourceInterval(481,484)),this.terminal(",").withInterval(decl.sourceInterval(486,489))]).withInterval(decl.sourceInterval(474,490)),this.terminal(">").withInterval(decl.sourceInterval(491,494))).withInterval(decl.sourceInterval(470,494))).define("Alt",[],this.seq(this.app("Seq").withInterval(decl.sourceInterval(508,511)),this.star(this.seq(this.terminal("|").withInterval(decl.sourceInterval(513,516)),this.app("Seq").withInterval(decl.sourceInterval(517,520))).withInterval(decl.sourceInterval(513,520))).withInterval(decl.sourceInterval(512,522))).withInterval(decl.sourceInterval(508,522))).define("Seq",[],this.star(this.app("Iter").withInterval(decl.sourceInterval(536,540))).withInterval(decl.sourceInterval(536,541))).define("Iter_star",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(556,560)),this.terminal("*").withInterval(decl.sourceInterval(561,564))).withInterval(decl.sourceInterval(556,564))).define("Iter_plus",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(580,584)),this.terminal("+").withInterval(decl.sourceInterval(585,588))).withInterval(decl.sourceInterval(580,588))).define("Iter_opt",[],this.seq(this.app("Pred").withInterval(decl.sourceInterval(604,608)),this.terminal("?").withInterval(decl.sourceInterval(609,612))).withInterval(decl.sourceInterval(604,612))).define("Iter",[],this.alt(this.app("Iter_star").withInterval(decl.sourceInterval(556,564)),this.app("Iter_plus").withInterval(decl.sourceInterval(580,588)),this.app("Iter_opt").withInterval(decl.sourceInterval(604,612)),this.app("Pred").withInterval(decl.sourceInterval(627,631))).withInterval(decl.sourceInterval(556,631))).define("Pred_not",[],this.seq(this.terminal("~").withInterval(decl.sourceInterval(646,649)),this.app("Lex").withInterval(decl.sourceInterval(650,653))).withInterval(decl.sourceInterval(646,653))).define("Pred_lookahead",[],this.seq(this.terminal("&").withInterval(decl.sourceInterval(668,671)),this.app("Lex").withInterval(decl.sourceInterval(672,675))).withInterval(decl.sourceInterval(668,675))).define("Pred",[],this.alt(this.app("Pred_not").withInterval(decl.sourceInterval(646,653)),this.app("Pred_lookahead").withInterval(decl.sourceInterval(668,675)),this.app("Lex").withInterval(decl.sourceInterval(696,699))).withInterval(decl.sourceInterval(646,699))).define("Lex_lex",[],this.seq(this.terminal("#").withInterval(decl.sourceInterval(713,716)),this.app("Base").withInterval(decl.sourceInterval(717,721))).withInterval(decl.sourceInterval(713,721))).define("Lex",[],this.alt(this.app("Lex_lex").withInterval(decl.sourceInterval(713,721)),this.app("Base").withInterval(decl.sourceInterval(736,740))).withInterval(decl.sourceInterval(713,740))).define("Base_application",[],this.seq(this.app("ident").withInterval(decl.sourceInterval(755,760)),this.opt(this.app("Params").withInterval(decl.sourceInterval(761,767))).withInterval(decl.sourceInterval(761,768)),this.not(this.alt(this.seq(this.opt(this.app("ruleDescr").withInterval(decl.sourceInterval(771,780))).withInterval(decl.sourceInterval(771,781)),this.terminal("=").withInterval(decl.sourceInterval(782,785))).withInterval(decl.sourceInterval(771,785)),this.terminal(":=").withInterval(decl.sourceInterval(788,792)),this.terminal("+=").withInterval(decl.sourceInterval(795,799))).withInterval(decl.sourceInterval(771,799))).withInterval(decl.sourceInterval(769,800))).withInterval(decl.sourceInterval(755,800))).define("Base_range",[],this.seq(this.app("terminal").withInterval(decl.sourceInterval(823,831)),this.terminal("..").withInterval(decl.sourceInterval(832,836)),this.app("terminal").withInterval(decl.sourceInterval(837,845))).withInterval(decl.sourceInterval(823,845))).define("Base_terminal",[],this.app("terminal").withInterval(decl.sourceInterval(885,893))).define("Base_paren",[],this.seq(this.terminal("(").withInterval(decl.sourceInterval(950,953)),this.app("Alt").withInterval(decl.sourceInterval(954,957)),this.terminal(")").withInterval(decl.sourceInterval(958,961))).withInterval(decl.sourceInterval(950,961))).define("Base",[],this.alt(this.app("Base_application").withInterval(decl.sourceInterval(755,800)),this.app("Base_range").withInterval(decl.sourceInterval(823,845)),this.app("Base_terminal").withInterval(decl.sourceInterval(885,893)),this.app("Base_paren").withInterval(decl.sourceInterval(950,961))).withInterval(decl.sourceInterval(755,1005))).define("ruleDescr",[],this.seq(this.terminal("(").withInterval(decl.sourceInterval(1047,1050)),this.app("ruleDescrText").withInterval(decl.sourceInterval(1051,1064)),this.terminal(")").withInterval(decl.sourceInterval(1065,1068))).withInterval(decl.sourceInterval(1047,1068)),"a rule description").define("ruleDescrText",[],this.star(this.seq(this.not(this.terminal(")").withInterval(decl.sourceInterval(1094,1097))).withInterval(decl.sourceInterval(1093,1097)),this.app("any").withInterval(decl.sourceInterval(1098,1101))).withInterval(decl.sourceInterval(1093,1101))).withInterval(decl.sourceInterval(1092,1103))).define("caseName",[],this.seq(this.terminal("--").withInterval(decl.sourceInterval(1122,1126)),this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(1129,1133))).withInterval(decl.sourceInterval(1128,1133)),this.app("space").withInterval(decl.sourceInterval(1134,1139))).withInterval(decl.sourceInterval(1128,1139))).withInterval(decl.sourceInterval(1127,1141)),this.app("name").withInterval(decl.sourceInterval(1142,1146)),this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(1149,1153))).withInterval(decl.sourceInterval(1148,1153)),this.app("space").withInterval(decl.sourceInterval(1154,1159))).withInterval(decl.sourceInterval(1148,1159))).withInterval(decl.sourceInterval(1147,1161)),this.alt(this.terminal("\n").withInterval(decl.sourceInterval(1163,1167)),this.la(this.terminal("}").withInterval(decl.sourceInterval(1171,1174))).withInterval(decl.sourceInterval(1170,1174))).withInterval(decl.sourceInterval(1163,1174))).withInterval(decl.sourceInterval(1122,1175))).define("name",[],this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(1200,1209)),this.star(this.app("nameRest").withInterval(decl.sourceInterval(1210,1218))).withInterval(decl.sourceInterval(1210,1219))).withInterval(decl.sourceInterval(1200,1219)),"a name").define("nameFirst",[],this.alt(this.terminal("_").withInterval(decl.sourceInterval(1239,1242)),this.app("letter").withInterval(decl.sourceInterval(1249,1255))).withInterval(decl.sourceInterval(1239,1255))).define("nameRest",[],this.alt(this.terminal("_").withInterval(decl.sourceInterval(1274,1277)),this.app("alnum").withInterval(decl.sourceInterval(1284,1289))).withInterval(decl.sourceInterval(1274,1289))).define("ident",[],this.app("name").withInterval(decl.sourceInterval(1322,1326)),"an identifier").define("terminal",[],this.seq(this.terminal('"').withInterval(decl.sourceInterval(1345,1349)),this.star(this.app("terminalChar").withInterval(decl.sourceInterval(1350,1362))).withInterval(decl.sourceInterval(1350,1363)),this.terminal('"').withInterval(decl.sourceInterval(1364,1368))).withInterval(decl.sourceInterval(1345,1368))).define("terminalChar",[],this.alt(this.app("escapeChar").withInterval(decl.sourceInterval(1391,1401)),this.seq(this.not(this.terminal("\\").withInterval(decl.sourceInterval(1409,1413))).withInterval(decl.sourceInterval(1408,1413)),this.not(this.terminal('"').withInterval(decl.sourceInterval(1415,1419))).withInterval(decl.sourceInterval(1414,1419)),this.not(this.terminal("\n").withInterval(decl.sourceInterval(1421,1425))).withInterval(decl.sourceInterval(1420,1425)),this.app("any").withInterval(decl.sourceInterval(1426,1429))).withInterval(decl.sourceInterval(1408,1429))).withInterval(decl.sourceInterval(1391,1429))).define("escapeChar_backslash",[],this.terminal("\\\\").withInterval(decl.sourceInterval(1472,1478))).define("escapeChar_doubleQuote",[],this.terminal('\\"').withInterval(decl.sourceInterval(1534,1540))).define("escapeChar_singleQuote",[],this.terminal("\\'").withInterval(decl.sourceInterval(1598,1604))).define("escapeChar_backspace",[],this.terminal("\\b").withInterval(decl.sourceInterval(1662,1667))).define("escapeChar_lineFeed",[],this.terminal("\\n").withInterval(decl.sourceInterval(1724,1729))).define("escapeChar_carriageReturn",[],this.terminal("\\r").withInterval(decl.sourceInterval(1785,1790))).define("escapeChar_tab",[],this.terminal("\\t").withInterval(decl.sourceInterval(1852,1857))).define("escapeChar_unicodeEscape",[],this.seq(this.terminal("\\u").withInterval(decl.sourceInterval(1908,1913)),this.app("hexDigit").withInterval(decl.sourceInterval(1914,1922)),this.app("hexDigit").withInterval(decl.sourceInterval(1923,1931)),this.app("hexDigit").withInterval(decl.sourceInterval(1932,1940)),this.app("hexDigit").withInterval(decl.sourceInterval(1941,1949))).withInterval(decl.sourceInterval(1908,1949))).define("escapeChar_hexEscape",[],this.seq(this.terminal("\\x").withInterval(decl.sourceInterval(1974,1979)),this.app("hexDigit").withInterval(decl.sourceInterval(1980,1988)),this.app("hexDigit").withInterval(decl.sourceInterval(1989,1997))).withInterval(decl.sourceInterval(1974,1997))).define("escapeChar",[],this.alt(this.app("escapeChar_backslash").withInterval(decl.sourceInterval(1472,1478)),this.app("escapeChar_doubleQuote").withInterval(decl.sourceInterval(1534,1540)),this.app("escapeChar_singleQuote").withInterval(decl.sourceInterval(1598,1604)),this.app("escapeChar_backspace").withInterval(decl.sourceInterval(1662,1667)),this.app("escapeChar_lineFeed").withInterval(decl.sourceInterval(1724,1729)),this.app("escapeChar_carriageReturn").withInterval(decl.sourceInterval(1785,1790)),this.app("escapeChar_tab").withInterval(decl.sourceInterval(1852,1857)),this.app("escapeChar_unicodeEscape").withInterval(decl.sourceInterval(1908,1949)),this.app("escapeChar_hexEscape").withInterval(decl.sourceInterval(1974,1997))).withInterval(decl.sourceInterval(1472,2029)),"an escape sequence").extend("space",[],this.app("comment").withInterval(decl.sourceInterval(2045,2052))).define("comment_singleLine",[],this.seq(this.terminal("//").withInterval(decl.sourceInterval(2070,2074)),this.star(this.seq(this.not(this.terminal("\n").withInterval(decl.sourceInterval(2077,2081))).withInterval(decl.sourceInterval(2076,2081)),this.app("any").withInterval(decl.sourceInterval(2082,2085))).withInterval(decl.sourceInterval(2076,2085))).withInterval(decl.sourceInterval(2075,2087)),this.terminal("\n").withInterval(decl.sourceInterval(2088,2092))).withInterval(decl.sourceInterval(2070,2092))).define("comment_multiLine",[],this.seq(this.terminal("/*").withInterval(decl.sourceInterval(2114,2118)),this.star(this.seq(this.not(this.terminal("*/").withInterval(decl.sourceInterval(2121,2125))).withInterval(decl.sourceInterval(2120,2125)),this.app("any").withInterval(decl.sourceInterval(2126,2129))).withInterval(decl.sourceInterval(2120,2129))).withInterval(decl.sourceInterval(2119,2131)),this.terminal("*/").withInterval(decl.sourceInterval(2132,2136))).withInterval(decl.sourceInterval(2114,2136))).define("comment",[],this.alt(this.app("comment_singleLine").withInterval(decl.sourceInterval(2070,2092)),this.app("comment_multiLine").withInterval(decl.sourceInterval(2114,2136))).withInterval(decl.sourceInterval(2070,2150))).define("tokens",[],this.star(this.app("token").withInterval(decl.sourceInterval(2163,2168))).withInterval(decl.sourceInterval(2163,2169))).define("token",[],this.alt(this.app("caseName").withInterval(decl.sourceInterval(2181,2189)),this.app("comment").withInterval(decl.sourceInterval(2192,2199)),this.app("ident").withInterval(decl.sourceInterval(2202,2207)),this.app("operator").withInterval(decl.sourceInterval(2210,2218)),this.app("punctuation").withInterval(decl.sourceInterval(2221,2232)),this.app("terminal").withInterval(decl.sourceInterval(2235,2243)),this.app("any").withInterval(decl.sourceInterval(2246,2249))).withInterval(decl.sourceInterval(2181,2249))).define("operator",[],this.alt(this.terminal("<:").withInterval(decl.sourceInterval(2264,2268)),this.terminal("=").withInterval(decl.sourceInterval(2271,2274)),this.terminal(":=").withInterval(decl.sourceInterval(2277,2281)),this.terminal("+=").withInterval(decl.sourceInterval(2284,2288)),this.terminal("*").withInterval(decl.sourceInterval(2291,2294)),this.terminal("+").withInterval(decl.sourceInterval(2297,2300)),this.terminal("?").withInterval(decl.sourceInterval(2303,2306)),this.terminal("~").withInterval(decl.sourceInterval(2309,2312)),this.terminal("&").withInterval(decl.sourceInterval(2315,2318))).withInterval(decl.sourceInterval(2264,2318))).define("punctuation",[],this.alt(this.terminal("<").withInterval(decl.sourceInterval(2336,2339)),this.terminal(">").withInterval(decl.sourceInterval(2342,2345)),this.terminal(",").withInterval(decl.sourceInterval(2348,2351)),this.terminal("--").withInterval(decl.sourceInterval(2354,2358))).withInterval(decl.sourceInterval(2336,2358))).build()})},{"..":50}],12:[function(require,module,exports){var ohm=require("..");module.exports=ohm.makeRecipe(function(){var decl=this.newGrammar("OperationsAndAttributes").withSource('OperationsAndAttributes {\n\n AttributeSignature =\n name\n\n OperationSignature =\n name Formals?\n\n Formals\n = "(" ListOf ")"\n\n name (a name)\n = nameFirst nameRest*\n\n nameFirst\n = "_"\n | letter\n\n nameRest\n = "_"\n | alnum\n\n}').withDefaultStartRule("AttributeSignature");return decl.define("AttributeSignature",[],this.app("name").withInterval(decl.sourceInterval(54,58))).define("OperationSignature",[],this.seq(this.app("name").withInterval(decl.sourceInterval(87,91)),this.opt(this.app("Formals").withInterval(decl.sourceInterval(92,99))).withInterval(decl.sourceInterval(92,100))).withInterval(decl.sourceInterval(87,100))).define("Formals",[],this.seq(this.terminal("(").withInterval(decl.sourceInterval(118,121)),this.app("ListOf",[this.app("name").withInterval(decl.sourceInterval(129,133)),this.terminal(",").withInterval(decl.sourceInterval(135,138))]).withInterval(decl.sourceInterval(122,139)),this.terminal(")").withInterval(decl.sourceInterval(140,143))).withInterval(decl.sourceInterval(118,143))).define("name",[],this.seq(this.app("nameFirst").withInterval(decl.sourceInterval(168,177)),this.star(this.app("nameRest").withInterval(decl.sourceInterval(178,186))).withInterval(decl.sourceInterval(178,187))).withInterval(decl.sourceInterval(168,187)),"a name").define("nameFirst",[],this.alt(this.terminal("_").withInterval(decl.sourceInterval(207,210)),this.app("letter").withInterval(decl.sourceInterval(217,223))).withInterval(decl.sourceInterval(207,223))).define("nameRest",[],this.alt(this.terminal("_").withInterval(decl.sourceInterval(242,245)),this.app("alnum").withInterval(decl.sourceInterval(252,257))).withInterval(decl.sourceInterval(242,257))).build(); +})},{"..":50}],13:[function(require,module,exports){"use strict";module.exports={toAST:require("./semantics-toAST").helper,semanticsForToAST:require("./semantics-toAST").semantics}},{"./semantics-toAST":14}],14:[function(require,module,exports){"use strict";var pexprs=require("../src/pexprs");var MatchResult=require("../src/MatchResult");var Grammar=require("../src/Grammar");var extend=require("util-extend");var defaultOperation={_terminal:function(){return this.primitiveValue},_nonterminal:function(children){var ctorName=this._node.ctorName;var mapping=this.args.mapping;if(!mapping.hasOwnProperty(ctorName)){if(this._node instanceof pexprs.Alt||this._node instanceof pexprs.Apply){return children[0].toAST(mapping)}if(this.isLexical()){return this.interval.contents}var realChildren=children.filter(function(child){return!child.isTerminal()});if(realChildren.length===1){return realChildren[0].toAST(mapping)}}if(typeof mapping[ctorName]==="number"){return children[mapping[ctorName]].toAST(mapping)}var propMap=mapping[ctorName]||children;var node={type:ctorName};for(var prop in propMap){var mappedProp=mapping[ctorName]&&mapping[ctorName][prop];if(typeof mappedProp==="number"){node[prop]=children[mappedProp].toAST(mapping)}else if(typeof mappedProp==="string"||typeof mappedProp==="boolean"||mappedProp===null){node[prop]=mappedProp}else if(typeof mappedProp==="object"&&mappedProp instanceof Number){node[prop]=Number(mappedProp)}else if(typeof mappedProp==="function"){node[prop]=mappedProp.call(this,children)}else if(mappedProp===undefined){if(children[prop]&&!children[prop].isTerminal()){node[prop]=children[prop].toAST(mapping)}else{delete node[prop]}}}return node},_iter:function(children){if(this._node.isOptional()){if(this.numChildren===0){return null}else{return children[0].toAST(this.args.mapping)}}return children.map(function(child){return child.toAST(this.args.mapping)},this)},NonemptyListOf:function(first,sep,rest){return[first.toAST(this.args.mapping)].concat(rest.toAST(this.args.mapping))},EmptyListOf:function(){return[]}};function toAST(res,mapping){if(!(res instanceof MatchResult)||res.failed()){throw new Error("toAST() expects a succesfull MatchResult as first parameter")}mapping=extend({},mapping);var operation=extend({},defaultOperation);for(var termName in mapping){if(typeof mapping[termName]==="function"){operation[termName]=mapping[termName];delete mapping[termName]}}var g=res._cst.grammar;var s=g.semantics().addOperation("toAST(mapping)",operation);return s(res).toAST(mapping)}function semanticsForToAST(g){if(!(g instanceof Grammar)){throw new Error("semanticsToAST() expects a Grammar as parameter")}return g.semantics().addOperation("toAST(mapping)",defaultOperation)}module.exports={helper:toAST,semantics:semanticsForToAST}},{"../src/Grammar":38,"../src/MatchResult":42,"../src/pexprs":67,"util-extend":35}],15:[function(require,module,exports){"use strict";module.exports=require("./is-implemented")()?Symbol:require("./polyfill")},{"./is-implemented":16,"./polyfill":31}],16:[function(require,module,exports){"use strict";module.exports=function(){var symbol;if(typeof Symbol!=="function")return false;symbol=Symbol("test symbol");try{String(symbol)}catch(e){return false}if(typeof Symbol.iterator==="symbol")return true;if(typeof Symbol.isConcatSpreadable!=="object")return false;if(typeof Symbol.iterator!=="object")return false;if(typeof Symbol.toPrimitive!=="object")return false;if(typeof Symbol.toStringTag!=="object")return false;if(typeof Symbol.unscopables!=="object")return false;return true}},{}],17:[function(require,module,exports){"use strict";module.exports=function(x){return x&&(typeof x==="symbol"||x["@@toStringTag"]==="Symbol")||false}},{}],18:[function(require,module,exports){"use strict";var assign=require("es5-ext/object/assign"),normalizeOpts=require("es5-ext/object/normalize-options"),isCallable=require("es5-ext/object/is-callable"),contains=require("es5-ext/string/#/contains"),d;d=module.exports=function(dscr,value){var c,e,w,options,desc;if(arguments.length<2||typeof dscr!=="string"){options=value;value=dscr;dscr=null}else{options=arguments[2]}if(dscr==null){c=w=true;e=false}else{c=contains.call(dscr,"c");e=contains.call(dscr,"e");w=contains.call(dscr,"w")}desc={value:value,configurable:c,enumerable:e,writable:w};return!options?desc:assign(normalizeOpts(options),desc)};d.gs=function(dscr,get,set){var c,e,options,desc;if(typeof dscr!=="string"){options=set;set=get;get=dscr;dscr=null}else{options=arguments[3]}if(get==null){get=undefined}else if(!isCallable(get)){options=get;get=set=undefined}else if(set==null){set=undefined}else if(!isCallable(set)){options=set;set=undefined}if(dscr==null){c=true;e=false}else{c=contains.call(dscr,"c");e=contains.call(dscr,"e")}desc={get:get,set:set,configurable:c,enumerable:e};return!options?desc:assign(normalizeOpts(options),desc)}},{"es5-ext/object/assign":19,"es5-ext/object/is-callable":22,"es5-ext/object/normalize-options":26,"es5-ext/string/#/contains":28}],19:[function(require,module,exports){"use strict";module.exports=require("./is-implemented")()?Object.assign:require("./shim")},{"./is-implemented":20,"./shim":21}],20:[function(require,module,exports){"use strict";module.exports=function(){var assign=Object.assign,obj;if(typeof assign!=="function")return false;obj={foo:"raz"};assign(obj,{bar:"dwa"},{trzy:"trzy"});return obj.foo+obj.bar+obj.trzy==="razdwatrzy"}},{}],21:[function(require,module,exports){"use strict";var keys=require("../keys"),value=require("../valid-value"),max=Math.max;module.exports=function(dest,src){var error,i,l=max(arguments.length,2),assign;dest=Object(value(dest));assign=function(key){try{dest[key]=src[key]}catch(e){if(!error)error=e}};for(i=1;i-1}},{}],31:[function(require,module,exports){"use strict";var d=require("d"),validateSymbol=require("./validate-symbol"),create=Object.create,defineProperties=Object.defineProperties,defineProperty=Object.defineProperty,objPrototype=Object.prototype,Symbol,HiddenSymbol,globalSymbols=create(null);var generateName=function(){var created=create(null);return function(desc){var postfix=0,name;while(created[desc+(postfix||"")])++postfix;desc+=postfix||"";created[desc]=true;name="@@"+desc;defineProperty(objPrototype,name,d.gs(null,function(value){defineProperty(this,name,d(value))}));return name}}();HiddenSymbol=function Symbol(description){if(this instanceof HiddenSymbol)throw new TypeError("TypeError: Symbol is not a constructor");return Symbol(description)};module.exports=Symbol=function Symbol(description){var symbol;if(this instanceof Symbol)throw new TypeError("TypeError: Symbol is not a constructor");symbol=create(HiddenSymbol.prototype);description=description===undefined?"":String(description);return defineProperties(symbol,{__description__:d("",description),__name__:d("",generateName(description))})};defineProperties(Symbol,{"for":d(function(key){if(globalSymbols[key])return globalSymbols[key];return globalSymbols[key]=Symbol(String(key))}),keyFor:d(function(s){var key;validateSymbol(s);for(key in globalSymbols)if(globalSymbols[key]===s)return key}),hasInstance:d("",Symbol("hasInstance")),isConcatSpreadable:d("",Symbol("isConcatSpreadable")),iterator:d("",Symbol("iterator")),match:d("",Symbol("match")),replace:d("",Symbol("replace")),search:d("",Symbol("search")),species:d("",Symbol("species")),split:d("",Symbol("split")),toPrimitive:d("",Symbol("toPrimitive")),toStringTag:d("",Symbol("toStringTag")),unscopables:d("",Symbol("unscopables"))});defineProperties(HiddenSymbol.prototype,{constructor:d(Symbol),toString:d("",function(){return this.__name__})});defineProperties(Symbol.prototype,{toString:d(function(){return"Symbol ("+validateSymbol(this).__description__+")"}),valueOf:d(function(){return validateSymbol(this)})});defineProperty(Symbol.prototype,Symbol.toPrimitive,d("",function(){return validateSymbol(this)}));defineProperty(Symbol.prototype,Symbol.toStringTag,d("c","Symbol"));defineProperty(HiddenSymbol.prototype,Symbol.toPrimitive,d("c",Symbol.prototype[Symbol.toPrimitive]));defineProperty(HiddenSymbol.prototype,Symbol.toStringTag,d("c",Symbol.prototype[Symbol.toStringTag]))},{"./validate-symbol":32,d:18}],32:[function(require,module,exports){"use strict";var isSymbol=require("./is-symbol");module.exports=function(value){if(!isSymbol(value))throw new TypeError(value+" is not a symbol");return value}},{"./is-symbol":17}],33:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],34:[function(require,module,exports){module.exports=function(obj){return!!(obj!=null&&obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj))}},{}],35:[function(require,module,exports){module.exports=extend;function extend(origin,add){if(!add||typeof add!=="object")return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin}},{}],36:[function(require,module,exports){"use strict";var GrammarDecl=require("./GrammarDecl");var pexprs=require("./pexprs");function Builder(){}Builder.prototype={newGrammar:function(name){return new GrammarDecl(name)},terminal:function(x){return new pexprs.Terminal(x)},range:function(from,to){return new pexprs.Range(from,to)},param:function(index){return new pexprs.Param(index)},alt:function(){var terms=[];for(var idx=0;idx0){var prettyProblems=problems.map(function(problem){return"- "+problem});var error=new Error("Found errors in the action dictionary of the '"+name+"' "+what+":\n"+prettyProblems.join("\n"));error.problems=problems;throw error}},_topDownActionArity:function(actionName){if(actionName==="_iter"||actionName==="_nonterminal"||actionName==="_default"){return 1}else if(actionName==="_terminal"){return 0}return this.ruleBodies[actionName].getArity()},_inheritsFrom:function(grammar){var g=this.superGrammar;while(g){if(g===grammar){return true}g=g.superGrammar}return false},toRecipe:function(optVarName){if(this.isBuiltIn()){throw new Error("Why would anyone want to generate a recipe for the "+this.name+" grammar?!?!")}var sb=new common.StringBuffer;if(optVarName){sb.append("var "+optVarName+" = ")}sb.append("(function() {\n");var superGrammarDecl="";if(!this.superGrammar.isBuiltIn()){sb.append(this.superGrammar.toRecipe("buildSuperGrammar"));superGrammarDecl=" .withSuperGrammar(buildSuperGrammar.call(this))\n"}sb.append(" var decl = this.newGrammar("+JSON.stringify(this.name)+")\n");if(this.definitionInterval){sb.append(" .withSource("+JSON.stringify(this.definitionInterval.contents)+")\n")}sb.append(superGrammarDecl);if(this.defaultStartRule){sb.append(' .withDefaultStartRule("'+this.defaultStartRule+'")\n')}sb.append(" return decl\n");var self=this;Object.keys(this.ruleBodies).forEach(function(ruleName){var body=self.ruleBodies[ruleName];sb.append(" .");if(self.superGrammar.ruleBodies[ruleName]){sb.append(body instanceof pexprs.Extend?"extend":"override")}else{sb.append("define")}var formals=self.ruleFormals[ruleName];var formalsString="["+formals.map(JSON.stringify).join(", ")+"]";sb.append("("+JSON.stringify(ruleName)+", "+formalsString+", ");body.outputRecipe(sb,formals,self.definitionInterval);if(!self.superGrammar.ruleBodies[ruleName]&&self.ruleDescriptions[ruleName]){sb.append(", "+JSON.stringify(self.ruleDescriptions[ruleName]))}sb.append(")\n")});sb.append(" .build();\n});\n");return sb.contents()},toOperationActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},toAttributeActionDictionaryTemplate:function(){return this._toOperationOrAttributeActionDictionaryTemplate()},_toOperationOrAttributeActionDictionaryTemplate:function(){var sb=new common.StringBuffer;sb.append("{");var first=true;for(var ruleName in this.ruleBodies){var body=this.ruleBodies[ruleName];if(first){first=false}else{sb.append(",")}sb.append("\n");sb.append(" ");this.addSemanticActionTemplate(ruleName,body,sb)}sb.append("\n}");return sb.contents()},addSemanticActionTemplate:function(ruleName,body,sb){sb.append(ruleName);sb.append(": function(");var arity=this._topDownActionArity(ruleName);sb.append(common.repeat("_",arity).join(", "));sb.append(") {\n");sb.append(" }")},parseApplication:function(str){var app;if(str.indexOf("<")===-1){app=new pexprs.Apply(str)}else{var cst=ohmGrammar.match(str,"Base_application");app=buildGrammar(cst,{})}if(!(app.ruleName in this.ruleBodies)){throw errors.undeclaredRule(app.ruleName,this.name)}else if(this.ruleFormals[app.ruleName].length!==app.args.length){throw errors.wrongNumberOfParameters(app.ruleName,this.ruleFormals[app.ruleName].length,app.args.length)}return app}};Grammar.ProtoBuiltInRules=new Grammar("ProtoBuiltInRules",undefined,{any:pexprs.any,end:pexprs.end,spaces:new pexprs.Star(new pexprs.Apply("space")),space:new pexprs.Range("\x00"," "),lower:new pexprs.UnicodeChar("Ll"),upper:new pexprs.UnicodeChar("Lu"),unicodeLtmo:new pexprs.UnicodeChar("Ltmo")},{any:[],end:[],spaces:[],space:[],lower:[],upper:[],unicodeLtmo:[]},{any:"any object",end:"end of input",space:"a space",lower:"a lowercase letter",upper:"an uppercase letter"});module.exports=Grammar},{"./MatchResult":42,"./Semantics":45,"./State":46,"./common":48,"./errors":49,"./pexprs":67}],39:[function(require,module,exports){"use strict";var Grammar=require("./Grammar");var InputStream=require("./InputStream");var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");function GrammarDecl(name){this.name=name}GrammarDecl.prototype.sourceInterval=function(startIdx,endIdx){var inputStream=this.interval.inputStream;return inputStream.interval(startIdx,endIdx)};GrammarDecl.prototype.ensureSuperGrammar=function(){if(!this.superGrammar){this.withSuperGrammar(this.name==="BuiltInRules"?Grammar.ProtoBuiltInRules:Grammar.BuiltInRules)}return this.superGrammar};GrammarDecl.prototype.installOverriddenOrExtendedRule=function(name,formals,body){var duplicateParameterNames=common.getDuplicates(formals);if(duplicateParameterNames.length>0){throw errors.duplicateParameterNames(name,duplicateParameterNames,body)}var expectedFormals=this.ensureSuperGrammar().ruleFormals[name];var expectedNumFormals=expectedFormals?expectedFormals.length:0;if(formals.length!==expectedNumFormals){throw errors.wrongNumberOfParameters(name,expectedNumFormals,formals.length,body)}return this.install(name,formals,body)};GrammarDecl.prototype.install=function(name,formals,body,optDescription){body=body.introduceParams(formals);this.ruleFormals[name]=formals;if(optDescription){this.ruleDescriptions[name]=optDescription}this.ruleBodies[name]=body;return this};GrammarDecl.prototype.withSuperGrammar=function(superGrammar){if(this.superGrammar){throw new Error("the super grammar of a GrammarDecl cannot be set more than once")}this.superGrammar=superGrammar;this.ruleBodies=Object.create(superGrammar.ruleBodies);this.ruleFormals=Object.create(superGrammar.ruleFormals);this.ruleDescriptions=Object.create(superGrammar.ruleDescriptions);if(!superGrammar.isBuiltIn()){this.defaultStartRule=superGrammar.defaultStartRule}return this};GrammarDecl.prototype.withDefaultStartRule=function(ruleName){this.defaultStartRule=ruleName;return this};GrammarDecl.prototype.withSource=function(source){this.interval=new InputStream(source).interval(0,source.length);return this};GrammarDecl.prototype.build=function(){var grammar=new Grammar(this.name,this.ensureSuperGrammar(),this.ruleBodies,this.ruleFormals,this.ruleDescriptions,this.defaultStartRule);var grammarErrors=[];var grammarHasInvalidApplications=false;Object.keys(grammar.ruleBodies).forEach(function(ruleName){var body=grammar.ruleBodies[ruleName];try{body.assertChoicesHaveUniformArity(ruleName)}catch(e){grammarErrors.push(e)}try{body.assertAllApplicationsAreValid(ruleName,grammar)}catch(e){grammarErrors.push(e);grammarHasInvalidApplications=true}});if(!grammarHasInvalidApplications){Object.keys(grammar.ruleBodies).forEach(function(ruleName){var body=grammar.ruleBodies[ruleName];try{body.assertIteratedExprsAreNotNullable(grammar,ruleName)}catch(e){grammarErrors.push(e)}})}if(grammarErrors.length>0){errors.throwErrors(grammarErrors)}if(this.interval){grammar.definitionInterval=this.interval}return grammar};GrammarDecl.prototype.define=function(name,formals,body,optDescr){this.ensureSuperGrammar();if(this.superGrammar.ruleBodies[name]){throw errors.duplicateRuleDeclaration(name,this.name,this.superGrammar.name,body)}else if(this.ruleBodies[name]){throw errors.duplicateRuleDeclaration(name,this.name,this.name,body)}var duplicateParameterNames=common.getDuplicates(formals);if(duplicateParameterNames.length>0){throw errors.duplicateParameterNames(name,duplicateParameterNames,body)}return this.install(name,formals,body,optDescr)};GrammarDecl.prototype.override=function(name,formals,body){var baseRule=this.ensureSuperGrammar().ruleBodies[name];if(!baseRule){throw errors.cannotOverrideUndeclaredRule(name,this.superGrammar.name,body)}this.installOverriddenOrExtendedRule(name,formals,body);return this};GrammarDecl.prototype.extend=function(name,formals,fragment){var baseRule=this.ensureSuperGrammar().ruleBodies[name];if(!baseRule){throw errors.cannotExtendUndeclaredRule(name,this.superGrammar.name,fragment)}var body=new pexprs.Extend(this.superGrammar,name,fragment);body.interval=fragment.interval;this.installOverriddenOrExtendedRule(name,formals,body);return this};module.exports=GrammarDecl},{"./Grammar":38,"./InputStream":40,"./common":48,"./errors":49,"./pexprs":67}],40:[function(require,module,exports){"use strict";var Interval=require("./Interval");function InputStream(source){this.source=source;this.pos=0;this.posInfos=[]}InputStream.prototype={atEnd:function(){return this.pos===this.source.length},next:function(){return this.source[this.pos++]},matchString:function(s){for(var idx=0;idx=that.startIdx&&this.endIdx<=that.endIdx,"other interval does not cover this one");return new Interval(newInputStream,this.startIdx-that.startIdx,this.endIdx-that.startIdx)},trimmed:function(){var contents=this.contents;var startIdx=this.startIdx+contents.match(/^\s*/)[0].length;var endIdx=this.endIdx-contents.match(/\s*$/)[0].length;return new Interval(this.inputStream,startIdx,endIdx)}};Object.defineProperties(Interval.prototype,{contents:{get:function(){if(this._contents===undefined){this._contents=this.inputStream.sourceSlice(this.startIdx,this.endIdx)}return this._contents},enumerable:true}});module.exports=Interval},{"./common":48,"./errors":49,"./util":68}],42:[function(require,module,exports){"use strict";var inherits=require("inherits");var common=require("./common");var nodes=require("./nodes");var util=require("./util");var Interval=require("./Interval");function getShortMatchErrorMessage(pos,source,detail){var errorInfo=util.getLineAndColumn(source,pos);return"Line "+errorInfo.lineNum+", col "+errorInfo.colNum+": "+detail}function MatchResult(state){this.state=state;this._cst=state.bindings[0]}MatchResult.newFor=function(state){var succeeded=state.bindings.length>0;return succeeded?new MatchResult(state):new MatchFailure(state)};MatchResult.prototype.failed=function(){return false};MatchResult.prototype.succeeded=function(){return!this.failed()};MatchResult.prototype.getDiscardedSpaces=function(){if(this.failed()){return[]}var state=this.state;var grammar=state.grammar;var inputStream=state.inputStream;var intervals=[new Interval(inputStream,0,inputStream.source.length)];var s=grammar.semantics().addOperation("subtractTerminals",{_nonterminal:function(children){children.forEach(function(child){child.subtractTerminals()})},_terminal:function(){var t=this;intervals=intervals.map(function(interval){return interval.minus(t.interval)}).reduce(function(xs,ys){return xs.concat(ys)},[])}});s(this).subtractTerminals();s.addOperation("fixIntervals(idxOffset)",{_default:function(children){var idxOffset=this.args.idxOffset;this.interval.inputStream=inputStream;this.interval.startIdx+=idxOffset;this.interval.endIdx+=idxOffset;if(!this.isTerminal()){children.forEach(function(child){child.fixIntervals(idxOffset)})}}});var discardedNodes=intervals.map(function(interval){var r=grammar.match(interval.contents,"spaces");s(r).fixIntervals(interval.startIdx);return r._cst});discardedNodes=new nodes.IterationNode(grammar,discardedNodes,discardedNodes.length===0?new Interval(inputStream,0,0):new Interval(inputStream,discardedNodes[0].interval.startIdx,discardedNodes[discardedNodes.length-1].interval.endIdx));var r=Object.create(this);r._cst=discardedNodes;r.getDiscardedSpaces=function(){return r};return r};function MatchFailure(state){this.state=state;common.defineLazyProperty(this,"_failures",function(){return this.state.getFailures()});common.defineLazyProperty(this,"message",function(){var source=this.state.inputStream.source;if(typeof source!=="string"){return"match failed at position "+this.getRightmostFailurePosition()}var detail="Expected "+this.getExpectedText();return util.getLineAndColumnMessage(source,this.getRightmostFailurePosition())+detail});common.defineLazyProperty(this,"shortMessage",function(){if(typeof this.state.inputStream.source!=="string"){return"match failed at position "+this.getRightmostFailurePosition()}var detail="expected "+this.getExpectedText();return getShortMatchErrorMessage(this.getRightmostFailurePosition(),this.state.inputStream.source,detail)})}inherits(MatchFailure,MatchResult);MatchFailure.prototype.toString=function(){return"[MatchFailure at position "+this.getRightmostFailurePosition()+"]"};MatchFailure.prototype.failed=function(){return true};MatchFailure.prototype.getRightmostFailurePosition=function(){return this.state.getRightmostFailurePosition()};MatchFailure.prototype.getRightmostFailures=function(){return this._failures};MatchFailure.prototype.getExpectedText=function(){var sb=new common.StringBuffer;var failures=this.getRightmostFailures();failures=failures.filter(function(failure){return!failure.isFluffy()});for(var idx=0;idx0){if(idx===failures.length-1){sb.append(failures.length>2?", or ":" or ")}else{sb.append(", ")}}sb.append(failures[idx].toString())}return sb.contents()};MatchFailure.prototype.getInterval=function(){var pos=this.state.getRightmostFailurePosition();return new Interval(this.state.inputStream,pos,pos)};module.exports=MatchResult},{"./Interval":41,"./common":48,"./nodes":51,"./util":68,inherits:33}],43:[function(require,module,exports){"use strict";var extend=require("util-extend");function Namespace(){}Namespace.prototype=Object.create(null);Namespace.asNamespace=function(objOrNamespace){if(objOrNamespace instanceof Namespace){return objOrNamespace}return Namespace.createNamespace(objOrNamespace)};Namespace.createNamespace=function(optProps){return Namespace.extend(Namespace.prototype,optProps)};Namespace.extend=function(namespace,optProps){if(namespace!==Namespace.prototype&&!(namespace instanceof Namespace)){throw new TypeError("not a Namespace object: "+namespace)}var ns=Object.create(namespace,{constructor:{value:Namespace,enumerable:false, +writable:true,configurable:true}});return extend(ns,optProps)};Namespace.toString=function(ns){return Object.prototype.toString.call(ns)};module.exports=Namespace},{"util-extend":35}],44:[function(require,module,exports){"use strict";function PosInfo(state){this.state=state;this.applicationMemoKeyStack=[];this.memo={};this.currentLeftRecursion=undefined}PosInfo.prototype={isActive:function(application){return this.applicationMemoKeyStack.indexOf(application.toMemoKey())>=0},enter:function(application){this.state.enter(application);this.applicationMemoKeyStack.push(application.toMemoKey())},exit:function(){this.state.exit();this.applicationMemoKeyStack.pop()},startLeftRecursion:function(headApplication,memoRec){memoRec.isLeftRecursion=true;memoRec.headApplication=headApplication;memoRec.nextLeftRecursion=this.currentLeftRecursion;this.currentLeftRecursion=memoRec;var applicationMemoKeyStack=this.applicationMemoKeyStack;var indexOfFirstInvolvedRule=applicationMemoKeyStack.indexOf(headApplication.toMemoKey())+1;var involvedApplicationMemoKeys=applicationMemoKeyStack.slice(indexOfFirstInvolvedRule);memoRec.isInvolved=function(applicationMemoKey){return involvedApplicationMemoKeys.indexOf(applicationMemoKey)>=0};memoRec.updateInvolvedApplicationMemoKeys=function(){for(var idx=indexOfFirstInvolvedRule;idx0){signature+="("+semanticOperations[name].formals.join(", ")+")"}var method;if(hasSuperSemantics(this)&&this.super[type.toLowerCase()+"s"][name]){method="extend"+type}else{method="add"+type}str+="\n ."+method+"("+JSON.stringify(signature)+", {";var actions=semanticOperations[name].actionDict;var srcArray=[];Object.keys(actions).forEach(function(actionName){if(semanticOperations[name].builtInDefault!==actions[actionName]){srcArray.push("\n "+JSON.stringify(actionName)+": "+actions[actionName].toString())}});str+=srcArray.join(",");str+="\n })"},this)},this);str+=";\n })";if(!semanticsOnly){str="(function() {\n"+" var buildGrammar = "+this.grammar.toRecipe()+" var grammar = buildGrammar.call(this);\n"+" var semantics = "+str+"(grammar);\n"+" return semantics;\n"+"});\n"}return str};var prototypeGrammar;var prototypeGrammarSemantics;Semantics.initPrototypeParser=function(grammar){prototypeGrammarSemantics=grammar.semantics().addOperation("parse",{AttributeSignature:function(name){return{name:name.parse(),formals:[]}},OperationSignature:function(name,optFormals){return{name:name.parse(),formals:optFormals.parse()[0]||[]}},Formals:function(oparen,fs,cparen){return fs.asIteration().parse()},name:function(first,rest){return this.interval.contents}});prototypeGrammar=grammar};function parseSignature(signature,type){if(!prototypeGrammar){common.assert(signature.indexOf("(")===-1);return{name:signature,formals:[]}}var r=prototypeGrammar.match(signature,type==="operation"?"OperationSignature":"AttributeSignature");if(r.failed()){throw new Error(r.message)}return prototypeGrammarSemantics(r).parse()}function newDefaultAction(type,name,doIt){return function(children){var self=this;var thisThing=this._semantics.operations[name]||this._semantics.attributes[name];var args=thisThing.formals.map(function(formal){return self.args[formal]});if(this.isIteration()){return children.map(function(child){return doIt.apply(child,args)})}if(children.length===1){return doIt.apply(children[0],args)}else{throw new Error("Missing semantic action for "+this.ctorName+" in "+name+" "+type)}}}Semantics.prototype.addOperationOrAttribute=function(type,signature,actionDict){var typePlural=type+"s";var parsedNameAndFormalArgs=parseSignature(signature,type);var name=parsedNameAndFormalArgs.name;var formals=parsedNameAndFormalArgs.formals;this.assertNewName(name,type);var builtInDefault=newDefaultAction(type,name,doIt);var realActionDict={_default:builtInDefault};Object.keys(actionDict).forEach(function(name){realActionDict[name]=actionDict[name]});var entry=type==="operation"?new Operation(name,formals,realActionDict,builtInDefault):new Attribute(name,realActionDict,builtInDefault);entry.checkActionDict(this.grammar);this[typePlural][name]=entry;function doIt(){var thisThing=this._semantics[typePlural][name];if(arguments.length!==thisThing.formals.length){throw new Error("Invalid number of arguments passed to "+name+" "+type+" (expected "+thisThing.formals.length+", got "+arguments.length+")")}var args=Object.create(null);for(var idx=0;idxnewLength){this.bindings.pop()}},getCurrentPosInfo:function(){return this.getPosInfo(this.inputStream.pos)},getPosInfo:function(pos){var posInfo=this.posInfos[pos];return posInfo||(this.posInfos[pos]=new PosInfo(this))},processFailure:function(pos,expr){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){if(pos>this.rightmostFailurePosition){this.rightmostFailurePosition=pos}}else if(pos===this.rightmostFailurePosition){this.addRightmostFailure(expr.toFailure(this.grammar),false)}},ensureRightmostFailures:function(){if(!this.rightmostFailures){this.rightmostFailures=Object.create(null)}},addRightmostFailure:function(failure,shouldCloneIfNew){this.ensureRightmostFailures();var key=failure.toKey();if(!this.rightmostFailures[key]){this.rightmostFailures[key]=shouldCloneIfNew?failure.clone():failure}else if(this.rightmostFailures[key].isFluffy()&&!failure.isFluffy()){this.rightmostFailures[key].clearFluffy()}},addRightmostFailures:function(failures,shouldCloneIfNew){var self=this;Object.keys(failures).forEach(function(key){self.addRightmostFailure(failures[key],shouldCloneIfNew)})},cloneRightmostFailures:function(){if(!this.rightmostFailures){return undefined}var ans=Object.create(null);var self=this;Object.keys(this.rightmostFailures).forEach(function(key){ans[key]=self.rightmostFailures[key].clone()});return ans},getRightmostFailurePosition:function(){return this.rightmostFailurePosition},getFailures:function(){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){this.init(RM_RIGHTMOST_FAILURES);this.evalFromStart()}this.ensureRightmostFailures();var self=this;return Object.keys(this.rightmostFailures).map(function(key){return self.rightmostFailures[key]})},getMemoizedTraceEntry:function(pos,expr){var posInfo=this.posInfos[pos];if(posInfo&&expr.ruleName){var memoRec=posInfo.memo[expr.toMemoKey()];if(memoRec){return memoRec.traceEntry}}return null},getTraceEntry:function(pos,expr,succeeded,bindings){var memoEntry=this.getMemoizedTraceEntry(pos,expr);return memoEntry?memoEntry.cloneWithExpr(expr):new Trace(this.inputStream,pos,expr,succeeded,bindings,this.trace)},isTracing:function(){return this.tracingEnabled},useMemoizedResult:function(memoRec){if(this.isTracing()){this.trace.push(memoRec.traceEntry)}if(this.recordingMode===RM_RIGHTMOST_FAILURES&&memoRec.failuresAtRightmostPosition){this.addRightmostFailures(memoRec.failuresAtRightmostPosition,true)}if(memoRec.value){this.inputStream.pos=memoRec.pos;this.bindings.push(memoRec.value);return true}return false},eval:function(expr){var inputStream=this.inputStream;var origNumBindings=this.bindings.length;if(this.recordingMode===RM_RIGHTMOST_FAILURES){var origFailures=this.rightmostFailures;this.rightmostFailures=undefined}var origPos=inputStream.pos;var memoPos=this.maybeSkipSpacesBefore(expr);if(this.isTracing()){var origTrace=this.trace;this.trace=[]}var ans=expr.eval(this);if(this.isTracing()){var bindings=this.bindings.slice(origNumBindings);var traceEntry=this.getTraceEntry(memoPos,expr,ans,bindings);traceEntry.isImplicitSpaces=expr===applySpaces;traceEntry.isRootNode=expr===this.startExpr;origTrace.push(traceEntry);this.trace=origTrace}if(ans){if(this.rightmostFailures&&(inputStream.pos===this.rightmostFailurePosition||this.skipSpacesIfInSyntacticContext()===this.rightmostFailurePosition)){var self=this;Object.keys(this.rightmostFailures).forEach(function(key){self.rightmostFailures[key].makeFluffy()})}}else{inputStream.pos=origPos;this.truncateBindings(origNumBindings)}if(this.recordingMode===RM_RIGHTMOST_FAILURES&&origFailures){this.addRightmostFailures(origFailures,false)}return ans},_getStartExpr:function(grammar,optStartApplication){var applicationStr=optStartApplication||grammar.defaultStartRule;if(!applicationStr){throw new Error("Missing start rule argument -- the grammar has no default start rule.")}var startApp=grammar.parseApplication(applicationStr);return new pexprs.Seq([startApp,pexprs.end])},evalFromStart:function(){this.eval(this.startExpr)},getFailuresInfo:function(){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){return this.rightmostFailurePosition}else{return this.rightmostFailures}},restoreFailuresInfo:function(failuresInfo){if(this.recordingMode===RM_RIGHTMOST_FAILURE_POSITION){this.rightmostFailurePosition=failuresInfo}else{this.rightmostFailures=failuresInfo}}};module.exports=State},{"./InputStream":40,"./PosInfo":44,"./Trace":47,"./pexprs":67}],47:[function(require,module,exports){"use strict";var Interval=require("./Interval");var common=require("./common");var BALLOT_X="✗";var CHECK_MARK="✓";var DOT_OPERATOR="⋅";var RIGHTWARDS_DOUBLE_ARROW="⇒";var SYMBOL_FOR_HORIZONTAL_TABULATION="␉";var SYMBOL_FOR_LINE_FEED="␊";var SYMBOL_FOR_CARRIAGE_RETURN="␍";function spaces(n){return common.repeat(" ",n).join("")}function getInputExcerpt(inputStream,pos,len){var excerpt=asEscapedString(inputStream.sourceSlice(pos,pos+len));if(excerpt.length0){arr.push(fn())}return arr};exports.repeatStr=function(str,n){return new Array(n+1).join(str)};exports.repeat=function(x,n){return exports.repeatFn(function(){return x},n)};exports.getDuplicates=function(array){var duplicates=[];for(var idx=0;idx1){throw multipleErrors(errors)}}}},{"./Namespace":43}],50:[function(require,module,exports){"use strict";var Builder=require("./Builder");var Grammar=require("./Grammar");var Namespace=require("./Namespace");var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");var util=require("./util");var isBuffer=require("is-buffer");var ohmGrammar;var documentInterface={querySelector:function(sel){return document.querySelector(sel)},querySelectorAll:function(sel){return document.querySelectorAll(sel)}};function isElement(obj){return!!(obj&&obj.nodeType===1)}function isUndefined(obj){return obj===void 0}var MAX_ARRAY_INDEX=Math.pow(2,53)-1;function isArrayLike(obj){if(obj==null){return false}var length=obj.length;return typeof length==="number"&&length>=0&&length<=MAX_ARRAY_INDEX}function load(url){var req=new XMLHttpRequest;req.open("GET",url,false);try{req.send();if(req.status===0||req.status===200){return req.responseText}}catch(e){}throw new Error("unable to load url "+url)}function buildGrammar(match,namespace,optOhmGrammarForTesting){var builder=new Builder;var decl;var currentRuleName;var currentRuleFormals;var overriding=false;var metaGrammar=optOhmGrammarForTesting||ohmGrammar;var helpers=metaGrammar.semantics().addOperation("visit",{Grammar:function(n,s,open,rs,close){var grammarName=n.visit();decl=builder.newGrammar(grammarName,namespace);s.visit();rs.visit();var g=decl.build();g.definitionInterval=this.interval.trimmed();if(grammarName in namespace){throw errors.duplicateGrammarDeclaration(g,namespace)}namespace[grammarName]=g;return g},SuperGrammar:function(_,n){var superGrammarName=n.visit();if(superGrammarName==="null"){decl.withSuperGrammar(null)}else{if(!namespace||!(superGrammarName in namespace)){throw errors.undeclaredGrammar(superGrammarName,namespace,n.interval)}decl.withSuperGrammar(namespace[superGrammarName])}},Rule_define:function(n,fs,d,_,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];if(!decl.defaultStartRule&&decl.ensureSuperGrammar()!==Grammar.ProtoBuiltInRules){decl.withDefaultStartRule(currentRuleName)}var body=b.visit();body.definitionInterval=this.interval.trimmed();var description=d.visit()[0];return decl.define(currentRuleName,currentRuleFormals,body,description)},Rule_override:function(n,fs,_,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];overriding=true;var body=b.visit();body.definitionInterval=this.interval.trimmed();var ans=decl.override(currentRuleName,currentRuleFormals,body);overriding=false;return ans},Rule_extend:function(n,fs,_,b){currentRuleName=n.visit();currentRuleFormals=fs.visit()[0]||[];var body=b.visit();var ans=decl.extend(currentRuleName,currentRuleFormals,body);decl.ruleBodies[currentRuleName].definitionInterval=this.interval.trimmed();return ans},RuleBody:function(_,term,_bars,terms){var args=[term.visit()].concat(terms.visit());return builder.alt.apply(builder,args).withInterval(this.interval)},Formals:function(opointy,fs,cpointy){return fs.visit()},Params:function(opointy,ps,cpointy){return ps.visit()},Alt:function(seq,_,seqs){var args=[seq.visit()].concat(seqs.visit());return builder.alt.apply(builder,args).withInterval(this.interval)},TopLevelTerm_inline:function(b,n){var inlineRuleName=currentRuleName+"_"+n.visit();var body=b.visit();body.definitionInterval=this.interval.trimmed();var isNewRuleDeclaration=!(decl.superGrammar&&decl.superGrammar.ruleBodies[inlineRuleName]);if(overriding&&!isNewRuleDeclaration){decl.override(inlineRuleName,currentRuleFormals,body)}else{decl.define(inlineRuleName,currentRuleFormals,body)}var params=currentRuleFormals.map(function(formal){return builder.app(formal)});return builder.app(inlineRuleName,params).withInterval(body.interval)},Seq:function(expr){return builder.seq.apply(builder,expr.visit()).withInterval(this.interval)},Iter_star:function(x,_){return builder.star(x.visit()).withInterval(this.interval)},Iter_plus:function(x,_){return builder.plus(x.visit()).withInterval(this.interval)},Iter_opt:function(x,_){return builder.opt(x.visit()).withInterval(this.interval)},Pred_not:function(_,x){return builder.not(x.visit()).withInterval(this.interval)},Pred_lookahead:function(_,x){return builder.la(x.visit()).withInterval(this.interval)},Lex_lex:function(_,x){return builder.lex(x.visit()).withInterval(this.interval)},Base_application:function(rule,ps){return builder.app(rule.visit(),ps.visit()[0]||[]).withInterval(this.interval)},Base_range:function(from,_,to){return builder.range(from.visit(),to.visit()).withInterval(this.interval)},Base_terminal:function(expr){return builder.terminal(expr.visit()).withInterval(this.interval)},Base_paren:function(open,x,close){return x.visit()},ruleDescr:function(open,t,close){return t.visit()},ruleDescrText:function(_){return this.interval.contents.trim()},caseName:function(_,space1,n,space2,end){return n.visit()},name:function(first,rest){return this.interval.contents},nameFirst:function(expr){},nameRest:function(expr){},terminal:function(open,cs,close){return cs.visit().map(function(c){return common.unescapeChar(c)}).join("")},terminalChar:function(_){return this.interval.contents},escapeChar:function(_){return this.interval.contents},NonemptyListOf:function(x,_,xs){return[x.visit()].concat(xs.visit())},EmptyListOf:function(){return[]},_terminal:function(){return this.primitiveValue}});return helpers(match).visit()}function compileAndLoad(source,namespace){var m=ohmGrammar.match(source,"Grammars");if(m.failed()){throw errors.grammarSyntaxError(m)}return buildGrammar(m,namespace)}function getScriptElementContents(el){if(!isElement(el)){throw new TypeError("Expected a DOM Node, got "+common.unexpectedObjToString(el))}if(el.type!=="text/ohm-js"){throw new Error('Expected a script tag with type="text/ohm-js", got '+el)}return el.getAttribute("src")?load(el.getAttribute("src")):el.innerHTML}function grammar(source,optNamespace){var ns=grammars(source,optNamespace);var grammarNames=Object.keys(ns);if(grammarNames.length===0){throw new Error("Missing grammar definition")}else if(grammarNames.length>1){var secondGrammar=ns[grammarNames[1]];var interval=secondGrammar.definitionInterval;throw new Error(util.getLineAndColumnMessage(interval.inputStream.source,interval.startIdx)+"Found more than one grammar definition -- use ohm.grammars() instead.")}return ns[grammarNames[0]]}function grammars(source,optNamespace){var ns=Namespace.extend(Namespace.asNamespace(optNamespace));if(typeof source!=="string"){if(isBuffer(source)){source=source.toString()}else{throw new TypeError("Expected string as first argument, got "+common.unexpectedObjToString(source))}}compileAndLoad(source,ns);return ns}function grammarFromScriptElement(optNode){var node=optNode;if(isUndefined(node)){var nodeList=documentInterface.querySelectorAll('script[type="text/ohm-js"]');if(nodeList.length!==1){throw new Error('Expected exactly one script tag with type="text/ohm-js", found '+nodeList.length)}node=nodeList[0]}return grammar(getScriptElementContents(node))}function grammarsFromScriptElements(optNodeOrNodeList){if(isElement(optNodeOrNodeList)){return grammars(optNodeOrNodeList)}var nodeList=optNodeOrNodeList;if(isUndefined(nodeList)){nodeList=documentInterface.querySelectorAll('script[type="text/ohm-js"]')}else if(typeof nodeList==="string"||!isElement(nodeList)&&!isArrayLike(nodeList)){throw new TypeError("Expected a Node, NodeList, or Array, but got "+nodeList)}var ns=Namespace.createNamespace();for(var i=0;i0};Node.prototype.hasNoChildren=function(){return!this.hasChildren()};Node.prototype.onlyChild=function(){if(this.children.length!==1){throw new Error("cannot get only child of a node of type "+this.ctorName+" (it has "+this.numChildren()+" children)")}else{return this.firstChild()}};Node.prototype.firstChild=function(){if(this.hasNoChildren()){throw new Error("cannot get first child of a "+this.ctorName+" node, which has no children")}else{return this.childAt(0)}};Node.prototype.lastChild=function(){if(this.hasNoChildren()){throw new Error("cannot get last child of a "+this.ctorName+" node, which has no children")}else{return this.childAt(this.numChildren()-1)}};Node.prototype.childBefore=function(child){var childIdx=this.indexOfChild(child);if(childIdx<0){throw new Error("Node.childBefore() called w/ an argument that is not a child")}else if(childIdx===0){throw new Error("cannot get child before first child")}else{return this.childAt(childIdx-1)}};Node.prototype.childAfter=function(child){var childIdx=this.indexOfChild(child);if(childIdx<0){throw new Error("Node.childAfter() called w/ an argument that is not a child")}else if(childIdx===this.numChildren()-1){throw new Error("cannot get child after last child")}else{return this.childAt(childIdx+1)}};Node.prototype.isTerminal=function(){return false};Node.prototype.isNonterminal=function(){return false};Node.prototype.isIteration=function(){return false};Node.prototype.isOptional=function(){return false};Node.prototype.toJSON=function(){var r={};r[this.ctorName]=this.children;return r};function TerminalNode(grammar,value,interval){Node.call(this,grammar,"_terminal",[],interval);this.primitiveValue=value}inherits(TerminalNode,Node);TerminalNode.prototype.isTerminal=function(){return true};function NonterminalNode(grammar,ruleName,children,interval){Node.call(this,grammar,ruleName,children,interval)}inherits(NonterminalNode,Node);NonterminalNode.prototype.isNonterminal=function(){return true};NonterminalNode.prototype.isLexical=function(){return common.isLexical(this.ctorName)};NonterminalNode.prototype.isSyntactic=function(){return common.isSyntactic(this.ctorName)};function IterationNode(grammar,children,interval,optional){Node.call(this,grammar,"_iter",children,interval);this.optional=optional}inherits(IterationNode,Node);IterationNode.prototype.isIteration=function(){return true};IterationNode.prototype.isOptional=function(){return this.optional};module.exports={Node:Node,TerminalNode:TerminalNode,NonterminalNode:NonterminalNode,IterationNode:IterationNode}},{"./common":48,inherits:33}],52:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.allowsSkippingPrecedingSpace=common.abstract;pexprs.any.allowsSkippingPrecedingSpace=pexprs.end.allowsSkippingPrecedingSpace=pexprs.Apply.prototype.allowsSkippingPrecedingSpace=pexprs.Terminal.prototype.allowsSkippingPrecedingSpace=pexprs.Range.prototype.allowsSkippingPrecedingSpace=pexprs.UnicodeChar.prototype.allowsSkippingPrecedingSpace=function(){return true};pexprs.Alt.prototype.allowsSkippingPrecedingSpace=pexprs.Iter.prototype.allowsSkippingPrecedingSpace=pexprs.Lex.prototype.allowsSkippingPrecedingSpace=pexprs.Lookahead.prototype.allowsSkippingPrecedingSpace=pexprs.Not.prototype.allowsSkippingPrecedingSpace=pexprs.Param.prototype.allowsSkippingPrecedingSpace=pexprs.Seq.prototype.allowsSkippingPrecedingSpace=function(){return false}},{"./common":48,"./pexprs":67}],53:[function(require,module,exports){"use strict";var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");var lexifyCount;pexprs.PExpr.prototype.assertAllApplicationsAreValid=function(ruleName,grammar){lexifyCount=0;this._assertAllApplicationsAreValid(ruleName,grammar)};pexprs.PExpr.prototype._assertAllApplicationsAreValid=common.abstract;pexprs.any._assertAllApplicationsAreValid=pexprs.end._assertAllApplicationsAreValid=pexprs.Terminal.prototype._assertAllApplicationsAreValid=pexprs.Range.prototype._assertAllApplicationsAreValid=pexprs.Param.prototype._assertAllApplicationsAreValid=pexprs.UnicodeChar.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){};pexprs.Lex.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){lexifyCount++;this.expr._assertAllApplicationsAreValid(ruleName,grammar);lexifyCount--};pexprs.Alt.prototype._assertAllApplicationsAreValid=function(ruleName,grammar){for(var idx=0;idx0)){throw errors.applicationOfSyntacticRuleFromLexicalContext(this.ruleName,this)}var actual=this.args.length;var expected=grammar.ruleFormals[this.ruleName].length;if(actual!==expected){throw errors.wrongNumberOfArguments(this.ruleName,expected,actual,this)}var self=this;this.args.forEach(function(arg){arg._assertAllApplicationsAreValid(ruleName,grammar);if(arg.getArity()!==1){throw errors.invalidParameter(self.ruleName,arg)}})}},{"./common":48,"./errors":49,"./pexprs":67}],54:[function(require,module,exports){"use strict";var common=require("./common");var errors=require("./errors");var pexprs=require("./pexprs");pexprs.PExpr.prototype.assertChoicesHaveUniformArity=common.abstract;pexprs.any.assertChoicesHaveUniformArity=pexprs.end.assertChoicesHaveUniformArity=pexprs.Terminal.prototype.assertChoicesHaveUniformArity=pexprs.Range.prototype.assertChoicesHaveUniformArity=pexprs.Param.prototype.assertChoicesHaveUniformArity=pexprs.Lex.prototype.assertChoicesHaveUniformArity=pexprs.UnicodeChar.prototype.assertChoicesHaveUniformArity=function(ruleName){};pexprs.Alt.prototype.assertChoicesHaveUniformArity=function(ruleName){if(this.terms.length===0){return}var arity=this.terms[0].getArity();for(var idx=0;idx=1};pexprs.end.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&vals[0].primitiveValue===undefined};pexprs.Terminal.prototype.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&vals[0].primitiveValue===this.obj};pexprs.Range.prototype.check=function(grammar,vals){return vals[0]instanceof nodes.Node&&vals[0].isTerminal()&&typeof vals[0].primitiveValue===typeof this.from};pexprs.Param.prototype.check=function(grammar,vals){return vals.length>=1};pexprs.Alt.prototype.check=function(grammar,vals){for(var i=0;i=0){if(this.args.length>0){throw new Error("Parameterized rules cannot be passed as arguments to another rule.")}return new pexprs.Param(index)}else{this.args.forEach(function(arg,idx,args){args[idx]=arg.introduceParams(formals)});return this}}},{"./common":48,"./pexprs":67}],60:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.isNullable=function(grammar){return this._isNullable(grammar,Object.create(null))};pexprs.PExpr.prototype._isNullable=common.abstract;pexprs.any._isNullable=pexprs.Range.prototype._isNullable=pexprs.Param.prototype._isNullable=pexprs.Plus.prototype._isNullable=pexprs.UnicodeChar.prototype._isNullable=function(grammar,memo){return false};pexprs.end._isNullable=function(grammar,memo){return true};pexprs.Terminal.prototype._isNullable=function(grammar,memo){if(typeof this.obj==="string"){return this.obj===""}else{return false}};pexprs.Alt.prototype._isNullable=function(grammar,memo){return this.terms.length===0||this.terms.some(function(term){return term._isNullable(grammar,memo)})};pexprs.Seq.prototype._isNullable=function(grammar,memo){return this.factors.every(function(factor){return factor._isNullable(grammar,memo)})};pexprs.Star.prototype._isNullable=pexprs.Opt.prototype._isNullable=pexprs.Not.prototype._isNullable=pexprs.Lookahead.prototype._isNullable=function(grammar,memo){ +return true};pexprs.Lex.prototype._isNullable=function(grammar,memo){return this.expr._isNullable(grammar,memo)};pexprs.Apply.prototype._isNullable=function(grammar,memo){var key=this.toMemoKey();if(!Object.prototype.hasOwnProperty.call(memo,key)){var body=grammar.ruleBodies[this.ruleName];var inlined=body.substituteParams(this.args);memo[key]=false;memo[key]=inlined._isNullable(grammar,memo)}return memo[key]}},{"./common":48,"./pexprs":67}],61:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");function escapeString(str){var output=JSON.stringify(str);output=output.replace(/[\u2028\u2029]/g,function(char,pos,str){var hex=char.codePointAt(0).toString(16);return"\\u"+"0000".slice(hex.length)+hex});return output}function getIntervalInfo(expr,grammarInterval){if(expr.interval&&grammarInterval){var adjusted=expr.interval.relativeTo(grammarInterval);var start=adjusted.startIdx;var end=adjusted.endIdx;return".withInterval(decl.sourceInterval("+start+", "+end+"))"}return""}pexprs.PExpr.prototype.outputRecipe=common.abstract;pexprs.any.outputRecipe=function(sb,formals,grammarInterval){throw new Error("should never output a recipe for `any` expression")};pexprs.end.outputRecipe=function(sb,formals,grammarInterval){throw new Error("should never output a recipe for `end` expression")};pexprs.Terminal.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.terminal(");sb.append(typeof this.obj==="string"?escapeString(this.obj):""+this.obj);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Range.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.range(");sb.append(JSON.stringify(this.from));sb.append(", ");sb.append(JSON.stringify(this.to));sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Param.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.param("+this.index+")"+getIntervalInfo(this,grammarInterval))};pexprs.Alt.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.alt(");for(var idx=0;idx0){sb.append(", ")}this.terms[idx].outputRecipe(sb,formals,grammarInterval)}sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Extend.prototype.outputRecipe=function(sb,formals,grammarInterval){var extension=this.terms[0];extension.outputRecipe(sb,formals,grammarInterval)};pexprs.Seq.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.seq(");for(var idx=0;idx0){sb.append(", ")}this.factors[idx].outputRecipe(sb,formals,grammarInterval)}sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Star.prototype.outputRecipe=pexprs.Plus.prototype.outputRecipe=pexprs.Opt.prototype.outputRecipe=pexprs.Not.prototype.outputRecipe=pexprs.Lex.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this."+this.constructor.name.toLowerCase()+"(");this.expr.outputRecipe(sb,formals,grammarInterval);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Lookahead.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.la(");this.expr.outputRecipe(sb,formals,grammarInterval);sb.append(")"+getIntervalInfo(this,grammarInterval))};pexprs.Apply.prototype.outputRecipe=function(sb,formals,grammarInterval){sb.append("this.app(");sb.append(JSON.stringify(this.ruleName));if(this.ruleName.indexOf("_")>=0&&formals.length>0){var apps=formals.map(function(_,idx){return"this.param("+idx+")"});sb.append(", ["+apps.join(", ")+"]")}else if(this.args.length>0){sb.append(", [");this.args.forEach(function(arg,idx){if(idx>0){sb.append(", ")}arg.outputRecipe(sb,formals,grammarInterval)});sb.append("]")}sb.append(")"+getIntervalInfo(this,grammarInterval))}},{"./common":48,"./pexprs":67}],62:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");pexprs.PExpr.prototype.substituteParams=common.abstract;pexprs.any.substituteParams=pexprs.end.substituteParams=pexprs.Terminal.prototype.substituteParams=pexprs.Range.prototype.substituteParams=pexprs.Terminal.prototype.substituteParams=pexprs.UnicodeChar.prototype.substituteParams=function(actuals){return this};pexprs.Param.prototype.substituteParams=function(actuals){return actuals[this.index]};pexprs.Alt.prototype.substituteParams=function(actuals){return new pexprs.Alt(this.terms.map(function(term){return term.substituteParams(actuals)}))};pexprs.Seq.prototype.substituteParams=function(actuals){return new pexprs.Seq(this.factors.map(function(factor){return factor.substituteParams(actuals)}))};pexprs.Iter.prototype.substituteParams=pexprs.Not.prototype.substituteParams=pexprs.Lookahead.prototype.substituteParams=pexprs.Lex.prototype.substituteParams=function(actuals){return new this.constructor(this.expr.substituteParams(actuals))};pexprs.Apply.prototype.substituteParams=function(actuals){if(this.args.length===0){return this}else{var args=this.args.map(function(arg){return arg.substituteParams(actuals)});return new pexprs.Apply(this.ruleName,args)}}},{"./common":48,"./pexprs":67}],63:[function(require,module,exports){"use strict";var common=require("./common");var pexprs=require("./pexprs");var copyWithoutDuplicates=common.copyWithoutDuplicates;pexprs.PExpr.prototype.toArgumentNameList=common.abstract;pexprs.any.toArgumentNameList=function(firstArgIndex){return["any"]};pexprs.end.toArgumentNameList=function(firstArgIndex){return["end"]};pexprs.Terminal.prototype.toArgumentNameList=function(firstArgIndex){if(typeof this.obj==="string"&&/^[_a-zA-Z0-9]+$/.test(this.obj)){return["_"+this.obj]}else{return["$"+firstArgIndex]}};pexprs.Range.prototype.toArgumentNameList=function(firstArgIndex){return[this.from+"_to_"+this.to]};pexprs.Alt.prototype.toArgumentNameList=function(firstArgIndex){var termArgNameLists=this.terms.map(function(term){return term.toArgumentNameList(firstArgIndex)});var argumentNameList=[];var numArgs=termArgNameLists[0].length;for(var colIdx=0;colIdx0){var ps=this.args.map(function(arg){return arg.toString()});return this.ruleName+"<"+ps.join(",")+">"}else{return this.ruleName}};pexprs.UnicodeChar.prototype.toString=function(){return"\\p{"+this.category+"}"}},{"./common":48,"./pexprs":67}],67:[function(require,module,exports){"use strict";var UnicodeCategories=require("../third_party/UnicodeCategories");var common=require("./common");var errors=require("./errors");var inherits=require("inherits");function PExpr(){throw new Error("PExpr cannot be instantiated -- it's abstract")}PExpr.prototype.withInterval=function(interval){if(interval){this.interval=interval.trimmed()}return this};var any=Object.create(PExpr.prototype);var end=Object.create(PExpr.prototype);function Terminal(obj){this.obj=obj}inherits(Terminal,PExpr);function Range(from,to){this.from=from;this.to=to}inherits(Range,PExpr);function Param(index){this.index=index}inherits(Param,PExpr);function Alt(terms){this.terms=terms}inherits(Alt,PExpr);function Extend(superGrammar,name,body){this.superGrammar=superGrammar;this.name=name;this.body=body;var origBody=superGrammar.ruleBodies[name];this.terms=[body,origBody]}inherits(Extend,Alt);function Seq(factors){this.factors=factors}inherits(Seq,PExpr);function Iter(expr){this.expr=expr}inherits(Iter,PExpr);function Star(expr){this.expr=expr}inherits(Star,Iter);function Plus(expr){this.expr=expr}inherits(Plus,Iter);function Opt(expr){this.expr=expr}inherits(Opt,Iter);Star.prototype.operator="*";Plus.prototype.operator="+";Opt.prototype.operator="?";Star.prototype.minNumMatches=0;Plus.prototype.minNumMatches=1;Opt.prototype.minNumMatches=0;Star.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Plus.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Opt.prototype.maxNumMatches=1;function Not(expr){this.expr=expr}inherits(Not,PExpr);function Lookahead(expr){this.expr=expr}inherits(Lookahead,PExpr);function Lex(expr){this.expr=expr}inherits(Lex,PExpr);function Arr(expr){this.expr=expr}inherits(Arr,PExpr);function Str(expr){this.expr=expr}inherits(Str,PExpr);function Obj(properties,isLenient){var names=properties.map(function(property){return property.name});var duplicates=common.getDuplicates(names);if(duplicates.length>0){throw errors.duplicatePropertyNames(duplicates)}else{this.properties=properties;this.isLenient=isLenient}}inherits(Obj,PExpr);function Apply(ruleName,optArgs){this.ruleName=ruleName;this.args=optArgs||[]}inherits(Apply,PExpr);Apply.prototype.isSyntactic=function(){return common.isSyntactic(this.ruleName)};Apply.prototype.toMemoKey=function(){if(!this._memoKey){Object.defineProperty(this,"_memoKey",{value:this.toString()})}return this._memoKey};function UnicodeChar(category){this.category=category;this.pattern=UnicodeCategories[category]}inherits(UnicodeChar,PExpr);exports.PExpr=PExpr;exports.any=any;exports.end=end;exports.Terminal=Terminal;exports.Range=Range;exports.Param=Param;exports.Alt=Alt;exports.Extend=Extend;exports.Seq=Seq;exports.Iter=Iter;exports.Star=Star;exports.Plus=Plus;exports.Opt=Opt;exports.Not=Not;exports.Lookahead=Lookahead;exports.Lex=Lex;exports.Arr=Arr;exports.Str=Str;exports.Obj=Obj;exports.Apply=Apply;exports.UnicodeChar=UnicodeChar;require("./pexprs-allowsSkippingPrecedingSpace");require("./pexprs-assertAllApplicationsAreValid");require("./pexprs-assertChoicesHaveUniformArity");require("./pexprs-assertIteratedExprsAreNotNullable");require("./pexprs-check");require("./pexprs-eval");require("./pexprs-getArity");require("./pexprs-outputRecipe");require("./pexprs-introduceParams");require("./pexprs-isNullable");require("./pexprs-substituteParams");require("./pexprs-toDisplayString");require("./pexprs-toArgumentNameList");require("./pexprs-toFailure");require("./pexprs-toString")},{"../third_party/UnicodeCategories":69,"./common":48,"./errors":49,"./pexprs-allowsSkippingPrecedingSpace":52,"./pexprs-assertAllApplicationsAreValid":53,"./pexprs-assertChoicesHaveUniformArity":54,"./pexprs-assertIteratedExprsAreNotNullable":55,"./pexprs-check":56,"./pexprs-eval":57,"./pexprs-getArity":58,"./pexprs-introduceParams":59,"./pexprs-isNullable":60,"./pexprs-outputRecipe":61,"./pexprs-substituteParams":62,"./pexprs-toArgumentNameList":63,"./pexprs-toDisplayString":64,"./pexprs-toFailure":65,"./pexprs-toString":66,inherits:33}],68:[function(require,module,exports){"use strict";var common=require("./common");function padNumbersToEqualLength(arr){var maxLen=0;var strings=arr.map(function(n){var str=n.toString();maxLen=Math.max(maxLen,str.length);return str});return strings.map(function(s){return common.padLeft(s,maxLen)})}function strcpy(dest,src,offset){var origDestLen=dest.length;var start=dest.slice(0,offset);var end=dest.slice(offset+src.length);return(start+src+end).substr(0,origDestLen)}exports.getLineAndColumn=function(str,offset){var lineNum=1;var colNum=1;var currOffset=0;var lineStartOffset=0;var nextLine=null;var prevLine=null;var prevLineStartOffset=-1;while(currOffset=0){prevLine=str.slice(prevLineStartOffset,lineStartOffset).replace(/\r?\n$/,"")}var line=str.slice(lineStartOffset,lineEndOffset).replace(/\r$/,"");return{lineNum:lineNum,colNum:colNum,line:line,prevLine:prevLine,nextLine:nextLine}};exports.getLineAndColumnMessage=function(str,offset){var repeatStr=common.repeatStr;var lineAndCol=exports.getLineAndColumn(str,offset);var sb=new common.StringBuffer;sb.append("Line "+lineAndCol.lineNum+", col "+lineAndCol.colNum+":\n");var lineNumbers=padNumbersToEqualLength([lineAndCol.prevLine==null?0:lineAndCol.lineNum-1,lineAndCol.lineNum,lineAndCol.nextLine==null?0:lineAndCol.lineNum+1]);function appendLine(num,content,prefix){sb.append(prefix+lineNumbers[num]+" | "+content+"\n")}if(lineAndCol.prevLine!=null){appendLine(0,lineAndCol.prevLine," ")}appendLine(1,lineAndCol.line,"> ");var lineLen=lineAndCol.line.length;var indicationLine=repeatStr(" ",lineLen+1);var ranges=Array.prototype.slice.call(arguments,2);for(var i=0;i=0&&startIdx<=endIdx,"range start must be >= 0 and <= end");var lineStartOffset=offset-lineAndCol.colNum+1;startIdx=Math.max(0,startIdx-lineStartOffset);endIdx=Math.min(endIdx-lineStartOffset,lineLen);indicationLine=strcpy(indicationLine,repeatStr("~",endIdx-startIdx),startIdx)}var gutterWidth=2+lineNumbers[1].length+3;sb.append(repeatStr(" ",gutterWidth));indicationLine=strcpy(indicationLine,"^",lineAndCol.colNum-1);sb.append(indicationLine.replace(/ +$/,"")+"\n");if(lineAndCol.nextLine!=null){appendLine(2,lineAndCol.nextLine," ")}return sb.contents()}},{"./common":48}],69:[function(require,module,exports){module.exports={Lu:/[\u0041-\u005A]|[\u00C0-\u00D6]|[\u00D8-\u00DE]|[\u0100-\u0100]|[\u0102-\u0102]|[\u0104-\u0104]|[\u0106-\u0106]|[\u0108-\u0108]|[\u010A-\u010A]|[\u010C-\u010C]|[\u010E-\u010E]|[\u0110-\u0110]|[\u0112-\u0112]|[\u0114-\u0114]|[\u0116-\u0116]|[\u0118-\u0118]|[\u011A-\u011A]|[\u011C-\u011C]|[\u011E-\u011E]|[\u0120-\u0120]|[\u0122-\u0122]|[\u0124-\u0124]|[\u0126-\u0126]|[\u0128-\u0128]|[\u012A-\u012A]|[\u012C-\u012C]|[\u012E-\u012E]|[\u0130-\u0130]|[\u0132-\u0132]|[\u0134-\u0134]|[\u0136-\u0136]|[\u0139-\u0139]|[\u013B-\u013B]|[\u013D-\u013D]|[\u013F-\u013F]|[\u0141-\u0141]|[\u0143-\u0143]|[\u0145-\u0145]|[\u0147-\u0147]|[\u014A-\u014A]|[\u014C-\u014C]|[\u014E-\u014E]|[\u0150-\u0150]|[\u0152-\u0152]|[\u0154-\u0154]|[\u0156-\u0156]|[\u0158-\u0158]|[\u015A-\u015A]|[\u015C-\u015C]|[\u015E-\u015E]|[\u0160-\u0160]|[\u0162-\u0162]|[\u0164-\u0164]|[\u0166-\u0166]|[\u0168-\u0168]|[\u016A-\u016A]|[\u016C-\u016C]|[\u016E-\u016E]|[\u0170-\u0170]|[\u0172-\u0172]|[\u0174-\u0174]|[\u0176-\u0176]|[\u0178-\u0179]|[\u017B-\u017B]|[\u017D-\u017D]|[\u0181-\u0182]|[\u0184-\u0184]|[\u0186-\u0187]|[\u0189-\u018B]|[\u018E-\u0191]|[\u0193-\u0194]|[\u0196-\u0198]|[\u019C-\u019D]|[\u019F-\u01A0]|[\u01A2-\u01A2]|[\u01A4-\u01A4]|[\u01A6-\u01A7]|[\u01A9-\u01A9]|[\u01AC-\u01AC]|[\u01AE-\u01AF]|[\u01B1-\u01B3]|[\u01B5-\u01B5]|[\u01B7-\u01B8]|[\u01BC-\u01BC]|[\u01C4-\u01C4]|[\u01C7-\u01C7]|[\u01CA-\u01CA]|[\u01CD-\u01CD]|[\u01CF-\u01CF]|[\u01D1-\u01D1]|[\u01D3-\u01D3]|[\u01D5-\u01D5]|[\u01D7-\u01D7]|[\u01D9-\u01D9]|[\u01DB-\u01DB]|[\u01DE-\u01DE]|[\u01E0-\u01E0]|[\u01E2-\u01E2]|[\u01E4-\u01E4]|[\u01E6-\u01E6]|[\u01E8-\u01E8]|[\u01EA-\u01EA]|[\u01EC-\u01EC]|[\u01EE-\u01EE]|[\u01F1-\u01F1]|[\u01F4-\u01F4]|[\u01FA-\u01FA]|[\u01FC-\u01FC]|[\u01FE-\u01FE]|[\u0200-\u0200]|[\u0202-\u0202]|[\u0204-\u0204]|[\u0206-\u0206]|[\u0208-\u0208]|[\u020A-\u020A]|[\u020C-\u020C]|[\u020E-\u020E]|[\u0210-\u0210]|[\u0212-\u0212]|[\u0214-\u0214]|[\u0216-\u0216]|[\u0386-\u0386]|[\u0388-\u038A]|[\u038C-\u038C]|[\u038E-\u038F]|[\u0391-\u03A1]|[\u03A3-\u03AB]|[\u03D2-\u03D4]|[\u03DA-\u03DA]|[\u03DC-\u03DC]|[\u03DE-\u03DE]|[\u03E0-\u03E0]|[\u03E2-\u03E2]|[\u03E4-\u03E4]|[\u03E6-\u03E6]|[\u03E8-\u03E8]|[\u03EA-\u03EA]|[\u03EC-\u03EC]|[\u03EE-\u03EE]|[\u0401-\u040C]|[\u040E-\u042F]|[\u0460-\u0460]|[\u0462-\u0462]|[\u0464-\u0464]|[\u0466-\u0466]|[\u0468-\u0468]|[\u046A-\u046A]|[\u046C-\u046C]|[\u046E-\u046E]|[\u0470-\u0470]|[\u0472-\u0472]|[\u0474-\u0474]|[\u0476-\u0476]|[\u0478-\u0478]|[\u047A-\u047A]|[\u047C-\u047C]|[\u047E-\u047E]|[\u0480-\u0480]|[\u0490-\u0490]|[\u0492-\u0492]|[\u0494-\u0494]|[\u0496-\u0496]|[\u0498-\u0498]|[\u049A-\u049A]|[\u049C-\u049C]|[\u049E-\u049E]|[\u04A0-\u04A0]|[\u04A2-\u04A2]|[\u04A4-\u04A4]|[\u04A6-\u04A6]|[\u04A8-\u04A8]|[\u04AA-\u04AA]|[\u04AC-\u04AC]|[\u04AE-\u04AE]|[\u04B0-\u04B0]|[\u04B2-\u04B2]|[\u04B4-\u04B4]|[\u04B6-\u04B6]|[\u04B8-\u04B8]|[\u04BA-\u04BA]|[\u04BC-\u04BC]|[\u04BE-\u04BE]|[\u04C1-\u04C1]|[\u04C3-\u04C3]|[\u04C7-\u04C7]|[\u04CB-\u04CB]|[\u04D0-\u04D0]|[\u04D2-\u04D2]|[\u04D4-\u04D4]|[\u04D6-\u04D6]|[\u04D8-\u04D8]|[\u04DA-\u04DA]|[\u04DC-\u04DC]|[\u04DE-\u04DE]|[\u04E0-\u04E0]|[\u04E2-\u04E2]|[\u04E4-\u04E4]|[\u04E6-\u04E6]|[\u04E8-\u04E8]|[\u04EA-\u04EA]|[\u04EE-\u04EE]|[\u04F0-\u04F0]|[\u04F2-\u04F2]|[\u04F4-\u04F4]|[\u04F8-\u04F8]|[\u0531-\u0556]|[\u10A0-\u10C5]|[\u1E00-\u1E00]|[\u1E02-\u1E02]|[\u1E04-\u1E04]|[\u1E06-\u1E06]|[\u1E08-\u1E08]|[\u1E0A-\u1E0A]|[\u1E0C-\u1E0C]|[\u1E0E-\u1E0E]|[\u1E10-\u1E10]|[\u1E12-\u1E12]|[\u1E14-\u1E14]|[\u1E16-\u1E16]|[\u1E18-\u1E18]|[\u1E1A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133]|[\uFF21-\uFF3A]/,Ll:/[\u0061-\u007A]|[\u00AA-\u00AA]|[\u00B5-\u00B5]|[\u00BA-\u00BA]|[\u00DF-\u00F6]|[\u00F8-\u00FF]|[\u0101-\u0101]|[\u0103-\u0103]|[\u0105-\u0105]|[\u0107-\u0107]|[\u0109-\u0109]|[\u010B-\u010B]|[\u010D-\u010D]|[\u010F-\u010F]|[\u0111-\u0111]|[\u0113-\u0113]|[\u0115-\u0115]|[\u0117-\u0117]|[\u0119-\u0119]|[\u011B-\u011B]|[\u011D-\u011D]|[\u011F-\u011F]|[\u0121-\u0121]|[\u0123-\u0123]|[\u0125-\u0125]|[\u0127-\u0127]|[\u0129-\u0129]|[\u012B-\u012B]|[\u012D-\u012D]|[\u012F-\u012F]|[\u0131-\u0131]|[\u0133-\u0133]|[\u0135-\u0135]|[\u0137-\u0138]|[\u013A-\u013A]|[\u013C-\u013C]|[\u013E-\u013E]|[\u0140-\u0140]|[\u0142-\u0142]|[\u0144-\u0144]|[\u0146-\u0146]|[\u0148-\u0149]|[\u014B-\u014B]|[\u014D-\u014D]|[\u014F-\u014F]|[\u0151-\u0151]|[\u0153-\u0153]|[\u0155-\u0155]|[\u0157-\u0157]|[\u0159-\u0159]|[\u015B-\u015B]|[\u015D-\u015D]|[\u015F-\u015F]|[\u0161-\u0161]|[\u0163-\u0163]|[\u0165-\u0165]|[\u0167-\u0167]|[\u0169-\u0169]|[\u016B-\u016B]|[\u016D-\u016D]|[\u016F-\u016F]|[\u0171-\u0171]|[\u0173-\u0173]|[\u0175-\u0175]|[\u0177-\u0177]|[\u017A-\u017A]|[\u017C-\u017C]|[\u017E-\u0180]|[\u0183-\u0183]|[\u0185-\u0185]|[\u0188-\u0188]|[\u018C-\u018D]|[\u0192-\u0192]|[\u0195-\u0195]|[\u0199-\u019B]|[\u019E-\u019E]|[\u01A1-\u01A1]|[\u01A3-\u01A3]|[\u01A5-\u01A5]|[\u01A8-\u01A8]|[\u01AB-\u01AB]|[\u01AD-\u01AD]|[\u01B0-\u01B0]|[\u01B4-\u01B4]|[\u01B6-\u01B6]|[\u01B9-\u01BA]|[\u01BD-\u01BD]|[\u01C6-\u01C6]|[\u01C9-\u01C9]|[\u01CC-\u01CC]|[\u01CE-\u01CE]|[\u01D0-\u01D0]|[\u01D2-\u01D2]|[\u01D4-\u01D4]|[\u01D6-\u01D6]|[\u01D8-\u01D8]|[\u01DA-\u01DA]|[\u01DC-\u01DD]|[\u01DF-\u01DF]|[\u01E1-\u01E1]|[\u01E3-\u01E3]|[\u01E5-\u01E5]|[\u01E7-\u01E7]|[\u01E9-\u01E9]|[\u01EB-\u01EB]|[\u01ED-\u01ED]|[\u01EF-\u01F0]|[\u01F3-\u01F3]|[\u01F5-\u01F5]|[\u01FB-\u01FB]|[\u01FD-\u01FD]|[\u01FF-\u01FF]|[\u0201-\u0201]|[\u0203-\u0203]|[\u0205-\u0205]|[\u0207-\u0207]|[\u0209-\u0209]|[\u020B-\u020B]|[\u020D-\u020D]|[\u020F-\u020F]|[\u0211-\u0211]|[\u0213-\u0213]|[\u0215-\u0215]|[\u0217-\u0217]|[\u0250-\u02A8]|[\u0390-\u0390]|[\u03AC-\u03CE]|[\u03D0-\u03D1]|[\u03D5-\u03D6]|[\u03E3-\u03E3]|[\u03E5-\u03E5]|[\u03E7-\u03E7]|[\u03E9-\u03E9]|[\u03EB-\u03EB]|[\u03ED-\u03ED]|[\u03EF-\u03F2]|[\u0430-\u044F]|[\u0451-\u045C]|[\u045E-\u045F]|[\u0461-\u0461]|[\u0463-\u0463]|[\u0465-\u0465]|[\u0467-\u0467]|[\u0469-\u0469]|[\u046B-\u046B]|[\u046D-\u046D]|[\u046F-\u046F]|[\u0471-\u0471]|[\u0473-\u0473]|[\u0475-\u0475]|[\u0477-\u0477]|[\u0479-\u0479]|[\u047B-\u047B]|[\u047D-\u047D]|[\u047F-\u047F]|[\u0481-\u0481]|[\u0491-\u0491]|[\u0493-\u0493]|[\u0495-\u0495]|[\u0497-\u0497]|[\u0499-\u0499]|[\u049B-\u049B]|[\u049D-\u049D]|[\u049F-\u049F]|[\u04A1-\u04A1]|[\u04A3-\u04A3]|[\u04A5-\u04A5]|[\u04A7-\u04A7]|[\u04A9-\u04A9]|[\u04AB-\u04AB]|[\u04AD-\u04AD]|[\u04AF-\u04AF]|[\u04B1-\u04B1]|[\u04B3-\u04B3]|[\u04B5-\u04B5]|[\u04B7-\u04B7]|[\u04B9-\u04B9]|[\u04BB-\u04BB]|[\u04BD-\u04BD]|[\u04BF-\u04BF]|[\u04C2-\u04C2]|[\u04C4-\u04C4]|[\u04C8-\u04C8]|[\u04CC-\u04CC]|[\u04D1-\u04D1]|[\u04D3-\u04D3]|[\u04D5-\u04D5]|[\u04D7-\u04D7]|[\u04D9-\u04D9]|[\u04DB-\u04DB]|[\u04DD-\u04DD]|[\u04DF-\u04DF]|[\u04E1-\u04E1]|[\u04E3-\u04E3]|[\u04E5-\u04E5]|[\u04E7-\u04E7]|[\u04E9-\u04E9]|[\u04EB-\u04EB]|[\u04EF-\u04EF]|[\u04F1-\u04F1]|[\u04F3-\u04F3]|[\u04F5-\u04F5]|[\u04F9-\u04F9]|[\u0561-\u0587]|[\u10D0-\u10F6]|[\u1E01-\u1E01]|[\u1E03-\u1E03]|[\u1E05-\u1E05]|[\u1E07-\u1E07]|[\u1E09-\u1E09]|[\u1E0B-\u1E0B]|[\u1E0D-\u1E0D]|[\u1E0F-\u1E0F]|[\u1E11-\u1E11]|[\u1E13-\u1E13]|[\u1E15-\u1E15]|[\u1E17-\u1E17]|[\u1E19-\u1E19]|[\u1E1B-\u1E1B]|[\u1E1D-\u1E1D]|[\u1E1F-\u1E1F]|[\u1E21-\u1E21]|[\u1E23-\u1E23]|[\u1E25-\u1E25]|[\u1E27-\u1E27]|[\u1E29-\u1E29]|[\u1E2B-\u1E2B]|[\u1E2D-\u1E2D]|[\u1E2F-\u1E2F]|[\u1E31-\u1E31]|[\u1E33-\u1E33]|[\u1E35-\u1E35]|[\u1E37-\u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]|[\u0EC6-\u0EC6]|[\u3005-\u3005]|[\u3031-\u3035]|[\u309D-\u309E]|[\u30FC-\u30FE]|[\uFF70-\uFF70]|[\uFF9E-\uFF9F]/,Lo:/[\u01AA-\u01AA]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u0B0C]|[\u0B0F-\u0B10]|[\u0B13-\u0B28]|[\u0B2A-\u0B30]|[\u0B32-\u0B33]|[\u0B36-\u0B39]|[\u0B3D-\u0B3D]|[\u0B5C-\u0B5D]|[\u0B5F-\u0B61]|[\u0B85-\u0B8A]|[\u0B8E-\u0B90]|[\u0B92-\u0B95]|[\u0B99-\u0B9A]|[\u0B9C-\u0B9C]|[\u0B9E-\u0B9F]|[\u0BA3-\u0BA4]|[\u0BA8-\u0BAA]|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6F]|[\uFF71-\uFF9D]|[\uFFA0-\uFFBE]|[\uFFC2-\uFFC7]|[\uFFCA-\uFFCF]|[\uFFD2-\uFFD7]|[\uFFDA-\uFFDC]/, +Nl:/[\u2160-\u2182]|[\u3007-\u3007]|[\u3021-\u3029]/,Nd:/[\u0030-\u0039]|[\u0660-\u0669]|[\u06F0-\u06F9]|[\u0966-\u096F]|[\u09E6-\u09EF]|[\u0A66-\u0A6F]|[\u0AE6-\u0AEF]|[\u0B66-\u0B6F]|[\u0BE7-\u0BEF]|[\u0C66-\u0C6F]|[\u0CE6-\u0CEF]|[\u0D66-\u0D6F]|[\u0E50-\u0E59]|[\u0ED0-\u0ED9]|[\u0F20-\u0F29]|[\uFF10-\uFF19]/,Mn:/[\u0300-\u0345]|[\u0360-\u0361]|[\u0483-\u0486]|[\u0591-\u05A1]|[\u05A3-\u05B9]|[\u05BB-\u05BD]|[\u05BF-\u05BF]|[\u05C1-\u05C2]|[\u05C4-\u05C4]|[\u064B-\u0652]|[\u0670-\u0670]|[\u06D6-\u06DC]|[\u06DF-\u06E4]|[\u06E7-\u06E8]|[\u06EA-\u06ED]|[\u0901-\u0902]|[\u093C-\u093C]|[\u0941-\u0948]|[\u094D-\u094D]|[\u0951-\u0954]|[\u0962-\u0963]|[\u0981-\u0981]|[\u09BC-\u09BC]|[\u09C1-\u09C4]|[\u09CD-\u09CD]|[\u09E2-\u09E3]|[\u0A02-\u0A02]|[\u0A3C-\u0A3C]|[\u0A41-\u0A42]|[\u0A47-\u0A48]|[\u0A4B-\u0A4D]|[\u0A70-\u0A71]|[\u0A81-\u0A82]|[\u0ABC-\u0ABC]|[\u0AC1-\u0AC5]|[\u0AC7-\u0AC8]|[\u0ACD-\u0ACD]|[\u0B01-\u0B01]|[\u0B3C-\u0B3C]|[\u0B3F-\u0B3F]|[\u0B41-\u0B43]|[\u0B4D-\u0B4D]|[\u0B56-\u0B56]|[\u0B82-\u0B82]|[\u0BC0-\u0BC0]|[\u0BCD-\u0BCD]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u0D46-\u0D48]|[\u0D4A-\u0D4C]|[\u0D57-\u0D57]|[\u0F3E-\u0F3F]|[\u0F7F-\u0F7F]/,Pc:/[\u005F-\u005F]|[\u203F-\u2040]|[\u30FB-\u30FB]|[\uFE33-\uFE34]|[\uFE4D-\uFE4F]|[\uFF3F-\uFF3F]|[\uFF65-\uFF65]/,Zs:/[\u2000-\u200B]|[\u3000-\u3000]/,L:/[\u0041-\u005A]|[\u00C0-\u00D6]|[\u00D8-\u00DE]|[\u0100-\u0100]|[\u0102-\u0102]|[\u0104-\u0104]|[\u0106-\u0106]|[\u0108-\u0108]|[\u010A-\u010A]|[\u010C-\u010C]|[\u010E-\u010E]|[\u0110-\u0110]|[\u0112-\u0112]|[\u0114-\u0114]|[\u0116-\u0116]|[\u0118-\u0118]|[\u011A-\u011A]|[\u011C-\u011C]|[\u011E-\u011E]|[\u0120-\u0120]|[\u0122-\u0122]|[\u0124-\u0124]|[\u0126-\u0126]|[\u0128-\u0128]|[\u012A-\u012A]|[\u012C-\u012C]|[\u012E-\u012E]|[\u0130-\u0130]|[\u0132-\u0132]|[\u0134-\u0134]|[\u0136-\u0136]|[\u0139-\u0139]|[\u013B-\u013B]|[\u013D-\u013D]|[\u013F-\u013F]|[\u0141-\u0141]|[\u0143-\u0143]|[\u0145-\u0145]|[\u0147-\u0147]|[\u014A-\u014A]|[\u014C-\u014C]|[\u014E-\u014E]|[\u0150-\u0150]|[\u0152-\u0152]|[\u0154-\u0154]|[\u0156-\u0156]|[\u0158-\u0158]|[\u015A-\u015A]|[\u015C-\u015C]|[\u015E-\u015E]|[\u0160-\u0160]|[\u0162-\u0162]|[\u0164-\u0164]|[\u0166-\u0166]|[\u0168-\u0168]|[\u016A-\u016A]|[\u016C-\u016C]|[\u016E-\u016E]|[\u0170-\u0170]|[\u0172-\u0172]|[\u0174-\u0174]|[\u0176-\u0176]|[\u0178-\u0179]|[\u017B-\u017B]|[\u017D-\u017D]|[\u0181-\u0182]|[\u0184-\u0184]|[\u0186-\u0187]|[\u0189-\u018B]|[\u018E-\u0191]|[\u0193-\u0194]|[\u0196-\u0198]|[\u019C-\u019D]|[\u019F-\u01A0]|[\u01A2-\u01A2]|[\u01A4-\u01A4]|[\u01A6-\u01A7]|[\u01A9-\u01A9]|[\u01AC-\u01AC]|[\u01AE-\u01AF]|[\u01B1-\u01B3]|[\u01B5-\u01B5]|[\u01B7-\u01B8]|[\u01BC-\u01BC]|[\u01C4-\u01C4]|[\u01C7-\u01C7]|[\u01CA-\u01CA]|[\u01CD-\u01CD]|[\u01CF-\u01CF]|[\u01D1-\u01D1]|[\u01D3-\u01D3]|[\u01D5-\u01D5]|[\u01D7-\u01D7]|[\u01D9-\u01D9]|[\u01DB-\u01DB]|[\u01DE-\u01DE]|[\u01E0-\u01E0]|[\u01E2-\u01E2]|[\u01E4-\u01E4]|[\u01E6-\u01E6]|[\u01E8-\u01E8]|[\u01EA-\u01EA]|[\u01EC-\u01EC]|[\u01EE-\u01EE]|[\u01F1-\u01F1]|[\u01F4-\u01F4]|[\u01FA-\u01FA]|[\u01FC-\u01FC]|[\u01FE-\u01FE]|[\u0200-\u0200]|[\u0202-\u0202]|[\u0204-\u0204]|[\u0206-\u0206]|[\u0208-\u0208]|[\u020A-\u020A]|[\u020C-\u020C]|[\u020E-\u020E]|[\u0210-\u0210]|[\u0212-\u0212]|[\u0214-\u0214]|[\u0216-\u0216]|[\u0386-\u0386]|[\u0388-\u038A]|[\u038C-\u038C]|[\u038E-\u038F]|[\u0391-\u03A1]|[\u03A3-\u03AB]|[\u03D2-\u03D4]|[\u03DA-\u03DA]|[\u03DC-\u03DC]|[\u03DE-\u03DE]|[\u03E0-\u03E0]|[\u03E2-\u03E2]|[\u03E4-\u03E4]|[\u03E6-\u03E6]|[\u03E8-\u03E8]|[\u03EA-\u03EA]|[\u03EC-\u03EC]|[\u03EE-\u03EE]|[\u0401-\u040C]|[\u040E-\u042F]|[\u0460-\u0460]|[\u0462-\u0462]|[\u0464-\u0464]|[\u0466-\u0466]|[\u0468-\u0468]|[\u046A-\u046A]|[\u046C-\u046C]|[\u046E-\u046E]|[\u0470-\u0470]|[\u0472-\u0472]|[\u0474-\u0474]|[\u0476-\u0476]|[\u0478-\u0478]|[\u047A-\u047A]|[\u047C-\u047C]|[\u047E-\u047E]|[\u0480-\u0480]|[\u0490-\u0490]|[\u0492-\u0492]|[\u0494-\u0494]|[\u0496-\u0496]|[\u0498-\u0498]|[\u049A-\u049A]|[\u049C-\u049C]|[\u049E-\u049E]|[\u04A0-\u04A0]|[\u04A2-\u04A2]|[\u04A4-\u04A4]|[\u04A6-\u04A6]|[\u04A8-\u04A8]|[\u04AA-\u04AA]|[\u04AC-\u04AC]|[\u04AE-\u04AE]|[\u04B0-\u04B0]|[\u04B2-\u04B2]|[\u04B4-\u04B4]|[\u04B6-\u04B6]|[\u04B8-\u04B8]|[\u04BA-\u04BA]|[\u04BC-\u04BC]|[\u04BE-\u04BE]|[\u04C1-\u04C1]|[\u04C3-\u04C3]|[\u04C7-\u04C7]|[\u04CB-\u04CB]|[\u04D0-\u04D0]|[\u04D2-\u04D2]|[\u04D4-\u04D4]|[\u04D6-\u04D6]|[\u04D8-\u04D8]|[\u04DA-\u04DA]|[\u04DC-\u04DC]|[\u04DE-\u04DE]|[\u04E0-\u04E0]|[\u04E2-\u04E2]|[\u04E4-\u04E4]|[\u04E6-\u04E6]|[\u04E8-\u04E8]|[\u04EA-\u04EA]|[\u04EE-\u04EE]|[\u04F0-\u04F0]|[\u04F2-\u04F2]|[\u04F4-\u04F4]|[\u04F8-\u04F8]|[\u0531-\u0556]|[\u10A0-\u10C5]|[\u1E00-\u1E00]|[\u1E02-\u1E02]|[\u1E04-\u1E04]|[\u1E06-\u1E06]|[\u1E08-\u1E08]|[\u1E0A-\u1E0A]|[\u1E0C-\u1E0C]|[\u1E0E-\u1E0E]|[\u1E10-\u1E10]|[\u1E12-\u1E12]|[\u1E14-\u1E14]|[\u1E16-\u1E16]|[\u1E18-\u1E18]|[\u1E1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2133]|[\uFF21-\uFF3A]|[\u0061-\u007A]|[\u00AA-\u00AA]|[\u00B5-\u00B5]|[\u00BA-\u00BA]|[\u00DF-\u00F6]|[\u00F8-\u00FF]|[\u0101-\u0101]|[\u0103-\u0103]|[\u0105-\u0105]|[\u0107-\u0107]|[\u0109-\u0109]|[\u010B-\u010B]|[\u010D-\u010D]|[\u010F-\u010F]|[\u0111-\u0111]|[\u0113-\u0113]|[\u0115-\u0115]|[\u0117-\u0117]|[\u0119-\u0119]|[\u011B-\u011B]|[\u011D-\u011D]|[\u011F-\u011F]|[\u0121-\u0121]|[\u0123-\u0123]|[\u0125-\u0125]|[\u0127-\u0127]|[\u0129-\u0129]|[\u012B-\u012B]|[\u012D-\u012D]|[\u012F-\u012F]|[\u0131-\u0131]|[\u0133-\u0133]|[\u0135-\u0135]|[\u0137-\u0138]|[\u013A-\u013A]|[\u013C-\u013C]|[\u013E-\u013E]|[\u0140-\u0140]|[\u0142-\u0142]|[\u0144-\u0144]|[\u0146-\u0146]|[\u0148-\u0149]|[\u014B-\u014B]|[\u014D-\u014D]|[\u014F-\u014F]|[\u0151-\u0151]|[\u0153-\u0153]|[\u0155-\u0155]|[\u0157-\u0157]|[\u0159-\u0159]|[\u015B-\u015B]|[\u015D-\u015D]|[\u015F-\u015F]|[\u0161-\u0161]|[\u0163-\u0163]|[\u0165-\u0165]|[\u0167-\u0167]|[\u0169-\u0169]|[\u016B-\u016B]|[\u016D-\u016D]|[\u016F-\u016F]|[\u0171-\u0171]|[\u0173-\u0173]|[\u0175-\u0175]|[\u0177-\u0177]|[\u017A-\u017A]|[\u017C-\u017C]|[\u017E-\u0180]|[\u0183-\u0183]|[\u0185-\u0185]|[\u0188-\u0188]|[\u018C-\u018D]|[\u0192-\u0192]|[\u0195-\u0195]|[\u0199-\u019B]|[\u019E-\u019E]|[\u01A1-\u01A1]|[\u01A3-\u01A3]|[\u01A5-\u01A5]|[\u01A8-\u01A8]|[\u01AB-\u01AB]|[\u01AD-\u01AD]|[\u01B0-\u01B0]|[\u01B4-\u01B4]|[\u01B6-\u01B6]|[\u01B9-\u01BA]|[\u01BD-\u01BD]|[\u01C6-\u01C6]|[\u01C9-\u01C9]|[\u01CC-\u01CC]|[\u01CE-\u01CE]|[\u01D0-\u01D0]|[\u01D2-\u01D2]|[\u01D4-\u01D4]|[\u01D6-\u01D6]|[\u01D8-\u01D8]|[\u01DA-\u01DA]|[\u01DC-\u01DD]|[\u01DF-\u01DF]|[\u01E1-\u01E1]|[\u01E3-\u01E3]|[\u01E5-\u01E5]|[\u01E7-\u01E7]|[\u01E9-\u01E9]|[\u01EB-\u01EB]|[\u01ED-\u01ED]|[\u01EF-\u01F0]|[\u01F3-\u01F3]|[\u01F5-\u01F5]|[\u01FB-\u01FB]|[\u01FD-\u01FD]|[\u01FF-\u01FF]|[\u0201-\u0201]|[\u0203-\u0203]|[\u0205-\u0205]|[\u0207-\u0207]|[\u0209-\u0209]|[\u020B-\u020B]|[\u020D-\u020D]|[\u020F-\u020F]|[\u0211-\u0211]|[\u0213-\u0213]|[\u0215-\u0215]|[\u0217-\u0217]|[\u0250-\u02A8]|[\u0390-\u0390]|[\u03AC-\u03CE]|[\u03D0-\u03D1]|[\u03D5-\u03D6]|[\u03E3-\u03E3]|[\u03E5-\u03E5]|[\u03E7-\u03E7]|[\u03E9-\u03E9]|[\u03EB-\u03EB]|[\u03ED-\u03ED]|[\u03EF-\u03F2]|[\u0430-\u044F]|[\u0451-\u045C]|[\u045E-\u045F]|[\u0461-\u0461]|[\u0463-\u0463]|[\u0465-\u0465]|[\u0467-\u0467]|[\u0469-\u0469]|[\u046B-\u046B]|[\u046D-\u046D]|[\u046F-\u046F]|[\u0471-\u0471]|[\u0473-\u0473]|[\u0475-\u0475]|[\u0477-\u0477]|[\u0479-\u0479]|[\u047B-\u047B]|[\u047D-\u047D]|[\u047F-\u047F]|[\u0481-\u0481]|[\u0491-\u0491]|[\u0493-\u0493]|[\u0495-\u0495]|[\u0497-\u0497]|[\u0499-\u0499]|[\u049B-\u049B]|[\u049D-\u049D]|[\u049F-\u049F]|[\u04A1-\u04A1]|[\u04A3-\u04A3]|[\u04A5-\u04A5]|[\u04A7-\u04A7]|[\u04A9-\u04A9]|[\u04AB-\u04AB]|[\u04AD-\u04AD]|[\u04AF-\u04AF]|[\u04B1-\u04B1]|[\u04B3-\u04B3]|[\u04B5-\u04B5]|[\u04B7-\u04B7]|[\u04B9-\u04B9]|[\u04BB-\u04BB]|[\u04BD-\u04BD]|[\u04BF-\u04BF]|[\u04C2-\u04C2]|[\u04C4-\u04C4]|[\u04C8-\u04C8]|[\u04CC-\u04CC]|[\u04D1-\u04D1]|[\u04D3-\u04D3]|[\u04D5-\u04D5]|[\u04D7-\u04D7]|[\u04D9-\u04D9]|[\u04DB-\u04DB]|[\u04DD-\u04DD]|[\u04DF-\u04DF]|[\u04E1-\u04E1]|[\u04E3-\u04E3]|[\u04E5-\u04E5]|[\u04E7-\u04E7]|[\u04E9-\u04E9]|[\u04EB-\u04EB]|[\u04EF-\u04EF]|[\u04F1-\u04F1]|[\u04F3-\u04F3]|[\u04F5-\u04F5]|[\u04F9-\u04F9]|[\u0561-\u0587]|[\u10D0-\u10F6]|[\u1E01-\u1E01]|[\u1E03-\u1E03]|[\u1E05-\u1E05]|[\u1E07-\u1E07]|[\u1E09-\u1E09]|[\u1E0B-\u1E0B]|[\u1E0D-\u1E0D]|[\u1E0F-\u1E0F]|[\u1E11-\u1E11]|[\u1E13-\u1E13]|[\u1E15-\u1E15]|[\u1E17-\u1E17]|[\u1E19-\u1E19]|[\u1E1B-\u1E1B]|[\u1E1D-\u1E1D]|[\u1E1F-\u1E1F]|[\u1E21-\u1E21]|[\u1E23-\u1E23]|[\u1E25-\u1E25]|[\u1E27-\u1E27]|[\u1E29-\u1E29]|[\u1E2B-\u1E2B]|[\u1E2D-\u1E2D]|[\u1E2F-\u1E2F]|[\u1E31-\u1E31]|[\u1E33-\u1E33]|[\u1E35-\u1E35]|[\u1E37-\u1E37]|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|[\u3005-\u3005]|[\u3031-\u3035]|[\u309D-\u309E]|[\u30FC-\u30FE]|[\uFF70-\uFF70]|[\uFF9E-\uFF9F]|[\u01AA-\u01AA]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u0B0C]|[\u0B0F-\u0B10]|[\u0B13-\u0B28]|[\u0B2A-\u0B30]|[\u0B32-\u0B33]|[\u0B36-\u0B39]|[\u0B3D-\u0B3D]|[\u0B5C-\u0B5D]|[\u0B5F-\u0B61]|[\u0B85-\u0B8A]|[\u0B8E-\u0B90]|[\u0B92-\u0B95]|[\u0B99-\u0B9A]|[\u0B9C-\u0B9C]|[\u0B9E-\u0B9F]|[\u0BA3-\u0BA4]|[\u0BA8-\u0BAA]|[\u0BAE-\u0BB5]|[\u0BB7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FA0-\uFFBE]|[\uFFC2-\uFFC7]|[\uFFCA-\uFFCF]|[\uFFD2-\uFFD7]|[\uFFDA-\uFFDC]/,Ltmo:/[\u01C5-\u01C5]|[\u01C8-\u01C8]|[\u01CB-\u01CB]|[\u01F2-\u01F2][\u02B0-\u02B8]|[\u02BB-\u02C1]|[\u02D0-\u02D1]|[\u02E0-\u02E4]|[\u037A-\u037A]|[\u0559-\u0559]|[\u0640-\u0640]|[\u06E5-\u06E6]|[\u0E46-\u0E46]|[\u0EC6-\u0EC6]|[\u3005-\u3005]|[\u3031-\u3035]|[\u309D-\u309E]|[\u30FC-\u30FE]|[\uFF70-\uFF70]|[\uFF9E-\uFF9F][\u01AA-\u01AA]|[\u01BB-\u01BB]|[\u01BE-\u01C3]|[\u03F3-\u03F3]|[\u04C0-\u04C0]|[\u05D0-\u05EA]|[\u05F0-\u05F2]|[\u0621-\u063A]|[\u0641-\u064A]|[\u0671-\u06B7]|[\u06BA-\u06BE]|[\u06C0-\u06CE]|[\u06D0-\u06D3]|[\u06D5-\u06D5]|[\u0905-\u0939]|[\u093D-\u093D]|[\u0950-\u0950]|[\u0958-\u0961]|[\u0985-\u098C]|[\u098F-\u0990]|[\u0993-\u09A8]|[\u09AA-\u09B0]|[\u09B2-\u09B2]|[\u09B6-\u09B9]|[\u09DC-\u09DD]|[\u09DF-\u09E1]|[\u09F0-\u09F1]|[\u0A05-\u0A0A]|[\u0A0F-\u0A10]|[\u0A13-\u0A28]|[\u0A2A-\u0A30]|[\u0A32-\u0A33]|[\u0A35-\u0A36]|[\u0A38-\u0A39]|[\u0A59-\u0A5C]|[\u0A5E-\u0A5E]|[\u0A72-\u0A74]|[\u0A85-\u0A8B]|[\u0A8D-\u0A8D]|[\u0A8F-\u0A91]|[\u0A93-\u0AA8]|[\u0AAA-\u0AB0]|[\u0AB2-\u0AB3]|[\u0AB5-\u0AB9]|[\u0ABD-\u0ABD]|[\u0AD0-\u0AD0]|[\u0AE0-\u0AE0]|[\u0B05-\u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\uAC00-\uD7A3]|[\uF900-\uFA2D]|[\uFB1F-\uFB28]|[\uFB2A-\uFB36]|[\uFB38-\uFB3C]|[\uFB3E-\uFB3E]|[\uFB40-\uFB41]|[\uFB43-\uFB44]|[\uFB46-\uFBB1]|[\uFBD3-\uFD3D]|[\uFD50-\uFD8F]|[\uFD92-\uFDC7]|[\uFDF0-\uFDFB]|[\uFE70-\uFE72]|[\uFE74-\uFE74]|[\uFE76-\uFEFC]|[\uFF66-\uFF6F]|[\uFF71-\uFF9D]|[\uFFA0-\uFFBE]|[\uFFC2-\uFFC7]|[\uFFCA-\uFFCF]|[\uFFD2-\uFFD7]|[\uFFDA-\uFFDC]/}},{}]},{},[3])(3)}); \ No newline at end of file diff --git a/examples/motion/index.html b/examples/motion/index.html new file mode 100644 index 0000000..b22d30f --- /dev/null +++ b/examples/motion/index.html @@ -0,0 +1,26 @@ + + + + Syndicate: Motion + + + + + + + + + + + + + + + + + + + + diff --git a/examples/motion/index.js b/examples/motion/index.js new file mode 100644 index 0000000..d20ec50 --- /dev/null +++ b/examples/motion/index.js @@ -0,0 +1,58 @@ +assertion type point(color, x, y); + +var brokerConnection = Syndicate.Broker.brokerConnection; +var toBroker = Syndicate.Broker.toBroker; +var fromBroker = Syndicate.Broker.fromBroker; + +ground dataspace G { + Syndicate.UI.spawnUIDriver(); + Syndicate.Timer.spawnTimerDriver(); + Syndicate.Broker.spawnBrokerClientDriver(); + + actor { + var ui = new Syndicate.UI.Anchor(); + var color = tinycolor('hsl ' + (Math.random() * 360 | 0) + ' 100% 50%').toHexString(); + var x = 0; + var y = 0; + var publishedX = x; + var publishedY = y; + + function clamp(v) { + var limit = 9.8; + return Math.max(Math.min(v, limit), -limit); + } + + var wsurl = 'ws://demo-broker.syndicate-lang.org:8000/'; + react { + assert brokerConnection(wsurl); + + assert Syndicate.UI.uiAttribute('rect#my_color', 'fill', color); + + assert toBroker(wsurl, point(color, publishedX, publishedY)); + on message Syndicate.Timer.periodicTick(100) { + publishedX = x; + publishedY = y; + } + + on message Syndicate.UI.windowEvent('deviceorientation', $e) { + var scale = 0.5; + x = clamp(e.gamma * scale); + y = clamp((e.beta - 40) * scale); + } + + during fromBroker(wsurl, point($oc, $ox, $oy)) { + assert ui.context(oc) + .html('#container', + Mustache.render(document.getElementById('circle-template').innerHTML, { + color: oc, + x: ox, + y: oy + })); + } + } + } +} + +// G.dataspace.setOnStateChange(function (mux, patch) { +// document.getElementById("ds-state").innerText = Syndicate.prettyTrie(mux.routingTable); +// }); diff --git a/examples/motion/style.css b/examples/motion/style.css new file mode 100644 index 0000000..0399fe4 --- /dev/null +++ b/examples/motion/style.css @@ -0,0 +1,7 @@ +template { + display: none; +} + +svg { + border: solid black 1px; +} \ No newline at end of file diff --git a/examples/motion/tinycolor.js b/examples/motion/tinycolor.js new file mode 100644 index 0000000..79dfd42 --- /dev/null +++ b/examples/motion/tinycolor.js @@ -0,0 +1,897 @@ +// TinyColor v0.9.14+ +// https://github.com/bgrins/TinyColor +// 2013-02-24, Brian Grinstead, MIT License + +(function(root) { + +var trimLeft = /^[\s,#]+/, + trimRight = /\s+$/, + tinyCounter = 0, + math = Math, + mathRound = math.round, + mathMin = math.min, + mathMax = math.max, + mathRandom = math.random; + +function tinycolor (color, opts) { + + color = (color) ? color : ''; + opts = opts || { }; + + // If input is already a tinycolor, return itself + if (typeof color == "object" && color.hasOwnProperty("_tc_id")) { + return color; + } + + var rgb = inputToRGB(color); + var r = rgb.r, + g = rgb.g, + b = rgb.b, + a = rgb.a, + roundA = mathRound(100*a) / 100, + format = opts.format || rgb.format; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (r < 1) { r = mathRound(r); } + if (g < 1) { g = mathRound(g); } + if (b < 1) { b = mathRound(b); } + + return { + ok: rgb.ok, + format: format, + _tc_id: tinyCounter++, + alpha: a, + toHsv: function() { + var hsv = rgbToHsv(r, g, b); + return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: a }; + }, + toHsvString: function() { + var hsv = rgbToHsv(r, g, b); + var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); + return (a == 1) ? + "hsv(" + h + ", " + s + "%, " + v + "%)" : + "hsva(" + h + ", " + s + "%, " + v + "%, "+ roundA + ")"; + }, + toHsl: function() { + var hsl = rgbToHsl(r, g, b); + return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: a }; + }, + toHslString: function() { + var hsl = rgbToHsl(r, g, b); + var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); + return (a == 1) ? + "hsl(" + h + ", " + s + "%, " + l + "%)" : + "hsla(" + h + ", " + s + "%, " + l + "%, "+ roundA + ")"; + }, + toHex: function(allow3Char) { + return rgbToHex(r, g, b, allow3Char); + }, + toHexString: function(allow3Char) { + return '#' + rgbToHex(r, g, b, allow3Char); + }, + toRgb: function() { + return { r: mathRound(r), g: mathRound(g), b: mathRound(b), a: a }; + }, + toRgbString: function() { + return (a == 1) ? + "rgb(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ")" : + "rgba(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ", " + roundA + ")"; + }, + toPercentageRgb: function() { + return { r: mathRound(bound01(r, 255) * 100) + "%", g: mathRound(bound01(g, 255) * 100) + "%", b: mathRound(bound01(b, 255) * 100) + "%", a: a }; + }, + toPercentageRgbString: function() { + return (a == 1) ? + "rgb(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%)" : + "rgba(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%, " + roundA + ")"; + }, + toName: function() { + if (a === 0) { + return "transparent"; + } + + return hexNames[rgbToHex(r, g, b, true)] || false; + }, + toFilter: function(secondColor) { + var hex = rgbToHex(r, g, b); + var secondHex = hex; + var alphaHex = Math.round(parseFloat(a) * 255).toString(16); + var secondAlphaHex = alphaHex; + var gradientType = opts && opts.gradientType ? "GradientType = 1, " : ""; + + if (secondColor) { + var s = tinycolor(secondColor); + secondHex = s.toHex(); + secondAlphaHex = Math.round(parseFloat(s.alpha) * 255).toString(16); + } + + return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr=#" + pad2(alphaHex) + hex + ",endColorstr=#" + pad2(secondAlphaHex) + secondHex + ")"; + }, + toString: function(format) { + format = format || this.format; + var formattedString = false; + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + + return formattedString || this.toHexString(); + } + }; +} + +// If input is an object, force 1 into "1.0" to handle ratios properly +// String input requires "1.0" as input, so 1 will be treated as 1 +tinycolor.fromRatio = function(color, opts) { + if (typeof color == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } + else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + + return tinycolor(color, opts); +}; + +// Given a string or object, convert that input to RGB +// Possible string inputs: +// +// "red" +// "#f00" or "f00" +// "#ff0000" or "ff0000" +// "rgb 255 0 0" or "rgb (255, 0, 0)" +// "rgb 1.0 0 0" or "rgb (1, 0, 0)" +// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" +// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" +// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" +// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" +// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" +// +function inputToRGB(color) { + + var rgb = { r: 0, g: 0, b: 0 }; + var a = 1; + var ok = false; + var format = false; + + if (typeof color == "string") { + color = stringInputToObject(color); + } + + if (typeof color == "object") { + if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } + else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) { + color.s = convertToPercentage(color.s); + color.v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, color.s, color.v); + ok = true; + format = "hsv"; + } + else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) { + color.s = convertToPercentage(color.s); + color.l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, color.s, color.l); + ok = true; + format = "hsl"; + } + + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + + a = parseFloat(a); + + // Handle invalid alpha characters by setting to 1 + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + + return { + ok: ok, + format: color.format || format, + r: mathMin(255, mathMax(rgb.r, 0)), + g: mathMin(255, mathMax(rgb.g, 0)), + b: mathMin(255, mathMax(rgb.b, 0)), + a: a + }; +} + + + +// Conversion Functions +// -------------------- + +// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: +// + +// `rgbToRgb` +// Handle bounds / percentage checking to conform to CSS color spec +// +// *Assumes:* r, g, b in [0, 255] or [0, 1] +// *Returns:* { r, g, b } in [0, 255] +function rgbToRgb(r, g, b){ + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; +} + +// `rgbToHsl` +// Converts an RGB color value to HSL. +// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] +// *Returns:* { h, s, l } in [0,1] +function rgbToHsl(r, g, b) { + + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, l = (max + min) / 2; + + if(max == min) { + h = s = 0; // achromatic + } + else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch(max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + + h /= 6; + } + + return { h: h, s: s, l: l }; +} + +// `hslToRgb` +// Converts an HSL color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hslToRgb(h, s, l) { + var r, g, b; + + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + + function hue2rgb(p, q, t) { + if(t < 0) t += 1; + if(t > 1) t -= 1; + if(t < 1/6) return p + (q - p) * 6 * t; + if(t < 1/2) return q; + if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; + return p; + } + + if(s === 0) { + r = g = b = l; // achromatic + } + else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1/3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1/3); + } + + return { r: r * 255, g: g * 255, b: b * 255 }; +} + +// `rgbToHsv` +// Converts an RGB color value to HSV +// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] +// *Returns:* { h, s, v } in [0,1] +function rgbToHsv(r, g, b) { + + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + + var max = mathMax(r, g, b), min = mathMin(r, g, b); + var h, s, v = max; + + var d = max - min; + s = max === 0 ? 0 : d / max; + + if(max == min) { + h = 0; // achromatic + } + else { + switch(max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + return { h: h, s: s, v: v }; +} + +// `hsvToRgb` +// Converts an HSV color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + + var i = math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + + return { r: r * 255, g: g * 255, b: b * 255 }; +} + +// `rgbToHex` +// Converts an RGB color to hex +// Assumes r, g, and b are contained in the set [0, 255] +// Returns a 3 or 6 character hex +function rgbToHex(r, g, b, allow3Char) { + + var hex = [ + pad2(mathRound(r).toString(16)), + pad2(mathRound(g).toString(16)), + pad2(mathRound(b).toString(16)) + ]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + + return hex.join(""); +} + +// `equals` +// Can be called with any tinycolor input +tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) { return false; } + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); +}; +tinycolor.random = function() { + return tinycolor.fromRatio({ + r: mathRandom(), + g: mathRandom(), + b: mathRandom() + }); +}; + + +// Modification Functions +// ---------------------- +// Thanks to less.js for some of the basics here +// + + +tinycolor.desaturate = function (color, amount) { + var hsl = tinycolor(color).toHsl(); + hsl.s -= ((amount || 10) / 100); + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +}; +tinycolor.saturate = function (color, amount) { + var hsl = tinycolor(color).toHsl(); + hsl.s += ((amount || 10) / 100); + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +}; +tinycolor.greyscale = function(color) { + return tinycolor.desaturate(color, 100); +}; +tinycolor.lighten = function(color, amount) { + var hsl = tinycolor(color).toHsl(); + hsl.l += ((amount || 10) / 100); + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +}; +tinycolor.darken = function (color, amount) { + var hsl = tinycolor(color).toHsl(); + hsl.l -= ((amount || 10) / 100); + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +}; +tinycolor.complement = function(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); +}; + + +// Combination Functions +// --------------------- +// Thanks to jQuery xColor for some of the ideas behind these +// + +tinycolor.triad = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) + ]; +}; +tinycolor.tetrad = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), + tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) + ]; +}; +tinycolor.splitcomplement = function(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), + tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) + ]; +}; +tinycolor.analogous = function(color, results, slices) { + results = results || 6; + slices = slices || 30; + + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + + for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; +}; +tinycolor.monochromatic = function(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, s = hsv.s, v = hsv.v; + var ret = []; + var modification = 1 / results; + + while (results--) { + ret.push(tinycolor({ h: h, s: s, v: v})); + v = (v + modification) % 1; + } + + return ret; +}; + +// Readability Functions +// --------------------- +// + +// `readability` +// Analyze the 2 colors and returns an object with the following properties: +// `brightness`: difference in brightness between the two colors +// `color`: difference in color/hue between the two colors +tinycolor.readability = function(color1, color2) { + var a = tinycolor(color1).toRgb(); + var b = tinycolor(color2).toRgb(); + var brightnessA = (a.r * 299 + a.g * 587 + a.b * 114) / 1000; + var brightnessB = (b.r * 299 + b.g * 587 + b.b * 114) / 1000; + var colorDiff = ( + Math.max(a.r, b.r) - Math.min(a.r, b.r) + + Math.max(a.g, b.g) - Math.min(a.g, b.g) + + Math.max(a.b, b.b) - Math.min(a.b, b.b) + ); + + return { + brightness: Math.abs(brightnessA - brightnessB), + color: colorDiff + }; +}; + +// `readable` +// http://www.w3.org/TR/AERT#color-contrast +// Ensure that foreground and background color combinations provide sufficient contrast. +// *Example* +// tinycolor.readable("#000", "#111") => false +tinycolor.readable = function(color1, color2) { + var readability = tinycolor.readability(color1, color2); + return readability.brightness > 125 && readability.color > 500; +}; + +// `mostReadable` +// Given a base color and a list of possible foreground or background +// colors for that base, returns the most readable color. +// *Example* +// tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000" +tinycolor.mostReadable = function(baseColor, colorList) { + var bestColor = null; + var bestScore = 0; + var bestIsReadable = false; + for (var i=0; i < colorList.length; i++) { + + // We normalize both around the "acceptable" breaking point, + // but rank brightness constrast higher than hue. + + var readability = tinycolor.readability(baseColor, colorList[i]); + var readable = readability.brightness > 125 && readability.color > 500; + var score = 3 * (readability.brightness / 125) + (readability.color / 500); + + if ((readable && ! bestIsReadable) || + (readable && bestIsReadable && score > bestScore) || + ((! readable) && (! bestIsReadable) && score > bestScore)) { + bestIsReadable = readable; + bestScore = score; + bestColor = tinycolor(colorList[i]); + } + } + return bestColor; +}; + + +// Big List of Colors +// ------------------ +// +var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" +}; + +// Make it easy to access colors via `hexNames[hex]` +var hexNames = tinycolor.hexNames = flip(names); + + +// Utilities +// --------- + +// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` +function flip(o) { + var flipped = { }; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; +} + +// Take input from [0, n] and return it as [0, 1] +function bound01(n, max) { + if (isOnePointZero(n)) { n = "100%"; } + + var processPercent = isPercentage(n); + n = mathMin(max, mathMax(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if ((math.abs(n - max) < 0.000001)) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return (n % max) / parseFloat(max); +} + +// Force a number between 0 and 1 +function clamp01(val) { + return mathMin(1, mathMax(0, val)); +} + +// Parse an integer into hex +function parseHex(val) { + return parseInt(val, 16); +} + +// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 +// +function isOnePointZero(n) { + return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; +} + +// Check to see if string passed in is a percentage +function isPercentage(n) { + return typeof n === "string" && n.indexOf('%') != -1; +} + +// Force a hex value to have 2 characters +function pad2(c) { + return c.length == 1 ? '0' + c : '' + c; +} + +// Replace a decimal with it's percentage value +function convertToPercentage(n) { + if (n <= 1) { + n = (n * 100) + "%"; + } + + return n; +} + +var matchers = (function() { + + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + + return { + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; +})(); + +// `stringInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +function stringInputToObject(color) { + + color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } + else if (color == 'transparent') { + return { r: 0, g: 0, b: 0, a: 0, format: "name" }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if ((match = matchers.rgb.exec(color))) { + return { r: match[1], g: match[2], b: match[3] }; + } + if ((match = matchers.rgba.exec(color))) { + return { r: match[1], g: match[2], b: match[3], a: match[4] }; + } + if ((match = matchers.hsl.exec(color))) { + return { h: match[1], s: match[2], l: match[3] }; + } + if ((match = matchers.hsla.exec(color))) { + return { h: match[1], s: match[2], l: match[3], a: match[4] }; + } + if ((match = matchers.hsv.exec(color))) { + return { h: match[1], s: match[2], v: match[3] }; + } + if ((match = matchers.hex6.exec(color))) { + return { + r: parseHex(match[1]), + g: parseHex(match[2]), + b: parseHex(match[3]), + format: named ? "name" : "hex" + }; + } + if ((match = matchers.hex3.exec(color))) { + return { + r: parseHex(match[1] + '' + match[1]), + g: parseHex(match[2] + '' + match[2]), + b: parseHex(match[3] + '' + match[3]), + format: named ? "name" : "hex" + }; + } + + return false; +} + +// Node: Export function +if (typeof module !== "undefined" && module.exports) { + module.exports = tinycolor; +} +// AMD/requirejs: Define the module +else if (typeof define !== "undefined") { + define(function () {return tinycolor;}); +} +// Browser: Expose to window +else { + root.tinycolor = tinycolor; +} + +})(this);