From c783dc4908e6ab72bf4f554eb6bfe7d092ef9b0b Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Fri, 23 May 2014 00:20:26 +0900 Subject: [PATCH 01/64] Add super syntax --- src/grammar.pegjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/grammar.pegjs b/src/grammar.pegjs index 1f9ef18c..18a08ed5 100644 --- a/src/grammar.pegjs +++ b/src/grammar.pegjs @@ -589,7 +589,12 @@ leftHandSideExpressionNoImplicitObjectCall = callExpressionNoImplicitObjectCall / secondaryExpressionNoImplicitObjectCall callExpression - = fn:memberExpression accesses:callExpressionAccesses? secondaryArgs:("?"? secondaryArgumentList)? { + = SUPER accesses:callExpressionAccesses? secondaryArgs:secondaryArgumentList?{ + if(accesses) + return rp(new CS.Super(accesses[0].operands[0])); + return rp(new CS.Super(secondaryArgs || [] )); + } + / fn:memberExpression accesses:callExpressionAccesses? secondaryArgs:("?"? secondaryArgumentList)? { if(accesses) fn = createMemberExpression(fn, accesses); var soaked, secondaryCtor; if(secondaryArgs) { @@ -603,7 +608,12 @@ callExpression = TERMINDENT as:callExpressionAccesses DEDENT { return as; } / as:(argumentList / MemberAccessOps)+ bs:callExpressionAccesses? { return as.concat(bs || []); } callExpressionNoImplicitObjectCall - = fn:memberExpressionNoImplicitObjectCall accesses:(argumentList / MemberAccessOps)* secondaryArgs:("?"? secondaryArgumentListNoImplicitObjectCall)? { + = SUPER accesses:callExpressionAccesses? secondaryArgs:secondaryArgumentList?{ + if(accesses) + return rp(new CS.Super(accesses[0].operands[0])); + return rp(new CS.Super(secondaryArgs || [] )); + } + / fn:memberExpressionNoImplicitObjectCall accesses:(argumentList / MemberAccessOps)* secondaryArgs:("?"? secondaryArgumentListNoImplicitObjectCall)? { if(accesses) fn = createMemberExpression(fn, accesses); var soaked, secondaryCtor; if(secondaryArgs) { @@ -1217,6 +1227,7 @@ UNTIL = $("until" !identifierPart) WHEN = $("when" !identifierPart) WHILE = $("while" !identifierPart) YES = $("yes" !identifierPart) +SUPER = $("super" !identifierPart) SharedKeywords = ("true" / "false" / "null" / "this" / "new" / "delete" / "typeof" / From 0dc48d574b16a62b9cc209d5860e634983add829 Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Fri, 23 May 2014 00:21:34 +0900 Subject: [PATCH 02/64] Add find helper --- src/compiler.coffee | 2 +- src/functional-helpers.coffee | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler.coffee b/src/compiler.coffee index b853c042..af48aa5d 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -1,4 +1,4 @@ -{any, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union} = require './functional-helpers' +{find, any, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union} = require './functional-helpers' {beingDeclared, usedAsExpression, envEnrichments} = require './helpers' CS = require './nodes' JS = require './js-nodes' diff --git a/src/functional-helpers.coffee b/src/functional-helpers.coffee index 88158e28..3a0eafc8 100644 --- a/src/functional-helpers.coffee +++ b/src/functional-helpers.coffee @@ -8,6 +8,11 @@ return no unless fn e yes +@find = (list, fn) -> + for e in list + return e if fn(e) + null + @foldl = foldl = (memo, list, fn) -> for i in list memo = fn memo, i From 5ad09f640263f212e77b1b5c887ccc574094aa09 Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Fri, 23 May 2014 00:22:03 +0900 Subject: [PATCH 03/64] Implement super --- src/compiler.coffee | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/compiler.coffee b/src/compiler.coffee index af48aa5d..7ce47645 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -809,6 +809,73 @@ class exports.Compiler else lhs.right = new JS.AssignmentExpression '=', left, lhs.right new JS.LogicalExpression '&&', lhs, new JS.BinaryExpression expression.operator, left, expression.right ] + + [CS.Super, ({arguments: args, compile, inScope, ancestry}) -> + + classNode = find ancestry, (node) => + (node instanceof CS.Class) or (node.assignee instanceof CS.ProtoMemberAccessOp) + + classPositionInAncestry = ancestry.indexOf(classNode) + classAssignNode = ancestry[ ancestry.indexOf(classNode) - 1] + + className = null + functionName = null + isStatic = false + isProtoMemberAccess = classNode.assignee instanceof CS.ProtoMemberAccessOp + + switch + when classNode instanceof CS.Class + className = classNode.name.data + functionName = do -> + searchableNodes = []; + for i, n in ancestry + break if n is classPositionInAncestry + searchableNodes.unshift i + assignableNode = find searchableNodes, (node) => node.assignee? + return 'constructor' unless assignableNode? + + switch + when assignableNode.assignee instanceof CS.MemberAccessOp + isStatic = true + assignableNode.assignee.memberName + when assignableNode.assignee instanceof CS.Identifier + assignableNode.assignee.data + + when classNode instanceof CS.AssignOp + isStatic = false + className = classNode.assignee.expression.data + functionName = classNode.assignee.memberName + + if className is 'class' + if args.length > 0 + calledExprs = [new JS.ThisExpression].concat (map args, expr) + return new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'call'), calledExprs + else + return new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'apply'), [ + new JS.ThisExpression + new JS.Identifier 'arguments' + ] + + if isStatic + if args.length is 0 + new JS.CallExpression (memberAccess (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), 'constructor'), functionName), 'apply'), [ + new JS.ThisExpression + new JS.Identifier 'arguments' + ] + else + calledExprs = [new JS.ThisExpression].concat (map args, expr) + new JS.CallExpression (memberAccess (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), 'constructor'), functionName), 'call'), calledExprs + else + if args.length is 0 + new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), functionName), 'apply'), [ + new JS.ThisExpression + new JS.Identifier 'arguments' + ] + else + calledExprs = [new JS.ThisExpression].concat (map args, expr) + new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), functionName), 'call'), calledExprs + ] + [CS.FunctionApplication, ({function: fn, arguments: args, compile}) -> if any args, (m) -> m.spread lhs = @function From bb9fa6bb792b6a213f72c9ad1297d667a7d56ba1 Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Fri, 23 May 2014 00:23:18 +0900 Subject: [PATCH 04/64] Generate --- lib/compiler.js | 86 ++++- lib/functional-helpers.js | 9 + lib/helpers.js | 14 +- lib/parser.js | 285 ++++++++++++----- lib/preprocessor.js | 6 +- lib/repl.js | 4 +- lib/reporter.js | 86 +++++ lib/type-helpers.js | 88 +++++ lib/type_checker.js | 658 ++++++++++++++++++++++++++++++++++++++ lib/types.js | 390 ++++++++++++++++++++++ 10 files changed, 1533 insertions(+), 93 deletions(-) create mode 100644 lib/reporter.js create mode 100644 lib/type-helpers.js create mode 100644 lib/type_checker.js create mode 100644 lib/types.js diff --git a/lib/compiler.js b/lib/compiler.js index d48a9454..21d5a04f 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,6 +1,7 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; +var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; cache$ = require('./functional-helpers'); +find = cache$.find; any = cache$.any; concat = cache$.concat; concatMap = cache$.concatMap; @@ -1458,6 +1459,89 @@ exports.Compiler = function () { return new JS.LogicalExpression('&&', lhs, new JS.BinaryExpression(expression.operator, left, expression.right)); } ], + [ + CS.Super, + function (param$) { + var ancestry, args, cache$2, calledExprs, classAssignNode, className, classNode, classPositionInAncestry, compile, functionName, inScope, isProtoMemberAccess, isStatic; + { + cache$2 = param$; + args = cache$2['arguments']; + compile = cache$2.compile; + inScope = cache$2.inScope; + ancestry = cache$2.ancestry; + } + classNode = find(ancestry, function (node) { + return node instanceof CS.Class || node.assignee instanceof CS.ProtoMemberAccessOp; + }); + classPositionInAncestry = ancestry.indexOf(classNode); + classAssignNode = ancestry[ancestry.indexOf(classNode) - 1]; + className = null; + functionName = null; + isStatic = false; + isProtoMemberAccess = classNode.assignee instanceof CS.ProtoMemberAccessOp; + switch (false) { + case !(classNode instanceof CS.Class): + className = classNode.name.data; + functionName = function () { + var assignableNode, i, n, searchableNodes; + searchableNodes = []; + for (var i$ = 0, length$ = ancestry.length; i$ < length$; ++i$) { + i = ancestry[i$]; + n = i$; + if (n === classPositionInAncestry) + break; + searchableNodes.unshift(i); + } + assignableNode = find(searchableNodes, function (node) { + return null != node.assignee; + }); + if (!(null != assignableNode)) + return 'constructor'; + switch (false) { + case !(assignableNode.assignee instanceof CS.MemberAccessOp): + isStatic = true; + return assignableNode.assignee.memberName; + case !(assignableNode.assignee instanceof CS.Identifier): + return assignableNode.assignee.data; + } + }(); + break; + case !(classNode instanceof CS.AssignOp): + isStatic = false; + className = classNode.assignee.expression.data; + functionName = classNode.assignee.memberName; + } + if (className === 'class') + if (args.length > 0) { + calledExprs = [new JS.ThisExpression].concat(map(args, expr)); + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'call'), calledExprs); + } else { + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]); + } + if (isStatic) { + if (args.length === 0) { + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]); + } else { + calledExprs = [new JS.ThisExpression].concat(map(args, expr)); + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'call'), calledExprs); + } + } else if (args.length === 0) { + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]); + } else { + calledExprs = [new JS.ThisExpression].concat(map(args, expr)); + return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'call'), calledExprs); + } + } + ], [ CS.FunctionApplication, function (param$) { diff --git a/lib/functional-helpers.js b/lib/functional-helpers.js index be170885..f39a7eb0 100644 --- a/lib/functional-helpers.js +++ b/lib/functional-helpers.js @@ -18,6 +18,15 @@ this.all = function (list, fn) { } return true; }; +this.find = function (list, fn) { + var e; + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + e = list[i$]; + if (fn(e)) + return e; + } + return null; +}; this.foldl = foldl = function (memo, list, fn) { var i; for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { diff --git a/lib/helpers.js b/lib/helpers.js index 4471b06c..95639531 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -9,17 +9,17 @@ map = cache$.map; nub = cache$.nub; CS = require('./nodes'); COLOURS = { - red: '\x1B[31m', - green: '\x1B[32m', - yellow: '\x1B[33m', - blue: '\x1B[34m', - magenta: '\x1B[35m', - cyan: '\x1B[36m' + red: '\x1b[31m', + green: '\x1b[32m', + yellow: '\x1b[33m', + blue: '\x1b[34m', + magenta: '\x1b[35m', + cyan: '\x1b[36m' }; SUPPORTS_COLOUR = ('undefined' !== typeof process && null != process && null != process.stderr ? process.stderr.isTTY : void 0) && !process.env.NODE_DISABLE_COLORS; colourise = function (colour, str) { if (SUPPORTS_COLOUR) { - return '' + COLOURS[colour] + str + '\x1B[39m'; + return '' + COLOURS[colour] + str + '\x1b[39m'; } else { return str; } diff --git a/lib/parser.js b/lib/parser.js index 84bf8fb4..d1902a8d 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -4167,34 +4167,12 @@ module.exports = (function(){ r1 = pos; r2 = pos; - r3 = parse_memberExpression(); + r3 = parse_SUPER(); if (r3 !== null) { r4 = parse_callExpressionAccesses(); r4 = r4 !== null ? r4 : ""; if (r4 !== null) { - r6 = pos; - if (input.charCodeAt(pos) === 63) { - r7 = "?"; - pos++; - } else { - r7 = null; - if (reportFailures === 0) { - matchFailed("\"?\""); - } - } - r7 = r7 !== null ? r7 : ""; - if (r7 !== null) { - r8 = parse_secondaryArgumentList(); - if (r8 !== null) { - r5 = [r7, r8]; - } else { - r5 = null; - pos = r6; - } - } else { - r5 = null; - pos = r6; - } + r5 = parse_secondaryArgumentList(); r5 = r5 !== null ? r5 : ""; if (r5 !== null) { r0 = [r3, r4, r5]; @@ -4212,20 +4190,78 @@ module.exports = (function(){ } if (r0 !== null) { reportedPos = r1; - r0 = (function(fn, accesses, secondaryArgs) { - if(accesses) fn = createMemberExpression(fn, accesses); - var soaked, secondaryCtor; - if(secondaryArgs) { - soaked = secondaryArgs[0]; - secondaryCtor = soaked ? CS.SoakedFunctionApplication : CS.FunctionApplication; - fn = rp(new secondaryCtor(fn, secondaryArgs[1])); - } - return fn; - })(r3, r4, r5); + r0 = (function(accesses, secondaryArgs) { + if(accesses) + return rp(new CS.Super(accesses[0].operands[0])); + return rp(new CS.Super(secondaryArgs || [] )); + })(r4, r5); } if (r0 === null) { pos = r1; } + if (r0 === null) { + r1 = pos; + r2 = pos; + r3 = parse_memberExpression(); + if (r3 !== null) { + r4 = parse_callExpressionAccesses(); + r4 = r4 !== null ? r4 : ""; + if (r4 !== null) { + r6 = pos; + if (input.charCodeAt(pos) === 63) { + r7 = "?"; + pos++; + } else { + r7 = null; + if (reportFailures === 0) { + matchFailed("\"?\""); + } + } + r7 = r7 !== null ? r7 : ""; + if (r7 !== null) { + r8 = parse_secondaryArgumentList(); + if (r8 !== null) { + r5 = [r7, r8]; + } else { + r5 = null; + pos = r6; + } + } else { + r5 = null; + pos = r6; + } + r5 = r5 !== null ? r5 : ""; + if (r5 !== null) { + r0 = [r3, r4, r5]; + } else { + r0 = null; + pos = r2; + } + } else { + r0 = null; + pos = r2; + } + } else { + r0 = null; + pos = r2; + } + if (r0 !== null) { + reportedPos = r1; + r0 = (function(fn, accesses, secondaryArgs) { + if(accesses) fn = createMemberExpression(fn, accesses); + var soaked, secondaryCtor; + if(secondaryArgs) { + soaked = secondaryArgs[0]; + secondaryCtor = soaked ? CS.SoakedFunctionApplication : CS.FunctionApplication; + fn = rp(new secondaryCtor(fn, secondaryArgs[1])); + } + return fn; + })(r3, r4, r5); + } + if (r0 === null) { + pos = r1; + } + } cache[cacheKey] = { nextPos: pos, @@ -4332,44 +4368,12 @@ module.exports = (function(){ r1 = pos; r2 = pos; - r3 = parse_memberExpressionNoImplicitObjectCall(); + r3 = parse_SUPER(); if (r3 !== null) { - r4 = []; - r5 = parse_argumentList(); - if (r5 === null) { - r5 = parse_MemberAccessOps(); - } - while (r5 !== null) { - r4.push(r5); - r5 = parse_argumentList(); - if (r5 === null) { - r5 = parse_MemberAccessOps(); - } - } + r4 = parse_callExpressionAccesses(); + r4 = r4 !== null ? r4 : ""; if (r4 !== null) { - r6 = pos; - if (input.charCodeAt(pos) === 63) { - r7 = "?"; - pos++; - } else { - r7 = null; - if (reportFailures === 0) { - matchFailed("\"?\""); - } - } - r7 = r7 !== null ? r7 : ""; - if (r7 !== null) { - r8 = parse_secondaryArgumentListNoImplicitObjectCall(); - if (r8 !== null) { - r5 = [r7, r8]; - } else { - r5 = null; - pos = r6; - } - } else { - r5 = null; - pos = r6; - } + r5 = parse_secondaryArgumentList(); r5 = r5 !== null ? r5 : ""; if (r5 !== null) { r0 = [r3, r4, r5]; @@ -4387,20 +4391,88 @@ module.exports = (function(){ } if (r0 !== null) { reportedPos = r1; - r0 = (function(fn, accesses, secondaryArgs) { - if(accesses) fn = createMemberExpression(fn, accesses); - var soaked, secondaryCtor; - if(secondaryArgs) { - soaked = secondaryArgs[0]; - secondaryCtor = soaked ? CS.SoakedFunctionApplication : CS.FunctionApplication; - fn = rp(new secondaryCtor(fn, secondaryArgs[1])); - } - return fn; - })(r3, r4, r5); + r0 = (function(accesses, secondaryArgs) { + if(accesses) + return rp(new CS.Super(accesses[0].operands[0])); + return rp(new CS.Super(secondaryArgs || [] )); + })(r4, r5); } if (r0 === null) { pos = r1; } + if (r0 === null) { + r1 = pos; + r2 = pos; + r3 = parse_memberExpressionNoImplicitObjectCall(); + if (r3 !== null) { + r4 = []; + r5 = parse_argumentList(); + if (r5 === null) { + r5 = parse_MemberAccessOps(); + } + while (r5 !== null) { + r4.push(r5); + r5 = parse_argumentList(); + if (r5 === null) { + r5 = parse_MemberAccessOps(); + } + } + if (r4 !== null) { + r6 = pos; + if (input.charCodeAt(pos) === 63) { + r7 = "?"; + pos++; + } else { + r7 = null; + if (reportFailures === 0) { + matchFailed("\"?\""); + } + } + r7 = r7 !== null ? r7 : ""; + if (r7 !== null) { + r8 = parse_secondaryArgumentListNoImplicitObjectCall(); + if (r8 !== null) { + r5 = [r7, r8]; + } else { + r5 = null; + pos = r6; + } + } else { + r5 = null; + pos = r6; + } + r5 = r5 !== null ? r5 : ""; + if (r5 !== null) { + r0 = [r3, r4, r5]; + } else { + r0 = null; + pos = r2; + } + } else { + r0 = null; + pos = r2; + } + } else { + r0 = null; + pos = r2; + } + if (r0 !== null) { + reportedPos = r1; + r0 = (function(fn, accesses, secondaryArgs) { + if(accesses) fn = createMemberExpression(fn, accesses); + var soaked, secondaryCtor; + if(secondaryArgs) { + soaked = secondaryArgs[0]; + secondaryCtor = soaked ? CS.SoakedFunctionApplication : CS.FunctionApplication; + fn = rp(new secondaryCtor(fn, secondaryArgs[1])); + } + return fn; + })(r3, r4, r5); + } + if (r0 === null) { + pos = r1; + } + } cache[cacheKey] = { nextPos: pos, @@ -17503,6 +17575,59 @@ module.exports = (function(){ return r0; } + function parse_SUPER() { + var cacheKey = "SUPER@" + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + var r0, r1, r2, r3, r4, r5; + + r1 = pos; + r2 = pos; + if (input.substr(pos, 5) === "super") { + r3 = "super"; + pos += 5; + } else { + r3 = null; + if (reportFailures === 0) { + matchFailed("\"super\""); + } + } + if (r3 !== null) { + r5 = pos; + reportFailures++; + r4 = parse_identifierPart(); + reportFailures--; + if (r4 === null) { + r4 = ""; + } else { + r4 = null; + pos = r5; + } + if (r4 !== null) { + r0 = [r3, r4]; + } else { + r0 = null; + pos = r2; + } + } else { + r0 = null; + pos = r2; + } + if (r0 !== null) { + r0 = input.substring(pos, r1); + } + + cache[cacheKey] = { + nextPos: pos, + result: r0 + }; + return r0; + } + function parse_SharedKeywords() { var cacheKey = "SharedKeywords@" + pos; var cachedResult = cache[cacheKey]; diff --git a/lib/preprocessor.js b/lib/preprocessor.js index 3450a9d5..d099311b 100644 --- a/lib/preprocessor.js +++ b/lib/preprocessor.js @@ -4,9 +4,9 @@ pointToErrorLocation = require('./helpers').pointToErrorLocation; StringScanner = require('StringScanner'); this.Preprocessor = Preprocessor = function () { ws = '\\t\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; - INDENT = '\uEFEF'; - DEDENT = '\uEFFE'; - TERM = '\uEFFF'; + INDENT = '\uefef'; + DEDENT = '\ueffe'; + TERM = '\uefff'; function Preprocessor(param$) { if (null == param$) param$ = {}; diff --git a/lib/repl.js b/lib/repl.js index 2d387e92..48a5d178 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -49,7 +49,7 @@ addMultilineHandler = function (repl) { rli.cursor = 0; rli.output.cursorTo(0); rli.output.clearLine(1); - buffer = buffer.replace(/\n/g, '\uFF00'); + buffer = buffer.replace(/\n/g, '\uff00'); rli.emit('line', buffer); buffer = ''; } else { @@ -145,7 +145,7 @@ module.exports = { return cb(null, vm.runInContext(js, context, filename)); } catch (e$) { err = e$; - return cb('\x1B[0;31m' + err.constructor.name + ': ' + err.message + '\x1B[0m'); + return cb('\x1b[0;31m' + err.constructor.name + ': ' + err.message + '\x1b[0m'); } }); repl = nodeREPL.start(opts); diff --git a/lib/reporter.js b/lib/reporter.js new file mode 100644 index 00000000..a573ec60 --- /dev/null +++ b/lib/reporter.js @@ -0,0 +1,86 @@ +// Generated by TypedCoffeeScript 0.8.5 +var pj, render, Reporter, TypeError; +pj = function () { + try { + return require('prettyjson'); + } catch (e$) { + return; + } +}.call(this); +render = function (obj) { + if (null != pj) + return pj.render(obj); +}; +TypeError = require('./type-helpers').TypeError; +Reporter = function () { + function Reporter() { + var instance$; + instance$ = this; + this.add_warning = function (a, b) { + return Reporter.prototype.add_warning.apply(instance$, arguments); + }; + this.clean = function () { + return Reporter.prototype.clean.apply(instance$, arguments); + }; + this.add_error = function (a, b) { + return Reporter.prototype.add_error.apply(instance$, arguments); + }; + this.errors = []; + this.warnings = []; + } + Reporter.prototype.has_errors = function () { + return this.errors.length > 0; + }; + Reporter.prototype.has_warnings = function () { + return this.warnings.length > 0; + }; + Reporter.prototype.report = function () { + var errors; + errors = this.errors.map(function (param$) { + var cache$, node, text; + { + cache$ = param$; + node = cache$[0]; + text = cache$[1]; + } + return '' + text + '\n at | ' + node.raw + ''; + }); + return '[Error]\n' + errors.join('\n') + ''; + }; + Reporter.prototype.add_error = function (node, text) { + return this.errors.push([ + node, + text + ]); + }; + Reporter.prototype.clean = function () { + return this.errors = []; + }; + Reporter.prototype.add_warning = function (node) { + var ws; + ws = arguments.length > 1 ? [].slice.call(arguments, 1) : []; + return this.warnings.push([ + node, + ws.join('') + ]); + }; + Reporter.prototype.dump = function (node, prefix) { + var key, next, val; + if (null == prefix) + prefix = ''; + console.log(prefix + ('[' + node.name + ']')); + for (key in node._vars) { + val = node._vars[key]; + console.log(prefix, ' +', key, '::', JSON.stringify(val)); + } + return function (accum$) { + for (var i$ = 0, length$ = node.nodes.length; i$ < length$; ++i$) { + next = node.nodes[i$]; + accum$.push(this.dump(next, prefix + ' ')); + } + return accum$; + }.call(this, []); + }; + return Reporter; +}(); +module.exports = new Reporter; diff --git a/lib/type-helpers.js b/lib/type-helpers.js new file mode 100644 index 00000000..f7570c1b --- /dev/null +++ b/lib/type-helpers.js @@ -0,0 +1,88 @@ +// Generated by TypedCoffeeScript 0.8.5 +var ArrayInterface, clone, NumberInterface, ObjectInterface, rewrite; +this.clone = clone = function (obj) { + var flags, key, newInstance; + if (!(null != obj) || typeof obj !== 'object') + return obj; + if (obj instanceof Date) + return new Date(obj.getTime()); + if (obj instanceof RegExp) { + flags = ''; + if (null != obj.global) + flags += 'g'; + if (null != obj.ignoreCase) + flags += 'i'; + if (null != obj.multiline) + flags += 'm'; + if (null != obj.sticky) + flags += 'y'; + return new RegExp(obj.source, flags); + } + newInstance = new obj.constructor; + for (key in obj) { + newInstance[key] = clone(obj[key]); + } + return newInstance; +}; +this.rewrite = rewrite = function (obj, replacer) { + var key, val; + if (typeof obj === 'string' || typeof obj === 'number') + return; + return function (accum$) { + for (key in obj) { + val = obj[key]; + accum$.push(typeof val === 'string' ? null != replacer[val] ? obj[key] = replacer[val] : void 0 : val instanceof Object ? rewrite(val, replacer) : void 0); + } + return accum$; + }.call(this, []); +}; +this.TypeError = function () { + function TypeError(param$) { + this.message = param$; + } + return TypeError; +}(); +NumberInterface = { + toString: { + name: 'function', + _args_: [], + _return_: 'String' + } +}; +ArrayInterface = { + length: 'Number', + push: { + name: 'function', + _args_: ['T'], + _return_: 'void' + }, + unshift: { + name: 'function', + _args_: ['T'], + _return_: 'void' + }, + shift: { + name: 'function', + _args_: [], + _return_: 'T' + }, + toString: { + name: 'function', + _args_: [], + _return_: 'String' + } +}; +ObjectInterface = function () { + return { + toString: { + name: 'function', + _args_: [], + _return_: 'String' + }, + keys: { + name: 'function', + _args_: ['Any'], + _return_: { array: 'String' } + } + }; +}; diff --git a/lib/type_checker.js b/lib/type_checker.js new file mode 100644 index 00000000..c8de10a8 --- /dev/null +++ b/lib/type_checker.js @@ -0,0 +1,658 @@ +// Generated by CoffeeScript 0.8.5 +var checkNodes, ClassScope, console, CS, FunctionScope, g, initializeGlobalTypes, pj, render, reporter, Scope, walk, walk_arrayInializer, walk_assignOp, walk_binOp, walk_block, walk_bool, walk_class, walk_classProtoAssignOp, walk_conditional, walk_float, walk_for, walk_function, walk_functionApplication, walk_identifier, walk_int, walk_memberAccess, walk_newOp, walk_numbers, walk_objectInitializer, walk_primitives, walk_program, walk_range, walk_return, walk_string, walk_struct, walk_switch, walk_this, walk_vardef; +console = { + log: function () { + } +}; +pj = function () { + try { + return require('prettyjson'); + } catch (e$) { + return; + } +}.call(this); +render = function (obj) { + if (null != pj) + return pj.render(obj); +}; +reporter = require('./reporter'); +CS = require('./nodes'); +cache$ = require('./types'); +initializeGlobalTypes = cache$.initializeGlobalTypes; +Scope = cache$.Scope; +ClassScope = cache$.ClassScope; +FunctionScope = cache$.FunctionScope; +g = 'undefined' !== typeof window && null != window ? window : global; +checkNodes = function (cs_ast) { + var i, root; + if (!(null != (null != cs_ast.body ? cs_ast.body.statements : void 0))) + return; + if (g._root_) { + root = g._root_; + } else { + g._root_ = root = new Scope; + root.name = 'root'; + for (var cache$1 = [ + 'global', + 'exports', + 'module' + ], i$ = 0, length$ = cache$1.length; i$ < length$; ++i$) { + i = cache$1[i$]; + root.addVar(i, 'Any', true); + } + initializeGlobalTypes(root); + } + walk(cs_ast, root); + return root; +}; +walk_struct = function (node, scope) { + if (node.name instanceof Object) { + return scope.addType(node.name._base_, node.expr, node.name._templates_); + } else { + return scope.addType(node.name, node.expr); + } +}; +walk_vardef = function (node, scope) { + var symbol; + symbol = node.name === 'constructor' ? '_constructor_' : node.name; + if (scope instanceof ClassScope) { + return scope.addThis(symbol, node.expr); + } else { + return scope.addVar(symbol, node.expr); + } +}; +walk_program = function (node, scope) { + walk(node.body.statements, scope); + return node.annotation = { dataType: 'Program' }; +}; +walk_block = function (node, scope) { + var last_annotation; + walk(node.statements, scope); + last_annotation = null != node.statements[node.statements.length - 1] ? node.statements[node.statements.length - 1].annotation : void 0; + return node.annotation = last_annotation; +}; +walk_return = function (node, scope) { + walk(node.expression, scope); + if (null != (null != node.expression && null != node.expression.annotation ? node.expression.annotation.dataType : void 0)) { + scope.addReturnable(node.expression.annotation.dataType); + return node.annotation = node.expression.annotation; + } +}; +walk_binOp = function (node, scope) { + var left_type, right_type; + walk(node.left, scope); + walk(node.right, scope); + left_type = null != node.left && null != node.left.annotation ? node.left.annotation.dataType : void 0; + right_type = null != node.right && null != node.right.annotation ? node.right.annotation.dataType : void 0; + if (left_type && right_type) { + if (left_type === 'String' || right_type === 'String') { + return node.annotation = { dataType: 'String' }; + } else if (left_type === 'Int' && right_type === 'Int') { + return node.annotation = { dataType: 'Int' }; + } else if ((left_type === 'Int' || left_type === 'Float') && (right_type === 'Int' || right_type === 'Float')) { + return node.annotation = { dataType: 'Float' }; + } else if ((left_type === 'Int' || left_type === 'Float' || left_type === 'Number') && (right_type === 'Int' || right_type === 'Float' || right_type === 'Number')) { + return node.annotation = { dataType: 'Number' }; + } else if (left_type === right_type) { + return node.annotation = { dataType: left_type }; + } + } else { + return node.annotation = { dataType: 'Any' }; + } +}; +walk_conditional = function (node, scope) { + var alternate_annotation, annotation, dataType, possibilities; + walk(node.condition, scope); + walk(node.consequent, scope); + if (null != node.alternate) + walk(node.alternate, scope); + alternate_annotation = null != (null != node.alternate ? node.alternate.annotation : void 0) ? null != node.alternate ? node.alternate.annotation : void 0 : { dataType: 'Undefined' }; + possibilities = []; + for (var cache$1 = [ + null != node.consequent ? node.consequent.annotation : void 0, + alternate_annotation + ], i$ = 0, length$ = cache$1.length; i$ < length$; ++i$) { + annotation = cache$1[i$]; + if (!('undefined' !== typeof annotation && null != annotation)) + continue; + if (null != (null != annotation.dataType ? annotation.dataType.possibilities : void 0)) { + for (var i$1 = 0, length$1 = annotation.dataType.possibilities.length; i$1 < length$1; ++i$1) { + dataType = annotation.dataType.possibilities[i$1]; + possibilities.push(dataType); + } + } else if (null != annotation.dataType) { + possibilities.push(annotation.dataType); + } + } + return node.annotation = { dataType: { possibilities: possibilities } }; +}; +walk_switch = function (node, scope) { + var alternate_annotation, c, cond, possibilities; + walk(node.expression, scope); + for (var i$ = 0, length$ = node.cases.length; i$ < length$; ++i$) { + c = node.cases[i$]; + for (var i$1 = 0, length$1 = c.conditions.length; i$1 < length$1; ++i$1) { + cond = c.conditions[i$1]; + walk(c, scope); + } + walk(c.consequent, scope); + } + walk(node.consequent, scope); + if (null != node.alternate) + walk(node.alternate, scope); + alternate_annotation = null != (null != node.alternate ? node.alternate.annotation : void 0) ? null != node.alternate ? node.alternate.annotation : void 0 : { dataType: 'Undefined' }; + possibilities = []; + for (var i$2 = 0, length$2 = node.cases.length; i$2 < length$2; ++i$2) { + c = node.cases[i$2]; + if (!(null != c.annotation)) + continue; + possibilities.push(c.consequent.annotation); + } + possibilities.push(alternate_annotation.dataType); + return node.annotation = { dataType: { possibilities: possibilities } }; +}; +walk_newOp = function (node, scope) { + var _args_, arg, err, Type; + for (var i$ = 0, length$ = node['arguments'].length; i$ < length$; ++i$) { + arg = node['arguments'][i$]; + walk(arg, scope); + } + Type = scope.getTypeInScope(node.ctor.data); + if (Type) { + _args_ = null != node['arguments'] ? node['arguments'].map(function (arg) { + return null != arg.annotation ? arg.annotation.dataType : void 0; + }) : void 0; + if (err = scope.checkAcceptableObject(Type.dataType._constructor_, { + _args_: null != _args_ ? _args_ : [], + _return_: 'Any' + })) + return reporter.add_error(node, err); + } + return node.annotation = { dataType: null != Type ? Type.dataType : void 0 }; +}; +walk_for = function (node, scope) { + var dataType, err, nop; + walk(node.target, scope); + if (null != node.valAssignee) + scope.addVar(node.valAssignee.data, null != (null != node.valAssignee && null != node.valAssignee.annotation ? node.valAssignee.annotation.dataType : void 0) ? null != node.valAssignee && null != node.valAssignee.annotation ? node.valAssignee.annotation.dataType : void 0 : 'Any'); + if (null != node.keyAssignee) + scope.addVar(node.keyAssignee.data, null != (null != node.keyAssignee && null != node.keyAssignee.annotation ? node.keyAssignee.annotation.dataType : void 0) ? null != node.keyAssignee && null != node.keyAssignee.annotation ? node.keyAssignee.annotation.dataType : void 0 : 'Any'); + if (null != node.valAssignee) + if (null != (null != node.target.annotation && null != node.target.annotation.dataType ? node.target.annotation.dataType.array : void 0)) { + if (err = scope.checkAcceptableObject(node.valAssignee.annotation.dataType, node.target.annotation.dataType.array)) { + return reporter.add_error(node, err); + } + } else if ((null != node.target && null != node.target.annotation ? node.target.annotation.dataType : void 0) instanceof Object) { + if (node.target.annotation.dataType instanceof Object) { + for (nop in node.target.annotation.dataType) { + dataType = node.target.annotation.dataType[nop]; + if (err = scope.checkAcceptableObject(node.valAssignee.annotation.dataType, dataType)) + return reporter.add_error(node, err); + } + } + } + walk(node.body, scope); + node.annotation = null != node.target ? node.target.annotation : void 0; + delete scope._vars[null != node.valAssignee ? node.valAssignee.data : void 0]; + return delete scope._vars[null != node.keyAssignee ? node.keyAssignee.data : void 0]; +}; +walk_classProtoAssignOp = function (node, scope) { + var left, right, symbol; + left = node.assignee; + right = node.expression; + symbol = left.data; + walk(left, scope); + if (right['instanceof'](CS.Function) && scope.getThis(symbol)) { + walk_function(right, scope, scope.getThis(symbol).dataType); + } else { + walk(right, scope); + } + symbol = left.data; + if (null != right.annotation) + return scope.addThis(symbol, right.annotation.dataType); +}; +walk_assignOp = function (node, scope) { + var err, index, l, l_type, left, member, pre_registered_annotation, r, right, symbol, T; + pre_registered_annotation = node.assignee.annotation; + left = node.assignee; + right = node.expression; + symbol = left.data; + walk(left, scope); + if (('function' === typeof right['instanceof'] ? right['instanceof'](CS.Function) : void 0) && scope.getVarInScope(symbol)) { + walk_function(right, scope, scope.getVarInScope(symbol).dataType); + } else if (('function' === typeof right['instanceof'] ? right['instanceof'](CS.Function) : void 0) && pre_registered_annotation) { + walk_function(right, scope, left.annotation.dataType); + } else { + walk(right, scope); + } + if (left['instanceof'](CS.ArrayInitialiser)) { + for (var i$ = 0, length$ = left.members.length; i$ < length$; ++i$) { + member = left.members[i$]; + index = i$; + if (!(null != member.data)) + continue; + l = null != left.annotation && null != left.annotation.dataType && null != left.annotation.dataType.array ? left.annotation.dataType.array[index] : void 0; + r = null != right.annotation && null != right.annotation.dataType && null != right.annotation.dataType.array ? right.annotation.dataType.array[index] : void 0; + if (err = scope.checkAcceptableObject(l, r)) + reporter.add_error(node, err); + if (l) { + scope.addVar(member.data, l, true); + } else { + scope.addVar(member.data, 'Any', false); + } + } + } else if (null != (null != left ? left.members : void 0)) { + for (var i$1 = 0, length$1 = left.members.length; i$1 < length$1; ++i$1) { + member = left.members[i$1]; + if (!(null != (null != member.key ? member.key.data : void 0))) + continue; + if (scope.getVarInScope(member.key.data)) { + l_type = scope.getVarInScope(member.key.data).dataType; + if (err = scope.checkAcceptableObject(l_type, null != right.annotation && null != right.annotation.dataType ? right.annotation.dataType[member.key.data] : void 0)) + reporter.add_error(node, err); + } else { + scope.addVar(member.key.data, 'Any', false); + } + } + } else if (left['instanceof'](CS.MemberAccessOp)) { + if (left.expression['instanceof'](CS.This)) { + T = scope.getThis(left.memberName); + if (null != T) + left.annotation = T; + if (null != T) + if (err = scope.checkAcceptableObject(left.annotation.dataType, right.annotation.dataType)) { + reporter.add_error(node, err); + } + } else if (null != (null != left.annotation ? left.annotation.dataType : void 0) && null != (null != right.annotation ? right.annotation.dataType : void 0)) { + if (left.annotation.dataType !== 'Any') { + if (err = scope.checkAcceptableObject(left.annotation.dataType, right.annotation.dataType)) { + return reporter.add_error(node, err); + } + } + } + } else if (left['instanceof'](CS.Identifier)) { + if (scope.getVarInScope(symbol) && pre_registered_annotation) + return reporter.add_error(node, 'double bind: ' + symbol); + if (null != left.annotation.dataType && null != right.annotation) + if (err = scope.checkAcceptableObject(left.annotation.dataType, right.annotation.dataType)) { + return reporter.add_error(node, err); + } + if (!pre_registered_annotation && (null != right.annotation ? right.annotation.explicit : void 0)) { + scope.addVar(symbol, right.annotation.dataType, true); + } else { + scope.addVar(symbol, left.annotation.dataType, true); + } + } else { + scope.addVar(symbol, 'Any', false); + } + console.log('left'); + console.log(render(left)); + console.log('right'); + return console.log(render(right)); +}; +walk_primitives = function (node, scope) { + switch (false) { + case !node['instanceof'](CS.String): + return walk_string(node, scope); + case !node['instanceof'](CS.Bool): + return walk_bool(node, scope); + case !node['instanceof'](CS.Int): + return walk_int(node, scope); + case !node['instanceof'](CS.Float): + return walk_float(node, scope); + case !node['instanceof'](CS.Numbers): + return walk_numbers(node, scope); + } +}; +walk_string = function (node, scope) { + return null != node.annotation ? node.annotation : node.annotation = { + dataType: 'String', + primitive: true + }; +}; +walk_int = function (node, scope) { + return null != node.annotation ? node.annotation : node.annotation = { + dataType: 'Int', + primitive: true + }; +}; +walk_float = function (node, scope) { + return null != node.annotation ? node.annotation : node.annotation = { + dataType: 'Float', + primitive: true + }; +}; +walk_numbers = function (node, scope) { + return null != node.annotation ? node.annotation : node.annotation = { + dataType: 'Number', + primitive: true + }; +}; +walk_bool = function (node, scope) { + return null != node.annotation ? node.annotation : node.annotation = { + dataType: 'Boolean', + primitive: true + }; +}; +walk_identifier = function (node, scope) { + var Var; + if (scope.getVarInScope(node.data)) { + Var = scope.getVarInScope(node.data); + return node.annotation = { + dataType: null != Var ? Var.dataType : void 0, + explicit: null != Var ? Var.explicit : void 0 + }; + } else { + if (null != node.annotation) + return node.annotation; + else + return node.annotation = { dataType: 'Any' }; + } +}; +walk_this = function (node, scope) { + var dataType, key, val; + dataType = {}; + for (key in scope._this) { + val = scope._this[key]; + dataType[key] = val.dataType; + } + return null != node.annotation ? node.annotation : node.annotation = { dataType: dataType }; +}; +walk_memberAccess = function (node, scope) { + var dataType; + if (node['instanceof'](CS.SoakedMemberAccessOp)) { + walk(node.expression, scope); + dataType = scope.extendTypeLiteral(null != node.expression.annotation ? node.expression.annotation.dataType : void 0); + if (null != dataType) { + return node.annotation = { + dataType: { + possibilities: [ + 'Undefined', + dataType[node.memberName] + ] + } + }; + } else { + return node.annotation = { + dataType: 'Any', + explicit: false + }; + } + } else if (node['instanceof'](CS.MemberAccessOp)) { + walk(node.expression, scope); + dataType = scope.extendTypeLiteral(null != node.expression.annotation ? node.expression.annotation.dataType : void 0); + if (null != dataType) { + return node.annotation = { + dataType: dataType[node.memberName], + explicit: true + }; + } else { + return node.annotation = { + dataType: 'Any', + explicit: false + }; + } + } +}; +walk_arrayInializer = function (node, scope) { + walk(node.members, scope); + return null != node.annotation ? node.annotation : node.annotation = { + dataType: { + array: null != node.members ? node.members.map(function (m) { + return null != m.annotation ? m.annotation.dataType : void 0; + }) : void 0 + } + }; +}; +walk_range = function (node, scope) { + return node.annotation = { dataType: { array: 'Number' } }; +}; +walk_objectInitializer = function (node, scope) { + var cache$1, expression, key, nextScope, obj; + obj = {}; + nextScope = new Scope(scope); + nextScope.name = 'object'; + for (var i$ = 0, length$ = node.members.length; i$ < length$; ++i$) { + { + cache$1 = node.members[i$]; + expression = cache$1.expression; + key = cache$1.key; + } + if (!('undefined' !== typeof key && null != key)) + continue; + walk(expression, nextScope); + obj[key.data] = null != expression.annotation ? expression.annotation.dataType : void 0; + } + return null != node.annotation ? node.annotation : node.annotation = { dataType: obj }; +}; +walk_class = function (node, scope) { + var classScope, cls, constructorScope, fname, index, key, name, param, parent, predef, statement, this_scope, val; + classScope = new ClassScope(scope); + this_scope = {}; + if (null != node.nameAssignee ? node.nameAssignee.data : void 0) { + if (null != node.parent ? node.parent.data : void 0) { + parent = scope.getTypeInScope(node.parent.data); + if (parent) + for (key in parent.dataType) { + val = parent.dataType[key]; + this_scope[key] = val; + } + } + if (null != (null != node.impl ? node.impl.length : void 0)) + for (var i$ = 0, length$ = node.impl.length; i$ < length$; ++i$) { + name = node.impl[i$]; + cls = scope.getTypeInScope(name); + if (cls) + for (key in cls.dataType) { + val = cls.dataType[key]; + this_scope[key] = val; + } + } + } + if (null != (null != node.body ? node.body.statements : void 0)) + for (var i$1 = 0, length$1 = node.body.statements.length; i$1 < length$1; ++i$1) { + statement = node.body.statements[i$1]; + if (!(statement.dataType === 'vardef')) + continue; + walk_vardef(statement, classScope); + } + if (null != node.ctor) { + constructorScope = new FunctionScope(classScope); + constructorScope._this = classScope._this; + if (null != node.ctor.expression.parameters) + if (constructorScope.getThis('_constructor_')) { + predef = constructorScope.getThis('_constructor_').dataType; + for (var i$2 = 0, length$2 = node.ctor.expression.parameters.length; i$2 < length$2; ++i$2) { + param = node.ctor.expression.parameters[i$2]; + index = i$2; + if (!('undefined' !== typeof param && null != param)) + continue; + walk(param, constructorScope); + constructorScope.addVar(param.data, null != (null != predef._args_ ? predef._args_[index] : void 0) ? null != predef._args_ ? predef._args_[index] : void 0 : 'Any'); + } + } else { + for (var i$3 = 0, length$3 = node.ctor.expression.parameters.length; i$3 < length$3; ++i$3) { + param = node.ctor.expression.parameters[i$3]; + index = i$3; + if (!(null != param)) + continue; + walk(param, constructorScope); + constructorScope.addVar(param.data, null != (null != param && null != param.annotation ? param.annotation.dataType : void 0) ? null != param && null != param.annotation ? param.annotation.dataType : void 0 : 'Any'); + } + } + if (null != (null != node.ctor.expression.body ? node.ctor.expression.body.statements : void 0)) + for (var i$4 = 0, length$4 = node.ctor.expression.body.statements.length; i$4 < length$4; ++i$4) { + statement = node.ctor.expression.body.statements[i$4]; + walk(statement, constructorScope); + } + } + if (null != (null != node.body ? node.body.statements : void 0)) + for (var i$5 = 0, length$5 = node.body.statements.length; i$5 < length$5; ++i$5) { + statement = node.body.statements[i$5]; + if (!(statement.dataType !== 'vardef')) + continue; + walk(statement, classScope); + } + if (null != node.nameAssignee ? node.nameAssignee.data : void 0) { + for (fname in classScope._this) { + val = classScope._this[fname]; + this_scope[fname] = val.dataType; + } + return scope.addType(node.nameAssignee.data, this_scope); + } +}; +walk_function = function (node, scope, predef) { + var _args_, err, functionScope, index, last_expr, member, param, t; + if (null == predef) + predef = null; + _args_ = null != node.parameters ? node.parameters.map(function (param) { + return null != (null != param.annotation ? param.annotation.dataType : void 0) ? null != param.annotation ? param.annotation.dataType : void 0 : 'Any'; + }) : void 0; + node.annotation.dataType._args_ = _args_; + functionScope = new Scope(scope); + functionScope._name_ = 'function'; + if (scope instanceof ClassScope) + functionScope._this = scope._this; + if (null != node.parameters) + if (predef) { + node.annotation.dataType = predef; + for (var i$ = 0, length$ = node.parameters.length; i$ < length$; ++i$) { + param = node.parameters[i$]; + index = i$; + if (param.members) { + for (var i$1 = 0, length$1 = param.members.length; i$1 < length$1; ++i$1) { + member = param.members[i$1]; + if ((null != member.expression && null != member.expression.expression ? member.expression.expression.raw : void 0) === '@' || (null != member.expression && null != member.expression.expression ? member.expression.expression.raw : void 0) === 'this') { + t = functionScope.getThis(member.key.data); + if (!(null != (null != t ? t.dataType : void 0))) + functionScope.addThis(member.key.data, 'Any'); + } else if (null != member.key ? member.key.data : void 0) { + functionScope.addVar(member.key.data, 'Any'); + } + } + } else if ((null != param.expression ? param.expression.raw : void 0) === '@' || (null != param.expression ? param.expression.raw : void 0) === 'this') { + t = functionScope.getThis(param.memberName); + if (err = scope.checkAcceptableObject(null != predef._args_ ? predef._args_[index] : void 0, null != t ? t.dataType : void 0)) + reporter.add_error(node, err); + if (!(null != (null != t ? t.dataType : void 0))) + functionScope.addThis(param.memberName, 'Any'); + } else { + functionScope.addVar(param.data, null != (null != predef._args_ ? predef._args_[index] : void 0) ? null != predef._args_ ? predef._args_[index] : void 0 : 'Any'); + } + } + } else { + for (var i$2 = 0, length$2 = node.parameters.length; i$2 < length$2; ++i$2) { + param = node.parameters[i$2]; + index = i$2; + if (param.members) { + for (var i$3 = 0, length$3 = param.members.length; i$3 < length$3; ++i$3) { + member = param.members[i$3]; + if ((null != member.expression && null != member.expression.expression ? member.expression.expression.raw : void 0) === '@' || (null != member.expression && null != member.expression.expression ? member.expression.expression.raw : void 0) === 'this') { + t = functionScope.getThis(member.key.data); + if (!(null != (null != t ? t.dataType : void 0))) + functionScope.addThis(member.key.data, 'Any'); + } else if (null != member.key ? member.key.data : void 0) { + functionScope.addVar(member.key.data, 'Any'); + } + } + } else if ((null != param.expression ? param.expression.raw : void 0) === '@' || (null != param.expression ? param.expression.raw : void 0) === 'this') { + t = functionScope.getThis(param.memberName); + if (!(null != (null != t ? t.dataType : void 0))) + functionScope.addThis(param.memberName, 'Any'); + } else { + functionScope.addVar(param.data, null != (null != param && null != param.annotation ? param.annotation.dataType : void 0) ? null != param && null != param.annotation ? param.annotation.dataType : void 0 : 'Any'); + } + } + } + walk(node.body, functionScope); + if ((null != node.annotation && null != node.annotation.dataType ? node.annotation.dataType._return_ : void 0) !== 'Any') { + last_expr = (null != node.body && null != node.body.statements ? node.body.statements.length : void 0) ? null != node.body.statements ? node.body.statements[(null != node.body && null != node.body.statements ? node.body.statements.length : void 0) - 1] : void 0 : node.body; + if (err = scope.checkAcceptableObject(null != node.annotation ? node.annotation.dataType._return_ : void 0, null != last_expr && null != last_expr.annotation ? last_expr.annotation.dataType : void 0)) + return reporter.add_error(node, err); + } else { + last_expr = (null != node.body && null != node.body.statements ? node.body.statements.length : void 0) ? null != node.body.statements ? node.body.statements[(null != node.body && null != node.body.statements ? node.body.statements.length : void 0) - 1] : void 0 : node.body; + if (null != node.annotation) + return node.annotation.dataType._return_ = null != last_expr && null != last_expr.annotation ? last_expr.annotation.dataType : void 0; + } +}; +walk_functionApplication = function (node, scope) { + var _args_, arg, err; + for (var i$ = 0, length$ = node['arguments'].length; i$ < length$; ++i$) { + arg = node['arguments'][i$]; + walk(arg, scope); + } + walk(node['function'], scope); + node.annotation = { dataType: null != node['function'].annotation && null != node['function'].annotation.dataType ? node['function'].annotation.dataType._return_ : void 0 }; + if (node['function'].annotation) { + _args_ = null != node['arguments'] ? node['arguments'].map(function (arg) { + return null != arg.annotation ? arg.annotation.dataType : void 0; + }) : void 0; + if (err = scope.checkAcceptableObject(node['function'].annotation.dataType, { + _args_: null != _args_ ? _args_ : [], + _return_: 'Any' + })) + return reporter.add_error(node, err); + } +}; +walk = function (node, scope) { + var s; + console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~'); + console.log('---', null != node ? node.className : void 0, '---', null != node ? node.raw : void 0); + switch (false) { + case !!(null != node): + return; + case !(null != node.length): + return function (accum$) { + for (var i$ = 0, length$ = node.length; i$ < length$; ++i$) { + s = node[i$]; + accum$.push(walk(s, scope)); + } + return accum$; + }.call(this, []); + case !(node.dataType === 'struct'): + return walk_struct(node, scope); + case !(node.dataType === 'vardef'): + return walk_vardef(node, scope); + case !node['instanceof'](CS.Program): + return walk_program(node, scope); + case !node['instanceof'](CS.Block): + return walk_block(node, scope); + case !node['instanceof'](CS.Return): + return walk_return(node, scope); + case !node['instanceof'](CS.NewOp): + return walk_newOp(node, scope); + case !(node['instanceof'](CS.PlusOp) || node['instanceof'](CS.MultiplyOp) || node['instanceof'](CS.DivideOp) || node['instanceof'](CS.SubtractOp)): + return walk_binOp(node, scope); + case !node['instanceof'](CS.Switch): + return walk_switch(node, scope); + case !node['instanceof'](CS.Conditional): + return walk_conditional(node, scope); + case !(node['instanceof'](CS.ForIn) || node['instanceof'](CS.ForOf)): + return walk_for(node, scope); + case !node['instanceof'](CS.Primitives): + return walk_primitives(node, scope); + case !node['instanceof'](CS.This): + return walk_this(node, scope); + case !node['instanceof'](CS.Identifier): + return walk_identifier(node, scope); + case !node['instanceof'](CS.ClassProtoAssignOp): + return walk_classProtoAssignOp(node, scope); + case !node['instanceof'](CS.MemberAccessOps): + return walk_memberAccess(node, scope); + case !node['instanceof'](CS.ArrayInitialiser): + return walk_arrayInializer(node, scope); + case !node['instanceof'](CS.Range): + return walk_range(node, scope); + case !node['instanceof'](CS.ObjectInitialiser): + return walk_objectInitializer(node, scope); + case !node['instanceof'](CS.Class): + return walk_class(node, scope); + case !node['instanceof'](CS.Function): + return walk_function(node, scope); + case !node['instanceof'](CS.FunctionApplication): + return walk_functionApplication(node, scope); + case !node['instanceof'](CS.AssignOp): + return walk_assignOp(node, scope); + } +}; +module.exports = { checkNodes: checkNodes }; diff --git a/lib/types.js b/lib/types.js new file mode 100644 index 00000000..4f9c60de --- /dev/null +++ b/lib/types.js @@ -0,0 +1,390 @@ +// Generated by CoffeeScript 0.8.5 +var ArrayType, checkAcceptableObject, ClassScope, clone, console, FunctionScope, initializeGlobalTypes, ObjectType, pj, Possibilites, render, reporter, rewrite, Scope, Type, TypeSymbol, VarSymbol; +console = { + log: function () { + } +}; +pj = function () { + try { + return require('prettyjson'); + } catch (e$) { + return; + } +}.call(this); +render = function (obj) { + if (null != pj) + return pj.render(obj); +}; +cache$ = require('./type-helpers'); +clone = cache$.clone; +rewrite = cache$.rewrite; +reporter = require('./reporter'); +Type = function () { + function Type() { + } + return Type; +}(); +ObjectType = function (super$) { + extends$(ObjectType, super$); + function ObjectType(param$) { + this.dataType = param$; + } + return ObjectType; +}(Type); +ArrayType = function (super$1) { + extends$(ArrayType, super$1); + function ArrayType(dataType) { + this.array = dataType; + } + return ArrayType; +}(Type); +Possibilites = function (super$2) { + extends$(Possibilites, super$2); + function Possibilites(arr) { + var i; + if (null == arr) + arr = []; + for (var i$ = 0, length$ = arr.length; i$ < length$; ++i$) { + i = arr[i$]; + this.push(i); + } + } + return Possibilites; +}(Array); +checkAcceptableObject = function (this$) { + return function (left, right, scope) { + var cur, extended_list, i, key, l_arg, lval, r, results; + if (null != (null != left ? left._base_ : void 0) && null != left._templates_) + left = left._base_; + console.log('checkAcceptableObject /', left, right); + if (null != (null != right ? right.possibilities : void 0)) { + results = function (accum$) { + for (var i$ = 0, length$ = right.possibilities.length; i$ < length$; ++i$) { + r = right.possibilities[i$]; + accum$.push(checkAcceptableObject(left, r, scope)); + } + return accum$; + }.call(this$, []); + return results.every(function (i) { + return !i; + }) ? false : results.filter(function (i) { + return i; + }).join('\n'); + } + if (left === 'Any') + return false; + if (null != left ? left._args_ : void 0) { + if (left === void 0 || left === 'Any') + return; + if (null != left._args_) + left._args_; + else + left._args_ = []; + results = function (accum$1) { + for (var i$1 = 0, length$1 = left._args_.length; i$1 < length$1; ++i$1) { + l_arg = left._args_[i$1]; + i = i$1; + accum$1.push(checkAcceptableObject(l_arg, right._args_[i], scope)); + } + return accum$1; + }.call(this$, []); + return results.every(function (i) { + return !i; + }) ? false : results.filter(function (i) { + return i; + }).join('\n'); + if (right._return_ !== 'Any') + return checkAcceptableObject(left._return_, right._return_, scope); + return false; + } + if (null != (null != left ? left.array : void 0)) { + if (right.array instanceof Array) { + results = function (accum$2) { + for (var i$2 = 0, length$2 = right.array.length; i$2 < length$2; ++i$2) { + r = right.array[i$2]; + accum$2.push(checkAcceptableObject(left.array, r, scope)); + } + return accum$2; + }.call(this$, []); + return results.every(function (i) { + return !i; + }) ? false : results.filter(function (i) { + return i; + }).join('\n'); + } else { + return checkAcceptableObject(left.array, right.array, scope); + } + } else if (null != (null != right ? right.array : void 0)) { + if (left === 'Array' || left === 'Any' || left === void 0) { + return false; + } else { + return 'object deep equal mismatch ' + JSON.stringify(left) + ', ' + JSON.stringify(right); + } + } else if (typeof left === 'string' && typeof right === 'string') { + cur = scope.getTypeInScope(left); + extended_list = [left]; + while (cur._extends_) { + extended_list.push(cur._extends_); + cur = scope.getTypeInScope(cur._extends_); + } + if (left === 'Any' || right === 'Any' || in$(right, extended_list)) { + return false; + } else { + return 'object deep equal mismatch ' + JSON.stringify(left) + ', ' + JSON.stringify(right); + } + } else if (typeof left === 'object' && typeof right === 'object') { + results = function (accum$3) { + for (key in left) { + lval = left[key]; + accum$3.push(right[key] === void 0 && ('undefined' !== typeof lval && null != lval) && !(key === '_return_' || key === 'type' || key === 'possibilities') ? "'" + key + "' is not defined on right" : checkAcceptableObject(lval, right[key], scope)); + } + return accum$3; + }.call(this$, []); + return results.every(function (i) { + return !i; + }) ? false : results.filter(function (i) { + return i; + }).join('\n'); + } else if (left === void 0 || right === void 0) { + return false; + } else { + return 'object deep equal mismatch ' + JSON.stringify(left) + ', ' + JSON.stringify(right); + } + }; +}(this); +initializeGlobalTypes = function (node) { + node.addTypeObject('String', new TypeSymbol({ dataType: 'String' })); + node.addTypeObject('Number', new TypeSymbol({ + dataType: 'Number', + _extends_: 'Float' + })); + node.addTypeObject('Int', new TypeSymbol({ dataType: 'Int' })); + node.addTypeObject('Float', new TypeSymbol({ + dataType: 'Float', + _extends_: 'Int' + })); + node.addTypeObject('Boolean', new TypeSymbol({ dataType: 'Boolean' })); + node.addTypeObject('Object', new TypeSymbol({ dataType: 'Object' })); + node.addTypeObject('Array', new TypeSymbol({ dataType: 'Array' })); + node.addTypeObject('Undefined', new TypeSymbol({ dataType: 'Undefined' })); + return node.addTypeObject('Any', new TypeSymbol({ dataType: 'Any' })); +}; +VarSymbol = function () { + function VarSymbol(param$) { + var cache$1; + { + cache$1 = param$; + this.dataType = cache$1.dataType; + this.explicit = cache$1.explicit; + } + if (null != this.explicit) + this.explicit; + else + this.explicit = false; + } + return VarSymbol; +}(); +TypeSymbol = function () { + function TypeSymbol(param$) { + var cache$1; + { + cache$1 = param$; + this.dataType = cache$1.dataType; + this['instanceof'] = cache$1['instanceof']; + this._templates_ = cache$1._templates_; + this._extends_ = cache$1._extends_; + } + } + return TypeSymbol; +}(); +Scope = function () { + function Scope(param$) { + var instance$; + instance$ = this; + this.extendTypeLiteral = function (a) { + return Scope.prototype.extendTypeLiteral.apply(instance$, arguments); + }; + if (null == param$) + param$ = null; + this.parent = param$; + if (null != this.parent) + this.parent.nodes.push(this); + this.name = ''; + this.nodes = []; + this._vars = {}; + this._types = {}; + this._this = {}; + this._returnables = []; + } + Scope.prototype.addReturnable = function (symbol, dataType) { + return this._returnables.push(dataType); + }; + Scope.prototype.getReturnables = function () { + return this._returnables; + }; + Scope.prototype.addType = function (symbol, dataType, _templates_) { + return this._types[symbol] = new TypeSymbol({ + dataType: dataType, + _templates_: _templates_ + }); + }; + Scope.prototype.addTypeObject = function (symbol, type_object) { + return this._types[symbol] = type_object; + }; + Scope.prototype.getType = function (symbol) { + return this._types[symbol]; + }; + Scope.prototype.getTypeInScope = function (symbol) { + return this.getType(symbol) || (null != this.parent ? this.parent.getTypeInScope(symbol) : void 0) || void 0; + }; + Scope.prototype.addThis = function (symbol, dataType) { + var n, obj, replacer, rewrite_to, T, t; + if (null != (null != dataType ? dataType._base_ : void 0)) { + T = this.getType(dataType._base_); + if (!T) + return; + obj = clone(T.dataType); + if (T._templates_) { + rewrite_to = dataType._templates_; + replacer = {}; + for (var i$ = 0, length$ = T._templates_.length; i$ < length$; ++i$) { + t = T._templates_[i$]; + n = i$; + replacer[t] = rewrite_to[n]; + } + rewrite(obj, replacer); + } + return this._this[symbol] = new VarSymbol({ dataType: obj }); + } else { + return this._this[symbol] = new VarSymbol({ dataType: dataType }); + } + }; + Scope.prototype.getThis = function (symbol) { + return this._this[symbol]; + }; + Scope.prototype.addVar = function (symbol, dataType, explicit) { + var n, obj, replacer, rewrite_to, T, t; + if (null != (null != dataType ? dataType._base_ : void 0)) { + T = this.getType(dataType._base_); + if (!T) + return; + obj = clone(T.dataType); + if (T._templates_) { + rewrite_to = dataType._templates_; + replacer = {}; + for (var i$ = 0, length$ = T._templates_.length; i$ < length$; ++i$) { + t = T._templates_[i$]; + n = i$; + replacer[t] = rewrite_to[n]; + } + rewrite(obj, replacer); + } + return this._vars[symbol] = new VarSymbol({ + dataType: obj, + explicit: explicit + }); + } else { + return this._vars[symbol] = new VarSymbol({ + dataType: dataType, + explicit: explicit + }); + } + }; + Scope.prototype.getVar = function (symbol) { + return this._vars[symbol]; + }; + Scope.prototype.getVarInScope = function (symbol) { + return this.getVar(symbol) || (null != this.parent ? this.parent.getVarInScope(symbol) : void 0) || void 0; + }; + Scope.prototype.isImplicitVarInScope = function (symbol) { + return this.isImplicitVar(symbol) || (null != this.parent ? this.parent.isImplicitVarInScope(symbol) : void 0) || void 0; + }; + Scope.prototype.extendTypeLiteral = function (node) { + var dataType, i, key, ret, val; + switch (typeof node) { + case 'object': + if (node instanceof Array) { + return function (accum$) { + for (var i$ = 0, length$ = node.length; i$ < length$; ++i$) { + i = node[i$]; + accum$.push(this.extendTypeLiteral(i)); + } + return accum$; + }.call(this, []); + } else { + ret = {}; + for (key in node) { + val = node[key]; + ret[key] = this.extendTypeLiteral(val); + } + return ret; + } + case 'string': + Type = this.getTypeInScope(node); + dataType = null != Type ? Type.dataType : void 0; + switch (typeof dataType) { + case 'object': + return this.extendTypeLiteral(dataType); + case 'string': + return dataType; + } + } + }; + Scope.prototype.checkAcceptableObject = function (left, right) { + var l, r; + l = this.extendTypeLiteral(left); + r = this.extendTypeLiteral(right); + return checkAcceptableObject(l, r, this); + }; + return Scope; +}(); +ClassScope = function (super$3) { + extends$(ClassScope, super$3); + function ClassScope() { + super$3.apply(this, arguments); + } + void 0; + return ClassScope; +}(Scope); +FunctionScope = function (super$4) { + extends$(FunctionScope, super$4); + function FunctionScope() { + super$4.apply(this, arguments); + } + void 0; + return FunctionScope; +}(Scope); +module.exports = { + checkAcceptableObject: checkAcceptableObject, + initializeGlobalTypes: initializeGlobalTypes, + VarSymbol: VarSymbol, + TypeSymbol: TypeSymbol, + Scope: Scope, + ClassScope: ClassScope, + FunctionScope: FunctionScope, + ArrayType: ArrayType, + ObjectType: ObjectType, + Type: Type, + Possibilites: Possibilites +}; +function isOwn$(o, p) { + return {}.hasOwnProperty.call(o, p); +} +function extends$(child, parent) { + for (var key in parent) + if (isOwn$(parent, key)) + child[key] = parent[key]; + function ctor() { + this.constructor = child; + } + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; +} +function in$(member, list) { + for (var i = 0, length = list.length; i < length; ++i) + if (i in list && list[i] === member) + return true; + return false; +} From 9a16e21655472ee5f4cd9606be9fef876e192ab8 Mon Sep 17 00:00:00 2001 From: Koutarou Chikuba Date: Fri, 23 May 2014 00:24:07 +0900 Subject: [PATCH 05/64] Activate jashkenas/coffeescript tests --- test/classes.coffee | 270 +++++++++++++++++++++----------------------- 1 file changed, 131 insertions(+), 139 deletions(-) diff --git a/test/classes.coffee b/test/classes.coffee index f3a38792..abb69368 100644 --- a/test/classes.coffee +++ b/test/classes.coffee @@ -20,36 +20,36 @@ suite 'Classes', -> delete Function.prototype.new - test.skip 'basic classes, again, but in the manual prototype style', -> # Currently syntax error. - # - # Base = -> - # Base::func = (string) -> - # 'zero/' + string - # Base::['func-func'] = (string) -> - # "dynamic-#{string}" - # - # FirstChild = -> - # SecondChild = -> - # ThirdChild = -> - # @array = [1, 2, 3] - # this - # - # ThirdChild extends SecondChild extends FirstChild extends Base - # - # FirstChild::func = (string) -> - # super('one/') + string - # - # SecondChild::func = (string) -> - # super('two/') + string - # - # ThirdChild::func = (string) -> - # super('three/') + string - # - # result = (new ThirdChild).func 'four' - # - # ok result is 'zero/one/two/three/four' - # - # ok (new ThirdChild)['func-func']('thing') is 'dynamic-thing' + test 'basic classes, again, but in the manual prototype style', -> + + Base = -> + Base::func = (string) -> + 'zero/' + string + Base::['func-func'] = (string) -> + "dynamic-#{string}" + + FirstChild = -> + SecondChild = -> + ThirdChild = -> + @array = [1, 2, 3] + this + + ThirdChild extends SecondChild extends FirstChild extends Base + + FirstChild::func = (string) -> + super('one/') + string + + SecondChild::func = (string) -> + super('two/') + string + + ThirdChild::func = (string) -> + super('three/') + string + + result = (new ThirdChild).func 'four' + + ok result is 'zero/one/two/three/four' + + ok (new ThirdChild)['func-func']('thing') is 'dynamic-thing' test 'static assignment via colon', -> nonce = {} @@ -484,106 +484,98 @@ suite 'Classes', -> suite 'Inheritance and Super', -> - test.skip 'classes with a four-level inheritance chain', -> # Currently syntax error. - # - # class Base - # func: (string) -> - # "zero/#{string}" - # - # @static: (string) -> - # "static/#{string}" - # - # class FirstChild extends Base - # func: (string) -> - # super('one/') + string - # - # SecondChild = class extends FirstChild - # func: (string) -> - # super('two/') + string - # - # thirdCtor = -> - # @array = [1, 2, 3] - # - # class ThirdChild extends SecondChild - # constructor: -> thirdCtor.call this - # - # # Gratuitous comment for testing. - # func: (string) -> - # super('three/') + string - # - # result = (new ThirdChild).func 'four' - # - # ok result is 'zero/one/two/three/four' - # ok Base.static('word') is 'static/word' - # - # FirstChild::func = (string) -> - # super('one/').length + string - # - # result = (new ThirdChild).func 'four' - # - # ok result is '9two/three/four' - # - # ok (new ThirdChild).array.join(' ') is '1 2 3' + test 'classes with a four-level inheritance chain', -> + class Base + func: (string) -> + "zero/#{string}" - test.skip 'constructors with inheritance and super', -> # Currently syntax error. - # - # identity = (f) -> f - # - # class TopClass - # constructor: (arg) -> - # @prop = 'top-' + arg - # - # class SuperClass extends TopClass - # constructor: (arg) -> - # identity super 'super-' + arg - # - # class SubClass extends SuperClass - # constructor: -> - # identity super 'sub' - # - # ok (new SubClass).prop is 'top-super-sub' + @static: (string) -> + "static/#{string}" - test.skip "super with plain ol' functions as the original constructors", -> # Currently syntax error. - # - # TopClass = (arg) -> - # @prop = 'top-' + arg - # this - # - # SuperClass = (arg) -> - # super 'super-' + arg - # this - # - # SubClass = -> - # super 'sub' - # this - # - # SuperClass extends TopClass - # SubClass extends SuperClass - # - # ok (new SubClass).prop is 'top-super-sub' + class FirstChild extends Base + func: (string) -> + super('one/') + string - test.skip 'super() calls in constructors of classes that are defined as object properties', -> # Currently syntax error. - # - # class Hive - # constructor: (name) -> @name = name - # - # class Hive.Bee extends Hive - # constructor: (name) -> super - # - # maya = new Hive.Bee 'Maya' - # ok maya.name is 'Maya' + SecondChild = class extends FirstChild + func: (string) -> + super('two/') + string - test.skip 'calling super and passing along all arguments', -> # Currently syntax error. - # - # class Parent - # method: (args...) -> @args = args - # - # class Child extends Parent - # method: -> super - # - # c = new Child - # c.method 1, 2, 3, 4 - # ok c.args.join(' ') is '1 2 3 4' + thirdCtor = -> + @array = [1, 2, 3] + + class ThirdChild extends SecondChild + constructor: -> thirdCtor.call this + + # Gratuitous comment for testing. + func: (string) -> + super('three/') + string + + result = (new ThirdChild).func 'four' + + ok result is 'zero/one/two/three/four' + ok Base.static('word') is 'static/word' + + FirstChild::func = (string) -> + super('one/').length + string + + result = (new ThirdChild).func 'four' + # eq result, '9two/three/four' # can't pass super('one/').length + string + # ok (new ThirdChild).array.join(' ') is '1 2 3' + + test 'constructors with inheritance and super', -> + identity = (f) -> f + + class TopClass + constructor: (arg) -> + @prop = 'top-' + arg + + class SuperClass extends TopClass + constructor: (arg) -> + identity super 'super-' + arg + + class SubClass extends SuperClass + constructor: -> + identity super 'sub' + + ok (new SubClass).prop is 'top-super-sub' + + test "super with plain ol' functions as the original constructors", -> + TopClass = -> + TopClass::func = (arg) -> + 'top-' + arg + + SuperClass = -> + SuperClass extends TopClass + SuperClass::func = (arg) -> + super 'super-' + arg + + SubClass = -> + SubClass extends SuperClass + SubClass::func = -> + super 'sub' + + eq (new SubClass).func(), 'top-super-sub' + + test 'super() calls in constructors of classes that are defined as object properties', -> + class Hive + constructor: (name) -> @name = name + + class Hive.Bee extends Hive + constructor: (name) -> super + + maya = new Hive.Bee 'Maya' + ok maya.name is 'Maya' + + test 'calling super and passing along all arguments', -> + class Parent + method: (args...) -> @args = args + + class Child extends Parent + method: -> super + + c = new Child + c.method 1, 2, 3, 4 + ok c.args.join(' ') is '1 2 3 4' test.skip '`class extends this`', -> # Currently syntax error. # @@ -623,19 +615,19 @@ suite 'Classes', -> class B extends id A eq nonce, (new B).nonce - test.skip 'jashkenas/coffee-script#1598: super works for static methods too', -> # Currently syntax error. - # - # class Parent - # method: -> - # 'NO' - # @method: -> - # 'yes' - # - # class Child extends Parent - # @method: -> - # 'pass? ' + super - # - # eq Child.method(), 'pass? yes' + test 'jashkenas/coffee-script#1598: super works for static methods too', -> + + class Parent + method: -> + 'NO' + @method: -> + 'yes' + + class Child extends Parent + @method: -> + 'pass? ' + super + + eq Child.method(), 'pass? yes' test 'jashkenas/coffee-script#1876: Class @A extends A', -> class A From 97d90611a9e92f38ac45a540ae88725a9092144e Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 24 May 2015 13:21:14 -0400 Subject: [PATCH 06/64] update to newest escodegen --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f17556ad..2b35bfa6 100644 --- a/package.json +++ b/package.json @@ -36,9 +36,9 @@ "nopt": "~2.1.2" }, "optionalDependencies": { + "escodegen": "^1.6.1", "esmangle": "~1.0.0", "source-map": "0.1.x", - "escodegen": "~1.2.0", "cscodegen": "git+https://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383" }, "engines": { From c4f332e2ab58ee217186a64f45389f362188e5f6 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 25 May 2015 15:36:08 -0400 Subject: [PATCH 07/64] targetES6: rest args --- lib/cli.js | 8 ++++++-- lib/compiler.js | 41 +++++++++++++++++++++++++---------------- lib/js-nodes.js | 6 ++++-- lib/optimiser.js | 2 +- src/cli.coffee | 5 +++-- src/compiler.coffee | 33 +++++++++++++++++++-------------- src/js-nodes.coffee | 4 ++-- 7 files changed, 60 insertions(+), 39 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 2f1896f2..2def4b51 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -68,7 +68,7 @@ optAliases = { v: '--version', w: '--watch' }; -option('parse', 'compile', 'optimise', 'debug', 'literate', 'raw', 'version', 'help'); +option('parse', 'compile', 'optimise', 'debug', 'literate', 'raw', 'version', 'help', 'target-es6'); parameter('cli', 'input', 'nodejs', 'output', 'watch'); if (null != escodegen) { option('bare', 'js', 'source-map', 'eval', 'repl'); @@ -87,6 +87,7 @@ else options.optimise = true; options.sourceMap = options['source-map']; options.sourceMapFile = options['source-map-file']; +options.targetES6 = options['target-es6']; if (!(options.compile || options.js || options.sourceMap || options.parse || options['eval'] || options.cscodegen)) if (!(null != escodegen)) { options.compile = true; @@ -213,7 +214,10 @@ if (options.help) { process.exit(1); } } - jsAST = CoffeeScript.compile(result, { bare: options.bare }); + jsAST = CoffeeScript.compile(result, { + bare: options.bare, + targetES6: options.targetES6 + }); if (options.compile) if (null != jsAST) { output(inspect(jsAST)); diff --git a/lib/compiler.js b/lib/compiler.js index d48a9454..3c924f25 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -652,7 +652,7 @@ exports.Compiler = function () { Compiler.compile = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).compile.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).compile.apply(cache$2, [].slice.call(arguments)); }; }(Compiler); defaultRules = [ @@ -1132,7 +1132,7 @@ exports.Compiler = function () { } }; return function (param$) { - var alternate, ancestry, block, cache$2, consequent, i, index, inScope, last, newThis, numArgs, numParams, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rewriteThis, test; + var alternate, ancestry, block, cache$2, consequent, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; var body, parameters; { cache$2 = param$; @@ -1140,6 +1140,7 @@ exports.Compiler = function () { body = cache$2.body; ancestry = cache$2.ancestry; inScope = cache$2.inScope; + options = cache$2.options; } if (!(null != ancestry[0] ? ancestry[0]['instanceof'](CS.Constructor) : void 0)) body = makeReturn(body); @@ -1156,14 +1157,18 @@ exports.Compiler = function () { parameters = parameters_.reverse(); if (parameters.length > 0) { if (parameters.slice(-1)[0].rest) { - paramName = parameters.pop().expression; - numParams = parameters.length; - test = new JS.BinaryExpression('>', memberAccess(new JS.Identifier('arguments'), 'length'), new JS.Literal(numParams)); - consequent = helpers.slice(new JS.Identifier('arguments'), new JS.Literal(numParams)); - alternate = new JS.ArrayExpression([]); - if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) - block.body.unshift(makeVarDeclaration([paramName])); - block.body.unshift(stmt(new JS.AssignmentExpression('=', paramName, new JS.ConditionalExpression(test, consequent, alternate)))); + if (options.targetES6) { + rest = new JS.Identifier(parameters.pop().expression.name); + } else { + paramName = parameters.pop().expression; + numParams = parameters.length; + test = new JS.BinaryExpression('>', memberAccess(new JS.Identifier('arguments'), 'length'), new JS.Literal(numParams)); + consequent = helpers.slice(new JS.Identifier('arguments'), new JS.Literal(numParams)); + alternate = new JS.ArrayExpression([]); + if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) + block.body.unshift(makeVarDeclaration([paramName])); + block.body.unshift(stmt(new JS.AssignmentExpression('=', paramName, new JS.ConditionalExpression(test, consequent, alternate)))); + } } else if (any(parameters, function (p) { return p.rest; })) { @@ -1210,7 +1215,7 @@ exports.Compiler = function () { }); rewriteThis(block); } - fn = new JS.FunctionExpression(null, parameters, block); + fn = new JS.FunctionExpression(null, parameters, block, rest); if (performedRewrite) { return new JS.CallExpression(new JS.FunctionExpression(null, [newThis], new JS.BlockStatement([new JS.ReturnStatement(fn)])), [new JS.ThisExpression]); } else { @@ -1222,8 +1227,12 @@ exports.Compiler = function () { [ CS.Rest, function (param$) { - var expression; - expression = param$.expression; + var cache$2, expression, options; + { + cache$2 = param$; + expression = cache$2.expression; + options = cache$2.options; + } return { rest: true, expression: expression, @@ -2290,18 +2299,18 @@ exports.Compiler = function () { children[childName] = in$(childName, this.listMembers) ? function (accum$) { for (var i$1 = 0, length$1 = this[childName].length; i$1 < length$1; ++i$1) { member = this[childName][i$1]; - jsNode = walk.call(member, fn, inScope, ancestry); + jsNode = walk.call(member, fn, inScope, ancestry, options); inScope = union(inScope, envEnrichments(member, inScope)); accum$.push(jsNode); } return accum$; - }.call(this, []) : (child = this[childName], jsNode = walk.call(child, fn, inScope, ancestry), inScope = union(inScope, envEnrichments(child, inScope)), jsNode); + }.call(this, []) : (child = this[childName], jsNode = walk.call(child, fn, inScope, ancestry, options), inScope = union(inScope, envEnrichments(child, inScope)), jsNode); } children.inScope = inScope; children.ancestry = ancestry; children.options = options; children.compile = function (node) { - return walk.call(node, fn, inScope, ancestry); + return walk.call(node, fn, inScope, ancestry, options); }; ancestry.shift(); jsNode = fn.call(this, children); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index bdcf9940..2a82b63b 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -182,7 +182,8 @@ nodeData = [ [ 'id', 'params', - 'body' + 'body', + 'rest' ] ], [ @@ -191,7 +192,8 @@ nodeData = [ [ 'id', 'params', - 'body' + 'body', + 'rest' ] ], [ diff --git a/lib/optimiser.js b/lib/optimiser.js index 874585fa..c25cd58e 100644 --- a/lib/optimiser.js +++ b/lib/optimiser.js @@ -387,7 +387,7 @@ exports.Optimiser = function () { Optimiser.optimise = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).optimise.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).optimise.apply(cache$2, [].slice.call(arguments)); }; }(Optimiser); Optimiser.isTruthy = isTruthy; diff --git a/src/cli.coffee b/src/cli.coffee index a5c63a4e..1d0c1485 100644 --- a/src/cli.coffee +++ b/src/cli.coffee @@ -33,7 +33,7 @@ optAliases = v: '--version' w: '--watch' -option 'parse', 'compile', 'optimise', 'debug', 'literate', 'raw', 'version', 'help' +option 'parse', 'compile', 'optimise', 'debug', 'literate', 'raw', 'version', 'help', 'target-es6' parameter 'cli', 'input', 'nodejs', 'output', 'watch' if escodegen? @@ -55,6 +55,7 @@ options.optimise ?= yes options.sourceMap = options['source-map'] options.sourceMapFile = options['source-map-file'] +options.targetES6 = options['target-es6'] # input validation @@ -245,7 +246,7 @@ else process.exit 1 # compile - jsAST = CoffeeScript.compile result, bare: options.bare + jsAST = CoffeeScript.compile result, bare: options.bare, targetES6: options.targetES6 # --compile if options.compile diff --git a/src/compiler.coffee b/src/compiler.coffee index b853c042..348ff316 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -620,7 +620,7 @@ class exports.Compiler p else throw new Error "Unsupported parameter type: #{original.className}" - ({parameters, body, ancestry, inScope}) -> + ({parameters, body, ancestry, inScope, options}) -> unless ancestry[0]?.instanceof CS.Constructor body = makeReturn body block = forceBlock body @@ -638,14 +638,17 @@ class exports.Compiler if parameters.length > 0 if parameters[-1..][0].rest - paramName = parameters.pop().expression - numParams = parameters.length - test = new JS.BinaryExpression '>', (memberAccess (new JS.Identifier 'arguments'), 'length'), new JS.Literal numParams - consequent = helpers.slice (new JS.Identifier 'arguments'), new JS.Literal numParams - alternate = new JS.ArrayExpression [] - if (paramName.instanceof JS.Identifier) and paramName.name in inScope - block.body.unshift makeVarDeclaration [paramName] - block.body.unshift stmt new JS.AssignmentExpression '=', paramName, new JS.ConditionalExpression test, consequent, alternate + if options.targetES6 + rest = new JS.Identifier(parameters.pop().expression.name) + else + paramName = parameters.pop().expression + numParams = parameters.length + test = new JS.BinaryExpression '>', (memberAccess (new JS.Identifier 'arguments'), 'length'), new JS.Literal numParams + consequent = helpers.slice (new JS.Identifier 'arguments'), new JS.Literal numParams + alternate = new JS.ArrayExpression [] + if (paramName.instanceof JS.Identifier) and paramName.name in inScope + block.body.unshift makeVarDeclaration [paramName] + block.body.unshift stmt new JS.AssignmentExpression '=', paramName, new JS.ConditionalExpression test, consequent, alternate else if any parameters, (p) -> p.rest paramName = index = null for p, i in parameters when p.rest @@ -677,14 +680,16 @@ class exports.Compiler else rewriteThis this rewriteThis block - fn = new JS.FunctionExpression null, parameters, block + fn = new JS.FunctionExpression null, parameters, block, rest if performedRewrite new JS.CallExpression (new JS.FunctionExpression null, [newThis], new JS.BlockStatement [ new JS.ReturnStatement fn ]), [new JS.ThisExpression] else fn ] - [CS.Rest, ({expression}) -> {rest: yes, expression, isExpression: yes, isStatement: yes}] + [CS.Rest, ({expression, options}) -> + {rest: yes, expression, isExpression: yes, isStatement: yes} + ] # TODO: comment [CS.Class, ({nameAssignee, parent, name, ctor, body, compile}) -> @@ -1038,12 +1043,12 @@ class exports.Compiler children[childName] = if childName in @listMembers for member in this[childName] - jsNode = walk.call member, fn, inScope, ancestry + jsNode = walk.call member, fn, inScope, ancestry, options inScope = union inScope, envEnrichments member, inScope jsNode else child = this[childName] - jsNode = walk.call child, fn, inScope, ancestry + jsNode = walk.call child, fn, inScope, ancestry, options inScope = union inScope, envEnrichments child, inScope jsNode @@ -1051,7 +1056,7 @@ class exports.Compiler children.ancestry = ancestry children.options = options children.compile = (node) -> - walk.call node, fn, inScope, ancestry + walk.call node, fn, inScope, ancestry, options do ancestry.shift jsNode = fn.call this, children diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index e9df8fd5..c5cea351 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -50,8 +50,8 @@ nodeData = [ ['ExpressionStatement' , yes, ['expression']] ['ForInStatement' , yes, ['left', 'right', 'body']] ['ForStatement' , yes, ['init', 'test', 'update', 'body']] - ['FunctionDeclaration' , yes, ['id', 'params', 'body']] - ['FunctionExpression' , no , ['id', 'params', 'body']] + ['FunctionDeclaration' , yes, ['id', 'params', 'body', 'rest']] + ['FunctionExpression' , no , ['id', 'params', 'body', 'rest']] ['GenSym' , no , ['ns', 'uniqueId']] ['Identifier' , no , ['name']] ['IfStatement' , yes, ['test', 'consequent', 'alternate']] From 6b6b730f3543c8369877d36bc413b1fc26a16e3e Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 25 May 2015 15:53:26 -0400 Subject: [PATCH 08/64] targetES6: arrow function expression --- lib/compiler.js | 31 +++++++++++++++++-------------- lib/js-nodes.js | 17 ++++++++++++++++- src/compiler.coffee | 19 +++++++++++-------- src/js-nodes.coffee | 4 +++- 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 3c924f25..bc0a99d9 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1201,20 +1201,23 @@ exports.Compiler = function () { throw new Error('Parameter lists may not have more than one rest operator'); } performedRewrite = false; - if (this['instanceof'](CS.BoundFunction)) { - newThis = genSym('this'); - rewriteThis = generateMutatingWalker(function () { - if (this['instanceof'](JS.ThisExpression)) { - performedRewrite = true; - return newThis; - } else if (this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration)) { - return this; - } else { - return rewriteThis(this); - } - }); - rewriteThis(block); - } + if (this['instanceof'](CS.BoundFunction)) + if (options.targetES6) { + return new JS.ArrowFunctionExpression(parameters, [], rest, body); + } else { + newThis = genSym('this'); + rewriteThis = generateMutatingWalker(function () { + if (this['instanceof'](JS.ThisExpression)) { + performedRewrite = true; + return newThis; + } else if (this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration)) { + return this; + } else { + return rewriteThis(this); + } + }); + rewriteThis(block); + } fn = new JS.FunctionExpression(null, parameters, block, rest); if (performedRewrite) { return new JS.CallExpression(new JS.FunctionExpression(null, [newThis], new JS.BlockStatement([new JS.ReturnStatement(fn)])), [new JS.ThisExpression]); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 2a82b63b..b4c78407 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; +var ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { @@ -76,6 +76,16 @@ nodeData = [ false, ['elements'] ], + [ + 'ArrowFunctionExpression', + false, + [ + 'params', + 'defaults', + 'rest', + 'body' + ] + ], [ 'AssignmentExpression', false, @@ -405,6 +415,7 @@ VariableDeclaration = cache$1.VariableDeclaration; SwitchStatement = cache$1.SwitchStatement; SwitchCase = cache$1.SwitchCase; TryStatement = cache$1.TryStatement; +ArrowFunctionExpression = cache$1.ArrowFunctionExpression; handlePrimitives = function (ctor, primitives) { ctor.prototype.childNodes = difference(ctor.prototype.childNodes, primitives); return ctor.prototype.toBasicObject = function () { @@ -437,6 +448,10 @@ handleLists = function (ctor, listProps) { return ctor.prototype.listMembers = listProps; }; handleLists(ArrayExpression, ['elements']); +handleLists(ArrowFunctionExpression, [ + 'params', + 'defaults' +]); handleLists(BlockStatement, ['body']); handleLists(CallExpression, ['arguments']); handleLists(FunctionDeclaration, ['params']); diff --git a/src/compiler.coffee b/src/compiler.coffee index 348ff316..39f55790 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -671,14 +671,17 @@ class exports.Compiler performedRewrite = no if @instanceof CS.BoundFunction - newThis = genSym 'this' - rewriteThis = generateMutatingWalker -> - if @instanceof JS.ThisExpression - performedRewrite = yes - newThis - else if @instanceof JS.FunctionExpression, JS.FunctionDeclaration then this - else rewriteThis this - rewriteThis block + if options.targetES6 + return new JS.ArrowFunctionExpression parameters, [], rest, body + else + newThis = genSym 'this' + rewriteThis = generateMutatingWalker -> + if @instanceof JS.ThisExpression + performedRewrite = yes + newThis + else if @instanceof JS.FunctionExpression, JS.FunctionDeclaration then this + else rewriteThis this + rewriteThis block fn = new JS.FunctionExpression null, parameters, block, rest if performedRewrite diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index c5cea351..0cc2b8ab 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -36,6 +36,7 @@ createNode = (type, props) -> nodeData = [ # constructor name, isStatement, construction parameters ['ArrayExpression' , no , ['elements']] + ['ArrowFunctionExpression',no, ['params', 'defaults', 'rest', 'body']] ['AssignmentExpression' , no , ['operator', 'left', 'right']] ['BinaryExpression' , no , ['operator', 'left', 'right']] ['BlockStatement' , yes, ['body']] @@ -90,7 +91,7 @@ for [node, isStatement, params] in nodeData UnaryExpression, NewExpression, VariableDeclaration, ObjectExpression, MemberExpression, UpdateExpression, AssignmentExpression, LogicalExpression, GenSym, FunctionDeclaration, VariableDeclaration, SwitchStatement, SwitchCase, - TryStatement + TryStatement, ArrowFunctionExpression } = exports ## Nodes that contain primitive properties @@ -119,6 +120,7 @@ handlePrimitives VariableDeclaration, ['kind'] handleLists = (ctor, listProps) -> ctor::listMembers = listProps handleLists ArrayExpression, ['elements'] +handleLists ArrowFunctionExpression, ['params', 'defaults'] handleLists BlockStatement, ['body'] handleLists CallExpression, ['arguments'] handleLists FunctionDeclaration, ['params'] From 1583ff2bfba027b981583698c2818ea3e56069ad Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 25 May 2015 16:51:07 -0400 Subject: [PATCH 09/64] render arrow function expression bodies as expressions --- lib/compiler.js | 8 +++++++- lib/js-nodes.js | 16 +++++++++++----- src/compiler.coffee | 7 ++++++- src/js-nodes.coffee | 6 ++++-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index bc0a99d9..2e03668f 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1203,7 +1203,13 @@ exports.Compiler = function () { performedRewrite = false; if (this['instanceof'](CS.BoundFunction)) if (options.targetES6) { - return new JS.ArrowFunctionExpression(parameters, [], rest, body); + if (block.body.length === 1 && block.body[0] instanceof JS.ReturnStatement) { + fn = new JS.ArrowFunctionExpression(parameters, [], rest, block.body[0].argument); + fn.expression = true; + return fn; + } else { + return new JS.ArrowFunctionExpression(parameters, [], rest, block); + } } else { newThis = genSym('this'); rewriteThis = generateMutatingWalker(function () { diff --git a/lib/js-nodes.js b/lib/js-nodes.js index b4c78407..0f6b3525 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -34,10 +34,8 @@ this.Nodes = Nodes = function () { return false; }; Nodes.prototype.toBasicObject = function () { - var child, obj, p; + var child, obj, p, property; obj = { type: this.type }; - if (null != this.leadingComments) - obj.leadingComments = this.leadingComments; for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) { child = this.childNodes[i$]; if (in$(child, this.listMembers)) { @@ -64,8 +62,16 @@ this.Nodes = Nodes = function () { this.offset, null != this.raw ? this.offset + this.raw.length : void 0 ]; - if (null != this.raw) - obj.raw = this.raw; + for (var cache$ = [ + 'leadingComments', + 'raw', + 'expression', + 'generator' + ], i$2 = 0, length$2 = cache$.length; i$2 < length$2; ++i$2) { + property = cache$[i$2]; + if (null != this[property]) + obj[property] = this[property]; + } return obj; }; return Nodes; diff --git a/src/compiler.coffee b/src/compiler.coffee index 39f55790..4905da2d 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -672,7 +672,12 @@ class exports.Compiler performedRewrite = no if @instanceof CS.BoundFunction if options.targetES6 - return new JS.ArrowFunctionExpression parameters, [], rest, body + if block.body.length == 1 && block.body[0] instanceof JS.ReturnStatement + fn = new JS.ArrowFunctionExpression parameters, [], rest, block.body[0].argument + fn.expression = true + return fn + else + return new JS.ArrowFunctionExpression parameters, [], rest, block else newThis = genSym 'this' rewriteThis = generateMutatingWalker -> diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 0cc2b8ab..0c45c19a 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -17,7 +17,6 @@ createNode = (type, props) -> no toBasicObject: -> obj = {@type} - obj.leadingComments = @leadingComments if @leadingComments? for child in @childNodes if child in @listMembers obj[child] = (p?.toBasicObject() for p in this[child]) @@ -30,7 +29,10 @@ createNode = (type, props) -> @offset if @raw? then @offset + @raw.length else undefined ] - if @raw? then obj.raw = @raw + + for property in ['leadingComments', 'raw', 'expression', 'generator'] + if this[property]? + obj[property] = this[property] obj nodeData = [ From ceccb928e37a89879bbf88b076c65eeccfb3465b Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 25 May 2015 18:33:52 -0400 Subject: [PATCH 10/64] fix accidental reuse of 'expression' property which is sometimes a member node and other times (ArrowFunctionExpression) just a flag. --- lib/js-nodes.js | 2 +- src/js-nodes.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 0f6b3525..a0836228 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -69,7 +69,7 @@ this.Nodes = Nodes = function () { 'generator' ], i$2 = 0, length$2 = cache$.length; i$2 < length$2; ++i$2) { property = cache$[i$2]; - if (null != this[property]) + if (null != this[property] && !in$(property, this.childNodes)) obj[property] = this[property]; } return obj; diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 0c45c19a..d064563b 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -31,7 +31,7 @@ createNode = (type, props) -> ] for property in ['leadingComments', 'raw', 'expression', 'generator'] - if this[property]? + if this[property]? && property not in @childNodes obj[property] = this[property] obj From 8ad3511b9c0a6cd23af088ffedb5ca2f75c81178 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 25 May 2015 18:40:56 -0400 Subject: [PATCH 11/64] Respect syntax error offset location --- lib/helpers.js | 24 +++++++++++++++++++----- src/helpers.coffee | 20 ++++++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 4471b06c..6a7b05ca 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -49,16 +49,30 @@ this.humanReadable = humanReadable = function (str) { return str.replace(/\uEFEF/g, '(INDENT)').replace(/\uEFFE/g, '(DEDENT)').replace(/\uEFFF/g, '(TERM)'); }; this.formatParserError = function (input, e) { - var found, message, realColumn, unicode; - realColumn = cleanMarkers(('' + input.split('\n')[e.line - 1] + '\n').slice(0, e.column)).length; + var column, found, line, lines, message, offset, realColumn, unicode; + lines = input.split('\n'); + line = e.line - 1; + column = e.column; + offset = e.offset; + while (offset > 0) { + if (offset > lines[line].length + 1) { + offset -= lines[line].length + 1; + line += 1; + } else { + column += offset; + offset = 0; + } + } + realColumn = cleanMarkers(('' + lines[line] + '\n').slice(0, column)).length; + line += 1; if (!(null != e.found)) - return 'Syntax error on line ' + e.line + ', column ' + realColumn + ': unexpected end of input'; + return 'Syntax error on line ' + line + ', column ' + realColumn + ': unexpected end of input'; found = JSON.stringify(humanReadable(e.found)); found = found.replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"'); unicode = e.found.charCodeAt(0).toString(16).toUpperCase(); unicode = '\\u' + '0000'.slice(unicode.length) + unicode; - message = 'Syntax error on line ' + e.line + ', column ' + realColumn + ": unexpected '" + found + "' (" + unicode + ')'; - return '' + message + '\n' + pointToErrorLocation(input, e.line, realColumn); + message = 'Syntax error on line ' + line + ', column ' + realColumn + ": unexpected '" + found + "' (" + unicode + ')'; + return '' + message + '\n' + pointToErrorLocation(input, line, realColumn); }; this.pointToErrorLocation = pointToErrorLocation = function (source, line, column, numLinesOfContext) { var currentLineOffset, lines, numberedLines, padSize, postLines, preLines, startLine; diff --git a/src/helpers.coffee b/src/helpers.coffee index 5498e9d4..a1ebf980 100644 --- a/src/helpers.coffee +++ b/src/helpers.coffee @@ -32,15 +32,27 @@ cleanMarkers = (str) -> str.replace /[\uEFEF\uEFFE\uEFFF]/g, '' ((str.replace /\uEFEF/g, '(INDENT)').replace /\uEFFE/g, '(DEDENT)').replace /\uEFFF/g, '(TERM)' @formatParserError = (input, e) -> - realColumn = (cleanMarkers "#{(input.split '\n')[e.line - 1]}\n"[...e.column]).length + lines = input.split('\n') + line = e.line - 1 # switch to zero-indexed + column = e.column + offset = e.offset + while offset > 0 + if offset > lines[line].length + 1 # these "+1"s are for the trailing "\n" + offset -= lines[line].length + 1 + line += 1 + else + column += offset + offset = 0 + realColumn = (cleanMarkers "#{lines[line]}\n"[...column]).length + line += 1 # switch back to one-indexed unless e.found? - return "Syntax error on line #{e.line}, column #{realColumn}: unexpected end of input" + return "Syntax error on line #{line}, column #{realColumn}: unexpected end of input" found = JSON.stringify humanReadable e.found found = ((found.replace /^"|"$/g, '').replace /'/g, '\\\'').replace /\\"/g, '"' unicode = ((e.found.charCodeAt 0).toString 16).toUpperCase() unicode = "\\u#{"0000"[unicode.length..]}#{unicode}" - message = "Syntax error on line #{e.line}, column #{realColumn}: unexpected '#{found}' (#{unicode})" - "#{message}\n#{pointToErrorLocation input, e.line, realColumn}" + message = "Syntax error on line #{line}, column #{realColumn}: unexpected '#{found}' (#{unicode})" + "#{message}\n#{pointToErrorLocation input, line, realColumn}" @pointToErrorLocation = pointToErrorLocation = (source, line, column, numLinesOfContext = 3) -> lines = source.split '\n' From 044b5626631ea9be55abf193a8c4dd381139466b Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Tue, 26 May 2015 22:30:53 -0400 Subject: [PATCH 12/64] avoid a crash when no raw --- lib/compiler.js | 4 ++-- lib/optimiser.js | 2 +- src/compiler.coffee | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index d48a9454..34a5a239 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -652,7 +652,7 @@ exports.Compiler = function () { Compiler.compile = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).compile.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).compile.apply(cache$2, [].slice.call(arguments)); }; }(Compiler); defaultRules = [ @@ -1605,7 +1605,7 @@ exports.Compiler = function () { return expr(compile(generateSoak(this))); } else { access = memberAccess(expression, this.memberName); - if (this.raw) { + if (this.raw && this.expression.raw) { access.property.raw = this.memberName; access.property.line = this.line; offset = this.raw.length - this.memberName.length; diff --git a/lib/optimiser.js b/lib/optimiser.js index 874585fa..c25cd58e 100644 --- a/lib/optimiser.js +++ b/lib/optimiser.js @@ -387,7 +387,7 @@ exports.Optimiser = function () { Optimiser.optimise = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).optimise.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).optimise.apply(cache$2, [].slice.call(arguments)); }; }(Optimiser); Optimiser.isTruthy = isTruthy; diff --git a/src/compiler.coffee b/src/compiler.coffee index b853c042..0181077d 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -862,7 +862,7 @@ class exports.Compiler else access = memberAccess expression, @memberName # manually calculate raw/position info for member name - if @raw + if @raw and @expression.raw access.property.raw = @memberName access.property.line = @line offset = @raw.length - @memberName.length From 155818392418b1cef57879537b7ef19c106d5336 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 03:44:53 -0400 Subject: [PATCH 13/64] class support --- lib/compiler.js | 85 +++++++++++++++++++++++++++++++++++++++------ lib/js-nodes.js | 26 +++++++++++++- src/compiler.coffee | 52 +++++++++++++++++++++++---- src/js-nodes.coffee | 6 +++- 4 files changed, 151 insertions(+), 18 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 2197417e..ac22c169 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; +var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -649,6 +649,38 @@ for (h in inlineHelpers) { fn = inlineHelpers[h]; helpers[h] = fn; } +findES6Methods = function (classIdentifier, body) { + var expression, inner, methods, properties, rest; + methods = []; + properties = []; + rest = []; + for (var i$ = 0, length$ = body.expressions.length; i$ < length$; ++i$) { + expression = body.expressions[i$]; + if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { + if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype') { + if (expression.right instanceof JS.FunctionExpression) { + methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)); + } else { + properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right)); + } + } else if (expression.left.object instanceof JS.ThisExpression) { + properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); + } + } else if (expression instanceof JS.SequenceExpression) { + inner = findES6Methods(classIdentifier, expression); + methods = methods.concat(inner.methods); + properties = properties.concat(inner.properties); + rest = rest.concat(inner.rest); + } else { + rest.push(expression); + } + } + return { + methods: methods, + properties: properties, + rest: rest + }; +}; exports.Compiler = function () { Compiler.compile = function (this$) { return function () { @@ -1254,7 +1286,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, args, block, body, c, cache$2, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, nameAssignee, params, parent, parentRef, protoAssignOp, protoMember, ps, rewriteThis; + var _, args, block, body, c, cache$2, cache$3, classIdentifier, classProperties, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rest, rewriteThis; var ctor, name; { cache$2 = param$; @@ -1264,6 +1296,32 @@ exports.Compiler = function () { ctor = cache$2.ctor; body = cache$2.body; compile = cache$2.compile; + options = cache$2.options; + } + if (options.targetES6) { + classIdentifier = new JS.Identifier(name.name); + debugger; + if (parent) + parentIdentifier = new JS.Identifier(parent.name); + cache$3 = findES6Methods(classIdentifier, body); + methods = cache$3.methods; + properties = cache$3.properties; + classProperties = cache$3.classProperties; + rest = cache$3.rest; + if (ctor) { + for (var i$ = 0, length$ = rest.length; i$ < length$; ++i$) { + c = rest[i$]; + i = i$; + if (!c['instanceof'](JS.FunctionDeclaration)) + continue; + ctorIndex = i; + break; + } + rest.splice(ctorIndex, 1); + methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), new JS.FunctionExpression(ctor.id, ctor.params, ctor.body, ctor.rest))); + } + if (rest.length === 0) + return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); } args = []; params = []; @@ -1272,9 +1330,9 @@ exports.Compiler = function () { if (name['instanceof'](JS.Identifier) && in$(name.name, jsReserved)) name = genSym(name.name); if (null != ctor) { - for (var i$ = 0, length$ = block.body.length; i$ < length$; ++i$) { - c = block.body[i$]; - i = i$; + for (var i$1 = 0, length$1 = block.body.length; i$1 < length$1; ++i$1) { + c = block.body[i$1]; + i = i$1; if (!c['instanceof'](JS.FunctionDeclaration)) continue; ctorIndex = i; @@ -1303,12 +1361,12 @@ exports.Compiler = function () { } if (this.boundMembers.length > 0) { instance = genSym('instance'); - for (var i$1 = 0, length$1 = this.boundMembers.length; i$1 < length$1; ++i$1) { - protoAssignOp = this.boundMembers[i$1]; + for (var i$2 = 0, length$2 = this.boundMembers.length; i$2 < length$2; ++i$2) { + protoAssignOp = this.boundMembers[i$2]; memberName = protoAssignOp.assignee.data.toString(); ps = function (accum$) { - for (var i$2 = 0, length$2 = protoAssignOp.expression.parameters.length; i$2 < length$2; ++i$2) { - _ = protoAssignOp.expression.parameters[i$2]; + for (var i$3 = 0, length$3 = protoAssignOp.expression.parameters.length; i$3 < length$3; ++i$3) { + _ = protoAssignOp.expression.parameters[i$3]; accum$.push(genSym()); } return accum$; @@ -1480,13 +1538,14 @@ exports.Compiler = function () { [ CS.Super, function (param$) { - var ancestry, args, cache$2, calledExprs, classAssignNode, className, classNode, classPositionInAncestry, compile, functionName, inScope, isProtoMemberAccess, isStatic; + var ancestry, args, cache$2, calledExprs, classAssignNode, className, classNode, classPositionInAncestry, compile, functionName, inScope, isProtoMemberAccess, isStatic, options; { cache$2 = param$; args = cache$2['arguments']; compile = cache$2.compile; inScope = cache$2.inScope; ancestry = cache$2.ancestry; + options = cache$2.options; } classNode = find(ancestry, function (node) { return node instanceof CS.Class || node.assignee instanceof CS.ProtoMemberAccessOp; @@ -1529,6 +1588,12 @@ exports.Compiler = function () { className = classNode.assignee.expression.data; functionName = classNode.assignee.memberName; } + if (options.targetES6) + if (functionName === 'constructor') { + return new JS.CallExpression(new JS.Identifier('super'), map(args, expr)); + } else { + return new JS.CallExpression(memberAccess(new JS.Identifier('super'), functionName), map(args, expr)); + } if (className === 'class') if (args.length > 0) { calledExprs = [new JS.ThisExpression].concat(map(args, expr)); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index a0836228..0893086a 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; +var ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { @@ -136,6 +136,20 @@ nodeData = [ 'body' ] ], + [ + 'ClassBody', + true, + ['body'] + ], + [ + 'ClassDeclaration', + true, + [ + 'id', + 'superClass', + 'body' + ] + ], [ 'ConditionalExpression', false, @@ -265,6 +279,14 @@ nodeData = [ 'property' ] ], + [ + 'MethodDefinition', + false, + [ + 'key', + 'value' + ] + ], [ 'NewExpression', false, @@ -422,6 +444,7 @@ SwitchStatement = cache$1.SwitchStatement; SwitchCase = cache$1.SwitchCase; TryStatement = cache$1.TryStatement; ArrowFunctionExpression = cache$1.ArrowFunctionExpression; +ClassBody = cache$1.ClassBody; handlePrimitives = function (ctor, primitives) { ctor.prototype.childNodes = difference(ctor.prototype.childNodes, primitives); return ctor.prototype.toBasicObject = function () { @@ -460,6 +483,7 @@ handleLists(ArrowFunctionExpression, [ ]); handleLists(BlockStatement, ['body']); handleLists(CallExpression, ['arguments']); +handleLists(ClassBody, ['body']); handleLists(FunctionDeclaration, ['params']); handleLists(FunctionExpression, ['params']); handleLists(NewExpression, ['arguments']); diff --git a/src/compiler.coffee b/src/compiler.coffee index 0c874d4a..b2df2942 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -384,6 +384,27 @@ inlineHelpers = for own h, fn of inlineHelpers helpers[h] = fn +findES6Methods = (classIdentifier, body) -> + methods = [] + properties = [] + rest = [] + for expression in body.expressions + if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) + if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') + if expression.right instanceof JS.FunctionExpression + methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)) + else + properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right) + else if expression.left.object instanceof JS.ThisExpression + properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) + else if expression instanceof JS.SequenceExpression + inner = findES6Methods(classIdentifier, expression) + methods = methods.concat(inner.methods) + properties = properties.concat(inner.properties) + rest = rest.concat(inner.rest) + else + rest.push(expression) + { methods, properties, rest } class exports.Compiler @@ -695,12 +716,26 @@ class exports.Compiler ]), [new JS.ThisExpression] else fn ] - [CS.Rest, ({expression, options}) -> - {rest: yes, expression, isExpression: yes, isStatement: yes} - ] + [CS.Rest, ({expression, options}) -> {rest: yes, expression, isExpression: yes, isStatement: yes}] # TODO: comment - [CS.Class, ({nameAssignee, parent, name, ctor, body, compile}) -> + [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options}) -> + if options.targetES6 + classIdentifier = new JS.Identifier(name.name) + debugger + if parent + parentIdentifier = new JS.Identifier(parent.name) + { methods, properties, classProperties, rest } = findES6Methods(classIdentifier, body) + if ctor + for c, i in rest when c.instanceof JS.FunctionDeclaration + ctorIndex = i + break + rest.splice(ctorIndex, 1) + methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), new JS.FunctionExpression(ctor.id, ctor.params, ctor.body, ctor.rest)) + # Emit our ES6 class if we were able to account for everything in its definition. Otherwise, fall through to the non-ES6 emulation + if rest.length == 0 + return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)) + args = [] params = [] parentRef = genSym 'super' @@ -823,8 +858,7 @@ class exports.Compiler new JS.LogicalExpression '&&', lhs, new JS.BinaryExpression expression.operator, left, expression.right ] - [CS.Super, ({arguments: args, compile, inScope, ancestry}) -> - + [CS.Super, ({arguments: args, compile, inScope, ancestry, options}) -> classNode = find ancestry, (node) => (node instanceof CS.Class) or (node.assignee instanceof CS.ProtoMemberAccessOp) @@ -859,6 +893,12 @@ class exports.Compiler className = classNode.assignee.expression.data functionName = classNode.assignee.memberName + if options.targetES6 + if functionName == 'constructor' + return new JS.CallExpression new JS.Identifier('super'), (map args, expr) + else + return new JS.CallExpression (memberAccess new JS.Identifier('super'), functionName), (map args, expr) + if className is 'class' if args.length > 0 calledExprs = [new JS.ThisExpression].concat (map args, expr) diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index d064563b..d23fe090 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -45,6 +45,8 @@ nodeData = [ ['BreakStatement' , yes, ['label']] ['CallExpression' , no , ['callee', 'arguments']] ['CatchClause' , yes, ['param', 'body']] + ['ClassBody' , yes, ['body']] + ['ClassDeclaration' , yes, ['id', 'superClass', 'body']] ['ConditionalExpression', no , ['test', 'consequent', 'alternate']] ['ContinueStatement' , yes, ['label']] ['DebuggerStatement' , yes, []] @@ -62,6 +64,7 @@ nodeData = [ ['Literal' , no , ['value']] ['LogicalExpression' , no , ['operator', 'left', 'right']] ['MemberExpression' , no , ['computed', 'object', 'property']] + ['MethodDefinition' , no , ['key', 'value']] ['NewExpression' , no , ['callee', 'arguments']] ['ObjectExpression' , no , ['properties']] ['Program' , yes, ['body']] @@ -93,7 +96,7 @@ for [node, isStatement, params] in nodeData UnaryExpression, NewExpression, VariableDeclaration, ObjectExpression, MemberExpression, UpdateExpression, AssignmentExpression, LogicalExpression, GenSym, FunctionDeclaration, VariableDeclaration, SwitchStatement, SwitchCase, - TryStatement, ArrowFunctionExpression + TryStatement, ArrowFunctionExpression, ClassBody } = exports ## Nodes that contain primitive properties @@ -125,6 +128,7 @@ handleLists ArrayExpression, ['elements'] handleLists ArrowFunctionExpression, ['params', 'defaults'] handleLists BlockStatement, ['body'] handleLists CallExpression, ['arguments'] +handleLists ClassBody, ['body'] handleLists FunctionDeclaration, ['params'] handleLists FunctionExpression, ['params'] handleLists NewExpression, ['arguments'] From 185851342a495d4c54f72e4b6146aaebff3f6c76 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 04:09:33 -0400 Subject: [PATCH 14/64] handle empty class bodies --- lib/compiler.js | 17 +++++++---------- src/compiler.coffee | 13 +++++-------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index ac22c169..712a3f4d 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -650,12 +650,13 @@ for (h in inlineHelpers) { helpers[h] = fn; } findES6Methods = function (classIdentifier, body) { - var expression, inner, methods, properties, rest; + var expression, methods, properties, rest, statement; methods = []; properties = []; rest = []; - for (var i$ = 0, length$ = body.expressions.length; i$ < length$; ++i$) { - expression = body.expressions[i$]; + for (var i$ = 0, length$ = body.body.length; i$ < length$; ++i$) { + statement = body.body[i$]; + expression = statement.expression; if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype') { if (expression.right instanceof JS.FunctionExpression) { @@ -666,13 +667,9 @@ findES6Methods = function (classIdentifier, body) { } else if (expression.left.object instanceof JS.ThisExpression) { properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); } - } else if (expression instanceof JS.SequenceExpression) { - inner = findES6Methods(classIdentifier, expression); - methods = methods.concat(inner.methods); - properties = properties.concat(inner.properties); - rest = rest.concat(inner.rest); } else { - rest.push(expression); + debugger; + rest.push(statement); } } return { @@ -1303,7 +1300,7 @@ exports.Compiler = function () { debugger; if (parent) parentIdentifier = new JS.Identifier(parent.name); - cache$3 = findES6Methods(classIdentifier, body); + cache$3 = findES6Methods(classIdentifier, forceBlock(body)); methods = cache$3.methods; properties = cache$3.properties; classProperties = cache$3.classProperties; diff --git a/src/compiler.coffee b/src/compiler.coffee index b2df2942..23af0019 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -388,7 +388,8 @@ findES6Methods = (classIdentifier, body) -> methods = [] properties = [] rest = [] - for expression in body.expressions + for statement in body.body + expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') if expression.right instanceof JS.FunctionExpression @@ -397,13 +398,9 @@ findES6Methods = (classIdentifier, body) -> properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right) else if expression.left.object instanceof JS.ThisExpression properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) - else if expression instanceof JS.SequenceExpression - inner = findES6Methods(classIdentifier, expression) - methods = methods.concat(inner.methods) - properties = properties.concat(inner.properties) - rest = rest.concat(inner.rest) else - rest.push(expression) + debugger + rest.push(statement) { methods, properties, rest } @@ -725,7 +722,7 @@ class exports.Compiler debugger if parent parentIdentifier = new JS.Identifier(parent.name) - { methods, properties, classProperties, rest } = findES6Methods(classIdentifier, body) + { methods, properties, classProperties, rest } = findES6Methods(classIdentifier, forceBlock body) if ctor for c, i in rest when c.instanceof JS.FunctionDeclaration ctorIndex = i From 45b9a365841d5f8efdf58aa2d0eea04ddb916cd6 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 10:38:38 -0400 Subject: [PATCH 15/64] targetES6: default args for both ArrowExpression and FunctionExpression --- lib/browser.js | 12 +- lib/cli.js | 42 ++++-- lib/compiler.js | 272 ++++++++++++++++++++++++---------- lib/functional-helpers.js | 29 +++- lib/helpers.js | 9 +- lib/js-nodes.js | 19 ++- lib/module.js | 9 +- lib/nodes.js | 21 ++- lib/optimiser.js | 69 ++++++--- lib/parser.js | 60 +++++--- lib/preprocessor.js | 57 ++++--- lib/repl.js | 21 ++- lib/run.js | 15 +- src/compiler.coffee | 57 ++++--- src/functional-helpers.coffee | 5 + src/js-nodes.coffee | 4 +- 16 files changed, 481 insertions(+), 220 deletions(-) diff --git a/lib/browser.js b/lib/browser.js index 205df7e6..b39f4ae8 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -28,18 +28,21 @@ CoffeeScript.load = function (url, callback) { var xhr; xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) + if ('overrideMimeType' in xhr) { xhr.overrideMimeType('text/plain'); + } xhr.onreadystatechange = function () { - if (!(xhr.readyState === xhr.DONE)) + if (!(xhr.readyState === xhr.DONE)) { return; + } if (xhr.status === 0 || xhr.status === 200) { CoffeeScript.run(xhr.responseText); } else { throw new Error('Could not load ' + url); } - if (callback) + if (callback) { return callback(); + } }; return xhr.send(null); }; @@ -58,8 +61,9 @@ runScripts = function () { index = 0; (execute = function () { var script; - if (!(script = coffees[index++])) + if (!(script = coffees[index++])) { return; + } if (script.src) { return CoffeeScript.load(script.src, execute); } else { diff --git a/lib/cli.js b/lib/cli.js index 2def4b51..59f8cab4 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -73,11 +73,13 @@ parameter('cli', 'input', 'nodejs', 'output', 'watch'); if (null != escodegen) { option('bare', 'js', 'source-map', 'eval', 'repl'); parameter('source-map-file', 'require'); - if (null != esmangle) + if (null != esmangle) { option('minify'); + } } -if (null != cscodegen) +if (null != cscodegen) { option('cscodegen'); +} options = nopt(knownOpts, optAliases, process.argv, 2); positionalArgs = options.argv.remain; delete options.argv; @@ -88,7 +90,7 @@ else options.sourceMap = options['source-map']; options.sourceMapFile = options['source-map-file']; options.targetES6 = options['target-es6']; -if (!(options.compile || options.js || options.sourceMap || options.parse || options['eval'] || options.cscodegen)) +if (!(options.compile || options.js || options.sourceMap || options.parse || options['eval'] || options.cscodegen)) { if (!(null != escodegen)) { options.compile = true; } else if (positionalArgs.length) { @@ -98,6 +100,7 @@ if (!(options.compile || options.js || options.sourceMap || options.parse || opt } else { options.repl = true; } +} if (1 !== (null != options.parse ? options.parse : 0) + (null != options.compile ? options.compile : 0) + (null != options.js ? options.js : 0) + (null != options.sourceMap ? options.sourceMap : 0) + (null != options['eval'] ? options['eval'] : 0) + (null != options.cscodegen ? options.cscodegen : 0) + (null != options.repl ? options.repl : 0)) { console.error('Error: At most one of --parse (-p), --compile (-c), --js (-j), --source-map, --eval (-e), --cscodegen, or --repl may be used.'); process.exit(1); @@ -133,8 +136,9 @@ if (options.cscodegen && !(null != cscodegen)) { output = function (out) { if (options.output) { return fs.writeFile(options.output, '' + out + '\n', function (err) { - if (null != err) + if (null != err) { throw err; + } }); } else { return process.stdout.write('' + out + '\n'); @@ -157,19 +161,22 @@ if (options.help) { inputSource = null != options.input ? fs.realpathSync(options.input) : options.cli && '(cli)' || '(stdin)'; processInput = function (err) { var cache$3, e, js, jsAST, preprocessed, result, sourceMap, sourceMappingUrl; - if (null != err) + if (null != err) { throw err; + } result = null; input = input.toString(); - if (65279 === input.charCodeAt(0)) + if (65279 === input.charCodeAt(0)) { input = input.slice(1); - if (options.debug) + } + if (options.debug) { try { console.error('### PREPROCESSED CS ###'); preprocessed = Preprocessor.process(input, { literate: options.literate }); console.error(numberLines(humanReadable(preprocessed))); } catch (e$3) { } + } try { result = CoffeeScript.parse(input, { optimise: false, @@ -186,15 +193,17 @@ if (options.help) { console.error('### PARSED CS-AST ###'); console.error(inspect(result.toBasicObject())); } - if (options.optimise && null != result) + if (options.optimise && null != result) { result = Optimiser.optimise(result); - if (options.parse) + } + if (options.parse) { if (null != result) { output(inspect(result.toBasicObject())); return; } else { process.exit(1); } + } if (options.debug && null != result) { console.error('### ' + (options.optimise ? 'OPTIMISED' : 'PARSED') + ' CS-AST ###'); console.error(inspect(result.toBasicObject())); @@ -218,18 +227,19 @@ if (options.help) { bare: options.bare, targetES6: options.targetES6 }); - if (options.compile) + if (options.compile) { if (null != jsAST) { output(inspect(jsAST)); return; } else { process.exit(1); } + } if (options.debug && null != jsAST) { console.error('### COMPILED JS-AST ###'); console.error(inspect(jsAST)); } - if (options.minify) + if (options.minify) { try { jsAST = esmangle.mangle(esmangle.optimize(jsAST), { destructive: true }); } catch (e$6) { @@ -237,6 +247,7 @@ if (options.help) { console.error(e.stack || e.message); process.exit(1); } + } if (options.sourceMap) { try { sourceMap = CoffeeScript.sourceMap(jsAST, inputName, { compact: options.minify }); @@ -283,13 +294,16 @@ if (options.help) { }; if (null != options.input) { fs.stat(options.input, function (err, stats) { - if (null != err) + if (null != err) { throw err; - if (stats.isDirectory()) + } + if (stats.isDirectory()) { options.input = path.join(options.input, 'index.coffee'); + } return fs.readFile(options.input, function (err, contents) { - if (null != err) + if (null != err) { throw err; + } input = contents; return processInput(); }); diff --git a/lib/compiler.js b/lib/compiler.js index 712a3f4d..ac563b12 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; +var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -15,6 +15,7 @@ owns = cache$.owns; partition = cache$.partition; span = cache$.span; union = cache$.union; +zip = cache$.zip; cache$1 = require('./helpers'); beingDeclared = cache$1.beingDeclared; usedAsExpression = cache$1.usedAsExpression; @@ -81,8 +82,9 @@ genSym = function () { }(); stmt = function (e) { var walk; - if (!(null != e)) + if (!(null != e)) { return e; + } if (e.isStatement) { return e; } else if (e['instanceof'](JS.SequenceExpression)) { @@ -104,8 +106,9 @@ stmt = function (e) { }; expr = function (s) { var accum, alternate, block, consequent, iife, lastExpression, push; - if (!(null != s)) + if (!(null != s)) { return s; + } if (s.isExpression) { return s; } else if (s['instanceof'](JS.BlockStatement)) { @@ -120,7 +123,7 @@ expr = function (s) { } else if (s['instanceof'](JS.ExpressionStatement)) { return s.expression; } else if (s['instanceof'](JS.ThrowStatement)) { - return new JS.CallExpression(new JS.FunctionExpression(null, [], forceBlock(s)), []); + return new JS.CallExpression(funcExpr({ body: forceBlock(s) }), []); } else if (s['instanceof'](JS.IfStatement)) { consequent = expr(null != s.consequent ? s.consequent : helpers.undef()); alternate = expr(null != s.alternate ? s.alternate : helpers.undef()); @@ -133,8 +136,9 @@ expr = function (s) { s.body = forceBlock(s.body); if (s.body.body.length) { lastExpression = s.body.body.slice(-1)[0]; - if (!lastExpression['instanceof'](JS.ThrowStatement)) + if (!lastExpression['instanceof'](JS.ThrowStatement)) { s.body.body[s.body.body.length - 1] = push(expr(lastExpression)); + } } else { s.body.body.push(push(helpers.undef())); } @@ -142,14 +146,17 @@ expr = function (s) { s, new JS.ReturnStatement(accum) ]); - iife = new JS.FunctionExpression(null, [accum], block); + iife = funcExpr({ + params: [accum], + body: block + }); return new JS.CallExpression(memberAccess(iife.g(), 'call'), [ new JS.ThisExpression, new JS.ArrayExpression([]) ]); } else if (s['instanceof'](JS.SwitchStatement, JS.TryStatement)) { block = new JS.BlockStatement([makeReturn(s)]); - iife = new JS.FunctionExpression(null, [], block); + iife = funcExpr({ body: block }); return new JS.CallExpression(memberAccess(iife.g(), 'call'), [new JS.ThisExpression]); } else { throw new Error('expr: Cannot use a ' + s.type + ' as a value'); @@ -157,8 +164,9 @@ expr = function (s) { }; makeReturn = function (node) { var stmts; - if (!(null != node)) + if (!(null != node)) { return new JS.ReturnStatement; + } if (node['instanceof'](JS.BlockStatement)) { return new JS.BlockStatement([].slice.call(node.body.slice(0, -1)).concat([makeReturn(node.body.slice(-1)[0])])); } else if (node['instanceof'](JS.SequenceExpression)) { @@ -168,8 +176,9 @@ makeReturn = function (node) { } else if (node['instanceof'](JS.SwitchStatement)) { return new JS.SwitchStatement(node.discriminant, map(node.cases, makeReturn)); } else if (node['instanceof'](JS.SwitchCase)) { - if (!node.consequent.length) + if (!node.consequent.length) { return node; + } stmts = node.consequent.slice(-1)[0]['instanceof'](JS.BreakStatement) ? node.consequent.slice(0, -1) : node.consequent; return new JS.SwitchCase(node.test, [].slice.call(stmts.slice(0, -1)).concat([makeReturn(stmts.slice(-1)[0])])); } else if (node['instanceof'](JS.TryStatement)) { @@ -190,12 +199,13 @@ generateMutatingWalker = function (fn) { args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; for (var i$ = 0, length$ = node.childNodes.length; i$ < length$; ++i$) { childName = node.childNodes[i$]; - if (!(null != node[childName])) + if (!(null != node[childName])) { continue; + } node[childName] = in$(childName, node.listMembers) ? function (accum$) { for (var i$1 = 0, length$1 = node[childName].length; i$1 < length$1; ++i$1) { n = node[childName][i$1]; - accum$.push(fn.apply(n, args)); + accum$.push('undefined' !== typeof n && null != n ? fn.apply(n, args) : void 0); } return accum$; }.call(this, []) : fn.apply(node[childName], args); @@ -204,8 +214,9 @@ generateMutatingWalker = function (fn) { }; }; declarationsNeeded = function (node) { - if (!(null != node)) + if (!(null != node)) { return []; + } if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' && node.left['instanceof'](JS.Identifier)) { return [node.left]; } else if (node['instanceof'](JS.ForInStatement) && node.left['instanceof'](JS.Identifier)) { @@ -215,14 +226,16 @@ declarationsNeeded = function (node) { } }; declarationsNeededRecursive = function (node) { - if (!(null != node)) + if (!(null != node)) { return []; + } if (node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration) && !node.generated) { return []; } else { return union(declarationsNeeded(node), concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) + if (!(null != node[childName])) { return []; + } if (in$(childName, node.listMembers)) { return concatMap(node[childName], declarationsNeededRecursive); } else { @@ -232,8 +245,9 @@ declarationsNeededRecursive = function (node) { } }; variableDeclarations = function (node) { - if (!(null != node)) + if (!(null != node)) { return []; + } if (node['instanceof'](JS.FunctionDeclaration)) { return [node.id]; } else if (node['instanceof'](JS.FunctionExpression) && !node.generated) { @@ -242,8 +256,9 @@ variableDeclarations = function (node) { return [node.id]; } else { return concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) + if (!(null != node[childName])) { return []; + } if (in$(childName, node.listMembers)) { return concatMap(node[childName], variableDeclarations); } else { @@ -257,14 +272,18 @@ collectIdentifiers = function (node) { switch (false) { case !!(null != node): return []; + case !!node['instanceof']: + debugger; + return []; case !node['instanceof'](JS.Identifier): return [node.name]; case !(node['instanceof'](JS.MemberExpression) && !node.computed): return collectIdentifiers(node.object); default: return concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) + if (!(null != node[childName])) { return []; + } if (in$(childName, node.listMembers)) { return concatMap(node[childName], collectIdentifiers); } else { @@ -275,8 +294,9 @@ collectIdentifiers = function (node) { }.call(this)); }; needsCaching = function (node) { - if (!(null != node)) + if (!(null != node)) { return false; + } return envEnrichments(node, []).length > 0 || node['instanceof'](CS.FunctionApplications, CS.DoOp, CS.NewOp, CS.ArrayInitialiser, CS.ObjectInitialiser, CS.RegExp, CS.HeregExp, CS.PreIncrementOp, CS.PostIncrementOp, CS.PreDecrementOp, CS.PostDecrementOp, CS.Range) || any(difference(node.childNodes, node.listMembers), function (n) { return needsCaching(node[n]); }) || any(node.listMembers, function (n) { @@ -284,8 +304,9 @@ needsCaching = function (node) { }); }; forceBlock = function (node) { - if (!(null != node)) + if (!(null != node)) { return new JS.BlockStatement([]); + } node = stmt(node); if (node['instanceof'](JS.BlockStatement)) { return node; @@ -350,8 +371,9 @@ assignment = function (assignee, expression, valueUsed) { for (var i$ = 0, length$ = elements.length; i$ < length$; ++i$) { m = elements[i$]; i = i$; - if (m.rest) + if (m.rest) { break; + } assignments.push(assignment(m, dynamicMemberAccess(e, new JS.Literal(i)), valueUsed)); } if (elements.length > 0) { @@ -390,8 +412,9 @@ assignment = function (assignee, expression, valueUsed) { } if (any(elements, function (p) { return p.rest; - })) + })) { throw new Error('Positional destructuring assignments may not have more than one rest operator'); + } } break; case !assignee['instanceof'](JS.ObjectExpression): @@ -570,7 +593,7 @@ helpers = { args = new JS.Identifier('args'); result = new JS.Identifier('result'); block = [ - new JS.VariableDeclaration('var', [new JS.VariableDeclarator(fn, new JS.FunctionExpression(null, [], new JS.BlockStatement([])))]), + new JS.VariableDeclaration('var', [new JS.VariableDeclarator(fn, funcExpr({ body: new JS.BlockStatement([]) }))]), new JS.AssignmentExpression('=', memberAccess(fn, 'prototype'), memberAccess(ctor, 'prototype')), new JS.VariableDeclaration('var', [ new JS.VariableDeclarator(child, new JS.NewExpression(fn, [])), @@ -678,6 +701,18 @@ findES6Methods = function (classIdentifier, body) { rest: rest }; }; +funcExpr = function (param$) { + var body, cache$2, defaults, id, params, rest; + { + cache$2 = param$; + id = cache$2.id; + params = cache$2.params; + defaults = cache$2.defaults; + rest = cache$2.rest; + body = cache$2.body; + } + return new JS.FunctionExpression(null != id ? id : null, null != params ? params : [], null != defaults ? defaults : [], null != rest ? rest : null, body); +}; exports.Compiler = function () { Compiler.compile = function (this$) { return function () { @@ -696,8 +731,9 @@ exports.Compiler = function () { inScope = cache$2.inScope; options = cache$2.options; } - if (!(null != body)) + if (!(null != body)) { return new JS.Program([]); + } block = stmt(body); block = block['instanceof'](JS.BlockStatement) ? block.body : [block]; cache$3 = partition(enabledHelpers, function (helper) { @@ -708,12 +744,13 @@ exports.Compiler = function () { [].push.apply(block, fnDeclHelpers); [].unshift.apply(block, otherHelpers); decls = nub(concatMap(block, declarationsNeededRecursive)); - if (decls.length > 0) + if (decls.length > 0) { if (options.bare) { block.unshift(makeVarDeclaration(decls)); } else { - block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(new JS.FunctionExpression(null, [], new JS.BlockStatement(block)), 'call'), [new JS.ThisExpression])))]; + block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(block) }), 'call'), [new JS.ThisExpression])))]; } + } pkg = require('./../package.json'); program = new JS.Program(block); program.leadingComments = [{ @@ -774,14 +811,17 @@ exports.Compiler = function () { ancestry = cache$2.ancestry; } if (null != alternate) { - if (!(null != consequent)) + if (!(null != consequent)) { throw new Error('Conditional with non-null alternate requires non-null consequent'); - if (!alternate['instanceof'](JS.IfStatement)) + } + if (!alternate['instanceof'](JS.IfStatement)) { alternate = forceBlock(alternate); + } } - if (null != alternate || (null != ancestry[0] ? ancestry[0]['instanceof'](CS.Conditional) : void 0)) + if (null != alternate || (null != ancestry[0] ? ancestry[0]['instanceof'](CS.Conditional) : void 0)) { consequent = forceBlock(consequent); - return new JS.IfStatement(expr(condition), stmt(consequent), alternate); + } + return new JS.IfStatement(expr(condition), forceBlock(consequent), alternate); } ], [ @@ -801,8 +841,9 @@ exports.Compiler = function () { i = genSym('i'); length = genSym('length'); block = forceBlock(body); - if (!block.body.length) + if (!block.body.length) { block.body.push(stmt(helpers.undef())); + } increment = null != this.step && !(this.step['instanceof'](CS.Int) && this.step.data === 1) ? function (x) { return new JS.AssignmentExpression('+=', x, step); } : function (x) { @@ -811,8 +852,9 @@ exports.Compiler = function () { if (this.target['instanceof'](CS.Range) && (this.target.left['instanceof'](CS.Int) || this.target.left['instanceof'](CS.UnaryNegateOp) && this.target.left.expression['instanceof'](CS.Int)) && (this.target.right['instanceof'](CS.Int) || this.target.right['instanceof'](CS.UnaryNegateOp) && this.target.right.expression['instanceof'](CS.Int))) { varDeclaration = new JS.VariableDeclaration('var', [new JS.VariableDeclarator(i, compile(this.target.left))]); update = increment(i); - if (null != this.filter) + if (null != this.filter) { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', filter), new JS.ContinueStatement))); + } if (null != keyAssignee) { k = genSym('k'); varDeclaration.declarations.unshift(new JS.VariableDeclarator(k, new JS.Literal(0))); @@ -822,8 +864,9 @@ exports.Compiler = function () { ]); block.body.unshift(stmt(new JS.AssignmentExpression('=', keyAssignee, k))); } - if (null != valAssignee) + if (null != valAssignee) { block.body.unshift(stmt(new JS.AssignmentExpression('=', valAssignee, i))); + } op = this.target.isInclusive ? '<=' : '<'; return new JS.ForStatement(varDeclaration, new JS.BinaryExpression(op, i, compile(this.target.right)), update, block); } @@ -832,14 +875,18 @@ exports.Compiler = function () { new JS.VariableDeclarator(i, new JS.Literal(0)), new JS.VariableDeclarator(length, memberAccess(e, 'length')) ]); - if (!(e === target)) + if (!(e === target)) { varDeclaration.declarations.unshift(new JS.VariableDeclarator(e, target)); - if (null != this.filter) + } + if (null != this.filter) { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', filter), new JS.ContinueStatement))); - if (null != keyAssignee) + } + if (null != keyAssignee) { block.body.unshift(stmt(assignment(keyAssignee, i))); - if (null != valAssignee) + } + if (null != valAssignee) { block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, i)))); + } return new JS.ForStatement(varDeclaration, new JS.BinaryExpression('<', i, length), increment(i), block); } ], @@ -856,15 +903,19 @@ exports.Compiler = function () { body = cache$2.body; } block = forceBlock(body); - if (!block.body.length) + if (!block.body.length) { block.body.push(stmt(helpers.undef())); + } e = this.isOwn && needsCaching(this.target) ? genSym('cache') : expr(target); - if (null != this.filter) + if (null != this.filter) { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', filter), new JS.ContinueStatement))); - if (null != valAssignee) + } + if (null != valAssignee) { block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, keyAssignee)))); - if (this.isOwn) + } + if (this.isOwn) { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', helpers.isOwn(e, keyAssignee)), new JS.ContinueStatement))); + } right = e === target ? e : new JS.AssignmentExpression('=', e, target); return new JS.ForInStatement(keyAssignee, right, block); } @@ -900,8 +951,9 @@ exports.Compiler = function () { c.test = new JS.UnaryExpression('!', c.test); } } - if (null != alternate) + if (null != alternate) { cases.push(new JS.SwitchCase(null, [stmt(alternate)])); + } for (var i$1 = 0, length$1 = cases.slice(0, -1).length; i$1 < length$1; ++i$1) { c = cases.slice(0, -1)[i$1]; if (!((null != c.consequent ? c.consequent.length : void 0) > 0)) @@ -944,8 +996,9 @@ exports.Compiler = function () { if (null != this.catchBody || !(null != this.finallyBody)) { e = genSym('e'); catchBlock = forceBlock(catchBody); - if (null != catchAssignee) + if (null != catchAssignee) { catchBlock.body.unshift(stmt(assignment(catchAssignee, e))); + } handlers = [new JS.CatchClause(e, catchBlock)]; } else { handlers = []; @@ -1023,12 +1076,12 @@ exports.Compiler = function () { if (any(ancestry, function (ancestor) { return ancestor['instanceof'](CS.Functions); })) { - return new JS.CallExpression(memberAccess(new JS.FunctionExpression(null, [], new JS.BlockStatement(body)), 'apply'), [ + return new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(body) }), 'apply'), [ new JS.ThisExpression, new JS.Identifier('arguments') ]); } else { - return new JS.CallExpression(memberAccess(new JS.FunctionExpression(null, [], new JS.BlockStatement(body)), 'call'), [new JS.ThisExpression]); + return new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(body) }), 'call'), [new JS.ThisExpression]); } } ], @@ -1137,7 +1190,7 @@ exports.Compiler = function () { CS.BoundFunction, function () { var handleParam; - handleParam = function (param, original, block, inScope) { + handleParam = function (param, original, block, inScope, options) { var decls, p; switch (false) { case !original['instanceof'](CS.Rest): @@ -1150,19 +1203,22 @@ exports.Compiler = function () { return new JS.Identifier(i); }); block.body.unshift(stmt(assignment(param, p))); - if (decls.length) + if (decls.length) { block.body.unshift(makeVarDeclaration(decls)); + } return p; case !original['instanceof'](CS.DefaultParam): - p = handleParam.call(this, param.param, original.param, block, inScope); - block.body.unshift(new JS.IfStatement(new JS.BinaryExpression('==', new JS.Literal(null), p), stmt(assignment(p, param['default'])))); + p = handleParam.call(this, param.param, original.param, block, inScope, options); + if (!options.targetES6) { + block.body.unshift(new JS.IfStatement(new JS.BinaryExpression('==', new JS.Literal(null), p), stmt(assignment(p, param['default'])))); + } return p; default: throw new Error('Unsupported parameter type: ' + original.className); } }; return function (param$) { - var alternate, ancestry, block, cache$2, consequent, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; + var alternate, ancestry, block, cache$2, consequent, defaults, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; var body, parameters; { cache$2 = param$; @@ -1172,15 +1228,30 @@ exports.Compiler = function () { inScope = cache$2.inScope; options = cache$2.options; } - if (!(null != ancestry[0] ? ancestry[0]['instanceof'](CS.Constructor) : void 0)) + if (!(null != ancestry[0] ? ancestry[0]['instanceof'](CS.Constructor) : void 0)) { body = makeReturn(body); + } block = forceBlock(body); last = block.body.slice(-1)[0]; - if ((null != last ? last['instanceof'](JS.ReturnStatement) : void 0) && !(null != last.argument)) + if ((null != last ? last['instanceof'](JS.ReturnStatement) : void 0) && !(null != last.argument)) { block.body = block.body.slice(0, -1); + } + defaults = options.targetES6 ? zip(parameters, this.parameters).map(function (param$1) { + var cache$3, original, param; + { + cache$3 = param$1; + param = cache$3[0]; + original = cache$3[1]; + } + if (original instanceof CS.DefaultParam) { + return param['default']; + } else { + return null; + } + }) : []; parameters_ = parameters.length === 0 ? [] : (pIndex = parameters.length, function (accum$) { while (pIndex--) { - accum$.push(handleParam.call(this, parameters[pIndex], this.parameters[pIndex], block, inScope)); + accum$.push(handleParam.call(this, parameters[pIndex], this.parameters[pIndex], block, inScope, options)); } return accum$; }.call(this, [])); @@ -1195,8 +1266,9 @@ exports.Compiler = function () { test = new JS.BinaryExpression('>', memberAccess(new JS.Identifier('arguments'), 'length'), new JS.Literal(numParams)); consequent = helpers.slice(new JS.Identifier('arguments'), new JS.Literal(numParams)); alternate = new JS.ArrayExpression([]); - if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) + if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) { block.body.unshift(makeVarDeclaration([paramName])); + } block.body.unshift(stmt(new JS.AssignmentExpression('=', paramName, new JS.ConditionalExpression(test, consequent, alternate)))); } } else if (any(parameters, function (p) { @@ -1221,24 +1293,26 @@ exports.Compiler = function () { i = i$1; reassignments.consequent.body.push(stmt(new JS.AssignmentExpression('=', p, new JS.MemberExpression(true, new JS.Identifier('arguments'), new JS.BinaryExpression('-', numArgs, new JS.Literal(numParams - index - i)))))); } - if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) + if (paramName['instanceof'](JS.Identifier) && in$(paramName.name, inScope)) { block.body.unshift(makeVarDeclaration([paramName])); + } block.body.unshift(reassignments); } if (any(parameters, function (p) { return p.rest; - })) + })) { throw new Error('Parameter lists may not have more than one rest operator'); + } } performedRewrite = false; - if (this['instanceof'](CS.BoundFunction)) + if (this['instanceof'](CS.BoundFunction)) { if (options.targetES6) { if (block.body.length === 1 && block.body[0] instanceof JS.ReturnStatement) { - fn = new JS.ArrowFunctionExpression(parameters, [], rest, block.body[0].argument); + fn = new JS.ArrowFunctionExpression(parameters, defaults, rest, block.body[0].argument); fn.expression = true; return fn; } else { - return new JS.ArrowFunctionExpression(parameters, [], rest, block); + return new JS.ArrowFunctionExpression(parameters, defaults, rest, block); } } else { newThis = genSym('this'); @@ -1254,9 +1328,18 @@ exports.Compiler = function () { }); rewriteThis(block); } - fn = new JS.FunctionExpression(null, parameters, block, rest); + } + fn = funcExpr({ + params: parameters, + defaults: defaults, + rest: rest, + body: block + }); if (performedRewrite) { - return new JS.CallExpression(new JS.FunctionExpression(null, [newThis], new JS.BlockStatement([new JS.ReturnStatement(fn)])), [new JS.ThisExpression]); + return new JS.CallExpression(funcExpr({ + params: [newThis], + body: new JS.BlockStatement([new JS.ReturnStatement(fn)]) + }), [new JS.ThisExpression]); } else { return fn; } @@ -1298,8 +1381,9 @@ exports.Compiler = function () { if (options.targetES6) { classIdentifier = new JS.Identifier(name.name); debugger; - if (parent) + if (parent) { parentIdentifier = new JS.Identifier(parent.name); + } cache$3 = findES6Methods(classIdentifier, forceBlock(body)); methods = cache$3.methods; properties = cache$3.properties; @@ -1315,17 +1399,25 @@ exports.Compiler = function () { break; } rest.splice(ctorIndex, 1); - methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), new JS.FunctionExpression(ctor.id, ctor.params, ctor.body, ctor.rest))); + methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ + id: ctor.id, + params: ctor.params, + body: ctor.body, + defaults: ctor.defaults, + rest: ctor.rest + }))); } - if (rest.length === 0) + if (rest.length === 0) { return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); + } } args = []; params = []; parentRef = genSym('super'); block = forceBlock(body); - if (name['instanceof'](JS.Identifier) && in$(name.name, jsReserved)) + if (name['instanceof'](JS.Identifier) && in$(name.name, jsReserved)) { name = genSym(name.name); + } if (null != ctor) { for (var i$1 = 0, length$1 = block.body.length; i$1 < length$1; ++i$1) { c = block.body[i$1]; @@ -1338,11 +1430,12 @@ exports.Compiler = function () { block.body.splice(ctorIndex, 1, ctor); } else { ctorBody = new JS.BlockStatement([]); - if (null != parent) + if (null != parent) { ctorBody.body.push(stmt(new JS.CallExpression(memberAccess(parentRef, 'apply'), [ new JS.ThisExpression, new JS.Identifier('arguments') ]))); + } ctor = new JS.FunctionDeclaration(name, [], ctorBody); ctorIndex = 0; block.body.unshift(ctor); @@ -1370,10 +1463,13 @@ exports.Compiler = function () { }.call(this, []); member = memberAccess(new JS.ThisExpression, memberName); protoMember = memberAccess(memberAccess(name, 'prototype'), memberName); - fn = new JS.FunctionExpression(null, ps, new JS.BlockStatement([makeReturn(new JS.CallExpression(memberAccess(protoMember, 'apply'), [ - instance, - new JS.Identifier('arguments') - ]))])); + fn = funcExpr({ + params: ps, + body: new JS.BlockStatement([makeReturn(new JS.CallExpression(memberAccess(protoMember, 'apply'), [ + instance, + new JS.Identifier('arguments') + ]))]) + }); ctor.body.body.unshift(stmt(new JS.AssignmentExpression('=', member, fn))); } ctor.body.body.unshift(stmt(new JS.AssignmentExpression('=', instance, new JS.ThisExpression))); @@ -1394,7 +1490,10 @@ exports.Compiler = function () { } }); rewriteThis(block); - iife = new JS.CallExpression(new JS.FunctionExpression(null, params, block).g(), args); + iife = new JS.CallExpression(funcExpr({ + params: params, + body: block + }).g(), args); if (null != nameAssignee) { return assignment(nameAssignee, iife); } else { @@ -1492,8 +1591,9 @@ exports.Compiler = function () { throw new Error('Unrecognised compound assignment operator'); } }.call(this); - if ((op === '&&' || op === '||' || op === '?') && assignee['instanceof'](JS.Identifier) && !in$(assignee.name, inScope)) + if ((op === '&&' || op === '||' || op === '?') && assignee['instanceof'](JS.Identifier) && !in$(assignee.name, inScope)) { throw new Error('the variable "' + assignee.name + '" can\'t be assigned with ?= because it has not been defined.'); + } switch (op) { case '&&': case '||': @@ -1517,8 +1617,9 @@ exports.Compiler = function () { expression = cache$2.expression; compile = cache$2.compile; } - if (!this.expression.left['instanceof'](CS.ComparisonOps)) + if (!this.expression.left['instanceof'](CS.ComparisonOps)) { return expression; + } left = expression.left.right; lhs = compile(new CS.ChainedComparisonOp(this.expression.left)); if (needsCaching(this.expression.left.right)) { @@ -1562,15 +1663,17 @@ exports.Compiler = function () { for (var i$ = 0, length$ = ancestry.length; i$ < length$; ++i$) { i = ancestry[i$]; n = i$; - if (n === classPositionInAncestry) + if (n === classPositionInAncestry) { break; + } searchableNodes.unshift(i); } assignableNode = find(searchableNodes, function (node) { return null != node.assignee; }); - if (!(null != assignableNode)) + if (!(null != assignableNode)) { return 'constructor'; + } switch (false) { case !(assignableNode.assignee instanceof CS.MemberAccessOp): isStatic = true; @@ -1585,13 +1688,14 @@ exports.Compiler = function () { className = classNode.assignee.expression.data; functionName = classNode.assignee.memberName; } - if (options.targetES6) + if (options.targetES6) { if (functionName === 'constructor') { return new JS.CallExpression(new JS.Identifier('super'), map(args, expr)); } else { return new JS.CallExpression(memberAccess(new JS.Identifier('super'), functionName), map(args, expr)); } - if (className === 'class') + } + if (className === 'class') { if (args.length > 0) { calledExprs = [new JS.ThisExpression].concat(map(args, expr)); return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'call'), calledExprs); @@ -1601,6 +1705,7 @@ exports.Compiler = function () { new JS.Identifier('arguments') ]); } + } if (isStatic) { if (args.length === 0) { return new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'apply'), [ @@ -1706,8 +1811,9 @@ exports.Compiler = function () { accum$.push(flag); } return accum$; - }.call(this, []).join('')) + }.call(this, []).join('')) { args.push(new JS.Literal(flags)); + } return new JS.NewExpression(new JS.Identifier('RegExp'), args); } ], @@ -1749,8 +1855,9 @@ exports.Compiler = function () { while (null != (null != leftmost.left ? leftmost.left.left : void 0)) { leftmost = leftmost.left; } - if (!(leftmost.left['instanceof'](JS.Literal) && 'string' === typeof leftmost.left.value)) + if (!(leftmost.left['instanceof'](JS.Literal) && 'string' === typeof leftmost.left.value)) { leftmost.left = new JS.BinaryExpression('+', new JS.Literal(''), leftmost.left); + } } return plusOp; } @@ -1846,8 +1953,9 @@ exports.Compiler = function () { right = cache$2.right; } args = null != left ? [left] : null != right ? [new JS.Literal(0)] : []; - if (null != right) + if (null != right) { args.push(this.isInclusive ? right['instanceof'](JS.Literal) && typeof right.data === 'number' ? new JS.Literal(right.data + 1) : new JS.LogicalExpression('||', new JS.BinaryExpression('+', new JS.UnaryExpression('+', right), new JS.Literal(1)), new JS.Literal(9e9)) : right); + } return new JS.CallExpression(memberAccess(expression, 'slice'), args); } ], @@ -1867,8 +1975,9 @@ exports.Compiler = function () { right = expr(right); e = needsCaching(this.left) ? genSym('cache') : left; condition = new JS.BinaryExpression('!=', new JS.Literal(null), e); - if (e['instanceof'](JS.Identifier) && !in$(e.name, inScope)) + if (e['instanceof'](JS.Identifier) && !in$(e.name, inScope)) { condition = new JS.LogicalExpression('&&', new JS.BinaryExpression('!==', new JS.Literal('undefined'), new JS.UnaryExpression('typeof', e)), condition); + } node = new JS.ConditionalExpression(condition, e, right); if (e === left) { return node; @@ -2443,8 +2552,9 @@ exports.Compiler = function () { var defaultRule, generateSymbols, walk; walk = function (fn, inScope, ancestry, options) { var child, childName, children, jsNode, member; - if ((null != ancestry[0] ? ancestry[0]['instanceof'](CS.Function, CS.BoundFunction) : void 0) && this === ancestry[0].body) + if ((null != ancestry[0] ? ancestry[0]['instanceof'](CS.Function, CS.BoundFunction) : void 0) && this === ancestry[0].body) { inScope = union(inScope, concatMap(ancestry[0].parameters, beingDeclared)); + } ancestry.unshift(this); children = {}; for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) { diff --git a/lib/functional-helpers.js b/lib/functional-helpers.js index f39a7eb0..ce0fd888 100644 --- a/lib/functional-helpers.js +++ b/lib/functional-helpers.js @@ -4,8 +4,9 @@ this.any = function (list, fn) { var e; for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { e = list[i$]; - if (fn(e)) + if (fn(e)) { return true; + } } return false; }; @@ -13,8 +14,9 @@ this.all = function (list, fn) { var e; for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { e = list[i$]; - if (!fn(e)) + if (!fn(e)) { return false; + } } return true; }; @@ -22,8 +24,9 @@ this.find = function (list, fn) { var e; for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { e = list[i$]; - if (fn(e)) + if (fn(e)) { return e; + } } return null; }; @@ -156,6 +159,26 @@ this.partition = function (list, fn) { } return result; }; +this.zip = function (listA, listB) { + var i, len; + len = Math.max(listA.length, listB.length); + return function (accum$) { + for (var cache$ = function () { + var accum$1; + accum$1 = []; + for (var i$ = 0; 0 <= len ? i$ < len : i$ > len; 0 <= len ? ++i$ : --i$) + accum$1.push(i$); + return accum$1; + }.apply(this, arguments), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) { + i = cache$[i$]; + accum$.push([ + listA[i], + listB[i] + ]); + } + return accum$; + }.call(this, []); +}; function in$(member, list) { for (var i = 0, length = list.length; i < length; ++i) if (i in list && list[i] === member) diff --git a/lib/helpers.js b/lib/helpers.js index 6a7b05ca..c4e64dcd 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -65,8 +65,9 @@ this.formatParserError = function (input, e) { } realColumn = cleanMarkers(('' + lines[line] + '\n').slice(0, column)).length; line += 1; - if (!(null != e.found)) + if (!(null != e.found)) { return 'Syntax error on line ' + line + ', column ' + realColumn + ': unexpected end of input'; + } found = JSON.stringify(humanReadable(e.found)); found = found.replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"'); unicode = e.found.charCodeAt(0).toString(16).toUpperCase(); @@ -79,12 +80,14 @@ this.pointToErrorLocation = pointToErrorLocation = function (source, line, colum if (null == numLinesOfContext) numLinesOfContext = 3; lines = source.split('\n'); - if (!lines[lines.length - 1]) + if (!lines[lines.length - 1]) { lines.pop(); + } currentLineOffset = line - 1; startLine = currentLineOffset - numLinesOfContext; - if (startLine < 0) + if (startLine < 0) { startLine = 0; + } preLines = lines.slice(startLine, +currentLineOffset + 1 || 9e9); preLines[preLines.length - 1] = colourise('yellow', preLines[preLines.length - 1]); postLines = lines.slice(currentLineOffset + 1, +(currentLineOffset + numLinesOfContext) + 1 || 9e9); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 0893086a..546883f2 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -50,18 +50,20 @@ this.Nodes = Nodes = function () { obj[child] = null != this[child] ? this[child].toBasicObject() : void 0; } } - if (null != this.line && null != this.column) + if (null != this.line && null != this.column) { obj.loc = { start: { line: this.line, column: this.column } }; - if (null != this.offset) + } + if (null != this.offset) { obj.range = [ this.offset, null != this.raw ? this.offset + this.raw.length : void 0 ]; + } for (var cache$ = [ 'leadingComments', 'raw', @@ -69,8 +71,9 @@ this.Nodes = Nodes = function () { 'generator' ], i$2 = 0, length$2 = cache$.length; i$2 < length$2; ++i$2) { property = cache$[i$2]; - if (null != this[property] && !in$(property, this.childNodes)) + if (null != this[property] && !in$(property, this.childNodes)) { obj[property] = this[property]; + } } return obj; }; @@ -222,8 +225,9 @@ nodeData = [ [ 'id', 'params', - 'body', - 'rest' + 'defaults', + 'rest', + 'body' ] ], [ @@ -485,7 +489,10 @@ handleLists(BlockStatement, ['body']); handleLists(CallExpression, ['arguments']); handleLists(ClassBody, ['body']); handleLists(FunctionDeclaration, ['params']); -handleLists(FunctionExpression, ['params']); +handleLists(FunctionExpression, [ + 'params', + 'defaults' +]); handleLists(NewExpression, ['arguments']); handleLists(ObjectExpression, ['properties']); handleLists(Program, ['body']); diff --git a/lib/module.js b/lib/module.js index 3d13cc61..da730a77 100644 --- a/lib/module.js +++ b/lib/module.js @@ -56,8 +56,9 @@ CoffeeScript = { } } catch (e$2) { e = e$2; - if (!(e instanceof Parser.SyntaxError)) + if (!(e instanceof Parser.SyntaxError)) { throw e; + } throw new Error(formatParserError(preprocessed, e)); } }, @@ -72,10 +73,12 @@ CoffeeScript = { name = 'unknown'; if (null == options) options = {}; - if (!(null != escodegen)) + if (!(null != escodegen)) { throw new Error('escodegen not found: run `npm install escodegen`'); - if (!{}.hasOwnProperty.call(jsAst, 'type')) + } + if (!{}.hasOwnProperty.call(jsAst, 'type')) { jsAst = jsAst.toBasicObject(); + } targetName = options.sourceMapFile || options.sourceMap && options.output.match(/^.*[\\\/]([^\\\/]+)$/)[1]; return escodegen.generate(jsAst, { comment: !options.compact, diff --git a/lib/nodes.js b/lib/nodes.js index 871cc78e..837e3098 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -44,8 +44,9 @@ createNodes = function (subclasses, superclasses) { i = i$; this[param] = arguments[i]; } - if (null != this.initialise) + if (null != this.initialise) { this.initialise.apply(this, arguments); + } return this; }; function class$() { @@ -55,10 +56,12 @@ createNodes = function (subclasses, superclasses) { class$.superclasses = superclasses; return class$; }(superclass); - if (null != ('undefined' !== typeof specs && null != specs ? specs[0] : void 0)) + if (null != ('undefined' !== typeof specs && null != specs ? specs[0] : void 0)) { klass.prototype.childNodes = specs[0]; - if (isCategory) + } + if (isCategory) { createNodes(specs[1], [klass].concat([].slice.call(superclasses))); + } return exports[className] = klass; }(className)); } @@ -368,17 +371,20 @@ Nodes.prototype.listMembers = []; Nodes.prototype.toBasicObject = function () { var child, obj, p; obj = { type: this.className }; - if (null != this.line) + if (null != this.line) { obj.line = this.line; - if (null != this.column) + } + if (null != this.column) { obj.column = this.column; + } if (null != this.raw) { obj.raw = this.raw; - if (null != this.offset) + if (null != this.offset) { obj.range = [ this.offset, this.offset + this.raw.length ]; + } } for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) { child = this.childNodes[i$]; @@ -504,7 +510,7 @@ Class.prototype.initialise = function () { else this.boundMembers = []; this.name = new GenSym('class'); - if (null != this.nameAssignee) + if (null != this.nameAssignee) { return this.name = function () { switch (false) { case !this.nameAssignee['instanceof'](Identifier): @@ -515,6 +521,7 @@ Class.prototype.initialise = function () { return this.name; } }.call(this); + } }; Class.prototype.childNodes.push('name'); ObjectInitialiser.prototype.keys = function () { diff --git a/lib/optimiser.js b/lib/optimiser.js index c25cd58e..e4c90cc7 100644 --- a/lib/optimiser.js +++ b/lib/optimiser.js @@ -37,8 +37,9 @@ makeDispatcher = function (defaultValue, handlers, defaultHandler) { return function (node) { var args; args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; - if (!(null != node)) + if (!(null != node)) { return defaultValue; + } handler = Object.prototype.hasOwnProperty.call(handlers_, node.className) ? handlers_[node.className] : defaultHandler; return handler.apply(node, args); }; @@ -284,8 +285,9 @@ mayHaveSideEffects = makeDispatcher(false, [ CS.DoOp, function (inScope) { var args, newScope, p; - if (!this.expression['instanceof'](CS.Functions)) + if (!this.expression['instanceof'](CS.Functions)) { return true; + } newScope = difference(inScope, concatMap(this.expression.parameters, beingDeclared)); args = function (accum$) { for (var i$ = 0, length$ = this.expression.parameters.length; i$ < length$; ++i$) { @@ -296,18 +298,21 @@ mayHaveSideEffects = makeDispatcher(false, [ }.call(this, []); if (any(args, function (a) { return mayHaveSideEffects(a, newScope); - })) + })) { return true; + } return mayHaveSideEffects(this.expression.body, newScope); } ], [ CS.ExistsOp, function (inScope) { - if (mayHaveSideEffects(this.left, inScope)) + if (mayHaveSideEffects(this.left, inScope)) { return true; - if (this.left['instanceof'](CS.Undefined, CS.Null)) + } + if (this.left['instanceof'](CS.Undefined, CS.Null)) { return false; + } return mayHaveSideEffects(this.right, inScope); } ], @@ -316,33 +321,39 @@ mayHaveSideEffects = makeDispatcher(false, [ CS.SoakedFunctionApplication, function (inScope) { var newScope; - if (!this['function']['instanceof'](CS.Function, CS.BoundFunction)) + if (!this['function']['instanceof'](CS.Function, CS.BoundFunction)) { return true; + } newScope = difference(inScope, concatMap(this['function'].parameters, beingDeclared)); if (any(this['arguments'], function (a) { return mayHaveSideEffects(a, newScope); - })) + })) { return true; + } return mayHaveSideEffects(this['function'].body, newScope); } ], [ CS.LogicalAndOp, function (inScope) { - if (mayHaveSideEffects(this.left, inScope)) + if (mayHaveSideEffects(this.left, inScope)) { return true; - if (isFalsey(this.left)) + } + if (isFalsey(this.left)) { return false; + } return mayHaveSideEffects(this.right, inScope); } ], [ CS.LogicalOrOp, function (inScope) { - if (mayHaveSideEffects(this.left, inScope)) + if (mayHaveSideEffects(this.left, inScope)) { return true; - if (isTruthy(this.left)) + } + if (isTruthy(this.left)) { return false; + } return mayHaveSideEffects(this.right, inScope); } ], @@ -465,8 +476,9 @@ exports.Optimiser = function () { [ CS.AssignOp, function () { - if (!this.expression['instanceof'](CS.SeqOp)) + if (!this.expression['instanceof'](CS.SeqOp)) { return this; + } return new CS.SeqOp(this.expression.left, new CS.AssignOp(this.assignee, this.expression.right)); } ], @@ -523,8 +535,9 @@ exports.Optimiser = function () { } decls = declarationsFor(removedBlock, inScope); block = null != block ? new CS.SeqOp(decls, block) : decls; - if (mayHaveSideEffects(this.condition, inScope)) + if (mayHaveSideEffects(this.condition, inScope)) { block = new CS.SeqOp(this.condition, block); + } return block; } ], @@ -533,8 +546,9 @@ exports.Optimiser = function () { function (param$) { var inScope; inScope = param$.inScope; - if (!(this.target['instanceof'](CS.ArrayInitialiser) && this.target.members.length === 0)) + if (!(this.target['instanceof'](CS.ArrayInitialiser) && this.target.members.length === 0)) { return this; + } return new CS.SeqOp(declarationsFor(this, inScope), new CS.ArrayInitialiser([]).g()); } ], @@ -543,8 +557,9 @@ exports.Optimiser = function () { function (param$) { var inScope; inScope = param$.inScope; - if (!(this.isOwn && this.target['instanceof'](CS.ObjectInitialiser) && this.target.members.length === 0)) + if (!(this.isOwn && this.target['instanceof'](CS.ObjectInitialiser) && this.target.members.length === 0)) { return this; + } return new CS.SeqOp(declarationsFor(this, inScope), new CS.ArrayInitialiser([]).g()); } ], @@ -554,24 +569,27 @@ exports.Optimiser = function () { function (param$) { var inScope; inScope = param$.inScope; - if (!isFalsey(this.filter)) + if (!isFalsey(this.filter)) { return this; + } return new CS.SeqOp(declarationsFor(this, inScope), new CS.ArrayInitialiser([]).g()); } ], [ CS.ForIn, function () { - if (!isTruthy(this.filter)) + if (!isTruthy(this.filter)) { return this; + } return new CS.ForIn(this.valAssignee, this.keyAssignee, this.target, this.step, null, this.body); } ], [ CS.ForOf, function () { - if (!isTruthy(this.filter)) + if (!isTruthy(this.filter)) { return this; + } return new CS.ForOf(this.isOwn, this.keyAssignee, this.valAssignee, this.target, null, this.body); } ], @@ -664,8 +682,9 @@ exports.Optimiser = function () { function (param$) { var ancestry; ancestry = param$.ancestry; - if (!((null != ancestry[0] ? ancestry[0]['instanceof'](CS.Functions) : void 0) && ancestry[0].body === this)) + if (!((null != ancestry[0] ? ancestry[0]['instanceof'](CS.Functions) : void 0) && ancestry[0].body === this)) { return this; + } if (this.right['instanceof'](CS.Return) && null != this.right.expression) { return new CS.SeqOp(this.left, this.right.expression); } else if (this.right['instanceof'](CS.Undefined)) { @@ -679,8 +698,9 @@ exports.Optimiser = function () { CS.Function, CS.BoundFunction, function () { - if (!(null != this.block && (this.block['instanceof'](CS.Undefined) || this.block['instanceof'](CS.Return) && !(null != this.block.expression)))) + if (!(null != this.block && (this.block['instanceof'](CS.Undefined) || this.block['instanceof'](CS.Return) && !(null != this.block.expression)))) { return this; + } return new this.constructor(this.parameters, null); } ], @@ -789,16 +809,19 @@ exports.Optimiser = function () { return walk.call(ast, function (param$) { var ancestry, memo, rule; ancestry = param$.ancestry; - if (!(null != this) || this === global) + if (!(null != this) || this === global) { throw new Error('Optimiser rules must produce a node. `null` is not a node.'); - if (in$(this, ancestry)) + } + if (in$(this, ancestry)) { return this; + } memo = this; for (var cache$2 = null != rules[memo.className] ? rules[memo.className] : [], i$ = 0, length$ = cache$2.length; i$ < length$; ++i$) { rule = cache$2[i$]; memo = rule.apply(memo, arguments); - if (memo !== this) + if (memo !== this) { break; + } } return memo; }); diff --git a/lib/parser.js b/lib/parser.js index 22a9efdc..e9fa7537 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -78,8 +78,9 @@ module.exports = (function() { return true; return false; }}, - peg$c10 = function(left, right) {if (!right) + peg$c10 = function(left, right) {if (!right) { return left; + } return rp(new CS.SeqOp(left, right)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); @@ -405,8 +406,9 @@ module.exports = (function() { peg$c82 = /^[+-\/]/, peg$c83 = { type: "class", value: "[+-\\/]", description: "[+-\\/]" }, peg$c84 = function(e, es, obj) {es.unshift(e); - if (null != obj) + if (null != obj) { es.push(obj); + } return es; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); @@ -442,8 +444,9 @@ module.exports = (function() { return false; }}, peg$c87 = function(fn, accesses, secondaryArgs) {var secondaryCtor, soaked; - if (null != accesses) + if (null != accesses) { fn = createMemberExpression(fn, accesses); + } if (secondaryArgs) { soaked = secondaryArgs[0]; secondaryCtor = soaked ? CS.SoakedFunctionApplication : CS.FunctionApplication; @@ -879,8 +882,9 @@ module.exports = (function() { }}, peg$c149 = ":", peg$c150 = { type: "literal", value: ":", description: "\":\"" }, - peg$c151 = function(key, fn) {if (fn['instanceof'](CS.BoundFunction)) + peg$c151 = function(key, fn) {if (fn['instanceof'](CS.BoundFunction)) { fn = c(new CS.Function(fn.parameters, fn.body).r(fn.raw), fn); + } return rp(new CS.Constructor(fn)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); @@ -1549,13 +1553,15 @@ module.exports = (function() { peg$c287 = /^[gimy]/, peg$c288 = { type: "class", value: "[gimy]", description: "[gimy]" }, peg$c289 = function(es, flags) {var interp; - if (!isValidRegExpFlags(flags)) + if (!isValidRegExpFlags(flags)) { throw new SyntaxError(['regular expression flags'], 'regular expression flags', offset(), line(), column()); + } interp = createInterpolation(foldl(function (memo, e) { return memo.concat(e); }, [], es)); - if (interp instanceof CS.String) + if (interp instanceof CS.String) { return p(new CS.RegExp(interp.data, flags)); + } return rp(new CS.HeregExp(interp, flags)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); @@ -1570,8 +1576,9 @@ module.exports = (function() { peg$c291 = { type: "literal", value: "/", description: "\"/\"" }, peg$c292 = /^[^\/\\[\n]/, peg$c293 = { type: "class", value: "[^\\/\\\\[\\n]", description: "[^\\/\\\\[\\n]" }, - peg$c294 = function(d, flags) {if (!isValidRegExpFlags(flags)) + peg$c294 = function(d, flags) {if (!isValidRegExpFlags(flags)) { throw new SyntaxError(['regular expression flags'], 'regular expression flags', offset(), line(), column()); + } return rp(new CS.RegExp(d, flags)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); @@ -19728,8 +19735,9 @@ module.exports = (function() { }; foldBinaryExpr = function (parts, ignoreChains) { var chainStack, expr, leftOperand, nextOp, nextPrec, operator, prec, rightOperand, stack; - if (parts.length < 3) + if (parts.length < 3) { return parts[0]; + } stack = [].slice.call(parts, 0, 3); parts = [].slice.call(parts, 3); while (parts.length > 0) { @@ -19747,8 +19755,9 @@ module.exports = (function() { nextPrec = precedenceTable[nextOp]; prec = precedenceTable[operator]; } - if (!(null != nextOp && (nextPrec > prec || in$(nextOp, chainableComparisonOps)))) + if (!(null != nextOp && (nextPrec > prec || in$(nextOp, chainableComparisonOps)))) { break; + } } stack.push(new CS.ChainedComparisonOp(foldBinaryExpr(chainStack, true))); continue; @@ -19811,16 +19820,19 @@ module.exports = (function() { }; isValidRegExpFlags = function (flags) { var f, flag; - if (!flags) + if (!flags) { return true; - if (flags.length > 4) + } + if (flags.length > 4) { return false; + } flags.sort(); flag = null; for (var i$1 = 0, length$1 = flags.length; i$1 < length$1; ++i$1) { f = flags[i$1]; - if (flag === f) + if (flag === f) { return false; + } flag = f; } return true; @@ -19835,11 +19847,13 @@ module.exports = (function() { wholeMatch = cache$[0]; attempt = cache$[1]; matchStr = matchStr.slice(match.index + wholeMatch.length); - if (!(null != indent) || 0 < attempt.length && attempt.length < indent.length) + if (!(null != indent) || 0 < attempt.length && attempt.length < indent.length) { indent = attempt; + } } - if (indent) + if (indent) { str = str.replace(new RegExp('\\n' + indent, 'g'), '\n'); + } str = str.replace(/^\n/, ''); return str; }; @@ -19850,31 +19864,36 @@ module.exports = (function() { piece = pieces[i$1]; index = i$1; if (piece instanceof CS.String) { - if (index === pieces.length - 1) + if (index === pieces.length - 1) { piece.data = piece.data.replace(/\s+$/, ''); + } matchStr = piece.data; while (match = /\n+([^\n\S]*)/.exec(matchStr)) { cache$ = match; wholeMatch = cache$[0]; attempt = cache$[1]; matchStr = matchStr.slice(match.index + wholeMatch.length); - if (!(null != indent) || 0 < attempt.length && attempt.length < indent.length) + if (!(null != indent) || 0 < attempt.length && attempt.length < indent.length) { indent = attempt; + } } } } - if (indent) + if (indent) { for (var i$2 = 0, length$2 = pieces.length; i$2 < length$2; ++i$2) { piece = pieces[i$2]; index = i$2; if (piece instanceof CS.String) { piece.data = piece.data.replace(new RegExp('\\n' + indent, 'g'), '\n'); - if (index === pieces.length - 1) + if (index === pieces.length - 1) { piece.data = piece.data.replace(/(\n\s*)+$/, ''); - if (index === 0) + } + if (index === 0) { piece.data = piece.data.replace(/^\n/, ''); + } } } + } return pieces; }; r = function (node) { @@ -19899,8 +19918,9 @@ module.exports = (function() { id = function (x) { return x; }; - if (!options.raw) + if (!options.raw) { r = p = rp = id; + } eval('\n // XXX: this overrides the function with the same name generated by PEGjs; see comment within\n function peg$computePosDetails() {\n function advanceCachedReportedPos() {\n var ch;\n\n for (; peg$cachedPos < peg$reportedPos; peg$cachedPos++) {\n ch = input.charAt(peg$cachedPos);\n if (ch === "\\n") {\n if (!peg$cachedPosDetails.seenCR) { peg$cachedPosDetails.line++; }\n peg$cachedPosDetails.column = 1;\n peg$cachedPosDetails.seenCR = false;\n } else if (ch === "\\r" || ch === "\\u2028" || ch === "\\u2029") {\n peg$cachedPosDetails.line++;\n peg$cachedPosDetails.column = 1;\n peg$cachedPosDetails.seenCR = true;\n // XXX: strip control characters when calculating position information; see #117\n } else if(!/[\\uEFEF\\uEFFE\\uEFFF]/.test(ch)) {\n peg$cachedPosDetails.column++;\n peg$cachedPosDetails.seenCR = false;\n }\n }\n }\n\n if (peg$cachedPos !== peg$reportedPos) {\n if (peg$cachedPos > peg$reportedPos) {\n peg$cachedPos = 0;\n peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };\n }\n advanceCachedReportedPos();\n }\n\n return peg$cachedPosDetails;\n }\n '); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); diff --git a/lib/preprocessor.js b/lib/preprocessor.js index 3450a9d5..45378b9d 100644 --- a/lib/preprocessor.js +++ b/lib/preprocessor.js @@ -82,34 +82,40 @@ this.Preprocessor = Preprocessor = function () { this.context.push(c); break; case DEDENT: - if (!(top === INDENT)) + if (!(top === INDENT)) { this.err(c); + } this.indents.pop(); this.context.pop(); break; case '\n': - if (!(top === '#' || top === 'heregexp-#')) + if (!(top === '#' || top === 'heregexp-#')) { this.err(c); + } this.context.pop(); break; case ']': - if (!(top === '[' || top === 'regexp-[' || top === 'heregexp-[')) + if (!(top === '[' || top === 'regexp-[' || top === 'heregexp-[')) { this.err(c); + } this.context.pop(); break; case ')': - if (!(top === '(' || top === 'regexp-(' || top === 'heregexp-(')) + if (!(top === '(' || top === 'regexp-(' || top === 'heregexp-(')) { this.err(c); + } this.context.pop(); break; case '}': - if (!(top === '#{' || top === '{' || top === 'regexp-{' || top === 'heregexp-{')) + if (!(top === '#{' || top === '{' || top === 'regexp-{' || top === 'heregexp-{')) { this.err(c); + } this.context.pop(); break; case 'end-\\': - if (!(top === '\\')) + if (!(top === '\\')) { this.err(c); + } this.context.pop(); break; default: @@ -118,8 +124,9 @@ this.Preprocessor = Preprocessor = function () { return this.context; }; Preprocessor.prototype.p = function (s) { - if (null != s) + if (null != s) { this.preprocessed = '' + this.preprocessed + s; + } return s; }; Preprocessor.prototype.scan = function (r) { @@ -174,14 +181,16 @@ this.Preprocessor = Preprocessor = function () { spaceBefore = new RegExp('[' + ws + ']').test(lastChar); impliedRegexp = /[;,=><*%^&|[(+!~-]/.test(lastChar); } - if (pos === 1 || impliedRegexp || spaceBefore && !this.ss.check(new RegExp('[' + ws + '=]')) && this.ss.check(/[^\r\n]*\//)) + if (pos === 1 || impliedRegexp || spaceBefore && !this.ss.check(new RegExp('[' + ws + '=]')) && this.ss.check(/[^\r\n]*\//)) { return this.observe('/'); + } } }; Preprocessor.prototype.process = function (input) { var tok; - if (this.options.literate) + if (this.options.literate) { input = input.replace(/^( {0,3}\S)/gm, ' #$1'); + } this.ss = new StringScanner(input); while (!this.ss.eos()) { switch (this.peek()) { @@ -228,8 +237,9 @@ this.Preprocessor = Preprocessor = function () { } break; case '\\': - if (this.scan(/[\s\S]/)) + if (this.scan(/[\s\S]/)) { this.observe('end-\\'); + } break; case '"""': this.scan(/(?:[^"#\\]+|""?(?!")|#(?!{)|\\.)+/); @@ -243,35 +253,41 @@ this.Preprocessor = Preprocessor = function () { case '"': this.scan(/(?:[^"#\\]+|#(?!{)|\\.)+/); this.ss.scan(/\\\n/); - if (tok = this.scan(/#{|"/)) + if (tok = this.scan(/#{|"/)) { this.observe(tok); + } break; case "'''": this.scan(/(?:[^'\\]+|''?(?!')|\\.)+/); this.ss.scan(/\\\n/); - if (tok = this.scan(/'''/)) + if (tok = this.scan(/'''/)) { this.observe(tok); + } break; case "'": this.scan(/(?:[^'\\]+|\\.)+/); this.ss.scan(/\\\n/); - if (tok = this.scan(/'/)) + if (tok = this.scan(/'/)) { this.observe(tok); + } break; case '###': this.scan(/(?:[^#]+|##?(?!#))+/); - if (tok = this.scan(/###/)) + if (tok = this.scan(/###/)) { this.observe(tok); + } break; case '#': this.scan(/[^\n]+/); - if (tok = this.scan(/\n/)) + if (tok = this.scan(/\n/)) { this.observe(tok); + } break; case '`': this.scan(/[^`]+/); - if (tok = this.scan(/`/)) + if (tok = this.scan(/`/)) { this.observe(tok); + } break; case '///': this.scan(/(?:[^[/#\\]+|\/\/?(?!\/)|\\.)+/); @@ -285,13 +301,15 @@ this.Preprocessor = Preprocessor = function () { break; case 'heregexp-[': this.scan(/(?:[^\]\/\\]+|\/\/?(?!\/))+/); - if (tok = this.scan(/[\]\\]|#{|\/\/\//)) + if (tok = this.scan(/[\]\\]|#{|\/\/\//)) { this.observe(tok); + } break; case 'heregexp-#': this.ss.scan(/(?:[^\n/]+|\/\/?(?!\/))+/); - if (tok = this.scan(/\n|\/\/\//)) + if (tok = this.scan(/\n|\/\/\//)) { this.observe(tok); + } break; case '/': this.scan(/[^[/\\]+/); @@ -303,8 +321,9 @@ this.Preprocessor = Preprocessor = function () { break; case 'regexp-[': this.scan(/[^\]\\]+/); - if (tok = this.scan(/[\]\\]/)) + if (tok = this.scan(/[\]\\]/)) { this.observe(tok); + } } } this.scan(new RegExp('[' + ws + '\\n]*$')); diff --git a/lib/repl.js b/lib/repl.js index eb71c11f..4d847841 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -35,8 +35,9 @@ addMultilineHandler = function (repl) { } }); return inputStream.on('keypress', function (char, key) { - if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) + if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { return; + } if (enabled) { if (!buffer.match(/\n/)) { enabled = !enabled; @@ -44,8 +45,9 @@ addMultilineHandler = function (repl) { rli.prompt(true); return; } - if (null != rli.line && !rli.line.match(/^\s*$/)) + if (null != rli.line && !rli.line.match(/^\s*$/)) { return; + } enabled = !enabled; rli.line = ''; rli.cursor = 0; @@ -68,13 +70,16 @@ addHistory = function (repl, filename, maxSize) { size = Math.min(maxSize, stat.size); readFd = fs.openSync(filename, 'r'); buffer = new Buffer(size); - if (size) + if (size) { fs.readSync(readFd, buffer, 0, size, stat.size - size); + } repl.rli.history = buffer.toString().split('\n').reverse(); - if (stat.size > maxSize) + if (stat.size > maxSize) { repl.rli.history.pop(); - if (repl.rli.history[0] === '') + } + if (repl.rli.history[0] === '') { repl.rli.history.shift(); + } repl.rli.historyIndex = -1; } catch (e$) { e = e$; @@ -138,8 +143,9 @@ module.exports = { input = input.replace(/\uFF00/g, '\n'); input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); input = input.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, '$1$2$3'); - if (/^\s*$/.test(input)) + if (/^\s*$/.test(input)) { return cb(null); + } try { inputAst = CoffeeScript.parse(input, { filename: filename, @@ -162,8 +168,9 @@ module.exports = { return repl.outputStream.write('\n'); }); addMultilineHandler(repl); - if (opts.historyFile) + if (opts.historyFile) { addHistory(repl, opts.historyFile, opts.historyMaxInputSize); + } repl.commands[getCommandId(repl, 'load')].help = 'Load code from a file into this REPL session'; return repl; } diff --git a/lib/run.js b/lib/run.js index a567eb11..5f880347 100644 --- a/lib/run.js +++ b/lib/run.js @@ -6,8 +6,9 @@ CoffeeScript = require('./module'); SourceMapConsumer = require('source-map').SourceMapConsumer; patched = false; patchStackTrace = function () { - if (patched) + if (patched) { return; + } patched = true; if (null != Module._sourceMaps) Module._sourceMaps; @@ -30,8 +31,9 @@ patchStackTrace = function () { frames = function (accum$) { for (var i$ = 0, length$ = stack.length; i$ < length$; ++i$) { frame = stack[i$]; - if (frame.getFunction() === exports.runMain) + if (frame.getFunction() === exports.runMain) { break; + } accum$.push(' at ' + formatSourcePosition(frame, getSourceMapping)); } return accum$; @@ -48,8 +50,9 @@ formatSourcePosition = function (frame, getSourceMapping) { } else { if (frame.isEval()) { fileName = frame.getScriptNameOrSourceURL(); - if (!fileName) + if (!fileName) { fileLocation = '' + frame.getEvalOrigin() + ', '; + } } else { fileName = frame.getFileName(); } @@ -67,10 +70,12 @@ formatSourcePosition = function (frame, getSourceMapping) { typeName = frame.getTypeName(); if (functionName) { tp = as = ''; - if (typeName && functionName.indexOf(typeName)) + if (typeName && functionName.indexOf(typeName)) { tp = '' + typeName + '.'; - if (methodName && functionName.indexOf('.' + methodName) !== functionName.length - methodName.length - 1) + } + if (methodName && functionName.indexOf('.' + methodName) !== functionName.length - methodName.length - 1) { as = ' [as ' + methodName + ']'; + } return '' + tp + functionName + as + ' (' + fileLocation + ')'; } else { return '' + typeName + '.' + (methodName || '') + ' (' + fileLocation + ')'; diff --git a/src/compiler.coffee b/src/compiler.coffee index 23af0019..cf5b464d 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -1,4 +1,4 @@ -{find, any, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union} = require './functional-helpers' +{find, any, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union, zip} = require './functional-helpers' {beingDeclared, usedAsExpression, envEnrichments} = require './helpers' CS = require './nodes' JS = require './js-nodes' @@ -46,7 +46,7 @@ expr = (s) -> else if s.instanceof JS.ExpressionStatement s.expression else if s.instanceof JS.ThrowStatement - new JS.CallExpression (new JS.FunctionExpression null, [], forceBlock s), [] + new JS.CallExpression (funcExpr body: (forceBlock s)), [] else if s.instanceof JS.IfStatement consequent = expr (s.consequent ? helpers.undef()) alternate = expr (s.alternate ? helpers.undef()) @@ -64,11 +64,11 @@ expr = (s) -> else s.body.body.push push helpers.undef() block = new JS.BlockStatement [s, new JS.ReturnStatement accum] - iife = new JS.FunctionExpression null, [accum], block + iife = funcExpr params: [accum], body: block new JS.CallExpression (memberAccess iife.g(), 'call'), [new JS.ThisExpression, new JS.ArrayExpression []] else if s.instanceof JS.SwitchStatement, JS.TryStatement block = new JS.BlockStatement [makeReturn s] - iife = new JS.FunctionExpression null, [], block + iife = funcExpr body: block new JS.CallExpression (memberAccess iife.g(), 'call'), [new JS.ThisExpression] else # TODO: comprehensive @@ -104,7 +104,8 @@ generateMutatingWalker = (fn) -> (node, args...) -> node[childName] = if childName in node.listMembers for n in node[childName] - fn.apply n, args + if n? + fn.apply n, args else fn.apply node[childName], args node @@ -338,7 +339,7 @@ helpers = result = new JS.Identifier 'result' block = [ new JS.VariableDeclaration 'var', [ - new JS.VariableDeclarator fn, new JS.FunctionExpression null, [], new JS.BlockStatement [] + new JS.VariableDeclarator fn, (funcExpr body: (new JS.BlockStatement [])) ] new JS.AssignmentExpression '=', (memberAccess fn, 'prototype'), memberAccess ctor, 'prototype' new JS.VariableDeclaration 'var', [ @@ -399,10 +400,11 @@ findES6Methods = (classIdentifier, body) -> else if expression.left.object instanceof JS.ThisExpression properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) else - debugger rest.push(statement) { methods, properties, rest } +funcExpr = ({id, params, defaults, rest, body}) -> + new JS.FunctionExpression(id ? null, params ? [], defaults ? [], rest ? null, body) class exports.Compiler @@ -429,7 +431,7 @@ class exports.Compiler block.unshift makeVarDeclaration decls else # add a function wrapper - block = [stmt new JS.UnaryExpression 'void', new JS.CallExpression (memberAccess (new JS.FunctionExpression null, [], new JS.BlockStatement block), 'call'), [new JS.ThisExpression]] + block = [stmt new JS.UnaryExpression 'void', new JS.CallExpression (memberAccess (funcExpr body: new JS.BlockStatement(block)), 'call'), [new JS.ThisExpression]] # generate node pkg = require './../package.json' program = new JS.Program block @@ -455,7 +457,7 @@ class exports.Compiler alternate = forceBlock alternate unless alternate.instanceof JS.IfStatement if alternate? or ancestry[0]?.instanceof CS.Conditional consequent = forceBlock consequent - new JS.IfStatement (expr condition), (stmt consequent), alternate + new JS.IfStatement (expr condition), (forceBlock consequent), alternate ] [CS.ForIn, ({valAssignee, keyAssignee, target, step, filter, body, compile}) -> i = genSym 'i' @@ -591,9 +593,9 @@ class exports.Compiler body.push new JS.ForStatement vars, condition, update, stmt new JS.CallExpression (memberAccess accum, 'push'), [i] body.push new JS.ReturnStatement accum if any ancestry, (ancestor) -> ancestor.instanceof CS.Functions - new JS.CallExpression (memberAccess (new JS.FunctionExpression null, [], new JS.BlockStatement body), 'apply'), [new JS.ThisExpression, new JS.Identifier 'arguments'] + new JS.CallExpression (memberAccess (funcExpr body: new JS.BlockStatement body), 'apply'), [new JS.ThisExpression, new JS.Identifier 'arguments'] else - new JS.CallExpression (memberAccess (new JS.FunctionExpression null, [], new JS.BlockStatement body), 'call'), [new JS.ThisExpression] + new JS.CallExpression (memberAccess (funcExpr body: new JS.BlockStatement body), 'call'), [new JS.ThisExpression] ] [CS.ArrayInitialiser, do -> groupMembers = (members) -> @@ -623,7 +625,7 @@ class exports.Compiler [CS.DefaultParam, ({param, default: d}) -> {param, default: d}] [CS.Function, CS.BoundFunction, do -> - handleParam = (param, original, block, inScope) -> switch + handleParam = (param, original, block, inScope, options) -> switch when original.instanceof CS.Rest then param # keep these for special processing later when original.instanceof CS.Identifier then param when original.instanceof CS.MemberAccessOps, CS.ObjectInitialiser, CS.ArrayInitialiser @@ -633,8 +635,9 @@ class exports.Compiler block.body.unshift makeVarDeclaration decls if decls.length p when original.instanceof CS.DefaultParam - p = handleParam.call this, param.param, original.param, block, inScope - block.body.unshift new JS.IfStatement (new JS.BinaryExpression '==', (new JS.Literal null), p), stmt assignment p, param.default + p = handleParam.call this, param.param, original.param, block, inScope, options + if !options.targetES6 + block.body.unshift new JS.IfStatement (new JS.BinaryExpression '==', (new JS.Literal null), p), stmt assignment p, param.default p else throw new Error "Unsupported parameter type: #{original.className}" @@ -646,12 +649,21 @@ class exports.Compiler if (last?.instanceof JS.ReturnStatement) and not last.argument? block.body = block.body[...-1] + defaults = if options.targetES6 + zip(parameters, @parameters).map ([param, original]) -> + if original instanceof CS.DefaultParam + param.default + else + null + else + [] + parameters_ = if parameters.length is 0 then [] else pIndex = parameters.length while pIndex-- - handleParam.call this, parameters[pIndex], @parameters[pIndex], block, inScope + handleParam.call this, parameters[pIndex], @parameters[pIndex], block, inScope, options parameters = parameters_.reverse() if parameters.length > 0 @@ -691,11 +703,11 @@ class exports.Compiler if @instanceof CS.BoundFunction if options.targetES6 if block.body.length == 1 && block.body[0] instanceof JS.ReturnStatement - fn = new JS.ArrowFunctionExpression parameters, [], rest, block.body[0].argument + fn = new JS.ArrowFunctionExpression parameters, defaults, rest, block.body[0].argument fn.expression = true return fn else - return new JS.ArrowFunctionExpression parameters, [], rest, block + return new JS.ArrowFunctionExpression parameters, defaults, rest, block else newThis = genSym 'this' rewriteThis = generateMutatingWalker -> @@ -706,9 +718,9 @@ class exports.Compiler else rewriteThis this rewriteThis block - fn = new JS.FunctionExpression null, parameters, block, rest + fn = funcExpr params:parameters, defaults:defaults, rest: rest, body: block if performedRewrite - new JS.CallExpression (new JS.FunctionExpression null, [newThis], new JS.BlockStatement [ + new JS.CallExpression (funcExpr params: [newThis], body: new JS.BlockStatement [ new JS.ReturnStatement fn ]), [new JS.ThisExpression] else fn @@ -719,7 +731,6 @@ class exports.Compiler [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options}) -> if options.targetES6 classIdentifier = new JS.Identifier(name.name) - debugger if parent parentIdentifier = new JS.Identifier(parent.name) { methods, properties, classProperties, rest } = findES6Methods(classIdentifier, forceBlock body) @@ -728,7 +739,7 @@ class exports.Compiler ctorIndex = i break rest.splice(ctorIndex, 1) - methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), new JS.FunctionExpression(ctor.id, ctor.params, ctor.body, ctor.rest)) + methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr(id: ctor.id, params: ctor.params, body: ctor.body, defaults: ctor.defaults, rest: ctor.rest)) # Emit our ES6 class if we were able to account for everything in its definition. Otherwise, fall through to the non-ES6 emulation if rest.length == 0 return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)) @@ -769,7 +780,7 @@ class exports.Compiler ps = (genSym() for _ in protoAssignOp.expression.parameters) member = memberAccess new JS.ThisExpression, memberName protoMember = memberAccess (memberAccess name, 'prototype'), memberName - fn = new JS.FunctionExpression null, ps, new JS.BlockStatement [ + fn = funcExpr params: ps, body: new JS.BlockStatement [ makeReturn new JS.CallExpression (memberAccess protoMember, 'apply'), [instance, new JS.Identifier 'arguments'] ] ctor.body.body.unshift stmt new JS.AssignmentExpression '=', member, fn @@ -787,7 +798,7 @@ class exports.Compiler else rewriteThis this rewriteThis block - iife = new JS.CallExpression (new JS.FunctionExpression null, params, block).g(), args + iife = new JS.CallExpression (funcExpr params: params, body: block).g(), args if nameAssignee? then assignment nameAssignee, iife else iife ] [CS.Constructor, ({expression}) -> diff --git a/src/functional-helpers.coffee b/src/functional-helpers.coffee index 3a0eafc8..ac374476 100644 --- a/src/functional-helpers.coffee +++ b/src/functional-helpers.coffee @@ -61,3 +61,8 @@ result = [[], []] result[+!fn item].push item for item in list result + +@zip = (listA, listB) -> + len = Math.max listA.length, listB.length + for i in [0...len] + [listA[i], listB[i]] diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index d23fe090..e3f9075e 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -56,7 +56,7 @@ nodeData = [ ['ForInStatement' , yes, ['left', 'right', 'body']] ['ForStatement' , yes, ['init', 'test', 'update', 'body']] ['FunctionDeclaration' , yes, ['id', 'params', 'body', 'rest']] - ['FunctionExpression' , no , ['id', 'params', 'body', 'rest']] + ['FunctionExpression' , no , ['id', 'params', 'defaults', 'rest', 'body']] ['GenSym' , no , ['ns', 'uniqueId']] ['Identifier' , no , ['name']] ['IfStatement' , yes, ['test', 'consequent', 'alternate']] @@ -130,7 +130,7 @@ handleLists BlockStatement, ['body'] handleLists CallExpression, ['arguments'] handleLists ClassBody, ['body'] handleLists FunctionDeclaration, ['params'] -handleLists FunctionExpression, ['params'] +handleLists FunctionExpression, ['params', 'defaults'] handleLists NewExpression, ['arguments'] handleLists ObjectExpression, ['properties'] handleLists Program, ['body'] From fa9f139f6dc946763533cce9020a75dac21a48f4 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 11:01:32 -0400 Subject: [PATCH 16/64] extend FunctionDeclration to support defaults This makes defaults & rest work in constructors --- lib/compiler.js | 90 +++++++++++++++++++++++++++----------- lib/js-nodes.js | 10 +++-- lib/pegjs-coffee-plugin.js | 3 +- src/compiler.coffee | 25 ++++++----- src/js-nodes.coffee | 4 +- 5 files changed, 91 insertions(+), 41 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index ac563b12..30fc024c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -272,9 +272,6 @@ collectIdentifiers = function (node) { switch (false) { case !!(null != node): return []; - case !!node['instanceof']: - debugger; - return []; case !node['instanceof'](JS.Identifier): return [node.name]; case !(node['instanceof'](JS.MemberExpression) && !node.computed): @@ -574,16 +571,23 @@ helpers = { key = new JS.Identifier('key'); block = [ new JS.ForInStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(key, null)]), parent, new JS.IfStatement(helpers.isOwn(parent, key), f = stmt(new JS.AssignmentExpression('=', new JS.MemberExpression(true, child, key), new JS.MemberExpression(true, parent, key))))), - new JS.FunctionDeclaration(ctor, [], new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', memberAccess(new JS.ThisExpression, 'constructor'), child))])), + funcDecl({ + id: ctor, + body: new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', memberAccess(new JS.ThisExpression, 'constructor'), child))]) + }), new JS.AssignmentExpression('=', protoAccess(ctor), protoAccess(parent)), new JS.AssignmentExpression('=', protoAccess(child), new JS.NewExpression(ctor, [])), new JS.AssignmentExpression('=', memberAccess(child, '__super__'), protoAccess(parent)), new JS.ReturnStatement(child) ]; - return new JS.FunctionDeclaration(helperNames['extends'], [ - child, - parent - ], new JS.BlockStatement(map(block, stmt))); + return funcDecl({ + id: helperNames['extends'], + params: [ + child, + parent + ], + body: new JS.BlockStatement(map(block, stmt)) + }); }, construct: function () { var args, block, child, ctor, fn, result; @@ -604,10 +608,14 @@ helpers = { ]), new JS.ReturnStatement(new JS.ConditionalExpression(new JS.BinaryExpression('===', result, new JS.CallExpression(new JS.Identifier('Object'), [result])), result, child)) ]; - return new JS.FunctionDeclaration(helperNames.construct, [ - ctor, - args - ], new JS.BlockStatement(map(block, stmt))); + return funcDecl({ + id: helperNames.construct, + params: [ + ctor, + args + ], + body: new JS.BlockStatement(map(block, stmt)) + }); }, isOwn: function () { var args, functionBody, hop, params; @@ -617,7 +625,11 @@ helpers = { new JS.Identifier('p') ]; functionBody = [new JS.CallExpression(memberAccess(hop, 'call'), args)]; - return new JS.FunctionDeclaration(helperNames.isOwn, params, makeReturn(new JS.BlockStatement(map(functionBody, stmt)))); + return funcDecl({ + id: helperNames.isOwn, + params: params, + body: makeReturn(new JS.BlockStatement(map(functionBody, stmt))) + }); }, 'in': function () { var functionBody, i, length, list, loopBody, member, varDeclaration; @@ -634,10 +646,14 @@ helpers = { new JS.ForStatement(varDeclaration, new JS.BinaryExpression('<', i, length), new JS.UpdateExpression('++', true, i), loopBody), new JS.Literal(false) ]; - return new JS.FunctionDeclaration(helperNames['in'], [ - member, - list - ], makeReturn(new JS.BlockStatement(map(functionBody, stmt)))); + return funcDecl({ + id: helperNames['in'], + params: [ + member, + list + ], + body: makeReturn(new JS.BlockStatement(map(functionBody, stmt))) + }); } }; enabledHelpers = []; @@ -691,7 +707,6 @@ findES6Methods = function (classIdentifier, body) { properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); } } else { - debugger; rest.push(statement); } } @@ -713,6 +728,18 @@ funcExpr = function (param$) { } return new JS.FunctionExpression(null != id ? id : null, null != params ? params : [], null != defaults ? defaults : [], null != rest ? rest : null, body); }; +funcDecl = function (param$) { + var body, cache$2, defaults, id, params, rest; + { + cache$2 = param$; + id = cache$2.id; + params = cache$2.params; + defaults = cache$2.defaults; + rest = cache$2.rest; + body = cache$2.body; + } + return new JS.FunctionDeclaration(null != id ? id : null, null != params ? params : [], null != defaults ? defaults : [], null != rest ? rest : null, body); +}; exports.Compiler = function () { Compiler.compile = function (this$) { return function () { @@ -724,7 +751,7 @@ exports.Compiler = function () { [ CS.Program, function (param$) { - var block, body, cache$2, cache$3, decls, fnDeclHelpers, inScope, options, otherHelpers, pkg, program; + var block, body, cache$2, cache$3, decls, ecmaMode, fnDeclHelpers, inScope, options, otherHelpers, pkg, program; { cache$2 = param$; body = cache$2.body; @@ -753,9 +780,10 @@ exports.Compiler = function () { } pkg = require('./../package.json'); program = new JS.Program(block); + ecmaMode = options.targetES6 ? '-es6' : ''; program.leadingComments = [{ type: 'Line', - value: ' Generated by CoffeeScript ' + pkg.version + value: ' Generated by CoffeeScript ' + pkg.version + ecmaMode }]; return program; } @@ -1380,7 +1408,6 @@ exports.Compiler = function () { } if (options.targetES6) { classIdentifier = new JS.Identifier(name.name); - debugger; if (parent) { parentIdentifier = new JS.Identifier(parent.name); } @@ -1436,7 +1463,10 @@ exports.Compiler = function () { new JS.Identifier('arguments') ]))); } - ctor = new JS.FunctionDeclaration(name, [], ctorBody); + ctor = funcDecl({ + id: name, + body: ctorBody + }); ctorIndex = 0; block.body.unshift(ctor); } @@ -1507,10 +1537,20 @@ exports.Compiler = function () { var expression, tmpName; expression = param$.expression; tmpName = genSym('class'); + debugger; if (this.expression['instanceof'](CS.Functions)) { - return new JS.FunctionDeclaration(tmpName, expression.params, forceBlock(expression.body)); + return funcDecl({ + id: tmpName, + params: expression.params, + defaults: expression.defaults, + rest: expression.rest, + body: forceBlock(expression.body) + }); } else { - return new JS.FunctionDeclaration(tmpName, [], new JS.BlockStatement([])); + return funcDecl({ + id: tmpName, + body: new JS.BlockStatement([]) + }); } } ], diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 546883f2..f9146ba9 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -215,8 +215,9 @@ nodeData = [ [ 'id', 'params', - 'body', - 'rest' + 'defaults', + 'rest', + 'body' ] ], [ @@ -488,7 +489,10 @@ handleLists(ArrowFunctionExpression, [ handleLists(BlockStatement, ['body']); handleLists(CallExpression, ['arguments']); handleLists(ClassBody, ['body']); -handleLists(FunctionDeclaration, ['params']); +handleLists(FunctionDeclaration, [ + 'params', + 'defaults' +]); handleLists(FunctionExpression, [ 'params', 'defaults' diff --git a/lib/pegjs-coffee-plugin.js b/lib/pegjs-coffee-plugin.js index 5c714df8..f8728b2e 100644 --- a/lib/pegjs-coffee-plugin.js +++ b/lib/pegjs-coffee-plugin.js @@ -7,8 +7,9 @@ compile = function (csCode, options) { if (null == options) options = {}; csAST = CoffeeScript.parse('-> ' + csCode.trimRight()); - if (csAST.body.statements.length > 1) + if (csAST.body.statements.length > 1) { throw new Error('inconsistent base indentation'); + } jsAST = CoffeeScript.compile(csAST, { bare: true, inScope: options.inScope diff --git a/src/compiler.coffee b/src/compiler.coffee index cf5b464d..bc8b7caf 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -322,15 +322,15 @@ helpers = block = [ new JS.ForInStatement (new JS.VariableDeclaration 'var', [new JS.VariableDeclarator key, null]), parent, new JS.IfStatement (helpers.isOwn parent, key), f = # TODO: figure out how we can allow this stmt new JS.AssignmentExpression '=', (new JS.MemberExpression yes, child, key), new JS.MemberExpression yes, parent, key - new JS.FunctionDeclaration ctor, [], new JS.BlockStatement [ + funcDecl(id: ctor , body: new JS.BlockStatement [ stmt new JS.AssignmentExpression '=', (memberAccess new JS.ThisExpression, 'constructor'), child - ] + ]) new JS.AssignmentExpression '=', (protoAccess ctor), protoAccess parent new JS.AssignmentExpression '=', (protoAccess child), new JS.NewExpression ctor, [] new JS.AssignmentExpression '=', (memberAccess child, '__super__'), protoAccess parent new JS.ReturnStatement child ] - new JS.FunctionDeclaration helperNames.extends, [child, parent], new JS.BlockStatement map block, stmt + funcDecl(id: helperNames.extends, params: [child, parent], body: (new JS.BlockStatement map block, stmt)) construct: -> child = new JS.Identifier 'child' ctor = new JS.Identifier 'ctor' @@ -348,12 +348,12 @@ helpers = ] new JS.ReturnStatement new JS.ConditionalExpression (new JS.BinaryExpression '===', result, new JS.CallExpression (new JS.Identifier 'Object'), [result]), result, child ] - new JS.FunctionDeclaration helperNames.construct, [ctor, args], new JS.BlockStatement map block, stmt + funcDecl(id: helperNames.construct, params: [ctor, args], body: (new JS.BlockStatement map block, stmt)) isOwn: -> hop = memberAccess (new JS.ObjectExpression []), 'hasOwnProperty' params = args = [(new JS.Identifier 'o'), new JS.Identifier 'p'] functionBody = [new JS.CallExpression (memberAccess hop, 'call'), args] - new JS.FunctionDeclaration helperNames.isOwn, params, makeReturn new JS.BlockStatement map functionBody, stmt + funcDecl(id: helperNames.isOwn, params: params, body: (makeReturn new JS.BlockStatement map functionBody, stmt)) in: -> member = new JS.Identifier 'member' list = new JS.Identifier 'list' @@ -368,7 +368,7 @@ helpers = new JS.ForStatement varDeclaration, (new JS.BinaryExpression '<', i, length), (new JS.UpdateExpression '++', yes, i), loopBody new JS.Literal no ] - new JS.FunctionDeclaration helperNames.in, [member, list], makeReturn new JS.BlockStatement map functionBody, stmt + funcDecl(id: helperNames.in, params: [member, list], body: (makeReturn new JS.BlockStatement map functionBody, stmt)) enabledHelpers = [] for own h, fn of helpers @@ -406,6 +406,9 @@ findES6Methods = (classIdentifier, body) -> funcExpr = ({id, params, defaults, rest, body}) -> new JS.FunctionExpression(id ? null, params ? [], defaults ? [], rest ? null, body) +funcDecl = ({id, params, defaults, rest, body}) -> + new JS.FunctionDeclaration(id ? null, params ? [], defaults ? [], rest ? null, body) + class exports.Compiler @compile = => (new this).compile arguments... @@ -435,9 +438,10 @@ class exports.Compiler # generate node pkg = require './../package.json' program = new JS.Program block + ecmaMode = if options.targetES6 then '-es6' else '' program.leadingComments = [ type: 'Line' - value: " Generated by CoffeeScript #{pkg.version}" + value: " Generated by CoffeeScript #{pkg.version}#{ecmaMode}" ] program ] @@ -763,7 +767,7 @@ class exports.Compiler ctorBody.body.push stmt new JS.CallExpression (memberAccess parentRef, 'apply'), [ new JS.ThisExpression, new JS.Identifier 'arguments' ] - ctor = new JS.FunctionDeclaration name, [], ctorBody + ctor = funcDecl id: name, body: ctorBody ctorIndex = 0 block.body.unshift ctor ctor.id = name @@ -803,10 +807,11 @@ class exports.Compiler ] [CS.Constructor, ({expression}) -> tmpName = genSym 'class' + debugger if @expression.instanceof CS.Functions - new JS.FunctionDeclaration tmpName, expression.params, forceBlock expression.body + funcDecl id: tmpName, params: expression.params, defaults: expression.defaults, rest: expression.rest, body: (forceBlock expression.body) else - new JS.FunctionDeclaration tmpName, [], new JS.BlockStatement [] + funcDecl id: tmpName, body: (new JS.BlockStatement []) ] [CS.ClassProtoAssignOp, ({assignee, expression, compile}) -> if @expression.instanceof CS.BoundFunction diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index e3f9075e..8996238f 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -55,7 +55,7 @@ nodeData = [ ['ExpressionStatement' , yes, ['expression']] ['ForInStatement' , yes, ['left', 'right', 'body']] ['ForStatement' , yes, ['init', 'test', 'update', 'body']] - ['FunctionDeclaration' , yes, ['id', 'params', 'body', 'rest']] + ['FunctionDeclaration' , yes, ['id', 'params', 'defaults', 'rest', 'body']] ['FunctionExpression' , no , ['id', 'params', 'defaults', 'rest', 'body']] ['GenSym' , no , ['ns', 'uniqueId']] ['Identifier' , no , ['name']] @@ -129,7 +129,7 @@ handleLists ArrowFunctionExpression, ['params', 'defaults'] handleLists BlockStatement, ['body'] handleLists CallExpression, ['arguments'] handleLists ClassBody, ['body'] -handleLists FunctionDeclaration, ['params'] +handleLists FunctionDeclaration, ['params', 'defaults'] handleLists FunctionExpression, ['params', 'defaults'] handleLists NewExpression, ['arguments'] handleLists ObjectExpression, ['properties'] From eaa1517407ae513c283b568fddff9ed0f8fd14fd Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 13:20:58 -0400 Subject: [PATCH 17/64] targetES6: array destructuring --- src/compiler.coffee | 41 +++++++++++++++++++++++++---------------- src/js-nodes.coffee | 4 +++- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/compiler.coffee b/src/compiler.coffee index bc8b7caf..94c2c399 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -1,4 +1,4 @@ -{find, any, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union, zip} = require './functional-helpers' +{find, any, all, concat, concatMap, difference, divMod, foldl1, intersect, map, nub, owns, partition, span, union, zip} = require './functional-helpers' {beingDeclared, usedAsExpression, envEnrichments} = require './helpers' CS = require './nodes' JS = require './js-nodes' @@ -188,12 +188,21 @@ dynamicMemberAccess = (e, index) -> then memberAccess e, index.value else new JS.MemberExpression yes, (expr e), expr index +es6AssignmentPattern = (assignee) -> + # ES6 has a RestElement but it is not implemented yet in escodegen, so for now we only emit ES6 patterns that don't need it + if (assignee.instanceof JS.ArrayExpression) and all(assignee.elements, (elt) -> elt instanceof JS.Identifier) + new JS.ArrayPattern(assignee.elements) + # TODO: rewrite this whole thing using the CS AST nodes -assignment = (assignee, expression, valueUsed = no) -> +assignment = (assignee, expression, options, valueUsed = no) -> assignments = [] expression = expr expression switch when assignee.rest then # do nothing for right now + + when options.targetES6 and (es6Pattern = es6AssignmentPattern(assignee)) + assignments.push new JS.AssignmentExpression '=', es6Pattern, expression + when assignee.instanceof JS.ArrayExpression e = expression # TODO: only cache expression when it needs it @@ -206,7 +215,7 @@ assignment = (assignee, expression, valueUsed = no) -> for m, i in elements break if m.rest - assignments.push assignment m, (dynamicMemberAccess e, new JS.Literal i), valueUsed + assignments.push assignment m, (dynamicMemberAccess e, new JS.Literal i), options, valueUsed if elements.length > 0 # TODO: see if this logic can be combined with rest-parameter handling @@ -245,7 +254,7 @@ assignment = (assignee, expression, valueUsed = no) -> for m in assignee.properties propName = if m.key.instanceof JS.Identifier then new JS.Literal m.key.name else m.key - assignments.push assignment m.value, (dynamicMemberAccess e, propName), valueUsed + assignments.push assignment m.value, (dynamicMemberAccess e, propName), options, valueUsed when assignee.instanceof JS.Identifier, JS.GenSym, JS.MemberExpression assignments.push new JS.AssignmentExpression '=', assignee, expr expression @@ -463,7 +472,7 @@ class exports.Compiler consequent = forceBlock consequent new JS.IfStatement (expr condition), (forceBlock consequent), alternate ] - [CS.ForIn, ({valAssignee, keyAssignee, target, step, filter, body, compile}) -> + [CS.ForIn, ({valAssignee, keyAssignee, target, step, filter, body, compile, options}) -> i = genSym 'i' length = genSym 'length' block = forceBlock body @@ -505,12 +514,12 @@ class exports.Compiler # TODO: if block only has a single statement, wrap it instead of continuing block.body.unshift stmt new JS.IfStatement (new JS.UnaryExpression '!', filter), new JS.ContinueStatement if keyAssignee? - block.body.unshift stmt assignment keyAssignee, i + block.body.unshift stmt assignment keyAssignee, i, options if valAssignee? - block.body.unshift stmt assignment valAssignee, new JS.MemberExpression yes, e, i + block.body.unshift stmt assignment valAssignee, (new JS.MemberExpression yes, e, i), options new JS.ForStatement varDeclaration, (new JS.BinaryExpression '<', i, length), (increment i), block ] - [CS.ForOf, ({keyAssignee, valAssignee, target, filter, body}) -> + [CS.ForOf, ({keyAssignee, valAssignee, target, filter, body, options}) -> block = forceBlock body block.body.push stmt helpers.undef() unless block.body.length e = if @isOwn and needsCaching @target then genSym 'cache' else expr target @@ -518,7 +527,7 @@ class exports.Compiler # TODO: if block only has a single statement, wrap it instead of continuing block.body.unshift stmt new JS.IfStatement (new JS.UnaryExpression '!', filter), new JS.ContinueStatement if valAssignee? - block.body.unshift stmt assignment valAssignee, new JS.MemberExpression yes, e, keyAssignee + block.body.unshift stmt assignment valAssignee, (new JS.MemberExpression yes, e, keyAssignee), options if @isOwn block.body.unshift stmt new JS.IfStatement (new JS.UnaryExpression '!', helpers.isOwn e, keyAssignee), new JS.ContinueStatement right = if e is target then e else new JS.AssignmentExpression '=', e, target @@ -547,13 +556,13 @@ class exports.Compiler cases[cases.length - 1].consequent = block cases ] - [CS.Try, ({body, catchAssignee, catchBody, finallyBody}) -> + [CS.Try, ({body, catchAssignee, catchBody, finallyBody, options}) -> finallyBlock = if @finallyBody? then forceBlock finallyBody else null if @catchBody? or not @finallyBody? e = genSym 'e' catchBlock = forceBlock catchBody if catchAssignee? - catchBlock.body.unshift stmt assignment catchAssignee, e + catchBlock.body.unshift stmt assignment catchAssignee, e, options handlers = [new JS.CatchClause e, catchBlock] else handlers = [] @@ -635,13 +644,13 @@ class exports.Compiler when original.instanceof CS.MemberAccessOps, CS.ObjectInitialiser, CS.ArrayInitialiser p = genSym 'param' decls = map (intersect inScope, beingDeclared original), (i) -> new JS.Identifier i - block.body.unshift stmt assignment param, p + block.body.unshift stmt assignment param, p, options block.body.unshift makeVarDeclaration decls if decls.length p when original.instanceof CS.DefaultParam p = handleParam.call this, param.param, original.param, block, inScope, options if !options.targetES6 - block.body.unshift new JS.IfStatement (new JS.BinaryExpression '==', (new JS.Literal null), p), stmt assignment p, param.default + block.body.unshift new JS.IfStatement (new JS.BinaryExpression '==', (new JS.Literal null), p), stmt assignment p, param.default, options p else throw new Error "Unsupported parameter type: #{original.className}" @@ -803,7 +812,7 @@ class exports.Compiler rewriteThis block iife = new JS.CallExpression (funcExpr params: params, body: block).g(), args - if nameAssignee? then assignment nameAssignee, iife else iife + if nameAssignee? then assignment nameAssignee, iife, options else iife ] [CS.Constructor, ({expression}) -> tmpName = genSym 'class' @@ -822,8 +831,8 @@ class exports.Compiler ] # more complex operations - [CS.AssignOp, ({assignee, expression, ancestry}) -> - assignment assignee, expression, usedAsExpression this, ancestry + [CS.AssignOp, ({assignee, expression, ancestry, options}) -> + assignment assignee, expression, options, usedAsExpression this, ancestry ] [CS.CompoundAssignOp, ({assignee, expression, inScope}) -> op = switch @op diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 8996238f..e03ff5c6 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -38,6 +38,7 @@ createNode = (type, props) -> nodeData = [ # constructor name, isStatement, construction parameters ['ArrayExpression' , no , ['elements']] + ['ArrayPattern' , no , ['elements']] ['ArrowFunctionExpression',no, ['params', 'defaults', 'rest', 'body']] ['AssignmentExpression' , no , ['operator', 'left', 'right']] ['BinaryExpression' , no , ['operator', 'left', 'right']] @@ -92,7 +93,7 @@ for [node, isStatement, params] in nodeData { Program, BlockStatement, Literal, Identifier, FunctionExpression, - CallExpression, SequenceExpression, ArrayExpression, BinaryExpression, + CallExpression, SequenceExpression, ArrayExpression, ArrayPattern, BinaryExpression, UnaryExpression, NewExpression, VariableDeclaration, ObjectExpression, MemberExpression, UpdateExpression, AssignmentExpression, LogicalExpression, GenSym, FunctionDeclaration, VariableDeclaration, SwitchStatement, SwitchCase, @@ -125,6 +126,7 @@ handlePrimitives VariableDeclaration, ['kind'] handleLists = (ctor, listProps) -> ctor::listMembers = listProps handleLists ArrayExpression, ['elements'] +handleLists ArrayPattern, ['elements'] handleLists ArrowFunctionExpression, ['params', 'defaults'] handleLists BlockStatement, ['body'] handleLists CallExpression, ['arguments'] From fbacb64ab6513a5e5b8ee117d09812c876fa4978 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 13:32:32 -0400 Subject: [PATCH 18/64] smarter declaration detection that will cover arbitrarily deep assignment patterns --- lib/compiler.js | 76 ++++++++++++++++++++++++++++++++------------- lib/js-nodes.js | 9 +++++- src/compiler.coffee | 23 ++++++++++++-- 3 files changed, 83 insertions(+), 25 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 30fc024c..ffce59f3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,8 +1,9 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; +all = cache$.all; concat = cache$.concat; concatMap = cache$.concatMap; difference = cache$.difference; @@ -213,14 +214,33 @@ generateMutatingWalker = function (fn) { return node; }; }; +declaredIdentifiers = function (node) { + if (!(null != node)) { + return []; + } + if (node['instanceof'](JS.Identifier)) { + return [node]; + } else if (node['instanceof'](JS.MemberExpression)) { + return []; + } else { + return concatMap(node.childNodes, function (childName) { + if (!(null != node[childName])) { + return []; + } + if (in$(childName, node.listMembers)) { + return concatMap(node[childName], declaredIdentifiers); + } else { + return declaredIdentifiers(node[childName]); + } + }); + } +}; declarationsNeeded = function (node) { if (!(null != node)) { return []; } - if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' && node.left['instanceof'](JS.Identifier)) { - return [node.left]; - } else if (node['instanceof'](JS.ForInStatement) && node.left['instanceof'](JS.Identifier)) { - return [node.left]; + if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' || node['instanceof'](JS.ForInStatement)) { + return declaredIdentifiers(node.left); } else { return []; } @@ -350,14 +370,24 @@ dynamicMemberAccess = function (e, index) { return new JS.MemberExpression(true, expr(e), expr(index)); } }; -assignment = function (assignee, expression, valueUsed) { - var alternate, assignments, consequent, e, elements, i, index, m, numElements, p, propName, restName, size, test; +es6AssignmentPattern = function (assignee) { + if (assignee['instanceof'](JS.ArrayExpression) && all(assignee.elements, function (elt) { + return elt instanceof JS.Identifier; + })) { + return new JS.ArrayPattern(assignee.elements); + } +}; +assignment = function (assignee, expression, options, valueUsed) { + var alternate, assignments, consequent, e, elements, es6Pattern, i, index, m, numElements, p, propName, restName, size, test; if (null == valueUsed) valueUsed = false; assignments = []; expression = expr(expression); switch (false) { case !assignee.rest: + case !(options.targetES6 && (es6Pattern = es6AssignmentPattern(assignee))): + assignments.push(new JS.AssignmentExpression('=', es6Pattern, expression)); + break; case !assignee['instanceof'](JS.ArrayExpression): e = expression; if (valueUsed || assignee.elements.length > 1) { @@ -371,7 +401,7 @@ assignment = function (assignee, expression, valueUsed) { if (m.rest) { break; } - assignments.push(assignment(m, dynamicMemberAccess(e, new JS.Literal(i)), valueUsed)); + assignments.push(assignment(m, dynamicMemberAccess(e, new JS.Literal(i)), options, valueUsed)); } if (elements.length > 0) { if (elements.slice(-1)[0].rest) { @@ -423,7 +453,7 @@ assignment = function (assignee, expression, valueUsed) { for (var i$3 = 0, length$3 = assignee.properties.length; i$3 < length$3; ++i$3) { m = assignee.properties[i$3]; propName = m.key['instanceof'](JS.Identifier) ? new JS.Literal(m.key.name) : m.key; - assignments.push(assignment(m.value, dynamicMemberAccess(e, propName), valueUsed)); + assignments.push(assignment(m.value, dynamicMemberAccess(e, propName), options, valueUsed)); } break; case !assignee['instanceof'](JS.Identifier, JS.GenSym, JS.MemberExpression): @@ -855,7 +885,7 @@ exports.Compiler = function () { [ CS.ForIn, function (param$) { - var block, body, cache$2, compile, e, filter, i, increment, k, keyAssignee, length, op, step, target, update, valAssignee, varDeclaration; + var block, body, cache$2, compile, e, filter, i, increment, k, keyAssignee, length, op, options, step, target, update, valAssignee, varDeclaration; { cache$2 = param$; valAssignee = cache$2.valAssignee; @@ -865,6 +895,7 @@ exports.Compiler = function () { filter = cache$2.filter; body = cache$2.body; compile = cache$2.compile; + options = cache$2.options; } i = genSym('i'); length = genSym('length'); @@ -910,10 +941,10 @@ exports.Compiler = function () { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', filter), new JS.ContinueStatement))); } if (null != keyAssignee) { - block.body.unshift(stmt(assignment(keyAssignee, i))); + block.body.unshift(stmt(assignment(keyAssignee, i, options))); } if (null != valAssignee) { - block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, i)))); + block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, i), options))); } return new JS.ForStatement(varDeclaration, new JS.BinaryExpression('<', i, length), increment(i), block); } @@ -921,7 +952,7 @@ exports.Compiler = function () { [ CS.ForOf, function (param$) { - var block, body, cache$2, e, filter, keyAssignee, right, target, valAssignee; + var block, body, cache$2, e, filter, keyAssignee, options, right, target, valAssignee; { cache$2 = param$; keyAssignee = cache$2.keyAssignee; @@ -929,6 +960,7 @@ exports.Compiler = function () { target = cache$2.target; filter = cache$2.filter; body = cache$2.body; + options = cache$2.options; } block = forceBlock(body); if (!block.body.length) { @@ -939,7 +971,7 @@ exports.Compiler = function () { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', filter), new JS.ContinueStatement))); } if (null != valAssignee) { - block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, keyAssignee)))); + block.body.unshift(stmt(assignment(valAssignee, new JS.MemberExpression(true, e, keyAssignee), options))); } if (this.isOwn) { block.body.unshift(stmt(new JS.IfStatement(new JS.UnaryExpression('!', helpers.isOwn(e, keyAssignee)), new JS.ContinueStatement))); @@ -1012,20 +1044,21 @@ exports.Compiler = function () { [ CS.Try, function (param$) { - var body, cache$2, catchAssignee, catchBlock, catchBody, e, finallyBlock, finallyBody, handlers; + var body, cache$2, catchAssignee, catchBlock, catchBody, e, finallyBlock, finallyBody, handlers, options; { cache$2 = param$; body = cache$2.body; catchAssignee = cache$2.catchAssignee; catchBody = cache$2.catchBody; finallyBody = cache$2.finallyBody; + options = cache$2.options; } finallyBlock = null != this.finallyBody ? forceBlock(finallyBody) : null; if (null != this.catchBody || !(null != this.finallyBody)) { e = genSym('e'); catchBlock = forceBlock(catchBody); if (null != catchAssignee) { - catchBlock.body.unshift(stmt(assignment(catchAssignee, e))); + catchBlock.body.unshift(stmt(assignment(catchAssignee, e, options))); } handlers = [new JS.CatchClause(e, catchBlock)]; } else { @@ -1230,7 +1263,7 @@ exports.Compiler = function () { decls = map(intersect(inScope, beingDeclared(original)), function (i) { return new JS.Identifier(i); }); - block.body.unshift(stmt(assignment(param, p))); + block.body.unshift(stmt(assignment(param, p, options))); if (decls.length) { block.body.unshift(makeVarDeclaration(decls)); } @@ -1238,7 +1271,7 @@ exports.Compiler = function () { case !original['instanceof'](CS.DefaultParam): p = handleParam.call(this, param.param, original.param, block, inScope, options); if (!options.targetES6) { - block.body.unshift(new JS.IfStatement(new JS.BinaryExpression('==', new JS.Literal(null), p), stmt(assignment(p, param['default'])))); + block.body.unshift(new JS.IfStatement(new JS.BinaryExpression('==', new JS.Literal(null), p), stmt(assignment(p, param['default'], options)))); } return p; default: @@ -1525,7 +1558,7 @@ exports.Compiler = function () { body: block }).g(), args); if (null != nameAssignee) { - return assignment(nameAssignee, iife); + return assignment(nameAssignee, iife, options); } else { return iife; } @@ -1575,14 +1608,15 @@ exports.Compiler = function () { [ CS.AssignOp, function (param$) { - var ancestry, assignee, cache$2, expression; + var ancestry, assignee, cache$2, expression, options; { cache$2 = param$; assignee = cache$2.assignee; expression = cache$2.expression; ancestry = cache$2.ancestry; + options = cache$2.options; } - return assignment(assignee, expression, usedAsExpression(this, ancestry)); + return assignment(assignee, expression, options, usedAsExpression(this, ancestry)); } ], [ diff --git a/lib/js-nodes.js b/lib/js-nodes.js index f9146ba9..76751003 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; +var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { @@ -85,6 +85,11 @@ nodeData = [ false, ['elements'] ], + [ + 'ArrayPattern', + false, + ['elements'] + ], [ 'ArrowFunctionExpression', false, @@ -433,6 +438,7 @@ FunctionExpression = cache$1.FunctionExpression; CallExpression = cache$1.CallExpression; SequenceExpression = cache$1.SequenceExpression; ArrayExpression = cache$1.ArrayExpression; +ArrayPattern = cache$1.ArrayPattern; BinaryExpression = cache$1.BinaryExpression; UnaryExpression = cache$1.UnaryExpression; NewExpression = cache$1.NewExpression; @@ -482,6 +488,7 @@ handleLists = function (ctor, listProps) { return ctor.prototype.listMembers = listProps; }; handleLists(ArrayExpression, ['elements']); +handleLists(ArrayPattern, ['elements']); handleLists(ArrowFunctionExpression, [ 'params', 'defaults' diff --git a/src/compiler.coffee b/src/compiler.coffee index 94c2c399..cbe262a5 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -110,11 +110,28 @@ generateMutatingWalker = (fn) -> (node, args...) -> fn.apply node[childName], args node + + +declaredIdentifiers = (node) -> + return [] unless node? + if node.instanceof JS.Identifier + [node] + else if node.instanceof JS.MemberExpression + [] + else + concatMap node.childNodes, (childName) -> + return [] unless node[childName]? + if childName in node.listMembers + concatMap node[childName], declaredIdentifiers + else + declaredIdentifiers node[childName] + declarationsNeeded = (node) -> return [] unless node? - if (node.instanceof JS.AssignmentExpression) and node.operator is '=' and node.left.instanceof JS.Identifier then [node.left] - else if (node.instanceof JS.ForInStatement) and node.left.instanceof JS.Identifier then [node.left] - else [] + if ((node.instanceof JS.AssignmentExpression) and node.operator is '=') or (node.instanceof JS.ForInStatement) + declaredIdentifiers(node.left) + else + [] declarationsNeededRecursive = (node) -> return [] unless node? From 08771f481f5bb428a636ab73b20d7760df09c32e Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 13:58:24 -0400 Subject: [PATCH 19/64] arrow function expressions have their own scope --- src/compiler.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler.coffee b/src/compiler.coffee index cbe262a5..5bd06845 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -136,7 +136,7 @@ declarationsNeeded = (node) -> declarationsNeededRecursive = (node) -> return [] unless node? # don't cross scope boundaries - if (node.instanceof JS.FunctionExpression, JS.FunctionDeclaration) and not node.generated then [] + if (node.instanceof JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) and not node.generated then [] else union (declarationsNeeded node), concatMap node.childNodes, (childName) -> # TODO: this should make use of an fmap method return [] unless node[childName]? @@ -1253,7 +1253,7 @@ class exports.Compiler newNode = new JS.Identifier generateName this, state usedSymbols.push newNode.name newNode - else if (@instanceof JS.FunctionExpression, JS.FunctionDeclaration) and not @generated + else if (@instanceof JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) and not @generated params = concatMap @params, collectIdentifiers nsCounters_ = {} nsCounters_[k] = v for own k, v of nsCounters From 3042c9f16cf1ca1471c779b094957cc3504d8e55 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 27 May 2015 13:58:55 -0400 Subject: [PATCH 20/64] recursive array assignment patterns --- lib/compiler.js | 22 ++++++++++++++++------ src/compiler.coffee | 14 +++++++++++--- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index ffce59f3..71c27f96 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -249,7 +249,7 @@ declarationsNeededRecursive = function (node) { if (!(null != node)) { return []; } - if (node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration) && !node.generated) { + if (node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) && !node.generated) { return []; } else { return union(declarationsNeeded(node), concatMap(node.childNodes, function (childName) { @@ -371,10 +371,20 @@ dynamicMemberAccess = function (e, index) { } }; es6AssignmentPattern = function (assignee) { - if (assignee['instanceof'](JS.ArrayExpression) && all(assignee.elements, function (elt) { - return elt instanceof JS.Identifier; - })) { - return new JS.ArrayPattern(assignee.elements); + var elements; + if (assignee instanceof JS.ArrayExpression) { + elements = assignee.elements.map(function (elt) { + if (elt instanceof JS.Identifier) { + return elt; + } else { + return es6AssignmentPattern(elt); + } + }); + if (all(elements, function (elt) { + return null != elt; + })) { + return new JS.ArrayPattern(elements); + } } }; assignment = function (assignee, expression, options, valueUsed) { @@ -2701,7 +2711,7 @@ exports.Compiler = function () { declaredSymbols = cache$2.declaredSymbols; usedSymbols = cache$2.usedSymbols; nsCounters = cache$2.nsCounters; - newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration) && !this.generated ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { + newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) && !this.generated ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { for (k in nsCounters) { if (!isOwn$(nsCounters, k)) continue; diff --git a/src/compiler.coffee b/src/compiler.coffee index 5bd06845..95c03974 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -206,9 +206,17 @@ dynamicMemberAccess = (e, index) -> else new JS.MemberExpression yes, (expr e), expr index es6AssignmentPattern = (assignee) -> - # ES6 has a RestElement but it is not implemented yet in escodegen, so for now we only emit ES6 patterns that don't need it - if (assignee.instanceof JS.ArrayExpression) and all(assignee.elements, (elt) -> elt instanceof JS.Identifier) - new JS.ArrayPattern(assignee.elements) + if assignee instanceof JS.ArrayExpression + # ES6 has a RestElement but it is not implemented yet in + # escodegen, so for now we only emit ES6 patterns that don't need + # it. + elements = assignee.elements.map (elt) -> + if elt instanceof JS.Identifier + elt + else + es6AssignmentPattern(elt) + if all(elements, (elt) -> elt?) + new JS.ArrayPattern(elements) # TODO: rewrite this whole thing using the CS AST nodes assignment = (assignee, expression, options, valueUsed = no) -> From 681429247cb5f86754b7c480a5a616de1008014a Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 10:29:34 -0400 Subject: [PATCH 21/64] added RestElement This requires a recent master version of escodegen. --- package.json | 2 +- src/compiler.coffee | 5 ++--- src/js-nodes.coffee | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2b35bfa6..560252a8 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "nopt": "~2.1.2" }, "optionalDependencies": { - "escodegen": "^1.6.1", + "escodegen": "git://github.com/estools/escodegen#2e90c2b95274aae27910c28e086676b104b7ded4", "esmangle": "~1.0.0", "source-map": "0.1.x", "cscodegen": "git+https://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383" diff --git a/src/compiler.coffee b/src/compiler.coffee index 95c03974..2356dafa 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -207,12 +207,11 @@ dynamicMemberAccess = (e, index) -> es6AssignmentPattern = (assignee) -> if assignee instanceof JS.ArrayExpression - # ES6 has a RestElement but it is not implemented yet in - # escodegen, so for now we only emit ES6 patterns that don't need - # it. elements = assignee.elements.map (elt) -> if elt instanceof JS.Identifier elt + else if elt.rest + new JS.RestElement elt.expression else es6AssignmentPattern(elt) if all(elements, (elt) -> elt?) diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index e03ff5c6..0608928c 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -70,6 +70,7 @@ nodeData = [ ['ObjectExpression' , no , ['properties']] ['Program' , yes, ['body']] ['Property' , yes, ['key', 'value']] + ['RestElement' , yes, ['argument']] ['ReturnStatement' , yes, ['argument']] ['SequenceExpression' , no , ['expressions']] ['SwitchCase' , yes, ['test', 'consequent']] From 2923e2b113db71f7c41c814d2a36d4e028696c2f Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 11:06:44 -0400 Subject: [PATCH 22/64] making functional helpers follow modern CJS conventions Because without this they can't be loaded in strict mode --- lib/functional-helpers.js | 330 +++++++++++++++++----------------- src/functional-helpers.coffee | 103 +++++------ 2 files changed, 218 insertions(+), 215 deletions(-) diff --git a/lib/functional-helpers.js b/lib/functional-helpers.js index ce0fd888..edd50c31 100644 --- a/lib/functional-helpers.js +++ b/lib/functional-helpers.js @@ -1,183 +1,185 @@ // Generated by CoffeeScript 2.0.0-beta9-dev var concat, foldl, map, nub, span; -this.any = function (list, fn) { - var e; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - e = list[i$]; - if (fn(e)) { - return true; - } - } - return false; -}; -this.all = function (list, fn) { - var e; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - e = list[i$]; - if (!fn(e)) { - return false; +module.exports = { + any: function (list, fn) { + var e; + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + e = list[i$]; + if (fn(e)) { + return true; + } } - } - return true; -}; -this.find = function (list, fn) { - var e; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - e = list[i$]; - if (fn(e)) { - return e; + return false; + }, + all: function (list, fn) { + var e; + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + e = list[i$]; + if (!fn(e)) { + return false; + } } - } - return null; -}; -this.foldl = foldl = function (memo, list, fn) { - var i; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - i = list[i$]; - memo = fn(memo, i); - } - return memo; -}; -this.foldl1 = function (list, fn) { - return foldl(list[0], list.slice(1), fn); -}; -this.map = map = function (list, fn) { - var e; - return function (accum$) { + return true; + }, + find: function (list, fn) { + var e; for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { e = list[i$]; - accum$.push(fn(e)); + if (fn(e)) { + return e; + } } - return accum$; - }.call(this, []); -}; -this.concat = concat = function (list) { - var cache$; - return (cache$ = []).concat.apply(cache$, [].slice.call(list)); -}; -this.concatMap = function (list, fn) { - return concat(map(list, fn)); -}; -this.intersect = function (listA, listB) { - var a; - return function (accum$) { - for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) { - a = listA[i$]; - if (!in$(a, listB)) - continue; - accum$.push(a); + return null; + }, + foldl: foldl = function (memo, list, fn) { + var i; + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + i = list[i$]; + memo = fn(memo, i); } - return accum$; - }.call(this, []); -}; -this.difference = function (listA, listB) { - var a; - return function (accum$) { - for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) { - a = listA[i$]; - if (!!in$(a, listB)) + return memo; + }, + foldl1: function (list, fn) { + return foldl(list[0], list.slice(1), fn); + }, + map: map = function (list, fn) { + var e; + return function (accum$) { + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + e = list[i$]; + accum$.push(fn(e)); + } + return accum$; + }.call(this, []); + }, + concat: concat = function (list) { + var cache$; + return (cache$ = []).concat.apply(cache$, [].slice.call(list)); + }, + concatMap: function (list, fn) { + return concat(map(list, fn)); + }, + intersect: function (listA, listB) { + var a; + return function (accum$) { + for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) { + a = listA[i$]; + if (!in$(a, listB)) + continue; + accum$.push(a); + } + return accum$; + }.call(this, []); + }, + difference: function (listA, listB) { + var a; + return function (accum$) { + for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) { + a = listA[i$]; + if (!!in$(a, listB)) + continue; + accum$.push(a); + } + return accum$; + }.call(this, []); + }, + nub: nub = function (list) { + var i, result; + result = []; + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + i = list[i$]; + if (!!in$(i, result)) continue; - accum$.push(a); + result.push(i); } - return accum$; - }.call(this, []); -}; -this.nub = nub = function (list) { - var i, result; - result = []; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - i = list[i$]; - if (!!in$(i, result)) - continue; - result.push(i); - } - return result; -}; -this.union = function (listA, listB) { - var b; - return listA.concat(function (accum$) { - for (var cache$ = nub(listB), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) { - b = cache$[i$]; - if (!!in$(b, listA)) - continue; - accum$.push(b); + return result; + }, + union: function (listA, listB) { + var b; + return listA.concat(function (accum$) { + for (var cache$ = nub(listB), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) { + b = cache$[i$]; + if (!!in$(b, listA)) + continue; + accum$.push(b); + } + return accum$; + }.call(this, [])); + }, + flip: function (fn) { + return function (b, a) { + return fn.call(this, a, b); + }; + }, + owns: function (hop) { + return function (a, b) { + return hop.call(a, b); + }; + }({}.hasOwnProperty), + span: span = function (list, f) { + var cache$, ys, zs; + if (list.length === 0) { + return [ + [], + [] + ]; + } else if (f(list[0])) { + cache$ = span(list.slice(1), f); + ys = cache$[0]; + zs = cache$[1]; + return [ + [list[0]].concat([].slice.call(ys)), + zs + ]; + } else { + return [ + [], + list + ]; } - return accum$; - }.call(this, [])); -}; -this.flip = function (fn) { - return function (b, a) { - return fn.call(this, a, b); - }; -}; -this.owns = function (hop) { - return function (a, b) { - return hop.call(a, b); - }; -}({}.hasOwnProperty); -this.span = span = function (list, f) { - var cache$, ys, zs; - if (list.length === 0) { + }, + divMod: function (a, b) { + var c, div, mod; + c = a % b; + mod = c < 0 ? c + b : c; + div = Math.floor(a / b); return [ - [], - [] + div, + mod ]; - } else if (f(list[0])) { - cache$ = span(list.slice(1), f); - ys = cache$[0]; - zs = cache$[1]; - return [ - [list[0]].concat([].slice.call(ys)), - zs - ]; - } else { - return [ + }, + partition: function (list, fn) { + var item, result; + result = [ [], - list + [] ]; - } -}; -this.divMod = function (a, b) { - var c, div, mod; - c = a % b; - mod = c < 0 ? c + b : c; - div = Math.floor(a / b); - return [ - div, - mod - ]; -}; -this.partition = function (list, fn) { - var item, result; - result = [ - [], - [] - ]; - for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { - item = list[i$]; - result[+!fn(item)].push(item); - } - return result; -}; -this.zip = function (listA, listB) { - var i, len; - len = Math.max(listA.length, listB.length); - return function (accum$) { - for (var cache$ = function () { - var accum$1; - accum$1 = []; - for (var i$ = 0; 0 <= len ? i$ < len : i$ > len; 0 <= len ? ++i$ : --i$) - accum$1.push(i$); - return accum$1; - }.apply(this, arguments), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) { - i = cache$[i$]; - accum$.push([ - listA[i], - listB[i] - ]); + for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) { + item = list[i$]; + result[+!fn(item)].push(item); } - return accum$; - }.call(this, []); + return result; + }, + zip: function (listA, listB) { + var i, len; + len = Math.max(listA.length, listB.length); + return function (accum$) { + for (var cache$ = function () { + var accum$1; + accum$1 = []; + for (var i$ = 0; 0 <= len ? i$ < len : i$ > len; 0 <= len ? ++i$ : --i$) + accum$1.push(i$); + return accum$1; + }.apply(this, arguments), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) { + i = cache$[i$]; + accum$.push([ + listA[i], + listB[i] + ]); + } + return accum$; + }.call(this, []); + } }; function in$(member, list) { for (var i = 0, length = list.length; i < length; ++i) diff --git a/src/functional-helpers.coffee b/src/functional-helpers.coffee index ac374476..2f1a7f21 100644 --- a/src/functional-helpers.coffee +++ b/src/functional-helpers.coffee @@ -1,68 +1,69 @@ -@any = (list, fn) -> - for e in list - return yes if fn e - no +module.exports = + any: (list, fn) -> + for e in list + return yes if fn e + no -@all = (list, fn) -> - for e in list - return no unless fn e - yes + all: (list, fn) -> + for e in list + return no unless fn e + yes -@find = (list, fn) -> - for e in list - return e if fn(e) - null + find: (list, fn) -> + for e in list + return e if fn(e) + null -@foldl = foldl = (memo, list, fn) -> - for i in list - memo = fn memo, i - memo + foldl: foldl = (memo, list, fn) -> + for i in list + memo = fn memo, i + memo -@foldl1 = (list, fn) -> foldl list[0], list[1..], fn + foldl1: (list, fn) -> foldl list[0], list[1..], fn -@map = map = (list, fn) -> fn e for e in list + map: map = (list, fn) -> fn e for e in list -@concat = concat = (list) -> [].concat list... + concat: concat = (list) -> [].concat list... -@concatMap = (list, fn) -> concat map list, fn + concatMap: (list, fn) -> concat map list, fn -@intersect = (listA, listB) -> a for a in listA when a in listB + intersect: (listA, listB) -> a for a in listA when a in listB -@difference = (listA, listB) -> a for a in listA when a not in listB + difference: (listA, listB) -> a for a in listA when a not in listB -@nub = nub = (list) -> - result = [] - result.push i for i in list when i not in result - result + nub: nub = (list) -> + result = [] + result.push i for i in list when i not in result + result -@union = (listA, listB) -> - listA.concat (b for b in (nub listB) when b not in listA) + union: (listA, listB) -> + listA.concat (b for b in (nub listB) when b not in listA) -@flip = (fn) -> (b, a) -> fn.call this, a, b + flip: (fn) -> (b, a) -> fn.call this, a, b -@owns = do (hop = {}.hasOwnProperty) -> (a, b) -> hop.call a, b + owns: do (hop = {}.hasOwnProperty) -> (a, b) -> hop.call a, b -@span = span = (list, f) -> - if list.length is 0 then [[], []] - else if f list[0] - [ys, zs] = span list[1..], f - [[list[0], ys...], zs] - else [[], list] + span: span = (list, f) -> + if list.length is 0 then [[], []] + else if f list[0] + [ys, zs] = span list[1..], f + [[list[0], ys...], zs] + else [[], list] -@divMod = (a, b) -> - c = a % b - mod = if c < 0 then c + b else c - div = Math.floor a / b - [div, mod] + divMod: (a, b) -> + c = a % b + mod = if c < 0 then c + b else c + div = Math.floor a / b + [div, mod] -# The partition function takes a list and predicate fn and returns the pair of lists -# of elements which do and do not satisfy the predicate, respectively. -@partition = (list, fn) -> - result = [[], []] - result[+!fn item].push item for item in list - result + # The partition function takes a list and predicate fn and returns the pair of lists + # of elements which do and do not satisfy the predicate, respectively. + partition: (list, fn) -> + result = [[], []] + result[+!fn item].push item for item in list + result -@zip = (listA, listB) -> - len = Math.max listA.length, listB.length - for i in [0...len] - [listA[i], listB[i]] + zip: (listA, listB) -> + len = Math.max listA.length, listB.length + for i in [0...len] + [listA[i], listB[i]] From f409dfb5a56fb7070acf396152d11c6d72f10287 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 16:03:20 -0400 Subject: [PATCH 23/64] Fix duplicate vars at top level To see the problem this patch fixes, look at the first line of lib/cli.js: ```js var $0, $0, ... ``` The Program node handler was attempting to deduplicate with `nub`, but doing so over a list of JS.Identifiers, not a list of plain strings. Since most callers of `declarationsNeededRecursive` are more interested in the set of names than the identifier nodes, I changed it to do that. --- lib/cli.js | 2 +- lib/compiler.js | 24 ++++++++++-------------- lib/js-nodes.js | 2 +- lib/optimiser.js | 2 +- lib/parser.js | 2 +- src/compiler.coffee | 12 ++++++------ 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 2f1896f2..4bfc5069 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var $0, $0, additionalArgs, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, fs, humanReadable, input, input, inputName, inputSource, inspect, knownOpts, nopt, numberLines, optAliases, Optimiser, option, options, output, parameter, path, pkg, positionalArgs, Preprocessor, processInput, Repl, runMain; +var $0, additionalArgs, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, fs, humanReadable, input, inputName, inputSource, inspect, knownOpts, nopt, numberLines, optAliases, Optimiser, option, options, output, parameter, path, pkg, positionalArgs, Preprocessor, processInput, Repl, runMain; fs = require('fs'); path = require('path'); cache$ = require('./functional-helpers'); diff --git a/lib/compiler.js b/lib/compiler.js index d48a9454..1299e2db 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; +var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations; cache$ = require('./functional-helpers'); any = cache$.any; concat = cache$.concat; @@ -206,9 +206,9 @@ declarationsNeeded = function (node) { if (!(null != node)) return []; if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' && node.left['instanceof'](JS.Identifier)) { - return [node.left]; + return [node.left.name]; } else if (node['instanceof'](JS.ForInStatement) && node.left['instanceof'](JS.Identifier)) { - return [node.left]; + return [node.left.name]; } else { return []; } @@ -652,7 +652,7 @@ exports.Compiler = function () { Compiler.compile = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).compile.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).compile.apply(cache$2, [].slice.call(arguments)); }; }(Compiler); defaultRules = [ @@ -680,7 +680,9 @@ exports.Compiler = function () { decls = nub(concatMap(block, declarationsNeededRecursive)); if (decls.length > 0) if (options.bare) { - block.unshift(makeVarDeclaration(decls)); + block.unshift(makeVarDeclaration(decls.map(function (name) { + return new JS.Identifier(name); + }))); } else { block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(new JS.FunctionExpression(null, [], new JS.BlockStatement(block)), 'call'), [new JS.ThisExpression])))]; } @@ -2346,9 +2348,7 @@ exports.Compiler = function () { }; return generateMutatingWalker(function (state) { var alreadyDeclared, cache$2, declaredSymbols, declNames, decls, k, newNode, nsCounters, nsCounters_, params, undeclared, usedSymbols, v; - state.declaredSymbols = union(state.declaredSymbols, map(declarationsNeeded(this), function (id) { - return id.name; - })); + state.declaredSymbols = union(state.declaredSymbols, declarationsNeeded(this)); cache$2 = state; declaredSymbols = cache$2.declaredSymbols; usedSymbols = cache$2.usedSymbols; @@ -2365,16 +2365,12 @@ exports.Compiler = function () { declaredSymbols: union(declaredSymbols, params), usedSymbols: union(usedSymbols, params), nsCounters: nsCounters_ - }), newNode.body = forceBlock(newNode.body), undeclared = map(declarationsNeededRecursive(this.body), function (id) { - return id.name; - }), undeclared = difference(undeclared, map(variableDeclarations(this.body), function (id) { + }), newNode.body = forceBlock(newNode.body), undeclared = declarationsNeededRecursive(this.body), undeclared = difference(undeclared, map(variableDeclarations(this.body), function (id) { return id.name; })), alreadyDeclared = union(declaredSymbols, concatMap(this.params, collectIdentifiers)), declNames = nub(difference(undeclared, alreadyDeclared)), decls = map(declNames, function (name) { return new JS.Identifier(name); }), decls.length > 0 ? newNode.body.body.unshift(makeVarDeclaration(decls)) : void 0, newNode) : generateSymbols(this, state); - state.declaredSymbols = union(declaredSymbols, map(declarationsNeededRecursive(newNode), function (id) { - return id.name; - })); + state.declaredSymbols = union(declaredSymbols, declarationsNeededRecursive(newNode)); return newNode; }); }(); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index bdcf9940..6a59e041 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; +var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { diff --git a/lib/optimiser.js b/lib/optimiser.js index 874585fa..c25cd58e 100644 --- a/lib/optimiser.js +++ b/lib/optimiser.js @@ -387,7 +387,7 @@ exports.Optimiser = function () { Optimiser.optimise = function (this$) { return function () { var cache$2; - return (cache$2 = new this$).optimise.apply(cache$2, [].slice.call(arguments)); + return (cache$2 = new this$()).optimise.apply(cache$2, [].slice.call(arguments)); }; }(Optimiser); Optimiser.isTruthy = isTruthy; diff --git a/lib/parser.js b/lib/parser.js index 16c05870..04dd514e 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -19426,7 +19426,7 @@ module.exports = (function() { } // Generated by CoffeeScript 2.0.0-beta9-dev - var associativities, c, chainableComparisonOps, constructorLookup, createInterpolation, createMemberExpression, CS, foldBinaryExpr, foldl, foldr, id, isValidRegExpFlags, LEFT_ASSOCIATIVE, negatableOps, op, p, p, postfixConstructorLookup, precedenceHierarchy, precedenceTable, prefixConstructorLookup, r, r, RIGHT_ASSOCIATIVE, rightAssocOps, rp, rp, stripLeadingWhitespace, stripLeadingWhitespaceInterpolation; + var associativities, c, chainableComparisonOps, constructorLookup, createInterpolation, createMemberExpression, CS, foldBinaryExpr, foldl, foldr, id, isValidRegExpFlags, LEFT_ASSOCIATIVE, negatableOps, op, p, postfixConstructorLookup, precedenceHierarchy, precedenceTable, prefixConstructorLookup, r, RIGHT_ASSOCIATIVE, rightAssocOps, rp, stripLeadingWhitespace, stripLeadingWhitespaceInterpolation; CS = require('./nodes'); constructorLookup = { '||': CS.LogicalOrOp, diff --git a/src/compiler.coffee b/src/compiler.coffee index b853c042..4ca73654 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -111,8 +111,8 @@ generateMutatingWalker = (fn) -> (node, args...) -> declarationsNeeded = (node) -> return [] unless node? - if (node.instanceof JS.AssignmentExpression) and node.operator is '=' and node.left.instanceof JS.Identifier then [node.left] - else if (node.instanceof JS.ForInStatement) and node.left.instanceof JS.Identifier then [node.left] + if (node.instanceof JS.AssignmentExpression) and node.operator is '=' and node.left.instanceof JS.Identifier then [node.left.name] + else if (node.instanceof JS.ForInStatement) and node.left.instanceof JS.Identifier then [node.left.name] else [] declarationsNeededRecursive = (node) -> @@ -408,7 +408,7 @@ class exports.Compiler decls = nub concatMap block, declarationsNeededRecursive if decls.length > 0 if options.bare - block.unshift makeVarDeclaration decls + block.unshift makeVarDeclaration decls.map (name) -> new JS.Identifier(name) else # add a function wrapper block = [stmt new JS.UnaryExpression 'void', new JS.CallExpression (memberAccess (new JS.FunctionExpression null, [], new JS.BlockStatement block), 'call'), [new JS.ThisExpression]] @@ -1088,7 +1088,7 @@ class exports.Compiler # TODO: comments generateMutatingWalker (state) -> - state.declaredSymbols = union state.declaredSymbols, map (declarationsNeeded this), (id) -> id.name + state.declaredSymbols = union state.declaredSymbols, declarationsNeeded this {declaredSymbols, usedSymbols, nsCounters} = state newNode = if @instanceof JS.GenSym newNode = new JS.Identifier generateName this, state @@ -1103,7 +1103,7 @@ class exports.Compiler usedSymbols: union usedSymbols, params nsCounters: nsCounters_ newNode.body = forceBlock newNode.body - undeclared = map (declarationsNeededRecursive @body), (id) -> id.name + undeclared = declarationsNeededRecursive @body undeclared = difference undeclared, map (variableDeclarations @body), (id) -> id.name alreadyDeclared = union declaredSymbols, concatMap @params, collectIdentifiers declNames = nub difference undeclared, alreadyDeclared @@ -1111,7 +1111,7 @@ class exports.Compiler newNode.body.body.unshift makeVarDeclaration decls if decls.length > 0 newNode else generateSymbols this, state - state.declaredSymbols = union declaredSymbols, map (declarationsNeededRecursive newNode), (id) -> id.name + state.declaredSymbols = union declaredSymbols, declarationsNeededRecursive newNode newNode defaultRule = -> From f59836997ba684322a3207ee1c254145d0f63ac7 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 16:23:55 -0400 Subject: [PATCH 24/64] destructuring patterns inside args --- lib/compiler.js | 182 ++++++++++++++++++++++++++------------------ lib/js-nodes.js | 7 +- src/compiler.coffee | 13 ++-- 3 files changed, 124 insertions(+), 78 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 71c27f96..7593b96e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, fn, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -8,6 +8,7 @@ concat = cache$.concat; concatMap = cache$.concatMap; difference = cache$.difference; divMod = cache$.divMod; +foldl = cache$.foldl; foldl1 = cache$.foldl1; intersect = cache$.intersect; map = cache$.map; @@ -74,6 +75,36 @@ jsReserved = [ 'arguments', 'eval' ]; +mapChildNodes = function (node, mapper, reducer, identity, opts) { + var child, childName; + if (null == opts) + opts = {}; + if (null != opts.listReducer) + opts.listReducer; + else + opts.listReducer = reducer; + if (null != opts.listIdentity) + opts.listIdentity; + else + opts.listIdentity = identity; + return foldl(identity, function (accum$) { + for (var i$ = 0, length$ = node.childNodes.length; i$ < length$; ++i$) { + childName = node.childNodes[i$]; + if (!(null != node[childName])) + continue; + accum$.push(in$(childName, node.listMembers) ? foldl(opts.listIdentity, function (accum$1) { + for (var i$1 = 0, length$1 = node[childName].length; i$1 < length$1; ++i$1) { + child = node[childName][i$1]; + if (!('undefined' !== typeof child && null != child)) + continue; + accum$1.push(mapper(child, childName)); + } + return accum$1; + }.call(this, []), opts.listReducer) : mapper(node[childName], childName)); + } + return accum$; + }.call(this, []), reducer); +}; genSym = function () { var genSymCounter; genSymCounter = 0; @@ -163,6 +194,9 @@ expr = function (s) { throw new Error('expr: Cannot use a ' + s.type + ' as a value'); } }; +isScopeBoundary = function (node) { + return node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration) && !node.generated; +}; makeReturn = function (node) { var stmts; if (!(null != node)) { @@ -196,22 +230,47 @@ makeReturn = function (node) { }; generateMutatingWalker = function (fn) { return function (node) { - var args, childName, n; + var args, mapper, reducer; args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; - for (var i$ = 0, length$ = node.childNodes.length; i$ < length$; ++i$) { - childName = node.childNodes[i$]; - if (!(null != node[childName])) { - continue; + mapper = function (child, nameInParent) { + return [ + nameInParent, + fn.apply(child, args) + ]; + }; + reducer = function (parent, param$) { + var cache$2, name, newChild; + { + cache$2 = param$; + name = cache$2[0]; + newChild = cache$2[1]; } - node[childName] = in$(childName, node.listMembers) ? function (accum$) { - for (var i$1 = 0, length$1 = node[childName].length; i$1 < length$1; ++i$1) { - n = node[childName][i$1]; - accum$.push('undefined' !== typeof n && null != n ? fn.apply(n, args) : void 0); + parent[name] = newChild; + return parent; + }; + return mapChildNodes(node, mapper, reducer, node, { + listReducer: function (param$, param$1) { + var _, accum, cache$2, cache$3, name, newChild; + { + cache$2 = param$; + _ = cache$2[0]; + accum = cache$2[1]; } - return accum$; - }.call(this, []) : fn.apply(node[childName], args); - } - return node; + { + cache$3 = param$1; + name = cache$3[0]; + newChild = cache$3[1]; + } + return [ + name, + accum.concat(newChild) + ]; + }, + listIdentity: [ + null, + [] + ] + }); }; }; declaredIdentifiers = function (node) { @@ -219,7 +278,7 @@ declaredIdentifiers = function (node) { return []; } if (node['instanceof'](JS.Identifier)) { - return [node]; + return [node.name]; } else if (node['instanceof'](JS.MemberExpression)) { return []; } else { @@ -249,19 +308,12 @@ declarationsNeededRecursive = function (node) { if (!(null != node)) { return []; } - if (node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) && !node.generated) { + if (isScopeBoundary(node)) { return []; } else { - return union(declarationsNeeded(node), concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) { - return []; - } - if (in$(childName, node.listMembers)) { - return concatMap(node[childName], declarationsNeededRecursive); - } else { - return declarationsNeededRecursive(node[childName]); - } - })); + return union(declarationsNeeded(node), mapChildNodes(node, declarationsNeededRecursive, function (a, b) { + return a.concat(b); + }, [])); } }; variableDeclarations = function (node) { @@ -270,21 +322,14 @@ variableDeclarations = function (node) { } if (node['instanceof'](JS.FunctionDeclaration)) { return [node.id]; - } else if (node['instanceof'](JS.FunctionExpression) && !node.generated) { + } else if (isScopeBoundary(node)) { return []; } else if (node['instanceof'](JS.VariableDeclarator)) { return [node.id]; } else { - return concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) { - return []; - } - if (in$(childName, node.listMembers)) { - return concatMap(node[childName], variableDeclarations); - } else { - return variableDeclarations(node[childName]); - } - }); + return mapChildNodes(node, variableDeclarations, function (a, b) { + return a.concat(b); + }, []); } }; collectIdentifiers = function (node) { @@ -297,16 +342,9 @@ collectIdentifiers = function (node) { case !(node['instanceof'](JS.MemberExpression) && !node.computed): return collectIdentifiers(node.object); default: - return concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) { - return []; - } - if (in$(childName, node.listMembers)) { - return concatMap(node[childName], collectIdentifiers); - } else { - return collectIdentifiers(node[childName]); - } - }); + return mapChildNodes(node, collectIdentifiers, function (a, b) { + return a.concat(b); + }, []); } }.call(this)); }; @@ -314,11 +352,9 @@ needsCaching = function (node) { if (!(null != node)) { return false; } - return envEnrichments(node, []).length > 0 || node['instanceof'](CS.FunctionApplications, CS.DoOp, CS.NewOp, CS.ArrayInitialiser, CS.ObjectInitialiser, CS.RegExp, CS.HeregExp, CS.PreIncrementOp, CS.PostIncrementOp, CS.PreDecrementOp, CS.PostDecrementOp, CS.Range) || any(difference(node.childNodes, node.listMembers), function (n) { - return needsCaching(node[n]); - }) || any(node.listMembers, function (n) { - return any(node[n], needsCaching); - }); + return envEnrichments(node, []).length > 0 || node['instanceof'](CS.FunctionApplications, CS.DoOp, CS.NewOp, CS.ArrayInitialiser, CS.ObjectInitialiser, CS.RegExp, CS.HeregExp, CS.PreIncrementOp, CS.PostIncrementOp, CS.PreDecrementOp, CS.PostDecrementOp, CS.Range) || mapChildNodes(node, needsCaching, function (a, b) { + return a || b; + }, false); }; forceBlock = function (node) { if (!(null != node)) { @@ -376,6 +412,8 @@ es6AssignmentPattern = function (assignee) { elements = assignee.elements.map(function (elt) { if (elt instanceof JS.Identifier) { return elt; + } else if (elt.rest) { + return new JS.RestElement(elt.expression); } else { return es6AssignmentPattern(elt); } @@ -813,7 +851,9 @@ exports.Compiler = function () { decls = nub(concatMap(block, declarationsNeededRecursive)); if (decls.length > 0) { if (options.bare) { - block.unshift(makeVarDeclaration(decls)); + block.unshift(makeVarDeclaration(decls.map(function (name) { + return new JS.Identifier(name); + }))); } else { block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(block) }), 'call'), [new JS.ThisExpression])))]; } @@ -1262,22 +1302,26 @@ exports.Compiler = function () { function () { var handleParam; handleParam = function (param, original, block, inScope, options) { - var decls, p; + var decls, p, pattern; switch (false) { case !original['instanceof'](CS.Rest): return param; case !original['instanceof'](CS.Identifier): return param; case !original['instanceof'](CS.MemberAccessOps, CS.ObjectInitialiser, CS.ArrayInitialiser): - p = genSym('param'); - decls = map(intersect(inScope, beingDeclared(original)), function (i) { - return new JS.Identifier(i); - }); - block.body.unshift(stmt(assignment(param, p, options))); - if (decls.length) { - block.body.unshift(makeVarDeclaration(decls)); + if (options.targetES6 && (pattern = es6AssignmentPattern(param))) { + return pattern; + } else { + p = genSym('param'); + decls = map(intersect(inScope, beingDeclared(original)), function (i) { + return new JS.Identifier(i); + }); + block.body.unshift(stmt(assignment(param, p, options))); + if (decls.length) { + block.body.unshift(makeVarDeclaration(decls)); + } + return p; } - return p; case !original['instanceof'](CS.DefaultParam): p = handleParam.call(this, param.param, original.param, block, inScope, options); if (!options.targetES6) { @@ -2704,14 +2748,12 @@ exports.Compiler = function () { }; return generateMutatingWalker(function (state) { var alreadyDeclared, cache$2, declaredSymbols, declNames, decls, k, newNode, nsCounters, nsCounters_, params, undeclared, usedSymbols, v; - state.declaredSymbols = union(state.declaredSymbols, map(declarationsNeeded(this), function (id) { - return id.name; - })); + state.declaredSymbols = union(state.declaredSymbols, declarationsNeeded(this)); cache$2 = state; declaredSymbols = cache$2.declaredSymbols; usedSymbols = cache$2.usedSymbols; nsCounters = cache$2.nsCounters; - newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration, JS.ArrowFunctionExpression) && !this.generated ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { + newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : isScopeBoundary(this) ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { for (k in nsCounters) { if (!isOwn$(nsCounters, k)) continue; @@ -2723,16 +2765,12 @@ exports.Compiler = function () { declaredSymbols: union(declaredSymbols, params), usedSymbols: union(usedSymbols, params), nsCounters: nsCounters_ - }), newNode.body = forceBlock(newNode.body), undeclared = map(declarationsNeededRecursive(this.body), function (id) { - return id.name; - }), undeclared = difference(undeclared, map(variableDeclarations(this.body), function (id) { + }), newNode.body = forceBlock(newNode.body), undeclared = declarationsNeededRecursive(this.body), undeclared = difference(undeclared, map(variableDeclarations(this.body), function (id) { return id.name; })), alreadyDeclared = union(declaredSymbols, concatMap(this.params, collectIdentifiers)), declNames = nub(difference(undeclared, alreadyDeclared)), decls = map(declNames, function (name) { return new JS.Identifier(name); }), decls.length > 0 ? newNode.body.body.unshift(makeVarDeclaration(decls)) : void 0, newNode) : generateSymbols(this, state); - state.declaredSymbols = union(declaredSymbols, map(declarationsNeededRecursive(newNode), function (id) { - return id.name; - })); + state.declaredSymbols = union(declaredSymbols, declarationsNeededRecursive(newNode)); return newNode; }); }(); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 76751003..a8df9e41 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; +var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { @@ -323,6 +323,11 @@ nodeData = [ 'value' ] ], + [ + 'RestElement', + true, + ['argument'] + ], [ 'ReturnStatement', true, diff --git a/src/compiler.coffee b/src/compiler.coffee index ef5167de..4fcfa056 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -672,11 +672,14 @@ class exports.Compiler when original.instanceof CS.Rest then param # keep these for special processing later when original.instanceof CS.Identifier then param when original.instanceof CS.MemberAccessOps, CS.ObjectInitialiser, CS.ArrayInitialiser - p = genSym 'param' - decls = map (intersect inScope, beingDeclared original), (i) -> new JS.Identifier i - block.body.unshift stmt assignment param, p, options - block.body.unshift makeVarDeclaration decls if decls.length - p + if options.targetES6 and (pattern = es6AssignmentPattern(param)) + pattern + else + p = genSym 'param' + decls = map (intersect inScope, beingDeclared original), (i) -> new JS.Identifier i + block.body.unshift stmt assignment param, p, options + block.body.unshift makeVarDeclaration decls if decls.length + p when original.instanceof CS.DefaultParam p = handleParam.call this, param.param, original.param, block, inScope, options if !options.targetES6 From ae5f80259997fb620d3180fe33d8e4a0d179f4fa Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 16:26:03 -0400 Subject: [PATCH 25/64] es6 test support --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 966c8356..445a8894 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,10 @@ LIBMIN = $(LIB:lib/%.js=lib/%.min.js) TEST = $(wildcard test/*.coffee | sort) ROOT = $(shell pwd) -COFFEE = bin/coffee --js --bare -PEGJS = node_modules/.bin/pegjs --cache --plugin ./lib/pegjs-coffee-plugin -MOCHA = node_modules/.bin/mocha --compilers coffee:./register -u tdd +NODE = $(if ${ES6}, babel-node, node) +COFFEE = ${NODE} bin/coffee --js --bare $(if ${ES6}, --target-es6) +PEGJS = ${NODE} node_modules/.bin/pegjs --cache --plugin ./lib/pegjs-coffee-plugin +MOCHA = ${NODE} node_modules/.bin/mocha --compilers coffee:./register -u tdd CJSIFY = node_modules/.bin/cjsify --export CoffeeScript MINIFIER = node_modules/.bin/esmangle From 84be770cc544145c5a7ee7086370135723d321b1 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 19:38:53 -0400 Subject: [PATCH 26/64] merged lib --- lib/cli.js | 2 +- lib/compiler.js | 34 +++++++++++++++++++++------------- lib/js-nodes.js | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 903b54c2..af783b53 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var $0, additionalArgs, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, fs, humanReadable, input, inputName, inputSource, inspect, knownOpts, nopt, numberLines, optAliases, Optimiser, option, options, output, parameter, path, pkg, positionalArgs, Preprocessor, processInput, Repl, runMain; +var $0, additionalArgs, cache$, cache$1, cache$2, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, fs, humanReadable, input, inputName, inputSource, inspect, knownOpts, nopt, numberLines, optAliases, Optimiser, option, options, output, parameter, path, pkg, positionalArgs, Preprocessor, processInput, Repl, runMain; fs = require('fs'); path = require('path'); cache$ = require('./functional-helpers'); diff --git a/lib/compiler.js b/lib/compiler.js index 7593b96e..4110bd6e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -849,14 +849,8 @@ exports.Compiler = function () { [].push.apply(block, fnDeclHelpers); [].unshift.apply(block, otherHelpers); decls = nub(concatMap(block, declarationsNeededRecursive)); - if (decls.length > 0) { - if (options.bare) { - block.unshift(makeVarDeclaration(decls.map(function (name) { - return new JS.Identifier(name); - }))); - } else { - block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(block) }), 'call'), [new JS.ThisExpression])))]; - } + if (decls.length && !options.bare) { + block = [stmt(new JS.UnaryExpression('void', new JS.CallExpression(memberAccess(funcExpr({ body: new JS.BlockStatement(block) }), 'call'), [new JS.ThisExpression])))]; } pkg = require('./../package.json'); program = new JS.Program(block); @@ -2714,7 +2708,7 @@ exports.Compiler = function () { return jsNode; }; generateSymbols = function () { - var format, generatedSymbols, generateName; + var format, generateChildSymbols, generatedSymbols, generateName; generatedSymbols = {}; format = function (pre, counter) { var cache$2, div, mod; @@ -2746,7 +2740,7 @@ exports.Compiler = function () { return generatedSymbols[node.uniqueId] = formatted; } }; - return generateMutatingWalker(function (state) { + generateChildSymbols = generateMutatingWalker(function (state) { var alreadyDeclared, cache$2, declaredSymbols, declNames, decls, k, newNode, nsCounters, nsCounters_, params, undeclared, usedSymbols, v; state.declaredSymbols = union(state.declaredSymbols, declarationsNeeded(this)); cache$2 = state; @@ -2761,7 +2755,7 @@ exports.Compiler = function () { accum$.push(nsCounters_[k] = v); } return accum$; - }.call(this, []), newNode = generateSymbols(this, { + }.call(this, []), newNode = generateChildSymbols(this, { declaredSymbols: union(declaredSymbols, params), usedSymbols: union(usedSymbols, params), nsCounters: nsCounters_ @@ -2769,10 +2763,24 @@ exports.Compiler = function () { return id.name; })), alreadyDeclared = union(declaredSymbols, concatMap(this.params, collectIdentifiers)), declNames = nub(difference(undeclared, alreadyDeclared)), decls = map(declNames, function (name) { return new JS.Identifier(name); - }), decls.length > 0 ? newNode.body.body.unshift(makeVarDeclaration(decls)) : void 0, newNode) : generateSymbols(this, state); + }), decls.length > 0 ? newNode.body.body.unshift(makeVarDeclaration(decls)) : void 0, newNode) : generateChildSymbols(this, state); state.declaredSymbols = union(declaredSymbols, declarationsNeededRecursive(newNode)); return newNode; }); + return function (jsAST, state) { + var inScope, needed, program; + inScope = (null != state.declaredSymbols ? state.declaredSymbols : []).slice(); + program = generateChildSymbols(jsAST, state); + if (program['instanceof'](JS.Program)) { + needed = nub(difference(concatMap(program.body, declarationsNeededRecursive), inScope)); + if (needed.length > 0) { + program.body.unshift(makeVarDeclaration(needed.map(function (n) { + return new JS.Identifier(n); + }))); + } + } + return program; + }; }(); defaultRule = function () { throw new Error('compile: Non-exhaustive patterns in case: ' + this.className); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index a8df9e41..5070f92a 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; +var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, cache$, cache$1, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { From 681515d89aa527b87f0b44844f322a4baab5f067 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 19:43:26 -0400 Subject: [PATCH 27/64] finish removing non-strict-mode compatible exports --- lib/helpers.js | 16 ++++++++-------- lib/js-nodes.js | 2 +- lib/preprocessor.js | 2 +- src/helpers.coffee | 16 ++++++++-------- src/js-nodes.coffee | 2 +- src/preprocessor.coffee | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 8d0b7ab1..c08f13d0 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -24,7 +24,7 @@ colourise = function (colour, str) { return str; } }; -this.numberLines = numberLines = function (input, startLine) { +exports.numberLines = numberLines = function (input, startLine) { var currLine, i, line, lines, numbered, pad, padSize; if (null == startLine) startLine = 1; @@ -45,10 +45,10 @@ this.numberLines = numberLines = function (input, startLine) { cleanMarkers = function (str) { return str.replace(/[\uEFEF\uEFFE\uEFFF]/g, ''); }; -this.humanReadable = humanReadable = function (str) { +exports.humanReadable = humanReadable = function (str) { return str.replace(/\uEFEF/g, '(INDENT)').replace(/\uEFFE/g, '(DEDENT)').replace(/\uEFFF/g, '(TERM)'); }; -this.formatParserError = function (input, e) { +exports.formatParserError = function (input, e) { var column, found, line, lines, message, offset, realColumn, unicode; lines = input.split('\n'); line = e.line - 1; @@ -75,7 +75,7 @@ this.formatParserError = function (input, e) { message = 'Syntax error on line ' + line + ', column ' + realColumn + ": unexpected '" + found + "' (" + unicode + ')'; return '' + message + '\n' + pointToErrorLocation(input, line, realColumn); }; -this.pointToErrorLocation = pointToErrorLocation = function (source, line, column, numLinesOfContext) { +exports.pointToErrorLocation = pointToErrorLocation = function (source, line, column, numLinesOfContext) { var currentLineOffset, lines, numberedLines, padSize, postLines, preLines, startLine; if (null == numLinesOfContext) numLinesOfContext = 3; @@ -98,7 +98,7 @@ this.pointToErrorLocation = pointToErrorLocation = function (source, line, colum padSize = (currentLineOffset + 1 + postLines.length).toString(10).length; return [].slice.call(preLines).concat(['' + colourise('red', Array(padSize + 1).join('^')) + ' : ' + Array(column).join(' ') + colourise('red', '^')], [].slice.call(postLines)).join('\n'); }; -this.beingDeclared = beingDeclared = function (assignment) { +exports.beingDeclared = beingDeclared = function (assignment) { switch (false) { case !!(null != assignment): return []; @@ -118,7 +118,7 @@ this.beingDeclared = beingDeclared = function (assignment) { throw new Error('beingDeclared: Non-exhaustive patterns in case: ' + assignment.className); } }; -this.declarationsFor = function (node, inScope) { +exports.declarationsFor = function (node, inScope) { var vars; vars = envEnrichments(node, inScope); return foldl(new CS.Undefined().g(), vars, function (expr, v) { @@ -144,7 +144,7 @@ usedAsExpression_ = function (ancestors) { return true; } }; -this.usedAsExpression = usedAsExpression = function (node, ancestors) { +exports.usedAsExpression = usedAsExpression = function (node, ancestors) { return usedAsExpression_.call(node, ancestors); }; envEnrichments_ = function (inScope) { @@ -197,7 +197,7 @@ envEnrichments_ = function (inScope) { }.call(this)); return difference(possibilities, inScope); }; -this.envEnrichments = envEnrichments = function (node) { +exports.envEnrichments = envEnrichments = function (node) { var args; args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; if (null != node) { diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 5070f92a..14b06ace 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -18,7 +18,7 @@ createNode = function (type, props) { return class$; }(Nodes); }; -this.Nodes = Nodes = function () { +exports.Nodes = Nodes = function () { function Nodes() { } Nodes.prototype.listMembers = []; diff --git a/lib/preprocessor.js b/lib/preprocessor.js index 45378b9d..e3d06baf 100644 --- a/lib/preprocessor.js +++ b/lib/preprocessor.js @@ -2,7 +2,7 @@ var DEDENT, INDENT, pointToErrorLocation, Preprocessor, StringScanner, TERM, ws; pointToErrorLocation = require('./helpers').pointToErrorLocation; StringScanner = require('StringScanner'); -this.Preprocessor = Preprocessor = function () { +exports.Preprocessor = Preprocessor = function () { ws = '\\t\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; INDENT = '\uEFEF'; DEDENT = '\uEFFE'; diff --git a/src/helpers.coffee b/src/helpers.coffee index a1ebf980..e4e5ef9d 100644 --- a/src/helpers.coffee +++ b/src/helpers.coffee @@ -17,7 +17,7 @@ colourise = (colour, str) -> if SUPPORTS_COLOUR then "#{COLOURS[colour]}#{str}\x1B[39m" else str -@numberLines = numberLines = (input, startLine = 1) -> +exports.numberLines = numberLines = (input, startLine = 1) -> lines = input.split '\n' padSize = "#{lines.length + startLine - 1}".length numbered = for line, i in lines @@ -28,10 +28,10 @@ colourise = (colour, str) -> cleanMarkers = (str) -> str.replace /[\uEFEF\uEFFE\uEFFF]/g, '' -@humanReadable = humanReadable = (str) -> +exports.humanReadable = humanReadable = (str) -> ((str.replace /\uEFEF/g, '(INDENT)').replace /\uEFFE/g, '(DEDENT)').replace /\uEFFF/g, '(TERM)' -@formatParserError = (input, e) -> +exports.formatParserError = (input, e) -> lines = input.split('\n') line = e.line - 1 # switch to zero-indexed column = e.column @@ -54,7 +54,7 @@ cleanMarkers = (str) -> str.replace /[\uEFEF\uEFFE\uEFFF]/g, '' message = "Syntax error on line #{line}, column #{realColumn}: unexpected '#{found}' (#{unicode})" "#{message}\n#{pointToErrorLocation input, line, realColumn}" -@pointToErrorLocation = pointToErrorLocation = (source, line, column, numLinesOfContext = 3) -> +exports.pointToErrorLocation = pointToErrorLocation = (source, line, column, numLinesOfContext = 3) -> lines = source.split '\n' lines.pop() unless lines[lines.length - 1] # figure out which lines are needed for context @@ -79,7 +79,7 @@ cleanMarkers = (str) -> str.replace /[\uEFEF\uEFFE\uEFFF]/g, '' # these are the identifiers that need to be declared when the given value is # being used as the target of an assignment -@beingDeclared = beingDeclared = (assignment) -> switch +exports.beingDeclared = beingDeclared = (assignment) -> switch when not assignment? then [] when assignment.instanceof CS.Identifiers then [assignment.data] when assignment.instanceof CS.Rest then beingDeclared assignment.expression @@ -89,7 +89,7 @@ cleanMarkers = (str) -> str.replace /[\uEFEF\uEFFE\uEFFF]/g, '' when assignment.instanceof CS.ObjectInitialiser then concatMap assignment.vals(), beingDeclared else throw new Error "beingDeclared: Non-exhaustive patterns in case: #{assignment.className}" -@declarationsFor = (node, inScope) -> +exports.declarationsFor = (node, inScope) -> vars = envEnrichments node, inScope foldl (new CS.Undefined).g(), vars, (expr, v) -> (new CS.AssignOp (new CS.Identifier v).g(), expr).g() @@ -113,7 +113,7 @@ usedAsExpression_ = (ancestors) -> no else yes -@usedAsExpression = usedAsExpression = (node, ancestors) -> +exports.usedAsExpression = usedAsExpression = (node, ancestors) -> usedAsExpression_.call node, ancestors # environment enrichments that occur when this node is evaluated @@ -155,5 +155,5 @@ envEnrichments_ = (inScope = []) -> else envEnrichments this[child], inScope difference possibilities, inScope -@envEnrichments = envEnrichments = (node, args...) -> +exports.envEnrichments = envEnrichments = (node, args...) -> if node? then envEnrichments_.apply node, args else [] diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 0608928c..c66f2ed3 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -8,7 +8,7 @@ createNode = (type, props) -> type: type childNodes: props -@Nodes = class Nodes +exports.Nodes = class Nodes listMembers: [] instanceof: (ctors...) -> # not a fold for efficiency's sake diff --git a/src/preprocessor.coffee b/src/preprocessor.coffee index d08c00a1..0e2f040b 100644 --- a/src/preprocessor.coffee +++ b/src/preprocessor.coffee @@ -6,7 +6,7 @@ StringScanner = require 'StringScanner' # TODO: support win32-style line endings # TODO: now that the preprocessor doesn't support streaming input, optimise the `process` method -@Preprocessor = class Preprocessor +exports.Preprocessor = class Preprocessor ws = '\\t\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF' INDENT = '\uEFEF' From 7c780a627cc772b03efa8a7967d366326408c055 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 20:31:32 -0400 Subject: [PATCH 28/64] static methods --- src/compiler.coffee | 9 +++++++-- src/js-nodes.coffee | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/compiler.coffee b/src/compiler.coffee index e26d2149..d981b394 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -431,13 +431,18 @@ findES6Methods = (classIdentifier, body) -> for statement in body.body expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) - if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') + if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') and (expression.left.object.object.instanceof JS.ThisExpression) if expression.right instanceof JS.FunctionExpression methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)) else properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right) else if expression.left.object instanceof JS.ThisExpression - properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) + if expression.right instanceof JS.FunctionExpression + m = new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right) + m.static = true + methods.push(m) + else + properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) else rest.push(statement) { methods, properties, rest } diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index c66f2ed3..1a985ea7 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -30,7 +30,7 @@ exports.Nodes = class Nodes if @raw? then @offset + @raw.length else undefined ] - for property in ['leadingComments', 'raw', 'expression', 'generator'] + for property in ['leadingComments', 'raw', 'expression', 'generator', 'static'] if this[property]? && property not in @childNodes obj[property] = this[property] obj From 22b5f38a1f4c7997ad02658c1f1c170c646befc2 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 21:26:13 -0400 Subject: [PATCH 29/64] anonymous classes & external constructors --- lib/compiler.js | 46 ++++++++++++++++++++++++++++++--------------- lib/js-nodes.js | 12 +++++++++++- src/compiler.coffee | 44 +++++++++++++++++++++++++++++++++---------- src/js-nodes.coffee | 3 ++- 4 files changed, 78 insertions(+), 27 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 4110bd6e..cb87c8ce 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -767,31 +767,47 @@ for (h in inlineHelpers) { helpers[h] = fn; } findES6Methods = function (classIdentifier, body) { - var expression, methods, properties, rest, statement; + var expression, m, methods, properties, rewriteThis, statement, unmatched; methods = []; properties = []; - rest = []; + unmatched = []; for (var i$ = 0, length$ = body.body.length; i$ < length$; ++i$) { statement = body.body[i$]; expression = statement.expression; if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { - if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype') { + if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype' && expression.left.object.object['instanceof'](JS.ThisExpression)) { if (expression.right instanceof JS.FunctionExpression) { methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)); } else { properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right)); } } else if (expression.left.object instanceof JS.ThisExpression) { - properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); + if (expression.right instanceof JS.FunctionExpression) { + m = new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right); + m['static'] = true; + methods.push(m); + } else { + properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); + } } } else { - rest.push(statement); + unmatched.push(statement); } } + rewriteThis = generateMutatingWalker(function () { + if (this['instanceof'](JS.ThisExpression)) { + return classIdentifier; + } else if (this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration)) { + return this; + } else { + return rewriteThis(this); + } + }); + properties = map(properties, rewriteThis); return { methods: methods, properties: properties, - rest: rest + unmatched: unmatched }; }; funcExpr = function (param$) { @@ -1475,7 +1491,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, args, block, body, c, cache$2, cache$3, classIdentifier, classProperties, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rest, rewriteThis; + var _, args, block, body, c, cache$2, cache$3, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, unmatched; var ctor, name; { cache$2 = param$; @@ -1488,25 +1504,25 @@ exports.Compiler = function () { options = cache$2.options; } if (options.targetES6) { - classIdentifier = new JS.Identifier(name.name); + classIdentifier = name.name ? new JS.Identifier(name.name) : genSym('klass'); if (parent) { parentIdentifier = new JS.Identifier(parent.name); } cache$3 = findES6Methods(classIdentifier, forceBlock(body)); methods = cache$3.methods; properties = cache$3.properties; - classProperties = cache$3.classProperties; - rest = cache$3.rest; + unmatched = cache$3.unmatched; if (ctor) { - for (var i$ = 0, length$ = rest.length; i$ < length$; ++i$) { - c = rest[i$]; + for (var i$ = 0, length$ = unmatched.length; i$ < length$; ++i$) { + c = unmatched[i$]; i = i$; if (!c['instanceof'](JS.FunctionDeclaration)) continue; ctorIndex = i; break; } - rest.splice(ctorIndex, 1); + debugger; + unmatched.splice(ctorIndex, 1); methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ id: ctor.id, params: ctor.params, @@ -1515,8 +1531,8 @@ exports.Compiler = function () { rest: ctor.rest }))); } - if (rest.length === 0) { - return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); + if (unmatched.length === 0 && (!this.ctor || this.ctor.expression['instanceof'](CS.Functions))) { + return classIdentifier['instanceof'](JS.GenSym) ? properties.length === 0 ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])) : new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); } } args = []; diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 14b06ace..b430e84c 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -68,7 +68,8 @@ exports.Nodes = Nodes = function () { 'leadingComments', 'raw', 'expression', - 'generator' + 'generator', + 'static' ], i$2 = 0, length$2 = cache$.length; i$2 < length$2; ++i$2) { property = cache$[i$2]; if (null != this[property] && !in$(property, this.childNodes)) { @@ -158,6 +159,15 @@ nodeData = [ 'body' ] ], + [ + 'ClassExpression', + false, + [ + 'id', + 'superClass', + 'body' + ] + ], [ 'ConditionalExpression', false, diff --git a/src/compiler.coffee b/src/compiler.coffee index d981b394..656a539c 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -427,7 +427,7 @@ for own h, fn of inlineHelpers findES6Methods = (classIdentifier, body) -> methods = [] properties = [] - rest = [] + unmatched = [] for statement in body.body expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) @@ -444,8 +444,16 @@ findES6Methods = (classIdentifier, body) -> else properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) else - rest.push(statement) - { methods, properties, rest } + unmatched.push(statement) + + rewriteThis = generateMutatingWalker -> + if @instanceof JS.ThisExpression then classIdentifier + else if @instanceof JS.FunctionExpression, JS.FunctionDeclaration then this + else rewriteThis this + + properties = map properties, rewriteThis + + { methods, properties, unmatched } funcExpr = ({id, params, defaults, rest, body}) -> new JS.FunctionExpression(id ? null, params ? [], defaults ? [], rest ? null, body) @@ -778,19 +786,35 @@ class exports.Compiler # TODO: comment [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options}) -> if options.targetES6 - classIdentifier = new JS.Identifier(name.name) + classIdentifier = if name.name + new JS.Identifier(name.name) + else + genSym 'klass' if parent parentIdentifier = new JS.Identifier(parent.name) - { methods, properties, classProperties, rest } = findES6Methods(classIdentifier, forceBlock body) + { methods, properties, unmatched } = findES6Methods(classIdentifier, forceBlock body) if ctor - for c, i in rest when c.instanceof JS.FunctionDeclaration + for c, i in unmatched when c.instanceof JS.FunctionDeclaration ctorIndex = i break - rest.splice(ctorIndex, 1) + debugger + unmatched.splice(ctorIndex, 1) methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr(id: ctor.id, params: ctor.params, body: ctor.body, defaults: ctor.defaults, rest: ctor.rest)) - # Emit our ES6 class if we were able to account for everything in its definition. Otherwise, fall through to the non-ES6 emulation - if rest.length == 0 - return new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)) + # Emit our ES6 class only if we were able to account for + # everything in its definition. Otherwise, fall through to the + # non-ES6 emulation + if unmatched.length == 0 and (!@ctor || @ctor.expression.instanceof CS.Functions) + return if classIdentifier.instanceof JS.GenSym + if properties.length == 0 + new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) + else + block = new JS.BlockStatement([ + new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + ].concat(map properties, stmt).concat(makeReturn classIdentifier) + ) + new JS.CallExpression (funcExpr body: block).g(), [] + else + new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)) args = [] params = [] diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 1a985ea7..80f83fe2 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -47,7 +47,8 @@ nodeData = [ ['CallExpression' , no , ['callee', 'arguments']] ['CatchClause' , yes, ['param', 'body']] ['ClassBody' , yes, ['body']] - ['ClassDeclaration' , yes, ['id', 'superClass', 'body']] + ['ClassDeclaration' , yes, ['id', 'superClass', 'body']] + ['ClassExpression' , no, ['id', 'superClass', 'body']] ['ConditionalExpression', no , ['test', 'consequent', 'alternate']] ['ContinueStatement' , yes, ['label']] ['DebuggerStatement' , yes, []] From d2bfb5cc3f2ffbaec6b27ff6817f5b04e327086a Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 22:25:26 -0400 Subject: [PATCH 30/64] punt on classes with complex assignee's for now --- lib/compiler.js | 4 +--- src/compiler.coffee | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index cb87c8ce..5494410c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1521,7 +1521,6 @@ exports.Compiler = function () { ctorIndex = i; break; } - debugger; unmatched.splice(ctorIndex, 1); methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ id: ctor.id, @@ -1531,7 +1530,7 @@ exports.Compiler = function () { rest: ctor.rest }))); } - if (unmatched.length === 0 && (!this.ctor || this.ctor.expression['instanceof'](CS.Functions))) { + if (unmatched.length === 0 && (!this.ctor || this.ctor.expression['instanceof'](CS.Functions)) && (!nameAssignee || nameAssignee['instanceof'](JS.Identifier))) { return classIdentifier['instanceof'](JS.GenSym) ? properties.length === 0 ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])) : new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); } } @@ -1634,7 +1633,6 @@ exports.Compiler = function () { var expression, tmpName; expression = param$.expression; tmpName = genSym('class'); - debugger; if (this.expression['instanceof'](CS.Functions)) { return funcDecl({ id: tmpName, diff --git a/src/compiler.coffee b/src/compiler.coffee index 656a539c..5543f91a 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -797,13 +797,12 @@ class exports.Compiler for c, i in unmatched when c.instanceof JS.FunctionDeclaration ctorIndex = i break - debugger unmatched.splice(ctorIndex, 1) methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr(id: ctor.id, params: ctor.params, body: ctor.body, defaults: ctor.defaults, rest: ctor.rest)) # Emit our ES6 class only if we were able to account for # everything in its definition. Otherwise, fall through to the # non-ES6 emulation - if unmatched.length == 0 and (!@ctor || @ctor.expression.instanceof CS.Functions) + if unmatched.length == 0 and (!@ctor || @ctor.expression.instanceof CS.Functions) and (!nameAssignee or nameAssignee.instanceof JS.Identifier) return if classIdentifier.instanceof JS.GenSym if properties.length == 0 new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) @@ -875,7 +874,6 @@ class exports.Compiler ] [CS.Constructor, ({expression}) -> tmpName = genSym 'class' - debugger if @expression.instanceof CS.Functions funcDecl id: tmpName, params: expression.params, defaults: expression.defaults, rest: expression.rest, body: (forceBlock expression.body) else From 2ee35e500ed9ba4b816222952543d359e408ab73 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 22:47:21 -0400 Subject: [PATCH 31/64] use mapChildNodes --- lib/compiler.js | 13 +++---------- src/compiler.coffee | 14 +++----------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 5494410c..6106b470 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -282,16 +282,9 @@ declaredIdentifiers = function (node) { } else if (node['instanceof'](JS.MemberExpression)) { return []; } else { - return concatMap(node.childNodes, function (childName) { - if (!(null != node[childName])) { - return []; - } - if (in$(childName, node.listMembers)) { - return concatMap(node[childName], declaredIdentifiers); - } else { - return declaredIdentifiers(node[childName]); - } - }); + return mapChildNodes(node, declaredIdentifiers, function (a, b) { + return a.concat(b); + }, []); } }; declarationsNeeded = function (node) { diff --git a/src/compiler.coffee b/src/compiler.coffee index 5543f91a..5ec9dce1 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -136,17 +136,9 @@ generateMutatingWalker = (fn) -> (node, args...) -> declaredIdentifiers = (node) -> return [] unless node? - if node.instanceof JS.Identifier - [node.name] - else if node.instanceof JS.MemberExpression - [] - else - concatMap node.childNodes, (childName) -> - return [] unless node[childName]? - if childName in node.listMembers - concatMap node[childName], declaredIdentifiers - else - declaredIdentifiers node[childName] + if node.instanceof JS.Identifier then [node.name] + else if node.instanceof JS.MemberExpression then [] + else mapChildNodes node, declaredIdentifiers, ((a,b) -> a.concat(b)), [] declarationsNeeded = (node) -> return [] unless node? From c785e29c1e6e046712c8b00f5bac88c6ec9d4758 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 22:51:08 -0400 Subject: [PATCH 32/64] don't drop nulls from child node lists Because we need them to properly represent function defaults. --- lib/compiler.js | 4 +--- src/compiler.coffee | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 6106b470..25593c7f 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -95,8 +95,6 @@ mapChildNodes = function (node, mapper, reducer, identity, opts) { accum$.push(in$(childName, node.listMembers) ? foldl(opts.listIdentity, function (accum$1) { for (var i$1 = 0, length$1 = node[childName].length; i$1 < length$1; ++i$1) { child = node[childName][i$1]; - if (!('undefined' !== typeof child && null != child)) - continue; accum$1.push(mapper(child, childName)); } return accum$1; @@ -235,7 +233,7 @@ generateMutatingWalker = function (fn) { mapper = function (child, nameInParent) { return [ nameInParent, - fn.apply(child, args) + null != child ? fn.apply(child, args) : child ]; }; reducer = function (parent, param$) { diff --git a/src/compiler.coffee b/src/compiler.coffee index 5ec9dce1..9891ba86 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -34,7 +34,7 @@ mapChildNodes = (node, mapper, reducer, identity, opts={}) -> opts.listIdentity ?= identity foldl identity, (for childName in node.childNodes when node[childName]? if childName in node.listMembers - foldl opts.listIdentity, (mapper(child, childName) for child in node[childName] when child?), opts.listReducer + foldl opts.listIdentity, (mapper(child, childName) for child in node[childName]), opts.listReducer else mapper(node[childName], childName) ), reducer @@ -125,7 +125,7 @@ makeReturn = (node) -> generateMutatingWalker = (fn) -> (node, args...) -> - mapper = (child, nameInParent) -> [nameInParent, fn.apply(child, args)] + mapper = (child, nameInParent) -> [nameInParent, (if child? then fn.apply(child, args) else child)] reducer = (parent, [name, newChild]) -> parent[name] = newChild; parent mapChildNodes node, mapper, reducer, node, { listReducer: ([_, accum],[name, newChild]) -> [name, accum.concat(newChild) ] From c71e98b480925d455a5d69b1cac122408e7ae967 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 23:03:04 -0400 Subject: [PATCH 33/64] only emit ES6 RestElement in final position --- lib/compiler.js | 19 +++++++++---------- src/compiler.coffee | 5 +++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 25593c7f..56862200 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -398,17 +398,16 @@ dynamicMemberAccess = function (e, index) { } }; es6AssignmentPattern = function (assignee) { - var elements; + var elements, elt, index; if (assignee instanceof JS.ArrayExpression) { - elements = assignee.elements.map(function (elt) { - if (elt instanceof JS.Identifier) { - return elt; - } else if (elt.rest) { - return new JS.RestElement(elt.expression); - } else { - return es6AssignmentPattern(elt); - } - }); + elements = function (accum$) { + for (var i$ = 0, length$ = assignee.elements.length; i$ < length$; ++i$) { + elt = assignee.elements[i$]; + index = i$; + accum$.push(elt instanceof JS.Identifier ? elt : elt.rest ? index === assignee.elements.length - 1 ? new JS.RestElement(elt.expression) : void 0 : es6AssignmentPattern(elt)); + } + return accum$; + }.call(this, []); if (all(elements, function (elt) { return null != elt; })) { diff --git a/src/compiler.coffee b/src/compiler.coffee index 9891ba86..d401c2fd 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -205,11 +205,12 @@ dynamicMemberAccess = (e, index) -> es6AssignmentPattern = (assignee) -> if assignee instanceof JS.ArrayExpression - elements = assignee.elements.map (elt) -> + elements = for elt, index in assignee.elements if elt instanceof JS.Identifier elt else if elt.rest - new JS.RestElement elt.expression + if index == assignee.elements.length - 1 + new JS.RestElement elt.expression else es6AssignmentPattern(elt) if all(elements, (elt) -> elt?) From e3e71b6b64a704afb7bc44b1ecaf78a5d43fa35c Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Thu, 28 May 2015 23:33:53 -0400 Subject: [PATCH 34/64] support ES6 methods that equal language keywords --- lib/compiler.js | 15 ++++++++++++--- src/compiler.coffee | 13 +++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 56862200..b843f9a3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -757,23 +757,32 @@ for (h in inlineHelpers) { helpers[h] = fn; } findES6Methods = function (classIdentifier, body) { - var expression, m, methods, properties, rewriteThis, statement, unmatched; + var expression, m, methodIdentifier, methods, properties, rewriteThis, statement, unmatched; methods = []; properties = []; unmatched = []; + methodIdentifier = function (expression) { + var prop; + prop = expression.left.property; + if (prop instanceof JS.Identifier) { + return new JS.Identifier(prop.name); + } else if (prop instanceof JS.Literal) { + return new JS.Identifier(prop.value); + } + }; for (var i$ = 0, length$ = body.body.length; i$ < length$; ++i$) { statement = body.body[i$]; expression = statement.expression; if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype' && expression.left.object.object['instanceof'](JS.ThisExpression)) { if (expression.right instanceof JS.FunctionExpression) { - methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)); + methods.push(new JS.MethodDefinition(methodIdentifier(expression), expression.right)); } else { properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right)); } } else if (expression.left.object instanceof JS.ThisExpression) { if (expression.right instanceof JS.FunctionExpression) { - m = new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right); + m = new JS.MethodDefinition(methodIdentifier(expression), expression.right); m['static'] = true; methods.push(m); } else { diff --git a/src/compiler.coffee b/src/compiler.coffee index d401c2fd..1381e62a 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -421,17 +421,26 @@ findES6Methods = (classIdentifier, body) -> methods = [] properties = [] unmatched = [] + + methodIdentifier = (expression) -> + prop = expression.left.property + if prop instanceof JS.Identifier + new JS.Identifier(prop.name) + else if prop instanceof JS.Literal + # ES6 allows method names that are the same as reserved keywords + new JS.Identifier(prop.value) + for statement in body.body expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') and (expression.left.object.object.instanceof JS.ThisExpression) if expression.right instanceof JS.FunctionExpression - methods.push(new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right)) + methods.push(new JS.MethodDefinition(methodIdentifier(expression), expression.right)) else properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right) else if expression.left.object instanceof JS.ThisExpression if expression.right instanceof JS.FunctionExpression - m = new JS.MethodDefinition(new JS.Identifier(expression.left.property.name), expression.right) + m = new JS.MethodDefinition(methodIdentifier(expression), expression.right) m.static = true methods.push(m) else From bdda1e247371df73ae0b130048a828601f603d79 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 00:04:05 -0400 Subject: [PATCH 35/64] clarify ClassExpressions vs ClassDeclarations --- lib/compiler.js | 4 +++- src/compiler.coffee | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index b843f9a3..3ae31abb 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -130,6 +130,8 @@ stmt = function (e) { return new JS.BlockStatement(walk(e)); } else if (e['instanceof'](JS.ConditionalExpression)) { return new JS.IfStatement(expr(e.test), stmt(e.consequent), stmt(e.alternate)); + } else if (e['instanceof'](JS.ClassExpression)) { + return new JS.ClassDeclaration(e.id, e.superclass, e.body); } else { return new JS.ExpressionStatement(e); } @@ -1530,7 +1532,7 @@ exports.Compiler = function () { }))); } if (unmatched.length === 0 && (!this.ctor || this.ctor.expression['instanceof'](CS.Functions)) && (!nameAssignee || nameAssignee['instanceof'](JS.Identifier))) { - return classIdentifier['instanceof'](JS.GenSym) ? properties.length === 0 ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])) : new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)); + return properties.length === 0 ? classIdentifier['instanceof'](JS.GenSym) ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : new JS.ClassExpression(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])); } } args = []; diff --git a/src/compiler.coffee b/src/compiler.coffee index 1381e62a..16b34249 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -56,6 +56,8 @@ stmt = (e) -> else if e.instanceof JS.ConditionalExpression # TODO: drop either the consequent or the alternate if they don't have side effects new JS.IfStatement (expr e.test), (stmt e.consequent), stmt e.alternate + else if e.instanceof JS.ClassExpression + new JS.ClassDeclaration e.id, e.superclass, e.body else new JS.ExpressionStatement e expr = (s) -> @@ -805,17 +807,19 @@ class exports.Compiler # everything in its definition. Otherwise, fall through to the # non-ES6 emulation if unmatched.length == 0 and (!@ctor || @ctor.expression.instanceof CS.Functions) and (!nameAssignee or nameAssignee.instanceof JS.Identifier) - return if classIdentifier.instanceof JS.GenSym - if properties.length == 0 + return if properties.length == 0 + # Always return ClassExpressions. The `stmt` helper knows + # how to conver them to ClassDeclarations if needed. + if classIdentifier.instanceof JS.GenSym new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) else - block = new JS.BlockStatement([ - new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) - ].concat(map properties, stmt).concat(makeReturn classIdentifier) - ) - new JS.CallExpression (funcExpr body: block).g(), [] + new JS.ClassExpression(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) else - new JS.SequenceExpression([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(properties)) + block = new JS.BlockStatement([ + new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + ].concat(map properties, stmt).concat(makeReturn classIdentifier) + ) + new JS.CallExpression (funcExpr body: block).g(), [] args = [] params = [] From 75fc57f47106d911d3e877b527ef67d73b12a8de Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 17:48:02 -0400 Subject: [PATCH 36/64] enforce ES6 rules for constructor super --- lib/compiler.js | 73 +++++++++++++++++++++++++++++++++++++++++---- package.json | 1 + src/compiler.coffee | 69 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 130 insertions(+), 13 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 3ae31abb..b4b17a2c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -24,6 +24,7 @@ usedAsExpression = cache$1.usedAsExpression; envEnrichments = cache$1.envEnrichments; CS = require('./nodes'); JS = require('./js-nodes'); +debugES6 = require('debug')('es6'); exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; jsReserved = [ 'break', @@ -131,7 +132,7 @@ stmt = function (e) { } else if (e['instanceof'](JS.ConditionalExpression)) { return new JS.IfStatement(expr(e.test), stmt(e.consequent), stmt(e.alternate)); } else if (e['instanceof'](JS.ClassExpression)) { - return new JS.ClassDeclaration(e.id, e.superclass, e.body); + return new JS.ClassDeclaration(e.id, e.superClass, e.body); } else { return new JS.ExpressionStatement(e); } @@ -811,6 +812,57 @@ findES6Methods = function (classIdentifier, body) { unmatched: unmatched }; }; +es6SafeConstructor = function (isDerivedClass, block) { + var calledSuper, callsSuper, either, referencesThis, sawThis, statement; + if (!isDerivedClass) { + return block; + } + either = function (a, b) { + return a || b; + }; + referencesThis = function (node) { + if (null != node && node instanceof JS.ThisExpression) { + return true; + } else { + return mapChildNodes(node, referencesThis, either, false); + } + }; + callsSuper = function (node) { + if (null != node && node instanceof JS.CallExpression && node.callee instanceof JS.Identifier && node.callee.name === 'super') { + return true; + } else { + return mapChildNodes(node, callsSuper, either, false); + } + }; + sawThis = calledSuper = false; + for (var i$ = 0, length$ = block.body.length; i$ < length$; ++i$) { + statement = block.body[i$]; + sawThis = sawThis || referencesThis(statement); + if (callsSuper(statement)) { + if (sawThis) { + return null; + } else { + calledSuper = true; + } + } + } + if (!calledSuper) { + block.body.unshift(stmt(new JS.CallExpression(new JS.Identifier('super'), []))); + } + return block; +}; +describeClass = function (name, parentNode) { + if (null != name ? name.name : void 0) { + return 'class ' + name.name; + } + if (parentNode instanceof CS.AssignOp && parentNode.assignee instanceof CS.Identifier) { + return 'An anonymous class assigned to identifier ' + parentNode.assignee.data; + } + if (parentNode instanceof CS.ObjectInitialiserMember) { + return 'An anonymous class assigned to property ' + parentNode.key.data; + } + return 'An anonymous class'; +}; funcExpr = function (param$) { var body, cache$2, defaults, id, params, rest; { @@ -1492,7 +1544,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, args, block, body, c, cache$2, cache$3, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, unmatched; + var _, ancestry, args, block, body, c, cache$2, cache$3, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, safeCtor, unmatched; var ctor, name; { cache$2 = param$; @@ -1503,6 +1555,7 @@ exports.Compiler = function () { body = cache$2.body; compile = cache$2.compile; options = cache$2.options; + ancestry = cache$2.ancestry; } if (options.targetES6) { classIdentifier = name.name ? new JS.Identifier(name.name) : genSym('klass'); @@ -1513,7 +1566,7 @@ exports.Compiler = function () { methods = cache$3.methods; properties = cache$3.properties; unmatched = cache$3.unmatched; - if (ctor) { + if (ctor && (safeCtor = es6SafeConstructor(null != parent, ctor.body))) { for (var i$ = 0, length$ = unmatched.length; i$ < length$; ++i$) { c = unmatched[i$]; i = i$; @@ -1526,12 +1579,20 @@ exports.Compiler = function () { methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ id: ctor.id, params: ctor.params, - body: ctor.body, + body: safeCtor, defaults: ctor.defaults, rest: ctor.rest }))); } - if (unmatched.length === 0 && (!this.ctor || this.ctor.expression['instanceof'](CS.Functions)) && (!nameAssignee || nameAssignee['instanceof'](JS.Identifier))) { + if (this.ctor && !this.ctor.expression['instanceof'](CS.Functions)) { + debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor is not a function expression.'); + } else if (this.ctor && !safeCtor) { + debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor does not follow the ES6 rules for super.'); + } else if (nameAssignee && !nameAssignee['instanceof'](JS.Identifier)) { + debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because it's being assigned to a compound name."); + } else if (unmatched.length > 0) { + debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties."); + } else { return properties.length === 0 ? classIdentifier['instanceof'](JS.GenSym) ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : new JS.ClassExpression(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])); } } diff --git a/package.json b/package.json index 560252a8..d3c43627 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "StringScanner": "~0.0.3", + "debug": "^2.2.0", "nopt": "~2.1.2" }, "optionalDependencies": { diff --git a/src/compiler.coffee b/src/compiler.coffee index 16b34249..f861a71b 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -2,6 +2,8 @@ {beingDeclared, usedAsExpression, envEnrichments} = require './helpers' CS = require './nodes' JS = require './js-nodes' +debugES6 = require('debug')('es6') + exports = module?.exports ? this # TODO: this whole file could use a general cleanup @@ -57,7 +59,7 @@ stmt = (e) -> # TODO: drop either the consequent or the alternate if they don't have side effects new JS.IfStatement (expr e.test), (stmt e.consequent), stmt e.alternate else if e.instanceof JS.ClassExpression - new JS.ClassDeclaration e.id, e.superclass, e.body + new JS.ClassDeclaration e.id, e.superClass, e.body else new JS.ExpressionStatement e expr = (s) -> @@ -456,9 +458,48 @@ findES6Methods = (classIdentifier, body) -> else rewriteThis this properties = map properties, rewriteThis - + { methods, properties, unmatched } + +es6SafeConstructor = (isDerivedClass, block) -> + return block unless isDerivedClass + + either = (a,b) -> a or b + + referencesThis = (node) -> + if node? and node instanceof JS.ThisExpression then true + else mapChildNodes(node, referencesThis, either, false) + + callsSuper = (node) -> + if node? and node instanceof JS.CallExpression and \ + node.callee instanceof JS.Identifier and \ + node.callee.name == 'super' + true + else + mapChildNodes(node, callsSuper, either, false) + + sawThis = calledSuper = false + for statement in block.body + sawThis = sawThis or referencesThis(statement) + if callsSuper(statement) + if sawThis + return null + else + calledSuper = true + if not calledSuper + block.body.unshift(stmt new JS.CallExpression(new JS.Identifier('super'), [])) + block + +describeClass = (name, parentNode) -> + return "class #{name.name}" if name?.name + if parentNode instanceof CS.AssignOp and parentNode.assignee instanceof CS.Identifier + return "An anonymous class assigned to identifier #{parentNode.assignee.data}" + if parentNode instanceof CS.ObjectInitialiserMember + return "An anonymous class assigned to property #{parentNode.key.data}" + return "An anonymous class" + + funcExpr = ({id, params, defaults, rest, body}) -> new JS.FunctionExpression(id ? null, params ? [], defaults ? [], rest ? null, body) @@ -779,6 +820,7 @@ class exports.Compiler rewriteThis block fn = funcExpr params:parameters, defaults:defaults, rest: rest, body: block + if performedRewrite new JS.CallExpression (funcExpr params: [newThis], body: new JS.BlockStatement [ new JS.ReturnStatement fn @@ -788,7 +830,7 @@ class exports.Compiler [CS.Rest, ({expression, options}) -> {rest: yes, expression, isExpression: yes, isStatement: yes}] # TODO: comment - [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options}) -> + [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options, ancestry}) -> if options.targetES6 classIdentifier = if name.name new JS.Identifier(name.name) @@ -797,16 +839,30 @@ class exports.Compiler if parent parentIdentifier = new JS.Identifier(parent.name) { methods, properties, unmatched } = findES6Methods(classIdentifier, forceBlock body) - if ctor + if ctor and (safeCtor = es6SafeConstructor(parent?, ctor.body)) for c, i in unmatched when c.instanceof JS.FunctionDeclaration ctorIndex = i break unmatched.splice(ctorIndex, 1) - methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr(id: ctor.id, params: ctor.params, body: ctor.body, defaults: ctor.defaults, rest: ctor.rest)) + methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr( + id: ctor.id, + params: ctor.params, + body: safeCtor + defaults: ctor.defaults, + rest: ctor.rest + )) # Emit our ES6 class only if we were able to account for # everything in its definition. Otherwise, fall through to the # non-ES6 emulation - if unmatched.length == 0 and (!@ctor || @ctor.expression.instanceof CS.Functions) and (!nameAssignee or nameAssignee.instanceof JS.Identifier) + if @ctor and not @ctor.expression.instanceof CS.Functions + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor is not a function expression." + else if @ctor and not safeCtor + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor does not follow the ES6 rules for super." + else if nameAssignee and not nameAssignee.instanceof JS.Identifier + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it's being assigned to a compound name." + else if unmatched.length > 0 + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties." + else return if properties.length == 0 # Always return ClassExpressions. The `stmt` helper knows # how to conver them to ClassDeclarations if needed. @@ -1340,4 +1396,3 @@ class exports.Compiler declaredSymbols: inScope usedSymbols: union jsReserved[..], collectIdentifiers jsAST nsCounters: {} - From 46d20ad4190c5fc130749ad7fd2da4eb1d37c89a Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 18:58:54 -0400 Subject: [PATCH 37/64] fix Class scoping --- lib/compiler.js | 12 ++++++++---- src/compiler.coffee | 45 ++++++++++++++++++++++++++++++++------------- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index b4b17a2c..6913d553 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -131,8 +131,8 @@ stmt = function (e) { return new JS.BlockStatement(walk(e)); } else if (e['instanceof'](JS.ConditionalExpression)) { return new JS.IfStatement(expr(e.test), stmt(e.consequent), stmt(e.alternate)); - } else if (e['instanceof'](JS.ClassExpression)) { - return new JS.ClassDeclaration(e.id, e.superClass, e.body); + } else if (typeof e.becomeStatement === 'function') { + return e.becomeStatement(); } else { return new JS.ExpressionStatement(e); } @@ -1544,7 +1544,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, ancestry, args, block, body, c, cache$2, cache$3, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, safeCtor, unmatched; + var _, ancestry, args, block, body, c, cache$2, cache$3, classAssignment, classExpression, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, safeCtor, unmatched; var ctor, name; { cache$2 = param$; @@ -1593,7 +1593,11 @@ exports.Compiler = function () { } else if (unmatched.length > 0) { debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties."); } else { - return properties.length === 0 ? classIdentifier['instanceof'](JS.GenSym) ? new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) : new JS.ClassExpression(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) : (block = new JS.BlockStatement([new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods))].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])); + classExpression = new JS.ClassExpression(classIdentifier instanceof JS.GenSym ? null : classIdentifier, parentIdentifier, new JS.ClassBody(methods)); + classAssignment = new JS.AssignmentExpression('=', classIdentifier, classExpression); + return properties.length === 0 ? classIdentifier instanceof JS.GenSym ? classExpression : (classAssignment.becomeStatement = function () { + return new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)); + }, classAssignment) : (block = new JS.BlockStatement([stmt(classAssignment)].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])); } } args = []; diff --git a/src/compiler.coffee b/src/compiler.coffee index f861a71b..f8ba0442 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -47,6 +47,8 @@ genSym = do -> stmt = (e) -> + # TODO: move these special cases into type-specific + # `becomeStatement` methods. return e unless e? if e.isStatement then e else if e.instanceof JS.SequenceExpression @@ -58,8 +60,8 @@ stmt = (e) -> else if e.instanceof JS.ConditionalExpression # TODO: drop either the consequent or the alternate if they don't have side effects new JS.IfStatement (expr e.test), (stmt e.consequent), stmt e.alternate - else if e.instanceof JS.ClassExpression - new JS.ClassDeclaration e.id, e.superClass, e.body + else if typeof e.becomeStatement == 'function' + e.becomeStatement() else new JS.ExpressionStatement e expr = (s) -> @@ -851,6 +853,7 @@ class exports.Compiler defaults: ctor.defaults, rest: ctor.rest )) + # Emit our ES6 class only if we were able to account for # everything in its definition. Otherwise, fall through to the # non-ES6 emulation @@ -863,20 +866,36 @@ class exports.Compiler else if unmatched.length > 0 debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties." else + # Key difference between coffeescript and ES6: in + # coffeescript, you get a local binding to the class's name + # whether or not you use the class as an expression + # value. In ES6, a class used as an expression value does + # not create a local binding. So to mimic coffeescript + # semantics in ES6, we convert `a = class B` to: + # + # var a, B; + # a = B = class B {} + # + # This is analogous to the way `var x = function y(){}` works. + classExpression = new JS.ClassExpression((if (classIdentifier instanceof JS.GenSym) then null else classIdentifier), parentIdentifier, new JS.ClassBody(methods)) + classAssignment = new JS.AssignmentExpression '=', classIdentifier, classExpression + + return if properties.length == 0 - # Always return ClassExpressions. The `stmt` helper knows - # how to conver them to ClassDeclarations if needed. - if classIdentifier.instanceof JS.GenSym - new JS.ClassExpression(null, parentIdentifier, new JS.ClassBody(methods)) + if classIdentifier instanceof JS.GenSym + # no properties, no name, so we can use just a bare anonymous expression + classExpression else - new JS.ClassExpression(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + # no properties, with name, so we use an assignment + # expression, and we provide the option to simply to a + # declaration if we're used in a statement context. + classAssignment.becomeStatement = -> new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + classAssignment else - block = new JS.BlockStatement([ - new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) - ].concat(map properties, stmt).concat(makeReturn classIdentifier) - ) - new JS.CallExpression (funcExpr body: block).g(), [] - + # need to set properties, so create an IIFE + block = new JS.BlockStatement([ stmt classAssignment ].concat(map properties, stmt).concat(makeReturn classIdentifier)) + new JS.CallExpression((funcExpr body: block).g(), []) + args = [] params = [] parentRef = genSym 'super' From 3aac70a7d73710cdfd31104f7b563fac45089de5 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 20:54:34 -0400 Subject: [PATCH 38/64] avoid mutating original constructor bodies Because we may still decide to give up on ES6ifying and fall through to the original code path. --- lib/compiler.js | 1 + src/compiler.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 6913d553..d768e0da 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -847,6 +847,7 @@ es6SafeConstructor = function (isDerivedClass, block) { } } if (!calledSuper) { + block = new JS.BlockStatement(block.body.slice()); block.body.unshift(stmt(new JS.CallExpression(new JS.Identifier('super'), []))); } return block; diff --git a/src/compiler.coffee b/src/compiler.coffee index f8ba0442..2b77476b 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -490,6 +490,7 @@ es6SafeConstructor = (isDerivedClass, block) -> else calledSuper = true if not calledSuper + block = new JS.BlockStatement(block.body.slice()) block.body.unshift(stmt new JS.CallExpression(new JS.Identifier('super'), [])) block From a4a316315a54c350c25afc97d7dd2da7dc135fff Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 22:02:14 -0400 Subject: [PATCH 39/64] preserve semantics of 'arguments' keyword in bound functions --- lib/compiler.js | 58 ++++++++++++++++++++++++++++++++++++--------- src/compiler.coffee | 47 +++++++++++++++++++++++++++--------- 2 files changed, 83 insertions(+), 22 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index d768e0da..5c976129 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -799,7 +799,7 @@ findES6Methods = function (classIdentifier, body) { rewriteThis = generateMutatingWalker(function () { if (this['instanceof'](JS.ThisExpression)) { return classIdentifier; - } else if (this['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration)) { + } else if (isScopeBoundary(this)) { return this; } else { return rewriteThis(this); @@ -852,6 +852,48 @@ es6SafeConstructor = function (isDerivedClass, block) { } return block; }; +es6SafeArrowExpression = function (parameters, defaults, rest, block) { + var rewriteArguments, statement, usesArguments; + usesArguments = function (node) { + if (node instanceof JS.Identifier) { + return node.name === 'arguments'; + } else { + return mapChildNodes(node, usesArguments, function (a, b) { + return a || b; + }, false); + } + }; + if (any(block.body, usesArguments)) { + if (parameters.length > 0) { + debugES6("Skipping arrow function conversion because your bound function refers to the 'arguments' keyword and has regular positional arguments"); + return null; + } + if (null != rest) + rest; + else + rest = genSym('arguments'); + rewriteArguments = generateMutatingWalker(function () { + if (this['instanceof'](JS.Identifier) && this.name === 'arguments') { + return rest; + } else if (isScopeBoundary(this)) { + return this; + } else { + return rewriteArguments(this); + } + }); + for (var i$ = 0, length$ = block.body.length; i$ < length$; ++i$) { + statement = block.body[i$]; + rewriteArguments(statement); + } + } + if (block.body.length === 1 && block.body[0] instanceof JS.ReturnStatement) { + fn = new JS.ArrowFunctionExpression(parameters, defaults, rest, block.body[0].argument); + fn.expression = true; + return fn; + } else { + return new JS.ArrowFunctionExpression(parameters, defaults, rest, block); + } +}; describeClass = function (name, parentNode) { if (null != name ? name.name : void 0) { return 'class ' + name.name; @@ -1397,7 +1439,7 @@ exports.Compiler = function () { } }; return function (param$) { - var alternate, ancestry, block, cache$2, consequent, defaults, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; + var alternate, ancestry, arrow, block, cache$2, consequent, defaults, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; var body, parameters; { cache$2 = param$; @@ -1485,14 +1527,8 @@ exports.Compiler = function () { } performedRewrite = false; if (this['instanceof'](CS.BoundFunction)) { - if (options.targetES6) { - if (block.body.length === 1 && block.body[0] instanceof JS.ReturnStatement) { - fn = new JS.ArrowFunctionExpression(parameters, defaults, rest, block.body[0].argument); - fn.expression = true; - return fn; - } else { - return new JS.ArrowFunctionExpression(parameters, defaults, rest, block); - } + if (options.targetES6 && (arrow = es6SafeArrowExpression(parameters, defaults, rest, block))) { + return arrow; } else { newThis = genSym('this'); rewriteThis = generateMutatingWalker(function () { diff --git a/src/compiler.coffee b/src/compiler.coffee index 2b77476b..eda3d212 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -456,7 +456,7 @@ findES6Methods = (classIdentifier, body) -> rewriteThis = generateMutatingWalker -> if @instanceof JS.ThisExpression then classIdentifier - else if @instanceof JS.FunctionExpression, JS.FunctionDeclaration then this + else if isScopeBoundary(this) then this else rewriteThis this properties = map properties, rewriteThis @@ -494,6 +494,37 @@ es6SafeConstructor = (isDerivedClass, block) -> block.body.unshift(stmt new JS.CallExpression(new JS.Identifier('super'), [])) block +es6SafeArrowExpression = (parameters, defaults, rest, block) -> + # A coffeescript bound function is *almost* the same as an ES6 arrow + # function, but they have a different meaning for the "arguments" + # keyword. In ES6, arguments still refers to the outer scope. + + usesArguments = (node) -> + if node instanceof JS.Identifier + node.name == 'arguments' + else + mapChildNodes node, usesArguments, ((a,b) -> a or b), false + + if any block.body, usesArguments + if parameters.length > 0 + debugES6("Skipping arrow function conversion because your bound function refers to the 'arguments' keyword and has regular positional arguments") + return null + rest ?= genSym 'arguments' + rewriteArguments = generateMutatingWalker -> + if (@instanceof JS.Identifier) and @name == 'arguments' then rest + else if isScopeBoundary(this) then this + else rewriteArguments this + for statement in block.body + rewriteArguments(statement) + + if block.body.length == 1 && block.body[0] instanceof JS.ReturnStatement + fn = new JS.ArrowFunctionExpression parameters, defaults, rest, block.body[0].argument + fn.expression = true + return fn + else + return new JS.ArrowFunctionExpression parameters, defaults, rest, block + + describeClass = (name, parentNode) -> return "class #{name.name}" if name?.name if parentNode instanceof CS.AssignOp and parentNode.assignee instanceof CS.Identifier @@ -805,13 +836,8 @@ class exports.Compiler performedRewrite = no if @instanceof CS.BoundFunction - if options.targetES6 - if block.body.length == 1 && block.body[0] instanceof JS.ReturnStatement - fn = new JS.ArrowFunctionExpression parameters, defaults, rest, block.body[0].argument - fn.expression = true - return fn - else - return new JS.ArrowFunctionExpression parameters, defaults, rest, block + if options.targetES6 and (arrow = es6SafeArrowExpression(parameters, defaults, rest, block)) + return arrow else newThis = genSym 'this' rewriteThis = generateMutatingWalker -> @@ -880,15 +906,13 @@ class exports.Compiler # This is analogous to the way `var x = function y(){}` works. classExpression = new JS.ClassExpression((if (classIdentifier instanceof JS.GenSym) then null else classIdentifier), parentIdentifier, new JS.ClassBody(methods)) classAssignment = new JS.AssignmentExpression '=', classIdentifier, classExpression - - return if properties.length == 0 if classIdentifier instanceof JS.GenSym # no properties, no name, so we can use just a bare anonymous expression classExpression else # no properties, with name, so we use an assignment - # expression, and we provide the option to simply to a + # expression, and we provide the option to simplify to a # declaration if we're used in a statement context. classAssignment.becomeStatement = -> new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) classAssignment @@ -896,6 +920,7 @@ class exports.Compiler # need to set properties, so create an IIFE block = new JS.BlockStatement([ stmt classAssignment ].concat(map properties, stmt).concat(makeReturn classIdentifier)) new JS.CallExpression((funcExpr body: block).g(), []) + args = [] params = [] From f130d0740ed5d244e128dceadb795183e8069777 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 22:29:44 -0400 Subject: [PATCH 40/64] fix empty node case --- lib/compiler.js | 4 +++- src/compiler.coffee | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 5c976129..9c1e790a 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -855,7 +855,9 @@ es6SafeConstructor = function (isDerivedClass, block) { es6SafeArrowExpression = function (parameters, defaults, rest, block) { var rewriteArguments, statement, usesArguments; usesArguments = function (node) { - if (node instanceof JS.Identifier) { + if (!(null != node)) { + return false; + } else if (node instanceof JS.Identifier) { return node.name === 'arguments'; } else { return mapChildNodes(node, usesArguments, function (a, b) { diff --git a/src/compiler.coffee b/src/compiler.coffee index eda3d212..3d3c2853 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -500,10 +500,9 @@ es6SafeArrowExpression = (parameters, defaults, rest, block) -> # keyword. In ES6, arguments still refers to the outer scope. usesArguments = (node) -> - if node instanceof JS.Identifier - node.name == 'arguments' - else - mapChildNodes node, usesArguments, ((a,b) -> a or b), false + if not node? then false + else if node instanceof JS.Identifier then node.name == 'arguments' + else mapChildNodes node, usesArguments, ((a,b) -> a or b), false if any block.body, usesArguments if parameters.length > 0 From 230a7c98d2167582e339128d4a4f7a777d4fe97f Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 29 May 2015 23:55:41 -0400 Subject: [PATCH 41/64] allow class declarations to be converted back to class expressions Because that's what happens when you use them inside a conditional and then use the conditional as an expression. --- lib/compiler.js | 9 ++++++++- src/compiler.coffee | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 9c1e790a..0b889866 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -191,6 +191,8 @@ expr = function (s) { block = new JS.BlockStatement([makeReturn(s)]); iife = funcExpr({ body: block }); return new JS.CallExpression(memberAccess(iife.g(), 'call'), [new JS.ThisExpression]); + } else if (typeof s.becomeExpression === 'function') { + return s.becomeExpression(); } else { throw new Error('expr: Cannot use a ' + s.type + ' as a value'); } @@ -1635,7 +1637,12 @@ exports.Compiler = function () { classExpression = new JS.ClassExpression(classIdentifier instanceof JS.GenSym ? null : classIdentifier, parentIdentifier, new JS.ClassBody(methods)); classAssignment = new JS.AssignmentExpression('=', classIdentifier, classExpression); return properties.length === 0 ? classIdentifier instanceof JS.GenSym ? classExpression : (classAssignment.becomeStatement = function () { - return new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)); + var statement; + statement = new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)); + statement.becomeExpression = function () { + return classAssignment; + }; + return statement; }, classAssignment) : (block = new JS.BlockStatement([stmt(classAssignment)].concat(map(properties, stmt)).concat(makeReturn(classIdentifier))), new JS.CallExpression(funcExpr({ body: block }).g(), [])); } } diff --git a/src/compiler.coffee b/src/compiler.coffee index 3d3c2853..6ec810e1 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -99,6 +99,8 @@ expr = (s) -> block = new JS.BlockStatement [makeReturn s] iife = funcExpr body: block new JS.CallExpression (memberAccess iife.g(), 'call'), [new JS.ThisExpression] + else if typeof s.becomeExpression == 'function' + s.becomeExpression() else # TODO: comprehensive throw new Error "expr: Cannot use a #{s.type} as a value" @@ -913,7 +915,10 @@ class exports.Compiler # no properties, with name, so we use an assignment # expression, and we provide the option to simplify to a # declaration if we're used in a statement context. - classAssignment.becomeStatement = -> new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + classAssignment.becomeStatement = -> + statement = new JS.ClassDeclaration(classIdentifier, parentIdentifier, new JS.ClassBody(methods)) + statement.becomeExpression = -> classAssignment + statement classAssignment else # need to set properties, so create an IIFE From 063b93814155320b38449c682ee79613eef11e85 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 30 May 2015 16:03:41 -0400 Subject: [PATCH 42/64] handle "(@foo...) ->" --- lib/compiler.js | 5 +++-- src/compiler.coffee | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 0b889866..b13b3ec5 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1443,7 +1443,7 @@ exports.Compiler = function () { } }; return function (param$) { - var alternate, ancestry, arrow, block, cache$2, consequent, defaults, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, test; + var alternate, ancestry, arrow, block, cache$2, consequent, defaults, expression, i, index, inScope, last, newThis, numArgs, numParams, options, p, parameters_, paramName, performedRewrite, pIndex, reassignments, rest, rewriteThis, sym, test; var body, parameters; { cache$2 = param$; @@ -1484,7 +1484,8 @@ exports.Compiler = function () { if (parameters.length > 0) { if (parameters.slice(-1)[0].rest) { if (options.targetES6) { - rest = new JS.Identifier(parameters.pop().expression.name); + expression = parameters.pop().expression; + rest = expression instanceof JS.Identifier ? new JS.Identifier(expression.name) : (sym = genSym('rest'), block.body.unshift(stmt(new JS.AssignmentExpression('=', expression, sym))), sym); } else { paramName = parameters.pop().expression; numParams = parameters.length; diff --git a/src/compiler.coffee b/src/compiler.coffee index 6ec810e1..8b457bc0 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -805,7 +805,13 @@ class exports.Compiler if parameters.length > 0 if parameters[-1..][0].rest if options.targetES6 - rest = new JS.Identifier(parameters.pop().expression.name) + expression = parameters.pop().expression + rest = if expression instanceof JS.Identifier + new JS.Identifier(expression.name) + else + sym = genSym 'rest' + block.body.unshift stmt new JS.AssignmentExpression '=', expression, sym + sym else paramName = parameters.pop().expression numParams = parameters.length From 4d23872b7368dbc85e086df3cc495c33fe88414c Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 30 May 2015 23:03:13 -0400 Subject: [PATCH 43/64] handle class properties whose name happen to be keywords --- lib/compiler.js | 17 ++++++++++------- src/compiler.coffee | 22 ++++++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index b13b3ec5..55258b1e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -762,7 +762,7 @@ for (h in inlineHelpers) { helpers[h] = fn; } findES6Methods = function (classIdentifier, body) { - var expression, m, methodIdentifier, methods, properties, rewriteThis, statement, unmatched; + var expression, m, methodIdentifier, methods, object, properties, property, propertyName, rewriteThis, statement, unmatched; methods = []; properties = []; unmatched = []; @@ -779,19 +779,22 @@ findES6Methods = function (classIdentifier, body) { statement = body.body[i$]; expression = statement.expression; if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { - if (expression.left.object instanceof JS.MemberExpression && expression.left.object.property.name === 'prototype' && expression.left.object.object['instanceof'](JS.ThisExpression)) { + property = expression.left.property; + propertyName = property instanceof JS.Identifier ? property.name : property instanceof JS.Literal ? property.value : void 0; + object = expression.left.object; + if (object instanceof JS.MemberExpression && object.property.name === 'prototype' && object.object['instanceof'](JS.ThisExpression)) { if (expression.right instanceof JS.FunctionExpression) { - methods.push(new JS.MethodDefinition(methodIdentifier(expression), expression.right)); + methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right)); } else { - properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right)); + properties.push(new JS.AssignmentExpression('=', memberAccess(memberAccess(classIdentifier, 'prototype'), propertyName), expression.right)); } - } else if (expression.left.object instanceof JS.ThisExpression) { + } else if (object instanceof JS.ThisExpression) { if (expression.right instanceof JS.FunctionExpression) { - m = new JS.MethodDefinition(methodIdentifier(expression), expression.right); + m = new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right); m['static'] = true; methods.push(m); } else { - properties.push(new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right)); + properties.push(new JS.AssignmentExpression('=', memberAccess(classIdentifier, propertyName), expression.right)); } } } else { diff --git a/src/compiler.coffee b/src/compiler.coffee index 8b457bc0..df257a67 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -441,18 +441,28 @@ findES6Methods = (classIdentifier, body) -> for statement in body.body expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) - if (expression.left.object instanceof JS.MemberExpression) and (expression.left.object.property.name == 'prototype') and (expression.left.object.object.instanceof JS.ThisExpression) + + property = expression.left.property + + propertyName = if property instanceof JS.Identifier + property.name + else if property instanceof JS.Literal + property.value + + object = expression.left.object + + if (object instanceof JS.MemberExpression) and (object.property.name == 'prototype') and (object.object.instanceof JS.ThisExpression) if expression.right instanceof JS.FunctionExpression - methods.push(new JS.MethodDefinition(methodIdentifier(expression), expression.right)) + methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right)) else - properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, new JS.MemberExpression(false, classIdentifier, new JS.Identifier('prototype')), expression.left.property), expression.right) - else if expression.left.object instanceof JS.ThisExpression + properties.push new JS.AssignmentExpression('=', memberAccess(memberAccess(classIdentifier, 'prototype'), propertyName), expression.right) + else if object instanceof JS.ThisExpression if expression.right instanceof JS.FunctionExpression - m = new JS.MethodDefinition(methodIdentifier(expression), expression.right) + m = new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right) m.static = true methods.push(m) else - properties.push new JS.AssignmentExpression('=', new JS.MemberExpression(false, classIdentifier, expression.left.property), expression.right) + properties.push new JS.AssignmentExpression('=', memberAccess(classIdentifier, propertyName), expression.right) else unmatched.push(statement) From 477d75a42a936d181716609b0e75940e70028dc0 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 30 May 2015 23:25:50 -0400 Subject: [PATCH 44/64] don't try to convert classes that extend expressions --- lib/compiler.js | 2 ++ src/compiler.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 55258b1e..73133a9d 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1635,6 +1635,8 @@ exports.Compiler = function () { debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor does not follow the ES6 rules for super.'); } else if (nameAssignee && !nameAssignee['instanceof'](JS.Identifier)) { debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because it's being assigned to a compound name."); + } else if (parent && !(parent instanceof JS.Identifier)) { + debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because it extends an expression.'); } else if (unmatched.length > 0) { debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties."); } else { diff --git a/src/compiler.coffee b/src/compiler.coffee index df257a67..926389f8 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -907,6 +907,8 @@ class exports.Compiler debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor does not follow the ES6 rules for super." else if nameAssignee and not nameAssignee.instanceof JS.Identifier debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it's being assigned to a compound name." + else if parent and not (parent instanceof JS.Identifier) + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it extends an expression." else if unmatched.length > 0 debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its body contains code that we couldn't map directly to methods, static methods, prototype properties, or class properties." else From 33805a9d2fa0988a3cdbe8ba87e1423cb707abb6 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 17:20:03 -0400 Subject: [PATCH 45/64] only rewrite super when we're inside ES6 classes --- lib/compiler.js | 232 +++++++++++++++++++++++--------------------- lib/js-nodes.js | 12 +++ src/compiler.coffee | 92 +++++++++++------- src/js-nodes.coffee | 8 ++ 4 files changed, 200 insertions(+), 144 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 73133a9d..b0076c81 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateMutatingWalker, generateSoak, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateCopyingWalker, generateMutatingWalker, generateSoak, generateWalker, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -231,51 +231,60 @@ makeReturn = function (node) { return new JS.ReturnStatement(expr(node)); } }; -generateMutatingWalker = function (fn) { - return function (node) { - var args, mapper, reducer; - args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; - mapper = function (child, nameInParent) { - return [ - nameInParent, - null != child ? fn.apply(child, args) : child - ]; - }; - reducer = function (parent, param$) { - var cache$2, name, newChild; - { - cache$2 = param$; - name = cache$2[0]; - newChild = cache$2[1]; - } - parent[name] = newChild; - return parent; - }; - return mapChildNodes(node, mapper, reducer, node, { - listReducer: function (param$, param$1) { - var _, accum, cache$2, cache$3, name, newChild; +generateWalker = function (makeIdentity) { + return function (fn) { + return function (node) { + var args, identity, mapper, reducer; + args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; + mapper = function (child, nameInParent) { + return [ + nameInParent, + null != child ? fn.apply(child, args) : child + ]; + }; + reducer = function (parent, param$) { + var cache$2, name, newChild; { cache$2 = param$; - _ = cache$2[0]; - accum = cache$2[1]; - } - { - cache$3 = param$1; - name = cache$3[0]; - newChild = cache$3[1]; + name = cache$2[0]; + newChild = cache$2[1]; } - return [ - name, - accum.concat(newChild) - ]; - }, - listIdentity: [ - null, - [] - ] - }); + parent[name] = newChild; + return parent; + }; + identity = makeIdentity(node); + return mapChildNodes(node, mapper, reducer, identity, { + listReducer: function (param$, param$1) { + var _, accum, cache$2, cache$3, name, newChild; + { + cache$2 = param$; + _ = cache$2[0]; + accum = cache$2[1]; + } + { + cache$3 = param$1; + name = cache$3[0]; + newChild = cache$3[1]; + } + return [ + name, + accum.concat(newChild) + ]; + }, + listIdentity: [ + null, + [] + ] + }); + }; }; }; +generateMutatingWalker = generateWalker(function (node) { + return node; +}); +generateCopyingWalker = generateWalker(function (node) { + return node.shallowCopy(); +}); declaredIdentifiers = function (node) { if (!(null != node)) { return []; @@ -761,11 +770,12 @@ for (h in inlineHelpers) { fn = inlineHelpers[h]; helpers[h] = fn; } -findES6Methods = function (classIdentifier, body) { - var expression, m, methodIdentifier, methods, object, properties, property, propertyName, rewriteThis, statement, unmatched; +findES6Methods = function (classIdentifier, ctor, isDerivedClass, body) { + var expression, foundConstructor, m, methodBody, methodIdentifier, methods, object, properties, property, propertyName, rewriteSuper, rewriteThis, safeCtorBody, statement, unmatched; methods = []; properties = []; unmatched = []; + foundConstructor = false; methodIdentifier = function (expression) { var prop; prop = expression.left.property; @@ -775,22 +785,56 @@ findES6Methods = function (classIdentifier, body) { return new JS.Identifier(prop.value); } }; + rewriteSuper = generateCopyingWalker(function () { + if (isScopeBoundary(this)) { + return this; + } else if (this.toES6Super) { + return this.toES6Super(); + } else { + return rewriteSuper(this); + } + }); + if (ctor) { + ctor = rewriteSuper(ctor); + if (safeCtorBody = es6SafeConstructor(isDerivedClass, ctor.body)) { + methods.push(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ + params: ctor.params, + defaults: ctor.defaults, + rest: ctor.rest, + body: safeCtorBody + }))); + } else { + debugES6('' + describeClass(classIdentifier) + "'s constructor does not follow the ES6 rules for super."); + unmatched.push(ctor); + } + } for (var i$ = 0, length$ = body.body.length; i$ < length$; ++i$) { statement = body.body[i$]; + if (statement instanceof JS.FunctionDeclaration && !foundConstructor) { + foundConstructor = true; + continue; + } expression = statement.expression; if (expression instanceof JS.AssignmentExpression && expression.operator === '=' && expression.left instanceof JS.MemberExpression) { property = expression.left.property; propertyName = property instanceof JS.Identifier ? property.name : property instanceof JS.Literal ? property.value : void 0; object = expression.left.object; + methodBody = expression.right instanceof JS.FunctionExpression ? funcExpr({ + id: expression.right.id, + params: expression.right.params, + defaults: expression.right.defaults, + rest: expression.right.rest, + body: rewriteSuper(expression.right.body) + }) : void 0; if (object instanceof JS.MemberExpression && object.property.name === 'prototype' && object.object['instanceof'](JS.ThisExpression)) { - if (expression.right instanceof JS.FunctionExpression) { - methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right)); + if (methodBody) { + methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), methodBody)); } else { properties.push(new JS.AssignmentExpression('=', memberAccess(memberAccess(classIdentifier, 'prototype'), propertyName), expression.right)); } } else if (object instanceof JS.ThisExpression) { - if (expression.right instanceof JS.FunctionExpression) { - m = new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right); + if (methodBody) { + m = new JS.MethodDefinition(new JS.Identifier(propertyName), methodBody); m['static'] = true; methods.push(m); } else { @@ -801,7 +845,7 @@ findES6Methods = function (classIdentifier, body) { unmatched.push(statement); } } - rewriteThis = generateMutatingWalker(function () { + rewriteThis = generateCopyingWalker(function () { if (this['instanceof'](JS.ThisExpression)) { return classIdentifier; } else if (isScopeBoundary(this)) { @@ -1589,7 +1633,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, ancestry, args, block, body, c, cache$2, cache$3, classAssignment, classExpression, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, safeCtor, unmatched; + var _, ancestry, args, block, body, c, cache$2, cache$3, classAssignment, classExpression, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, unmatched; var ctor, name; { cache$2 = param$; @@ -1603,36 +1647,17 @@ exports.Compiler = function () { ancestry = cache$2.ancestry; } if (options.targetES6) { - classIdentifier = name.name ? new JS.Identifier(name.name) : genSym('klass'); + debugger; if (parent) { parentIdentifier = new JS.Identifier(parent.name); } - cache$3 = findES6Methods(classIdentifier, forceBlock(body)); + classIdentifier = name.name ? new JS.Identifier(name.name) : genSym('klass'); + cache$3 = findES6Methods(classIdentifier, ctor, null != parent, forceBlock(body)); methods = cache$3.methods; properties = cache$3.properties; unmatched = cache$3.unmatched; - if (ctor && (safeCtor = es6SafeConstructor(null != parent, ctor.body))) { - for (var i$ = 0, length$ = unmatched.length; i$ < length$; ++i$) { - c = unmatched[i$]; - i = i$; - if (!c['instanceof'](JS.FunctionDeclaration)) - continue; - ctorIndex = i; - break; - } - unmatched.splice(ctorIndex, 1); - methods.unshift(new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr({ - id: ctor.id, - params: ctor.params, - body: safeCtor, - defaults: ctor.defaults, - rest: ctor.rest - }))); - } if (this.ctor && !this.ctor.expression['instanceof'](CS.Functions)) { debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor is not a function expression.'); - } else if (this.ctor && !safeCtor) { - debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor does not follow the ES6 rules for super.'); } else if (nameAssignee && !nameAssignee['instanceof'](JS.Identifier)) { debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because it's being assigned to a compound name."); } else if (parent && !(parent instanceof JS.Identifier)) { @@ -1660,9 +1685,9 @@ exports.Compiler = function () { name = genSym(name.name); } if (null != ctor) { - for (var i$1 = 0, length$1 = block.body.length; i$1 < length$1; ++i$1) { - c = block.body[i$1]; - i = i$1; + for (var i$ = 0, length$ = block.body.length; i$ < length$; ++i$) { + c = block.body[i$]; + i = i$; if (!c['instanceof'](JS.FunctionDeclaration)) continue; ctorIndex = i; @@ -1695,12 +1720,12 @@ exports.Compiler = function () { } if (this.boundMembers.length > 0) { instance = genSym('instance'); - for (var i$2 = 0, length$2 = this.boundMembers.length; i$2 < length$2; ++i$2) { - protoAssignOp = this.boundMembers[i$2]; + for (var i$1 = 0, length$1 = this.boundMembers.length; i$1 < length$1; ++i$1) { + protoAssignOp = this.boundMembers[i$1]; memberName = protoAssignOp.assignee.data.toString(); ps = function (accum$) { - for (var i$3 = 0, length$3 = protoAssignOp.expression.parameters.length; i$3 < length$3; ++i$3) { - _ = protoAssignOp.expression.parameters[i$3]; + for (var i$2 = 0, length$2 = protoAssignOp.expression.parameters.length; i$2 < length$2; ++i$2) { + _ = protoAssignOp.expression.parameters[i$2]; accum$.push(genSym()); } return accum$; @@ -1890,7 +1915,7 @@ exports.Compiler = function () { [ CS.Super, function (param$) { - var ancestry, args, cache$2, calledExprs, classAssignNode, className, classNode, classPositionInAncestry, compile, functionName, inScope, isProtoMemberAccess, isStatic, options; + var ancestry, args, cache$2, calledExprs, classAssignNode, className, classNode, classPositionInAncestry, compile, functionName, inScope, isProtoMemberAccess, isStatic, options, tagForES6; { cache$2 = param$; args = cache$2['arguments']; @@ -1899,6 +1924,16 @@ exports.Compiler = function () { ancestry = cache$2.ancestry; options = cache$2.options; } + tagForES6 = function (node) { + node.toES6Super = function () { + if (functionName === 'constructor') { + return new JS.CallExpression(new JS.Identifier('super'), map(args, expr)); + } else { + return new JS.CallExpression(memberAccess(new JS.Identifier('super'), functionName), map(args, expr)); + } + }; + return node; + }; classNode = find(ancestry, function (node) { return node instanceof CS.Class || node.assignee instanceof CS.ProtoMemberAccessOp; }); @@ -1942,43 +1977,24 @@ exports.Compiler = function () { className = classNode.assignee.expression.data; functionName = classNode.assignee.memberName; } - if (options.targetES6) { - if (functionName === 'constructor') { - return new JS.CallExpression(new JS.Identifier('super'), map(args, expr)); - } else { - return new JS.CallExpression(memberAccess(new JS.Identifier('super'), functionName), map(args, expr)); - } - } if (className === 'class') { if (args.length > 0) { calledExprs = [new JS.ThisExpression].concat(map(args, expr)); - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'call'), calledExprs); + return tagForES6(new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'call'), calledExprs)); } else { - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'apply'), [ - new JS.ThisExpression, - new JS.Identifier('arguments') - ]); - } - } - if (isStatic) { - if (args.length === 0) { - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'apply'), [ + return tagForES6(new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(classNode.parent.data), 'prototype'), functionName), 'apply'), [ new JS.ThisExpression, new JS.Identifier('arguments') - ]); - } else { - calledExprs = [new JS.ThisExpression].concat(map(args, expr)); - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'call'), calledExprs); + ])); } - } else if (args.length === 0) { - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'apply'), [ - new JS.ThisExpression, - new JS.Identifier('arguments') - ]); - } else { - calledExprs = [new JS.ThisExpression].concat(map(args, expr)); - return new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'call'), calledExprs); } + return tagForES6(isStatic ? args.length === 0 ? new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]) : (calledExprs = [new JS.ThisExpression].concat(map(args, expr)), new JS.CallExpression(memberAccess(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), 'constructor'), functionName), 'call'), calledExprs)) : args.length === 0 ? new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]) : (calledExprs = [new JS.ThisExpression].concat(map(args, expr)), new JS.CallExpression(memberAccess(memberAccess(memberAccess(new JS.Identifier(className), '__super__'), functionName), 'call'), calledExprs))); } ], [ diff --git a/lib/js-nodes.js b/lib/js-nodes.js index b430e84c..95874225 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -78,6 +78,18 @@ exports.Nodes = Nodes = function () { } return obj; }; + Nodes.prototype.shallowCopy = function () { + var c, k, v; + c = new this.constructor; + for (k in this) { + v = this[k]; + if (k && in$(k, this.listMembers)) { + k = k.slice(); + } + c[k] = v; + } + return c; + }; return Nodes; }(); nodeData = [ diff --git a/src/compiler.coffee b/src/compiler.coffee index 926389f8..8a004408 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -131,16 +131,17 @@ makeReturn = (node) -> else if (node.instanceof JS.UnaryExpression) and node.operator is 'void' then new JS.ReturnStatement else new JS.ReturnStatement expr node - -generateMutatingWalker = (fn) -> (node, args...) -> +generateWalker = (makeIdentity) -> (fn) -> (node, args...) -> mapper = (child, nameInParent) -> [nameInParent, (if child? then fn.apply(child, args) else child)] reducer = (parent, [name, newChild]) -> parent[name] = newChild; parent - mapChildNodes node, mapper, reducer, node, { + identity = makeIdentity(node) + mapChildNodes node, mapper, reducer, identity, { listReducer: ([_, accum],[name, newChild]) -> [name, accum.concat(newChild) ] listIdentity: [null, []] } - +generateMutatingWalker = generateWalker (node) -> node +generateCopyingWalker = generateWalker (node) -> node.shallowCopy() declaredIdentifiers = (node) -> return [] unless node? @@ -425,10 +426,11 @@ inlineHelpers = for own h, fn of inlineHelpers helpers[h] = fn -findES6Methods = (classIdentifier, body) -> +findES6Methods = (classIdentifier, ctor, isDerivedClass, body) -> methods = [] properties = [] unmatched = [] + foundConstructor = false methodIdentifier = (expression) -> prop = expression.left.property @@ -438,7 +440,29 @@ findES6Methods = (classIdentifier, body) -> # ES6 allows method names that are the same as reserved keywords new JS.Identifier(prop.value) + rewriteSuper = generateCopyingWalker -> + if isScopeBoundary(this) then this + else if @toES6Super then @toES6Super() + else rewriteSuper this + + if ctor + ctor = rewriteSuper(ctor) + if (safeCtorBody = es6SafeConstructor(isDerivedClass, ctor.body)) + methods.push new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr(params: ctor.params, defaults: ctor.defaults, rest: ctor.rest, body: safeCtorBody)) + else + debugES6 "#{describeClass classIdentifier}'s constructor does not follow the ES6 rules for super." + unmatched.push ctor + for statement in body.body + + if (statement instanceof JS.FunctionDeclaration) and not foundConstructor + # The first function declaration is the constructor inserted by + # the CS.Class rule, but it's not direclty usable because it + # obscures that there may be an external constructor. We rely on + # our ctor argument instead. + foundConstructor = true + continue + expression = statement.expression if (expression instanceof JS.AssignmentExpression) and (expression.operator == '=') and (expression.left instanceof JS.MemberExpression) @@ -450,15 +474,17 @@ findES6Methods = (classIdentifier, body) -> property.value object = expression.left.object + methodBody = if expression.right instanceof JS.FunctionExpression + funcExpr(id: expression.right.id, params: expression.right.params, defaults: expression.right.defaults, rest: expression.right.rest, body: rewriteSuper(expression.right.body)) if (object instanceof JS.MemberExpression) and (object.property.name == 'prototype') and (object.object.instanceof JS.ThisExpression) - if expression.right instanceof JS.FunctionExpression - methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right)) + if methodBody + methods.push(new JS.MethodDefinition(new JS.Identifier(propertyName), methodBody)) else properties.push new JS.AssignmentExpression('=', memberAccess(memberAccess(classIdentifier, 'prototype'), propertyName), expression.right) else if object instanceof JS.ThisExpression - if expression.right instanceof JS.FunctionExpression - m = new JS.MethodDefinition(new JS.Identifier(propertyName), expression.right) + if methodBody + m = new JS.MethodDefinition(new JS.Identifier(propertyName), methodBody) m.static = true methods.push(m) else @@ -466,7 +492,7 @@ findES6Methods = (classIdentifier, body) -> else unmatched.push(statement) - rewriteThis = generateMutatingWalker -> + rewriteThis = generateCopyingWalker -> if @instanceof JS.ThisExpression then classIdentifier else if isScopeBoundary(this) then this else rewriteThis this @@ -878,33 +904,19 @@ class exports.Compiler # TODO: comment [CS.Class, ({nameAssignee, parent, name, ctor, body, compile, options, ancestry}) -> if options.targetES6 + parentIdentifier = new JS.Identifier(parent.name) if parent classIdentifier = if name.name new JS.Identifier(name.name) else genSym 'klass' - if parent - parentIdentifier = new JS.Identifier(parent.name) - { methods, properties, unmatched } = findES6Methods(classIdentifier, forceBlock body) - if ctor and (safeCtor = es6SafeConstructor(parent?, ctor.body)) - for c, i in unmatched when c.instanceof JS.FunctionDeclaration - ctorIndex = i - break - unmatched.splice(ctorIndex, 1) - methods.unshift new JS.MethodDefinition(new JS.Identifier('constructor'), funcExpr( - id: ctor.id, - params: ctor.params, - body: safeCtor - defaults: ctor.defaults, - rest: ctor.rest - )) + + { methods, properties, unmatched } = findES6Methods(classIdentifier, ctor, parent?, forceBlock body) # Emit our ES6 class only if we were able to account for # everything in its definition. Otherwise, fall through to the # non-ES6 emulation if @ctor and not @ctor.expression.instanceof CS.Functions debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor is not a function expression." - else if @ctor and not safeCtor - debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor does not follow the ES6 rules for super." else if nameAssignee and not nameAssignee.instanceof JS.Identifier debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it's being assigned to a compound name." else if parent and not (parent instanceof JS.Identifier) @@ -1067,6 +1079,20 @@ class exports.Compiler ] [CS.Super, ({arguments: args, compile, inScope, ancestry, options}) -> + + tagForES6 = (node) -> + # If we're inside an ES6 class expression, we need to compile to + # an ES6 "super". But at this point we can't actually tell if + # we're going to end up inside an ES6 class expression, because + # our enclosing class may turn out to be untranspilable. So for + # now we just tag the node as eligible to be converted. + node.toES6Super = -> + if functionName == 'constructor' + new JS.CallExpression new JS.Identifier('super'), (map args, expr) + else + new JS.CallExpression (memberAccess new JS.Identifier('super'), functionName), (map args, expr) + node + classNode = find ancestry, (node) => (node instanceof CS.Class) or (node.assignee instanceof CS.ProtoMemberAccessOp) @@ -1101,23 +1127,17 @@ class exports.Compiler className = classNode.assignee.expression.data functionName = classNode.assignee.memberName - if options.targetES6 - if functionName == 'constructor' - return new JS.CallExpression new JS.Identifier('super'), (map args, expr) - else - return new JS.CallExpression (memberAccess new JS.Identifier('super'), functionName), (map args, expr) - if className is 'class' if args.length > 0 calledExprs = [new JS.ThisExpression].concat (map args, expr) - return new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'call'), calledExprs + return tagForES6 new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'call'), calledExprs else - return new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'apply'), [ + return tagForES6 new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier classNode.parent.data) , 'prototype'), functionName), 'apply'), [ new JS.ThisExpression new JS.Identifier 'arguments' ] - if isStatic + tagForES6 if isStatic if args.length is 0 new JS.CallExpression (memberAccess (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), 'constructor'), functionName), 'apply'), [ new JS.ThisExpression diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 80f83fe2..445f761c 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -35,6 +35,14 @@ exports.Nodes = class Nodes obj[property] = this[property] obj + shallowCopy: -> + c = new (this.constructor) + for k,v of this + if k and (k in @listMembers) + k = k.slice() + c[k] = v + c + nodeData = [ # constructor name, isStatement, construction parameters ['ArrayExpression' , no , ['elements']] From e9a35e9c7c0ed9c97b7c99b2398e91c7d6a3ac5b Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 18:20:56 -0400 Subject: [PATCH 46/64] fix missing declarations This is a bug in master and not just my ES6 branch. --- lib/compiler.js | 20 +++++++++++--------- src/compiler.coffee | 23 ++++++++++++++++------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index b0076c81..61837e77 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateCopyingWalker, generateMutatingWalker, generateSoak, generateWalker, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isIdentifierName, isScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateCopyingWalker, generateMutatingWalker, generateSoak, generateWalker, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isDownwardScopeBoundary, isIdentifierName, isUpwardScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -197,9 +197,12 @@ expr = function (s) { throw new Error('expr: Cannot use a ' + s.type + ' as a value'); } }; -isScopeBoundary = function (node) { +isDownwardScopeBoundary = function (node) { return node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration) && !node.generated; }; +isUpwardScopeBoundary = function (node) { + return node['instanceof'](JS.FunctionExpression, JS.FunctionDeclaration); +}; makeReturn = function (node) { var stmts; if (!(null != node)) { @@ -313,7 +316,7 @@ declarationsNeededRecursive = function (node) { if (!(null != node)) { return []; } - if (isScopeBoundary(node)) { + if (isDownwardScopeBoundary(node)) { return []; } else { return union(declarationsNeeded(node), mapChildNodes(node, declarationsNeededRecursive, function (a, b) { @@ -327,7 +330,7 @@ variableDeclarations = function (node) { } if (node['instanceof'](JS.FunctionDeclaration)) { return [node.id]; - } else if (isScopeBoundary(node)) { + } else if (isUpwardScopeBoundary(node)) { return []; } else if (node['instanceof'](JS.VariableDeclarator)) { return [node.id]; @@ -786,7 +789,7 @@ findES6Methods = function (classIdentifier, ctor, isDerivedClass, body) { } }; rewriteSuper = generateCopyingWalker(function () { - if (isScopeBoundary(this)) { + if (isDownwardScopeBoundary(this)) { return this; } else if (this.toES6Super) { return this.toES6Super(); @@ -848,7 +851,7 @@ findES6Methods = function (classIdentifier, ctor, isDerivedClass, body) { rewriteThis = generateCopyingWalker(function () { if (this['instanceof'](JS.ThisExpression)) { return classIdentifier; - } else if (isScopeBoundary(this)) { + } else if (isDownwardScopeBoundary(this)) { return this; } else { return rewriteThis(this); @@ -926,7 +929,7 @@ es6SafeArrowExpression = function (parameters, defaults, rest, block) { rewriteArguments = generateMutatingWalker(function () { if (this['instanceof'](JS.Identifier) && this.name === 'arguments') { return rest; - } else if (isScopeBoundary(this)) { + } else if (isDownwardScopeBoundary(this)) { return this; } else { return rewriteArguments(this); @@ -1647,7 +1650,6 @@ exports.Compiler = function () { ancestry = cache$2.ancestry; } if (options.targetES6) { - debugger; if (parent) { parentIdentifier = new JS.Identifier(parent.name); } @@ -2895,7 +2897,7 @@ exports.Compiler = function () { declaredSymbols = cache$2.declaredSymbols; usedSymbols = cache$2.usedSymbols; nsCounters = cache$2.nsCounters; - newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : isScopeBoundary(this) ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { + newNode = this['instanceof'](JS.GenSym) ? (newNode = new JS.Identifier(generateName(this, state)), usedSymbols.push(newNode.name), newNode) : isDownwardScopeBoundary(this) ? (params = concatMap(this.params, collectIdentifiers), nsCounters_ = {}, function (accum$) { for (k in nsCounters) { if (!isOwn$(nsCounters, k)) continue; diff --git a/src/compiler.coffee b/src/compiler.coffee index 8a004408..ad2af7fc 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -105,9 +105,18 @@ expr = (s) -> # TODO: comprehensive throw new Error "expr: Cannot use a #{s.type} as a value" -isScopeBoundary = (node) -> +# When looking downward, it's up to us to control the scope +# boundaries, and we want them to stop only at user-created functions, +# not compiler-generated functions. +isDownwardScopeBoundary = (node) -> (node.instanceof JS.FunctionExpression, JS.FunctionDeclaration) and not node.generated +# When looking upward for scope boundaries, we need to respect the +# real Javascript scope boundaries because our declarations will not +# escape even compiler-generated functions. +isUpwardScopeBoundary = (node) -> + node.instanceof JS.FunctionExpression, JS.FunctionDeclaration + makeReturn = (node) -> return new JS.ReturnStatement unless node? if node.instanceof JS.BlockStatement @@ -158,13 +167,13 @@ declarationsNeeded = (node) -> declarationsNeededRecursive = (node) -> return [] unless node? - if isScopeBoundary(node) then [] + if isDownwardScopeBoundary(node) then [] else union (declarationsNeeded node), mapChildNodes(node, declarationsNeededRecursive, ((a,b)->a.concat(b)), []) variableDeclarations = (node) -> return [] unless node? if node.instanceof JS.FunctionDeclaration then [node.id] - else if isScopeBoundary(node) then [] + else if isUpwardScopeBoundary(node) then [] else if node.instanceof JS.VariableDeclarator then [node.id] else mapChildNodes(node, variableDeclarations, ((a,b)->a.concat(b)), []) @@ -441,7 +450,7 @@ findES6Methods = (classIdentifier, ctor, isDerivedClass, body) -> new JS.Identifier(prop.value) rewriteSuper = generateCopyingWalker -> - if isScopeBoundary(this) then this + if isDownwardScopeBoundary(this) then this else if @toES6Super then @toES6Super() else rewriteSuper this @@ -494,7 +503,7 @@ findES6Methods = (classIdentifier, ctor, isDerivedClass, body) -> rewriteThis = generateCopyingWalker -> if @instanceof JS.ThisExpression then classIdentifier - else if isScopeBoundary(this) then this + else if isDownwardScopeBoundary(this) then this else rewriteThis this properties = map properties, rewriteThis @@ -549,7 +558,7 @@ es6SafeArrowExpression = (parameters, defaults, rest, block) -> rest ?= genSym 'arguments' rewriteArguments = generateMutatingWalker -> if (@instanceof JS.Identifier) and @name == 'arguments' then rest - else if isScopeBoundary(this) then this + else if isDownwardScopeBoundary(this) then this else rewriteArguments this for statement in block.body rewriteArguments(statement) @@ -1442,7 +1451,7 @@ class exports.Compiler newNode = new JS.Identifier generateName this, state usedSymbols.push newNode.name newNode - else if isScopeBoundary(this) + else if isDownwardScopeBoundary(this) params = concatMap @params, collectIdentifiers nsCounters_ = {} nsCounters_[k] = v for own k, v of nsCounters From 09fbe6335687ba4987e1e44f078e16fa21cd54a4 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 18:44:13 -0400 Subject: [PATCH 47/64] make test work in strict mode --- test/function-invocation.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/function-invocation.coffee b/test/function-invocation.coffee index fd83c26d..42f166a7 100644 --- a/test/function-invocation.coffee +++ b/test/function-invocation.coffee @@ -241,7 +241,13 @@ suite 'Function Invocation', -> ok (func --val) is 5 test "jashkenas/coffee-script#855: execution context for `func arr...` should be `null`", -> - contextTest = -> eq this, if window? then window else global + isStrictMode = (-> this == undefined)() + + contextTest = -> + if isStrictMode + ok(not this?) + else + eq this, if window? then window else global array = [] contextTest array contextTest.apply null, array From 9120377ccadbd5634b951b330a7b7de579039eaf Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 18:52:13 -0400 Subject: [PATCH 48/64] match coffeescript destructuring semantics for empty patterns In CS, empty patterns cause us to never access the rvalue. In ES6 (at least as transpiled by babel), we still try to cast the rvalue to an array and explode if it is undefined. --- lib/compiler.js | 2 +- src/compiler.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 61837e77..05c6e32f 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -427,7 +427,7 @@ es6AssignmentPattern = function (assignee) { }.call(this, []); if (all(elements, function (elt) { return null != elt; - })) { + }) && elements.length > 0) { return new JS.ArrayPattern(elements); } } diff --git a/src/compiler.coffee b/src/compiler.coffee index ad2af7fc..096a7714 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -231,7 +231,7 @@ es6AssignmentPattern = (assignee) -> new JS.RestElement elt.expression else es6AssignmentPattern(elt) - if all(elements, (elt) -> elt?) + if all(elements, (elt) -> elt?) and elements.length > 0 new JS.ArrayPattern(elements) # TODO: rewrite this whole thing using the CS AST nodes From 34ad7a45342746c4c73f494e7ac09600b01dace2 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 18:59:09 -0400 Subject: [PATCH 49/64] rest param between default params --- lib/compiler.js | 1 + src/compiler.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 05c6e32f..a00e5778 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1561,6 +1561,7 @@ exports.Compiler = function () { break; } parameters.splice(index, 1); + defaults.splice(index, 1); numParams = parameters.length; numArgs = genSym('numArgs'); reassignments = new JS.IfStatement(new JS.BinaryExpression('>', new JS.AssignmentExpression('=', numArgs, memberAccess(new JS.Identifier('arguments'), 'length')), new JS.Literal(numParams)), new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', paramName, helpers.slice(new JS.Identifier('arguments'), new JS.Literal(index), new JS.BinaryExpression('-', numArgs, new JS.Literal(numParams - index)))))]), new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', paramName, new JS.ArrayExpression([])))])); diff --git a/src/compiler.coffee b/src/compiler.coffee index 096a7714..31b42b07 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -873,6 +873,7 @@ class exports.Compiler index = i break parameters.splice index, 1 + defaults.splice index, 1 numParams = parameters.length numArgs = genSym 'numArgs' reassignments = new JS.IfStatement (new JS.BinaryExpression '>', (new JS.AssignmentExpression '=', numArgs, memberAccess (new JS.Identifier 'arguments'), 'length'), new JS.Literal numParams), (new JS.BlockStatement [ From cb08bfd55cfb9ca587a2dd4ab685230d26853817 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 19:26:43 -0400 Subject: [PATCH 50/64] don't try to transpile classes with bound members ... because the implementation makes it hard and having classes with bound members is a whack thing to be doing anyway, so you're on your own. --- lib/compiler.js | 2 ++ src/compiler.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index a00e5778..51fb7f4d 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1661,6 +1661,8 @@ exports.Compiler = function () { unmatched = cache$3.unmatched; if (this.ctor && !this.ctor.expression['instanceof'](CS.Functions)) { debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because its constructor is not a function expression.'); + } else if (this.boundMembers.length > 0) { + debugES6('' + describeClass(name, ancestry[0]) + ' was not converted to ES6 because it has bound function members.'); } else if (nameAssignee && !nameAssignee['instanceof'](JS.Identifier)) { debugES6('' + describeClass(name, ancestry[0]) + " was not converted to ES6 because it's being assigned to a compound name."); } else if (parent && !(parent instanceof JS.Identifier)) { diff --git a/src/compiler.coffee b/src/compiler.coffee index 31b42b07..3aa0a3ac 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -927,6 +927,8 @@ class exports.Compiler # non-ES6 emulation if @ctor and not @ctor.expression.instanceof CS.Functions debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because its constructor is not a function expression." + else if @boundMembers.length > 0 + debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it has bound function members." else if nameAssignee and not nameAssignee.instanceof JS.Identifier debugES6 "#{describeClass(name, ancestry[0])} was not converted to ES6 because it's being assigned to a compound name." else if parent and not (parent instanceof JS.Identifier) From 1c6dcb83768e7209abfd77e7db920e03a3a65d33 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 21:06:43 -0400 Subject: [PATCH 51/64] added a macro so that we can turn off certain tests that are not compatible with ES6 mode --- lib/cli.js | 3 +- lib/module.js | 3 +- lib/parser.js | 2369 +++++++++++++++++++++-------------------- src/cli.coffee | 1 + src/grammar.pegcoffee | 1 + src/module.coffee | 1 + 6 files changed, 1205 insertions(+), 1173 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index af783b53..2cc27ed9 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -182,7 +182,8 @@ if (options.help) { optimise: false, raw: options.raw || options.sourceMap || options.sourceMapFile || options['eval'], inputSource: inputSource, - literate: options.literate + literate: options.literate, + targetES6: options.targetES6 }); } catch (e$4) { e = e$4; diff --git a/lib/module.js b/lib/module.js index da730a77..0245f1f3 100644 --- a/lib/module.js +++ b/lib/module.js @@ -47,7 +47,8 @@ CoffeeScript = { preprocessed = Preprocessor.process(coffee, { literate: options.literate }); parsed = Parser.parse(preprocessed, { raw: options.raw, - inputSource: options.inputSource + inputSource: options.inputSource, + targetES6: options.targetES6 }); if (options.optimise) { return Optimiser.optimise(parsed); diff --git a/lib/parser.js b/lib/parser.js index bff10921..75c71bd2 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -1265,7 +1265,9 @@ module.exports = (function() { return true; return false; }}, - peg$c204 = function() {return rp(new CS.Bool(true)); + peg$c204 = "__TARGET_ES6__", + peg$c205 = { type: "literal", value: "__TARGET_ES6__", description: "\"__TARGET_ES6__\"" }, + peg$c206 = function() {return rp(new CS.Bool(!!options.targetES6)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1275,7 +1277,7 @@ module.exports = (function() { return true; return false; }}, - peg$c205 = function() {return rp(new CS.Bool(false)); + peg$c207 = function() {return rp(new CS.Bool(true)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1285,9 +1287,7 @@ module.exports = (function() { return true; return false; }}, - peg$c206 = "0b", - peg$c207 = { type: "literal", value: "0b", description: "\"0b\"" }, - peg$c208 = function(bs) {return rp(new CS.Int(parseInt(bs, 2))); + peg$c208 = function() {return rp(new CS.Bool(false)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1297,9 +1297,9 @@ module.exports = (function() { return true; return false; }}, - peg$c209 = "0o", - peg$c210 = { type: "literal", value: "0o", description: "\"0o\"" }, - peg$c211 = function(os) {return rp(new CS.Int(parseInt(os, 8))); + peg$c209 = "0b", + peg$c210 = { type: "literal", value: "0b", description: "\"0b\"" }, + peg$c211 = function(bs) {return rp(new CS.Int(parseInt(bs, 2))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1309,9 +1309,9 @@ module.exports = (function() { return true; return false; }}, - peg$c212 = "0x", - peg$c213 = { type: "literal", value: "0x", description: "\"0x\"" }, - peg$c214 = function(hs) {return rp(new CS.Int(parseInt(hs, 16))); + peg$c212 = "0o", + peg$c213 = { type: "literal", value: "0o", description: "\"0o\"" }, + peg$c214 = function(os) {return rp(new CS.Int(parseInt(os, 8))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1321,11 +1321,9 @@ module.exports = (function() { return true; return false; }}, - peg$c215 = /^[eE]/, - peg$c216 = { type: "class", value: "[eE]", description: "[eE]" }, - peg$c217 = /^[+\-]/, - peg$c218 = { type: "class", value: "[+\\-]", description: "[+\\-]" }, - peg$c219 = function(base, e, sign, exponent) {return rp(new CS.Float(parseFloat('' + base.data + e + (null != sign ? sign : '') + exponent.data))); + peg$c215 = "0x", + peg$c216 = { type: "literal", value: "0x", description: "\"0x\"" }, + peg$c217 = function(hs) {return rp(new CS.Int(parseInt(hs, 16))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1335,7 +1333,21 @@ module.exports = (function() { return true; return false; }}, - peg$c220 = function(integral, fractional) {if (fractional) { + peg$c218 = /^[eE]/, + peg$c219 = { type: "class", value: "[eE]", description: "[eE]" }, + peg$c220 = /^[+\-]/, + peg$c221 = { type: "class", value: "[+\\-]", description: "[+\\-]" }, + peg$c222 = function(base, e, sign, exponent) {return rp(new CS.Float(parseFloat('' + base.data + e + (null != sign ? sign : '') + exponent.data))); + function isOwn$(o, p) { + return {}.hasOwnProperty.call(o, p); + } + function in$(member, list) { + for (var i = 0, length = list.length; i < length; ++i) + if (i in list && list[i] === member) + return true; + return false; + }}, + peg$c223 = function(integral, fractional) {if (fractional) { return rp(new CS.Float(parseFloat(integral + fractional))); } else { return rp(new CS.Int(+integral)); @@ -1349,25 +1361,25 @@ module.exports = (function() { return true; return false; }}, - peg$c221 = "0", - peg$c222 = { type: "literal", value: "0", description: "\"0\"" }, - peg$c223 = /^[1-9]/, - peg$c224 = { type: "class", value: "[1-9]", description: "[1-9]" }, - peg$c225 = /^[0-9]/, - peg$c226 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c227 = /^[0-9a-fA-F]/, - peg$c228 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" }, - peg$c229 = /^[0-7]/, - peg$c230 = { type: "class", value: "[0-7]", description: "[0-7]" }, - peg$c231 = /^[01]/, - peg$c232 = { type: "class", value: "[01]", description: "[01]" }, - peg$c233 = "\"\"\"", - peg$c234 = { type: "literal", value: "\"\"\"", description: "\"\\\"\\\"\\\"\"" }, - peg$c235 = "'", - peg$c236 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c237 = "\"", - peg$c238 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c239 = function(d) {return rp(new CS.String(stripLeadingWhitespace(d.join('')))); + peg$c224 = "0", + peg$c225 = { type: "literal", value: "0", description: "\"0\"" }, + peg$c226 = /^[1-9]/, + peg$c227 = { type: "class", value: "[1-9]", description: "[1-9]" }, + peg$c228 = /^[0-9]/, + peg$c229 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c230 = /^[0-9a-fA-F]/, + peg$c231 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" }, + peg$c232 = /^[0-7]/, + peg$c233 = { type: "class", value: "[0-7]", description: "[0-7]" }, + peg$c234 = /^[01]/, + peg$c235 = { type: "class", value: "[01]", description: "[01]" }, + peg$c236 = "\"\"\"", + peg$c237 = { type: "literal", value: "\"\"\"", description: "\"\\\"\\\"\\\"\"" }, + peg$c238 = "'", + peg$c239 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c240 = "\"", + peg$c241 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c242 = function(d) {return rp(new CS.String(stripLeadingWhitespace(d.join('')))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1377,11 +1389,11 @@ module.exports = (function() { return true; return false; }}, - peg$c240 = "'''", - peg$c241 = { type: "literal", value: "'''", description: "\"'''\"" }, - peg$c242 = "#", - peg$c243 = { type: "literal", value: "#", description: "\"#\"" }, - peg$c244 = function(d) {return rp(new CS.String(d.join(''))); + peg$c243 = "'''", + peg$c244 = { type: "literal", value: "'''", description: "\"'''\"" }, + peg$c245 = "#", + peg$c246 = { type: "literal", value: "#", description: "\"#\"" }, + peg$c247 = function(d) {return rp(new CS.String(d.join(''))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1391,11 +1403,11 @@ module.exports = (function() { return true; return false; }}, - peg$c245 = /^[^"'\\#]/, - peg$c246 = { type: "class", value: "[^\"'\\\\#]", description: "[^\"'\\\\#]" }, - peg$c247 = "\\x", - peg$c248 = { type: "literal", value: "\\x", description: "\"\\\\x\"" }, - peg$c249 = function(h) {return String.fromCharCode(parseInt(h, 16)); + peg$c248 = /^[^"'\\#]/, + peg$c249 = { type: "class", value: "[^\"'\\\\#]", description: "[^\"'\\\\#]" }, + peg$c250 = "\\x", + peg$c251 = { type: "literal", value: "\\x", description: "\"\\\\x\"" }, + peg$c252 = function(h) {return String.fromCharCode(parseInt(h, 16)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1405,9 +1417,9 @@ module.exports = (function() { return true; return false; }}, - peg$c250 = "\\0", - peg$c251 = { type: "literal", value: "\\0", description: "\"\\\\0\"" }, - peg$c252 = function() {return '\0'; + peg$c253 = "\\0", + peg$c254 = { type: "literal", value: "\\0", description: "\"\\\\0\"" }, + peg$c255 = function() {return '\0'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1417,7 +1429,7 @@ module.exports = (function() { return true; return false; }}, - peg$c253 = function() {throw new SyntaxError(['string data'], 'octal escape sequence', offset(), line(), column()); + peg$c256 = function() {throw new SyntaxError(['string data'], 'octal escape sequence', offset(), line(), column()); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1427,9 +1439,9 @@ module.exports = (function() { return true; return false; }}, - peg$c254 = "\\b", - peg$c255 = { type: "literal", value: "\\b", description: "\"\\\\b\"" }, - peg$c256 = function() {return '\b'; + peg$c257 = "\\b", + peg$c258 = { type: "literal", value: "\\b", description: "\"\\\\b\"" }, + peg$c259 = function() {return '\b'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1439,9 +1451,9 @@ module.exports = (function() { return true; return false; }}, - peg$c257 = "\\t", - peg$c258 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c259 = function() {return '\t'; + peg$c260 = "\\t", + peg$c261 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, + peg$c262 = function() {return '\t'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1451,9 +1463,9 @@ module.exports = (function() { return true; return false; }}, - peg$c260 = "\\n", - peg$c261 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c262 = function() {return '\n'; + peg$c263 = "\\n", + peg$c264 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, + peg$c265 = function() {return '\n'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1463,9 +1475,9 @@ module.exports = (function() { return true; return false; }}, - peg$c263 = "\\v", - peg$c264 = { type: "literal", value: "\\v", description: "\"\\\\v\"" }, - peg$c265 = function() {return '\x0B'; + peg$c266 = "\\v", + peg$c267 = { type: "literal", value: "\\v", description: "\"\\\\v\"" }, + peg$c268 = function() {return '\x0B'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1475,9 +1487,9 @@ module.exports = (function() { return true; return false; }}, - peg$c266 = "\\f", - peg$c267 = { type: "literal", value: "\\f", description: "\"\\\\f\"" }, - peg$c268 = function() {return '\f'; + peg$c269 = "\\f", + peg$c270 = { type: "literal", value: "\\f", description: "\"\\\\f\"" }, + peg$c271 = function() {return '\f'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1487,9 +1499,9 @@ module.exports = (function() { return true; return false; }}, - peg$c269 = "\\r", - peg$c270 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c271 = function() {return '\r'; + peg$c272 = "\\r", + peg$c273 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, + peg$c274 = function() {return '\r'; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1499,12 +1511,12 @@ module.exports = (function() { return true; return false; }}, - peg$c272 = "\\", - peg$c273 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c274 = { type: "any", description: "any character" }, - peg$c275 = "#{", - peg$c276 = { type: "literal", value: "#{", description: "\"#{\"" }, - peg$c277 = function(es) {return rp(createInterpolation(stripLeadingWhitespaceInterpolation(es))); + peg$c275 = "\\", + peg$c276 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c277 = { type: "any", description: "any character" }, + peg$c278 = "#{", + peg$c279 = { type: "literal", value: "#{", description: "\"#{\"" }, + peg$c280 = function(es) {return rp(createInterpolation(stripLeadingWhitespaceInterpolation(es))); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1514,7 +1526,7 @@ module.exports = (function() { return true; return false; }}, - peg$c278 = function(es) {return rp(createInterpolation(es)); + peg$c281 = function(es) {return rp(createInterpolation(es)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1524,11 +1536,11 @@ module.exports = (function() { return true; return false; }}, - peg$c279 = "///", - peg$c280 = { type: "literal", value: "///", description: "\"///\"" }, - peg$c281 = /^[ \r\n]/, - peg$c282 = { type: "class", value: "[ \\r\\n]", description: "[ \\r\\n]" }, - peg$c283 = function() {return [rp(new CS.String('').g())]; + peg$c282 = "///", + peg$c283 = { type: "literal", value: "///", description: "\"///\"" }, + peg$c284 = /^[ \r\n]/, + peg$c285 = { type: "class", value: "[ \\r\\n]", description: "[ \\r\\n]" }, + peg$c286 = function() {return [rp(new CS.String('').g())]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1538,9 +1550,9 @@ module.exports = (function() { return true; return false; }}, - peg$c284 = /^[^\\\/#[ \r\n]/, - peg$c285 = { type: "class", value: "[^\\\\\\/#[ \\r\\n]", description: "[^\\\\\\/#[ \\r\\n]" }, - peg$c286 = function(s) {return [rp(new CS.String(s).g())]; + peg$c287 = /^[^\\\/#[ \r\n]/, + peg$c288 = { type: "class", value: "[^\\\\\\/#[ \\r\\n]", description: "[^\\\\\\/#[ \\r\\n]" }, + peg$c289 = function(s) {return [rp(new CS.String(s).g())]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1550,9 +1562,9 @@ module.exports = (function() { return true; return false; }}, - peg$c287 = /^[gimy]/, - peg$c288 = { type: "class", value: "[gimy]", description: "[gimy]" }, - peg$c289 = function(es, flags) {var interp; + peg$c290 = /^[gimy]/, + peg$c291 = { type: "class", value: "[gimy]", description: "[gimy]" }, + peg$c292 = function(es, flags) {var interp; if (!isValidRegExpFlags(flags)) { throw new SyntaxError(['regular expression flags'], 'regular expression flags', offset(), line(), column()); } @@ -1572,11 +1584,11 @@ module.exports = (function() { return true; return false; }}, - peg$c290 = "/", - peg$c291 = { type: "literal", value: "/", description: "\"/\"" }, - peg$c292 = /^[^\/\\[\n]/, - peg$c293 = { type: "class", value: "[^\\/\\\\[\\n]", description: "[^\\/\\\\[\\n]" }, - peg$c294 = function(d, flags) {if (!isValidRegExpFlags(flags)) { + peg$c293 = "/", + peg$c294 = { type: "literal", value: "/", description: "\"/\"" }, + peg$c295 = /^[^\/\\[\n]/, + peg$c296 = { type: "class", value: "[^\\/\\\\[\\n]", description: "[^\\/\\\\[\\n]" }, + peg$c297 = function(d, flags) {if (!isValidRegExpFlags(flags)) { throw new SyntaxError(['regular expression flags'], 'regular expression flags', offset(), line(), column()); } return rp(new CS.RegExp(d, flags)); @@ -1589,9 +1601,9 @@ module.exports = (function() { return true; return false; }}, - peg$c295 = /^[^\\\]\n]/, - peg$c296 = { type: "class", value: "[^\\\\\\]\\n]", description: "[^\\\\\\]\\n]" }, - peg$c297 = function(h) {return h[0]; + peg$c298 = /^[^\\\]\n]/, + peg$c299 = { type: "class", value: "[^\\\\\\]\\n]", description: "[^\\\\\\]\\n]" }, + peg$c300 = function(h) {return h[0]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1601,9 +1613,9 @@ module.exports = (function() { return true; return false; }}, - peg$c298 = /^[^\\\/\]]/, - peg$c299 = { type: "class", value: "[^\\\\\\/\\]]", description: "[^\\\\\\/\\]]" }, - peg$c300 = function(s) {return p(new CS.String(s)); + peg$c301 = /^[^\\\/\]]/, + peg$c302 = { type: "class", value: "[^\\\\\\/\\]]", description: "[^\\\\\\/\\]]" }, + peg$c303 = function(s) {return p(new CS.String(s)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1613,7 +1625,7 @@ module.exports = (function() { return true; return false; }}, - peg$c301 = function(d) {return [p(new CS.String('['))].concat([].slice.call(d), [p(new CS.String(']'))]); + peg$c304 = function(d) {return [p(new CS.String('['))].concat([].slice.call(d), [p(new CS.String(']'))]); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1623,7 +1635,7 @@ module.exports = (function() { return true; return false; }}, - peg$c302 = function(d) {return [rp(new CS.String(d))]; + peg$c305 = function(d) {return [rp(new CS.String(d))]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1633,7 +1645,7 @@ module.exports = (function() { return true; return false; }}, - peg$c303 = function(s) {return [rp(new CS.String(s))]; + peg$c306 = function(s) {return [rp(new CS.String(s))]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1643,7 +1655,7 @@ module.exports = (function() { return true; return false; }}, - peg$c304 = function(c) {return [rp(new CS.String(c))]; + peg$c307 = function(c) {return [rp(new CS.String(c))]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1653,7 +1665,7 @@ module.exports = (function() { return true; return false; }}, - peg$c305 = function(e) {return [e]; + peg$c308 = function(e) {return [e]; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1663,7 +1675,7 @@ module.exports = (function() { return true; return false; }}, - peg$c306 = function(e) {return rp(new CS.Throw(e)); + peg$c309 = function(e) {return rp(new CS.Throw(e)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1673,7 +1685,7 @@ module.exports = (function() { return true; return false; }}, - peg$c307 = function(e) {return rp(new CS.Return(e)); + peg$c310 = function(e) {return rp(new CS.Return(e)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1683,7 +1695,7 @@ module.exports = (function() { return true; return false; }}, - peg$c308 = function() {return rp(new CS.Continue); + peg$c311 = function() {return rp(new CS.Continue); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1693,7 +1705,7 @@ module.exports = (function() { return true; return false; }}, - peg$c309 = function() {return rp(new CS.Break); + peg$c312 = function() {return rp(new CS.Break); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1703,7 +1715,7 @@ module.exports = (function() { return true; return false; }}, - peg$c310 = function() {return rp(new CS.Debugger); + peg$c313 = function() {return rp(new CS.Debugger); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1713,7 +1725,7 @@ module.exports = (function() { return true; return false; }}, - peg$c311 = function() {return rp(new CS.Undefined); + peg$c314 = function() {return rp(new CS.Undefined); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1723,7 +1735,7 @@ module.exports = (function() { return true; return false; }}, - peg$c312 = function() {return rp(new CS.Null); + peg$c315 = function() {return rp(new CS.Null); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1733,11 +1745,11 @@ module.exports = (function() { return true; return false; }}, - peg$c313 = "arguments", - peg$c314 = { type: "literal", value: "arguments", description: "\"arguments\"" }, - peg$c315 = "eval", - peg$c316 = { type: "literal", value: "eval", description: "\"eval\"" }, - peg$c317 = function(i) {return i; + peg$c316 = "arguments", + peg$c317 = { type: "literal", value: "arguments", description: "\"arguments\"" }, + peg$c318 = "eval", + peg$c319 = { type: "literal", value: "eval", description: "\"eval\"" }, + peg$c320 = function(i) {return i; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1747,7 +1759,7 @@ module.exports = (function() { return true; return false; }}, - peg$c318 = function(v) {var key; + peg$c321 = function(v) {var key; key = rp(new CS.String(v.memberName)); return rp(new CS.ObjectInitialiserMember(key, v)); function isOwn$(o, p) { @@ -1759,7 +1771,7 @@ module.exports = (function() { return true; return false; }}, - peg$c319 = function(i) {return rp(new CS.ObjectInitialiserMember(i, i)); + peg$c322 = function(i) {return rp(new CS.ObjectInitialiserMember(i, i)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1769,21 +1781,21 @@ module.exports = (function() { return true; return false; }}, - peg$c320 = /^[$_]/, - peg$c321 = { type: "class", value: "[$_]", description: "[$_]" }, - peg$c322 = "###", - peg$c323 = { type: "literal", value: "###", description: "\"###\"" }, - peg$c324 = /^[^#]/, - peg$c325 = { type: "class", value: "[^#]", description: "[^#]" }, - peg$c326 = /^[\t\x0B\f \xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/, - peg$c327 = { type: "class", value: "[\\t\\x0B\\f \\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", description: "[\\t\\x0B\\f \\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" }, - peg$c328 = "\r", - peg$c329 = { type: "literal", value: "\r", description: "\"\\r\"" }, - peg$c330 = "\n", - peg$c331 = { type: "literal", value: "\n", description: "\"\\n\"" }, - peg$c332 = "\uEFEF", - peg$c333 = { type: "literal", value: "\uEFEF", description: "\"\\uEFEF\"" }, - peg$c334 = function(ws) {return ws; + peg$c323 = /^[$_]/, + peg$c324 = { type: "class", value: "[$_]", description: "[$_]" }, + peg$c325 = "###", + peg$c326 = { type: "literal", value: "###", description: "\"###\"" }, + peg$c327 = /^[^#]/, + peg$c328 = { type: "class", value: "[^#]", description: "[^#]" }, + peg$c329 = /^[\t\x0B\f \xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/, + peg$c330 = { type: "class", value: "[\\t\\x0B\\f \\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", description: "[\\t\\x0B\\f \\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" }, + peg$c331 = "\r", + peg$c332 = { type: "literal", value: "\r", description: "\"\\r\"" }, + peg$c333 = "\n", + peg$c334 = { type: "literal", value: "\n", description: "\"\\n\"" }, + peg$c335 = "\uEFEF", + peg$c336 = { type: "literal", value: "\uEFEF", description: "\"\\uEFEF\"" }, + peg$c337 = function(ws) {return ws; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1793,11 +1805,11 @@ module.exports = (function() { return true; return false; }}, - peg$c335 = "\uEFFE", - peg$c336 = { type: "literal", value: "\uEFFE", description: "\"\\uEFFE\"" }, - peg$c337 = "\uEFFF", - peg$c338 = { type: "literal", value: "\uEFFF", description: "\"\\uEFFF\"" }, - peg$c339 = function() {return ''; + peg$c338 = "\uEFFE", + peg$c339 = { type: "literal", value: "\uEFFE", description: "\"\\uEFFE\"" }, + peg$c340 = "\uEFFF", + peg$c341 = { type: "literal", value: "\uEFFF", description: "\"\\uEFFF\"" }, + peg$c342 = function() {return ''; function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1807,137 +1819,137 @@ module.exports = (function() { return true; return false; }}, - peg$c340 = "and", - peg$c341 = { type: "literal", value: "and", description: "\"and\"" }, - peg$c342 = "break", - peg$c343 = { type: "literal", value: "break", description: "\"break\"" }, - peg$c344 = "by", - peg$c345 = { type: "literal", value: "by", description: "\"by\"" }, - peg$c346 = "catch", - peg$c347 = { type: "literal", value: "catch", description: "\"catch\"" }, - peg$c348 = "continue", - peg$c349 = { type: "literal", value: "continue", description: "\"continue\"" }, - peg$c350 = "class", - peg$c351 = { type: "literal", value: "class", description: "\"class\"" }, - peg$c352 = "delete", - peg$c353 = { type: "literal", value: "delete", description: "\"delete\"" }, - peg$c354 = "debugger", - peg$c355 = { type: "literal", value: "debugger", description: "\"debugger\"" }, - peg$c356 = "do", - peg$c357 = { type: "literal", value: "do", description: "\"do\"" }, - peg$c358 = "else", - peg$c359 = { type: "literal", value: "else", description: "\"else\"" }, - peg$c360 = "extends", - peg$c361 = { type: "literal", value: "extends", description: "\"extends\"" }, - peg$c362 = "false", - peg$c363 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c364 = "finally", - peg$c365 = { type: "literal", value: "finally", description: "\"finally\"" }, - peg$c366 = "for", - peg$c367 = { type: "literal", value: "for", description: "\"for\"" }, - peg$c368 = "if", - peg$c369 = { type: "literal", value: "if", description: "\"if\"" }, - peg$c370 = "in", - peg$c371 = { type: "literal", value: "in", description: "\"in\"" }, - peg$c372 = "instanceof", - peg$c373 = { type: "literal", value: "instanceof", description: "\"instanceof\"" }, - peg$c374 = "is", - peg$c375 = { type: "literal", value: "is", description: "\"is\"" }, - peg$c376 = "isnt", - peg$c377 = { type: "literal", value: "isnt", description: "\"isnt\"" }, - peg$c378 = "loop", - peg$c379 = { type: "literal", value: "loop", description: "\"loop\"" }, - peg$c380 = "new", - peg$c381 = { type: "literal", value: "new", description: "\"new\"" }, - peg$c382 = "no", - peg$c383 = { type: "literal", value: "no", description: "\"no\"" }, - peg$c384 = "not", - peg$c385 = { type: "literal", value: "not", description: "\"not\"" }, - peg$c386 = "null", - peg$c387 = { type: "literal", value: "null", description: "\"null\"" }, - peg$c388 = "of", - peg$c389 = { type: "literal", value: "of", description: "\"of\"" }, - peg$c390 = "off", - peg$c391 = { type: "literal", value: "off", description: "\"off\"" }, - peg$c392 = "on", - peg$c393 = { type: "literal", value: "on", description: "\"on\"" }, - peg$c394 = "or", - peg$c395 = { type: "literal", value: "or", description: "\"or\"" }, - peg$c396 = "own", - peg$c397 = { type: "literal", value: "own", description: "\"own\"" }, - peg$c398 = "return", - peg$c399 = { type: "literal", value: "return", description: "\"return\"" }, - peg$c400 = "switch", - peg$c401 = { type: "literal", value: "switch", description: "\"switch\"" }, - peg$c402 = "then", - peg$c403 = { type: "literal", value: "then", description: "\"then\"" }, - peg$c404 = "this", - peg$c405 = { type: "literal", value: "this", description: "\"this\"" }, - peg$c406 = "throw", - peg$c407 = { type: "literal", value: "throw", description: "\"throw\"" }, - peg$c408 = "true", - peg$c409 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c410 = "try", - peg$c411 = { type: "literal", value: "try", description: "\"try\"" }, - peg$c412 = "typeof", - peg$c413 = { type: "literal", value: "typeof", description: "\"typeof\"" }, - peg$c414 = "undefined", - peg$c415 = { type: "literal", value: "undefined", description: "\"undefined\"" }, - peg$c416 = "unless", - peg$c417 = { type: "literal", value: "unless", description: "\"unless\"" }, - peg$c418 = "until", - peg$c419 = { type: "literal", value: "until", description: "\"until\"" }, - peg$c420 = "when", - peg$c421 = { type: "literal", value: "when", description: "\"when\"" }, - peg$c422 = "while", - peg$c423 = { type: "literal", value: "while", description: "\"while\"" }, - peg$c424 = "yes", - peg$c425 = { type: "literal", value: "yes", description: "\"yes\"" }, - peg$c426 = "super", - peg$c427 = { type: "literal", value: "super", description: "\"super\"" }, - peg$c428 = "case", - peg$c429 = { type: "literal", value: "case", description: "\"case\"" }, - peg$c430 = "default", - peg$c431 = { type: "literal", value: "default", description: "\"default\"" }, - peg$c432 = "function", - peg$c433 = { type: "literal", value: "function", description: "\"function\"" }, - peg$c434 = "var", - peg$c435 = { type: "literal", value: "var", description: "\"var\"" }, - peg$c436 = "void", - peg$c437 = { type: "literal", value: "void", description: "\"void\"" }, - peg$c438 = "with", - peg$c439 = { type: "literal", value: "with", description: "\"with\"" }, - peg$c440 = "const", - peg$c441 = { type: "literal", value: "const", description: "\"const\"" }, - peg$c442 = "let", - peg$c443 = { type: "literal", value: "let", description: "\"let\"" }, - peg$c444 = "enum", - peg$c445 = { type: "literal", value: "enum", description: "\"enum\"" }, - peg$c446 = "export", - peg$c447 = { type: "literal", value: "export", description: "\"export\"" }, - peg$c448 = "import", - peg$c449 = { type: "literal", value: "import", description: "\"import\"" }, - peg$c450 = "native", - peg$c451 = { type: "literal", value: "native", description: "\"native\"" }, - peg$c452 = "implements", - peg$c453 = { type: "literal", value: "implements", description: "\"implements\"" }, - peg$c454 = "interface", - peg$c455 = { type: "literal", value: "interface", description: "\"interface\"" }, - peg$c456 = "package", - peg$c457 = { type: "literal", value: "package", description: "\"package\"" }, - peg$c458 = "private", - peg$c459 = { type: "literal", value: "private", description: "\"private\"" }, - peg$c460 = "protected", - peg$c461 = { type: "literal", value: "protected", description: "\"protected\"" }, - peg$c462 = "public", - peg$c463 = { type: "literal", value: "public", description: "\"public\"" }, - peg$c464 = "static", - peg$c465 = { type: "literal", value: "static", description: "\"static\"" }, - peg$c466 = "yield", - peg$c467 = { type: "literal", value: "yield", description: "\"yield\"" }, - peg$c468 = "\\u", - peg$c469 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, - peg$c470 = function(h0, h1, h2, h3) {return String.fromCharCode(parseInt(h0 + h1 + h2 + h3, 16)); + peg$c343 = "and", + peg$c344 = { type: "literal", value: "and", description: "\"and\"" }, + peg$c345 = "break", + peg$c346 = { type: "literal", value: "break", description: "\"break\"" }, + peg$c347 = "by", + peg$c348 = { type: "literal", value: "by", description: "\"by\"" }, + peg$c349 = "catch", + peg$c350 = { type: "literal", value: "catch", description: "\"catch\"" }, + peg$c351 = "continue", + peg$c352 = { type: "literal", value: "continue", description: "\"continue\"" }, + peg$c353 = "class", + peg$c354 = { type: "literal", value: "class", description: "\"class\"" }, + peg$c355 = "delete", + peg$c356 = { type: "literal", value: "delete", description: "\"delete\"" }, + peg$c357 = "debugger", + peg$c358 = { type: "literal", value: "debugger", description: "\"debugger\"" }, + peg$c359 = "do", + peg$c360 = { type: "literal", value: "do", description: "\"do\"" }, + peg$c361 = "else", + peg$c362 = { type: "literal", value: "else", description: "\"else\"" }, + peg$c363 = "extends", + peg$c364 = { type: "literal", value: "extends", description: "\"extends\"" }, + peg$c365 = "false", + peg$c366 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c367 = "finally", + peg$c368 = { type: "literal", value: "finally", description: "\"finally\"" }, + peg$c369 = "for", + peg$c370 = { type: "literal", value: "for", description: "\"for\"" }, + peg$c371 = "if", + peg$c372 = { type: "literal", value: "if", description: "\"if\"" }, + peg$c373 = "in", + peg$c374 = { type: "literal", value: "in", description: "\"in\"" }, + peg$c375 = "instanceof", + peg$c376 = { type: "literal", value: "instanceof", description: "\"instanceof\"" }, + peg$c377 = "is", + peg$c378 = { type: "literal", value: "is", description: "\"is\"" }, + peg$c379 = "isnt", + peg$c380 = { type: "literal", value: "isnt", description: "\"isnt\"" }, + peg$c381 = "loop", + peg$c382 = { type: "literal", value: "loop", description: "\"loop\"" }, + peg$c383 = "new", + peg$c384 = { type: "literal", value: "new", description: "\"new\"" }, + peg$c385 = "no", + peg$c386 = { type: "literal", value: "no", description: "\"no\"" }, + peg$c387 = "not", + peg$c388 = { type: "literal", value: "not", description: "\"not\"" }, + peg$c389 = "null", + peg$c390 = { type: "literal", value: "null", description: "\"null\"" }, + peg$c391 = "of", + peg$c392 = { type: "literal", value: "of", description: "\"of\"" }, + peg$c393 = "off", + peg$c394 = { type: "literal", value: "off", description: "\"off\"" }, + peg$c395 = "on", + peg$c396 = { type: "literal", value: "on", description: "\"on\"" }, + peg$c397 = "or", + peg$c398 = { type: "literal", value: "or", description: "\"or\"" }, + peg$c399 = "own", + peg$c400 = { type: "literal", value: "own", description: "\"own\"" }, + peg$c401 = "return", + peg$c402 = { type: "literal", value: "return", description: "\"return\"" }, + peg$c403 = "switch", + peg$c404 = { type: "literal", value: "switch", description: "\"switch\"" }, + peg$c405 = "then", + peg$c406 = { type: "literal", value: "then", description: "\"then\"" }, + peg$c407 = "this", + peg$c408 = { type: "literal", value: "this", description: "\"this\"" }, + peg$c409 = "throw", + peg$c410 = { type: "literal", value: "throw", description: "\"throw\"" }, + peg$c411 = "true", + peg$c412 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c413 = "try", + peg$c414 = { type: "literal", value: "try", description: "\"try\"" }, + peg$c415 = "typeof", + peg$c416 = { type: "literal", value: "typeof", description: "\"typeof\"" }, + peg$c417 = "undefined", + peg$c418 = { type: "literal", value: "undefined", description: "\"undefined\"" }, + peg$c419 = "unless", + peg$c420 = { type: "literal", value: "unless", description: "\"unless\"" }, + peg$c421 = "until", + peg$c422 = { type: "literal", value: "until", description: "\"until\"" }, + peg$c423 = "when", + peg$c424 = { type: "literal", value: "when", description: "\"when\"" }, + peg$c425 = "while", + peg$c426 = { type: "literal", value: "while", description: "\"while\"" }, + peg$c427 = "yes", + peg$c428 = { type: "literal", value: "yes", description: "\"yes\"" }, + peg$c429 = "super", + peg$c430 = { type: "literal", value: "super", description: "\"super\"" }, + peg$c431 = "case", + peg$c432 = { type: "literal", value: "case", description: "\"case\"" }, + peg$c433 = "default", + peg$c434 = { type: "literal", value: "default", description: "\"default\"" }, + peg$c435 = "function", + peg$c436 = { type: "literal", value: "function", description: "\"function\"" }, + peg$c437 = "var", + peg$c438 = { type: "literal", value: "var", description: "\"var\"" }, + peg$c439 = "void", + peg$c440 = { type: "literal", value: "void", description: "\"void\"" }, + peg$c441 = "with", + peg$c442 = { type: "literal", value: "with", description: "\"with\"" }, + peg$c443 = "const", + peg$c444 = { type: "literal", value: "const", description: "\"const\"" }, + peg$c445 = "let", + peg$c446 = { type: "literal", value: "let", description: "\"let\"" }, + peg$c447 = "enum", + peg$c448 = { type: "literal", value: "enum", description: "\"enum\"" }, + peg$c449 = "export", + peg$c450 = { type: "literal", value: "export", description: "\"export\"" }, + peg$c451 = "import", + peg$c452 = { type: "literal", value: "import", description: "\"import\"" }, + peg$c453 = "native", + peg$c454 = { type: "literal", value: "native", description: "\"native\"" }, + peg$c455 = "implements", + peg$c456 = { type: "literal", value: "implements", description: "\"implements\"" }, + peg$c457 = "interface", + peg$c458 = { type: "literal", value: "interface", description: "\"interface\"" }, + peg$c459 = "package", + peg$c460 = { type: "literal", value: "package", description: "\"package\"" }, + peg$c461 = "private", + peg$c462 = { type: "literal", value: "private", description: "\"private\"" }, + peg$c463 = "protected", + peg$c464 = { type: "literal", value: "protected", description: "\"protected\"" }, + peg$c465 = "public", + peg$c466 = { type: "literal", value: "public", description: "\"public\"" }, + peg$c467 = "static", + peg$c468 = { type: "literal", value: "static", description: "\"static\"" }, + peg$c469 = "yield", + peg$c470 = { type: "literal", value: "yield", description: "\"yield\"" }, + peg$c471 = "\\u", + peg$c472 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, + peg$c473 = function(h0, h1, h2, h3) {return String.fromCharCode(parseInt(h0 + h1 + h2 + h3, 16)); function isOwn$(o, p) { return {}.hasOwnProperty.call(o, p); } @@ -1947,106 +1959,106 @@ module.exports = (function() { return true; return false; }}, - peg$c471 = /^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uFF21-\uFF3Aa-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D62-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\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\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7C\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2D00-\u2D25\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D61\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA717-\uA71F\uA770\uA788\uA9CF\uAA70\uAADD\uFF70\uFF9E\uFF9F\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BC0-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u2135-\u2138\u2D30-\u2D65\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400\u4DB5\u4E00\u9FCB\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/, - peg$c472 = { type: "class", value: "[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0531-\\u0556\\u10A0-\\u10C5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uFF21-\\uFF3Aa-z\\xAA\\xB5\\xBA\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D62-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\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\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7C\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2D00-\\u2D25\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D61\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA717-\\uA71F\\uA770\\uA788\\uA9CF\\uAA70\\uAADD\\uFF70\\uFF9E\\uFF9F\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u1100-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BC0-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u2135-\\u2138\\u2D30-\\u2D65\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FCB\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA2D\\uFA30-\\uFA6D\\uFA70-\\uFAD9\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF66-\\uFF6F\\uFF71-\\uFF9D\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]", description: "[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0531-\\u0556\\u10A0-\\u10C5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uFF21-\\uFF3Aa-z\\xAA\\xB5\\xBA\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D62-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\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\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7C\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2D00-\\u2D25\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D61\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA717-\\uA71F\\uA770\\uA788\\uA9CF\\uAA70\\uAADD\\uFF70\\uFF9E\\uFF9F\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u1100-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BC0-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u2135-\\u2138\\u2D30-\\u2D65\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FCB\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA2D\\uFA30-\\uFA6D\\uFA70-\\uFAD9\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF66-\\uFF6F\\uFF71-\\uFF9D\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]" }, - peg$c473 = "\uD82C", - peg$c474 = { type: "literal", value: "\uD82C", description: "\"\\uD82C\"" }, - peg$c475 = /^[\uDC00\uDC01]/, - peg$c476 = { type: "class", value: "[\\uDC00\\uDC01]", description: "[\\uDC00\\uDC01]" }, - peg$c477 = "\uD808", - peg$c478 = { type: "literal", value: "\uD808", description: "\"\\uD808\"" }, - peg$c479 = /^[\uDC00-\uDF6E]/, - peg$c480 = { type: "class", value: "[\\uDC00-\\uDF6E]", description: "[\\uDC00-\\uDF6E]" }, - peg$c481 = "\uD869", - peg$c482 = { type: "literal", value: "\uD869", description: "\"\\uD869\"" }, - peg$c483 = /^[\uDED6\uDF00]/, - peg$c484 = { type: "class", value: "[\\uDED6\\uDF00]", description: "[\\uDED6\\uDF00]" }, - peg$c485 = "\uD809", - peg$c486 = { type: "literal", value: "\uD809", description: "\"\\uD809\"" }, - peg$c487 = /^[\uDC00-\uDC62]/, - peg$c488 = { type: "class", value: "[\\uDC00-\\uDC62]", description: "[\\uDC00-\\uDC62]" }, - peg$c489 = "\uD835", - peg$c490 = { type: "literal", value: "\uD835", description: "\"\\uD835\"" }, - peg$c491 = /^[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]/, - peg$c492 = { type: "class", value: "[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]", description: "[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]" }, - peg$c493 = "\uD804", - peg$c494 = { type: "literal", value: "\uD804", description: "\"\\uD804\"" }, - peg$c495 = /^[\uDC03-\uDC37\uDC83-\uDCAF]/, - peg$c496 = { type: "class", value: "[\\uDC03-\\uDC37\\uDC83-\\uDCAF]", description: "[\\uDC03-\\uDC37\\uDC83-\\uDCAF]" }, - peg$c497 = "\uD800", - peg$c498 = { type: "literal", value: "\uD800", description: "\"\\uD800\"" }, - peg$c499 = /^[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1E\uDF30-\uDF40\uDF42-\uDF49\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]/, - peg$c500 = { type: "class", value: "[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1E\\uDF30-\\uDF40\\uDF42-\\uDF49\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]", description: "[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1E\\uDF30-\\uDF40\\uDF42-\\uDF49\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]" }, - peg$c501 = "\uD80C", - peg$c502 = { type: "literal", value: "\uD80C", description: "\"\\uD80C\"" }, - peg$c503 = /^[\uDC00-\uDFFF]/, - peg$c504 = { type: "class", value: "[\\uDC00-\\uDFFF]", description: "[\\uDC00-\\uDFFF]" }, - peg$c505 = "\uD801", - peg$c506 = { type: "literal", value: "\uD801", description: "\"\\uD801\"" }, - peg$c507 = /^[\uDC00-\uDC9D]/, - peg$c508 = { type: "class", value: "[\\uDC00-\\uDC9D]", description: "[\\uDC00-\\uDC9D]" }, - peg$c509 = "\uD86E", - peg$c510 = { type: "literal", value: "\uD86E", description: "\"\\uD86E\"" }, - peg$c511 = /^[\uDC1D]/, - peg$c512 = { type: "class", value: "[\\uDC1D]", description: "[\\uDC1D]" }, - peg$c513 = "\uD803", - peg$c514 = { type: "literal", value: "\uD803", description: "\"\\uD803\"" }, - peg$c515 = /^[\uDC00-\uDC48]/, - peg$c516 = { type: "class", value: "[\\uDC00-\\uDC48]", description: "[\\uDC00-\\uDC48]" }, - peg$c517 = "\uD840", - peg$c518 = { type: "literal", value: "\uD840", description: "\"\\uD840\"" }, - peg$c519 = /^[\uDC00]/, - peg$c520 = { type: "class", value: "[\\uDC00]", description: "[\\uDC00]" }, - peg$c521 = "\uD87E", - peg$c522 = { type: "literal", value: "\uD87E", description: "\"\\uD87E\"" }, - peg$c523 = /^[\uDC00-\uDE1D]/, - peg$c524 = { type: "class", value: "[\\uDC00-\\uDE1D]", description: "[\\uDC00-\\uDE1D]" }, - peg$c525 = "\uD86D", - peg$c526 = { type: "literal", value: "\uD86D", description: "\"\\uD86D\"" }, - peg$c527 = /^[\uDF34\uDF40]/, - peg$c528 = { type: "class", value: "[\\uDF34\\uDF40]", description: "[\\uDF34\\uDF40]" }, - peg$c529 = "\uD81A", - peg$c530 = { type: "literal", value: "\uD81A", description: "\"\\uD81A\"" }, - peg$c531 = /^[\uDC00-\uDE38]/, - peg$c532 = { type: "class", value: "[\\uDC00-\\uDE38]", description: "[\\uDC00-\\uDE38]" }, - peg$c533 = "\uD802", - peg$c534 = { type: "literal", value: "\uD802", description: "\"\\uD802\"" }, - peg$c535 = /^[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDD00-\uDD15\uDD20-\uDD39\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72]/, - peg$c536 = { type: "class", value: "[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72]", description: "[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72]" }, - peg$c537 = "\uD80D", - peg$c538 = { type: "literal", value: "\uD80D", description: "\"\\uD80D\"" }, - peg$c539 = /^[\uDC00-\uDC2E]/, - peg$c540 = { type: "class", value: "[\\uDC00-\\uDC2E]", description: "[\\uDC00-\\uDC2E]" }, - peg$c541 = /^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0900-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F\uA67C\uA67D\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u19B0-\u19C0\u19C8\u19C9\u1A19-\u1A1B\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF2\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BD-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]/, - peg$c542 = { type: "class", value: "[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0900-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFC-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]", description: "[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0900-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFC-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]" }, - peg$c543 = "\uDB40", - peg$c544 = { type: "literal", value: "\uDB40", description: "\"\\uDB40\"" }, - peg$c545 = /^[\uDD00-\uDDEF]/, - peg$c546 = { type: "class", value: "[\\uDD00-\\uDDEF]", description: "[\\uDD00-\\uDDEF]" }, - peg$c547 = "\uD834", - peg$c548 = { type: "literal", value: "\uD834", description: "\"\\uD834\"" }, - peg$c549 = /^[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44\uDD65\uDD66\uDD6D-\uDD72]/, - peg$c550 = { type: "class", value: "[\\uDD67-\\uDD69\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44\\uDD65\\uDD66\\uDD6D-\\uDD72]", description: "[\\uDD67-\\uDD69\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44\\uDD65\\uDD66\\uDD6D-\\uDD72]" }, - peg$c551 = /^[\uDC01\uDC38-\uDC46\uDC80\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8]/, - peg$c552 = { type: "class", value: "[\\uDC01\\uDC38-\\uDC46\\uDC80\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8]", description: "[\\uDC01\\uDC38-\\uDC46\\uDC80\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8]" }, - peg$c553 = /^[\uDDFD]/, - peg$c554 = { type: "class", value: "[\\uDDFD]", description: "[\\uDDFD]" }, - peg$c555 = /^[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F]/, - peg$c556 = { type: "class", value: "[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F]", description: "[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F]" }, - peg$c557 = /^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/, - peg$c558 = { type: "class", value: "[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]", description: "[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]" }, - peg$c559 = /^[\uDFCE-\uDFFF]/, - peg$c560 = { type: "class", value: "[\\uDFCE-\\uDFFF]", description: "[\\uDFCE-\\uDFFF]" }, - peg$c561 = /^[\uDC66-\uDC6F]/, - peg$c562 = { type: "class", value: "[\\uDC66-\\uDC6F]", description: "[\\uDC66-\\uDC6F]" }, - peg$c563 = /^[\uDCA0-\uDCA9]/, - peg$c564 = { type: "class", value: "[\\uDCA0-\\uDCA9]", description: "[\\uDCA0-\\uDCA9]" }, - peg$c565 = /^[_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F]/, - peg$c566 = { type: "class", value: "[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]", description: "[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]" }, - peg$c567 = "\u200C", - peg$c568 = { type: "literal", value: "\u200C", description: "\"\\u200C\"" }, - peg$c569 = "\u200D", - peg$c570 = { type: "literal", value: "\u200D", description: "\"\\u200D\"" }, + peg$c474 = /^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uFF21-\uFF3Aa-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D62-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\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\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7C\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2D00-\u2D25\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D61\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA717-\uA71F\uA770\uA788\uA9CF\uAA70\uAADD\uFF70\uFF9E\uFF9F\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BC0-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u2135-\u2138\u2D30-\u2D65\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400\u4DB5\u4E00\u9FCB\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/, + peg$c475 = { type: "class", value: "[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0531-\\u0556\\u10A0-\\u10C5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uFF21-\\uFF3Aa-z\\xAA\\xB5\\xBA\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D62-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\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\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7C\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2D00-\\u2D25\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D61\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA717-\\uA71F\\uA770\\uA788\\uA9CF\\uAA70\\uAADD\\uFF70\\uFF9E\\uFF9F\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u1100-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BC0-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u2135-\\u2138\\u2D30-\\u2D65\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FCB\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA2D\\uFA30-\\uFA6D\\uFA70-\\uFAD9\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF66-\\uFF6F\\uFF71-\\uFF9D\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]", description: "[A-Z\\xC0-\\xD6\\xD8-\\xDE\\u0100\\u0102\\u0104\\u0106\\u0108\\u010A\\u010C\\u010E\\u0110\\u0112\\u0114\\u0116\\u0118\\u011A\\u011C\\u011E\\u0120\\u0122\\u0124\\u0126\\u0128\\u012A\\u012C\\u012E\\u0130\\u0132\\u0134\\u0136\\u0139\\u013B\\u013D\\u013F\\u0141\\u0143\\u0145\\u0147\\u014A\\u014C\\u014E\\u0150\\u0152\\u0154\\u0156\\u0158\\u015A\\u015C\\u015E\\u0160\\u0162\\u0164\\u0166\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017B\\u017D\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018B\\u018E-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019C\\u019D\\u019F\\u01A0\\u01A2\\u01A4\\u01A6\\u01A7\\u01A9\\u01AC\\u01AE\\u01AF\\u01B1-\\u01B3\\u01B5\\u01B7\\u01B8\\u01BC\\u01C4\\u01C7\\u01CA\\u01CD\\u01CF\\u01D1\\u01D3\\u01D5\\u01D7\\u01D9\\u01DB\\u01DE\\u01E0\\u01E2\\u01E4\\u01E6\\u01E8\\u01EA\\u01EC\\u01EE\\u01F1\\u01F4\\u01F6-\\u01F8\\u01FA\\u01FC\\u01FE\\u0200\\u0202\\u0204\\u0206\\u0208\\u020A\\u020C\\u020E\\u0210\\u0212\\u0214\\u0216\\u0218\\u021A\\u021C\\u021E\\u0220\\u0222\\u0224\\u0226\\u0228\\u022A\\u022C\\u022E\\u0230\\u0232\\u023A\\u023B\\u023D\\u023E\\u0241\\u0243-\\u0246\\u0248\\u024A\\u024C\\u024E\\u0370\\u0372\\u0376\\u0386\\u0388-\\u038A\\u038C\\u038E\\u038F\\u0391-\\u03A1\\u03A3-\\u03AB\\u03CF\\u03D2-\\u03D4\\u03D8\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2\\u03E4\\u03E6\\u03E8\\u03EA\\u03EC\\u03EE\\u03F4\\u03F7\\u03F9\\u03FA\\u03FD-\\u042F\\u0460\\u0462\\u0464\\u0466\\u0468\\u046A\\u046C\\u046E\\u0470\\u0472\\u0474\\u0476\\u0478\\u047A\\u047C\\u047E\\u0480\\u048A\\u048C\\u048E\\u0490\\u0492\\u0494\\u0496\\u0498\\u049A\\u049C\\u049E\\u04A0\\u04A2\\u04A4\\u04A6\\u04A8\\u04AA\\u04AC\\u04AE\\u04B0\\u04B2\\u04B4\\u04B6\\u04B8\\u04BA\\u04BC\\u04BE\\u04C0\\u04C1\\u04C3\\u04C5\\u04C7\\u04C9\\u04CB\\u04CD\\u04D0\\u04D2\\u04D4\\u04D6\\u04D8\\u04DA\\u04DC\\u04DE\\u04E0\\u04E2\\u04E4\\u04E6\\u04E8\\u04EA\\u04EC\\u04EE\\u04F0\\u04F2\\u04F4\\u04F6\\u04F8\\u04FA\\u04FC\\u04FE\\u0500\\u0502\\u0504\\u0506\\u0508\\u050A\\u050C\\u050E\\u0510\\u0512\\u0514\\u0516\\u0518\\u051A\\u051C\\u051E\\u0520\\u0522\\u0524\\u0526\\u0531-\\u0556\\u10A0-\\u10C5\\u1E00\\u1E02\\u1E04\\u1E06\\u1E08\\u1E0A\\u1E0C\\u1E0E\\u1E10\\u1E12\\u1E14\\u1E16\\u1E18\\u1E1A\\u1E1C\\u1E1E\\u1E20\\u1E22\\u1E24\\u1E26\\u1E28\\u1E2A\\u1E2C\\u1E2E\\u1E30\\u1E32\\u1E34\\u1E36\\u1E38\\u1E3A\\u1E3C\\u1E3E\\u1E40\\u1E42\\u1E44\\u1E46\\u1E48\\u1E4A\\u1E4C\\u1E4E\\u1E50\\u1E52\\u1E54\\u1E56\\u1E58\\u1E5A\\u1E5C\\u1E5E\\u1E60\\u1E62\\u1E64\\u1E66\\u1E68\\u1E6A\\u1E6C\\u1E6E\\u1E70\\u1E72\\u1E74\\u1E76\\u1E78\\u1E7A\\u1E7C\\u1E7E\\u1E80\\u1E82\\u1E84\\u1E86\\u1E88\\u1E8A\\u1E8C\\u1E8E\\u1E90\\u1E92\\u1E94\\u1E9E\\u1EA0\\u1EA2\\u1EA4\\u1EA6\\u1EA8\\u1EAA\\u1EAC\\u1EAE\\u1EB0\\u1EB2\\u1EB4\\u1EB6\\u1EB8\\u1EBA\\u1EBC\\u1EBE\\u1EC0\\u1EC2\\u1EC4\\u1EC6\\u1EC8\\u1ECA\\u1ECC\\u1ECE\\u1ED0\\u1ED2\\u1ED4\\u1ED6\\u1ED8\\u1EDA\\u1EDC\\u1EDE\\u1EE0\\u1EE2\\u1EE4\\u1EE6\\u1EE8\\u1EEA\\u1EEC\\u1EEE\\u1EF0\\u1EF2\\u1EF4\\u1EF6\\u1EF8\\u1EFA\\u1EFC\\u1EFE\\u1F08-\\u1F0F\\u1F18-\\u1F1D\\u1F28-\\u1F2F\\u1F38-\\u1F3F\\u1F48-\\u1F4D\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F68-\\u1F6F\\u1FB8-\\u1FBB\\u1FC8-\\u1FCB\\u1FD8-\\u1FDB\\u1FE8-\\u1FEC\\u1FF8-\\u1FFB\\u2102\\u2107\\u210B-\\u210D\\u2110-\\u2112\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u2130-\\u2133\\u213E\\u213F\\u2145\\u2183\\u2C00-\\u2C2E\\u2C60\\u2C62-\\u2C64\\u2C67\\u2C69\\u2C6B\\u2C6D-\\u2C70\\u2C72\\u2C75\\u2C7E-\\u2C80\\u2C82\\u2C84\\u2C86\\u2C88\\u2C8A\\u2C8C\\u2C8E\\u2C90\\u2C92\\u2C94\\u2C96\\u2C98\\u2C9A\\u2C9C\\u2C9E\\u2CA0\\u2CA2\\u2CA4\\u2CA6\\u2CA8\\u2CAA\\u2CAC\\u2CAE\\u2CB0\\u2CB2\\u2CB4\\u2CB6\\u2CB8\\u2CBA\\u2CBC\\u2CBE\\u2CC0\\u2CC2\\u2CC4\\u2CC6\\u2CC8\\u2CCA\\u2CCC\\u2CCE\\u2CD0\\u2CD2\\u2CD4\\u2CD6\\u2CD8\\u2CDA\\u2CDC\\u2CDE\\u2CE0\\u2CE2\\u2CEB\\u2CED\\uA640\\uA642\\uA644\\uA646\\uA648\\uA64A\\uA64C\\uA64E\\uA650\\uA652\\uA654\\uA656\\uA658\\uA65A\\uA65C\\uA65E\\uA660\\uA662\\uA664\\uA666\\uA668\\uA66A\\uA66C\\uA680\\uA682\\uA684\\uA686\\uA688\\uA68A\\uA68C\\uA68E\\uA690\\uA692\\uA694\\uA696\\uA722\\uA724\\uA726\\uA728\\uA72A\\uA72C\\uA72E\\uA732\\uA734\\uA736\\uA738\\uA73A\\uA73C\\uA73E\\uA740\\uA742\\uA744\\uA746\\uA748\\uA74A\\uA74C\\uA74E\\uA750\\uA752\\uA754\\uA756\\uA758\\uA75A\\uA75C\\uA75E\\uA760\\uA762\\uA764\\uA766\\uA768\\uA76A\\uA76C\\uA76E\\uA779\\uA77B\\uA77D\\uA77E\\uA780\\uA782\\uA784\\uA786\\uA78B\\uA78D\\uA790\\uA7A0\\uA7A2\\uA7A4\\uA7A6\\uA7A8\\uFF21-\\uFF3Aa-z\\xAA\\xB5\\xBA\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F-\\u0293\\u0295-\\u02AF\\u0371\\u0373\\u0377\\u037B-\\u037D\\u0390\\u03AC-\\u03CE\\u03D0\\u03D1\\u03D5-\\u03D7\\u03D9\\u03DB\\u03DD\\u03DF\\u03E1\\u03E3\\u03E5\\u03E7\\u03E9\\u03EB\\u03ED\\u03EF-\\u03F3\\u03F5\\u03F8\\u03FB\\u03FC\\u0430-\\u045F\\u0461\\u0463\\u0465\\u0467\\u0469\\u046B\\u046D\\u046F\\u0471\\u0473\\u0475\\u0477\\u0479\\u047B\\u047D\\u047F\\u0481\\u048B\\u048D\\u048F\\u0491\\u0493\\u0495\\u0497\\u0499\\u049B\\u049D\\u049F\\u04A1\\u04A3\\u04A5\\u04A7\\u04A9\\u04AB\\u04AD\\u04AF\\u04B1\\u04B3\\u04B5\\u04B7\\u04B9\\u04BB\\u04BD\\u04BF\\u04C2\\u04C4\\u04C6\\u04C8\\u04CA\\u04CC\\u04CE\\u04CF\\u04D1\\u04D3\\u04D5\\u04D7\\u04D9\\u04DB\\u04DD\\u04DF\\u04E1\\u04E3\\u04E5\\u04E7\\u04E9\\u04EB\\u04ED\\u04EF\\u04F1\\u04F3\\u04F5\\u04F7\\u04F9\\u04FB\\u04FD\\u04FF\\u0501\\u0503\\u0505\\u0507\\u0509\\u050B\\u050D\\u050F\\u0511\\u0513\\u0515\\u0517\\u0519\\u051B\\u051D\\u051F\\u0521\\u0523\\u0525\\u0527\\u0561-\\u0587\\u1D00-\\u1D2B\\u1D62-\\u1D77\\u1D79-\\u1D9A\\u1E01\\u1E03\\u1E05\\u1E07\\u1E09\\u1E0B\\u1E0D\\u1E0F\\u1E11\\u1E13\\u1E15\\u1E17\\u1E19\\u1E1B\\u1E1D\\u1E1F\\u1E21\\u1E23\\u1E25\\u1E27\\u1E29\\u1E2B\\u1E2D\\u1E2F\\u1E31\\u1E33\\u1E35\\u1E37\\u1E39\\u1E3B\\u1E3D\\u1E3F\\u1E41\\u1E43\\u1E45\\u1E47\\u1E49\\u1E4B\\u1E4D\\u1E4F\\u1E51\\u1E53\\u1E55\\u1E57\\u1E59\\u1E5B\\u1E5D\\u1E5F\\u1E61\\u1E63\\u1E65\\u1E67\\u1E69\\u1E6B\\u1E6D\\u1E6F\\u1E71\\u1E73\\u1E75\\u1E77\\u1E79\\u1E7B\\u1E7D\\u1E7F\\u1E81\\u1E83\\u1E85\\u1E87\\u1E89\\u1E8B\\u1E8D\\u1E8F\\u1E91\\u1E93\\u1E95-\\u1E9D\\u1E9F\\u1EA1\\u1EA3\\u1EA5\\u1EA7\\u1EA9\\u1EAB\\u1EAD\\u1EAF\\u1EB1\\u1EB3\\u1EB5\\u1EB7\\u1EB9\\u1EBB\\u1EBD\\u1EBF\\u1EC1\\u1EC3\\u1EC5\\u1EC7\\u1EC9\\u1ECB\\u1ECD\\u1ECF\\u1ED1\\u1ED3\\u1ED5\\u1ED7\\u1ED9\\u1EDB\\u1EDD\\u1EDF\\u1EE1\\u1EE3\\u1EE5\\u1EE7\\u1EE9\\u1EEB\\u1EED\\u1EEF\\u1EF1\\u1EF3\\u1EF5\\u1EF7\\u1EF9\\u1EFB\\u1EFD\\u1EFF-\\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\\u1FC2-\\u1FC4\\u1FC6\\u1FC7\\u1FD0-\\u1FD3\\u1FD6\\u1FD7\\u1FE0-\\u1FE7\\u1FF2-\\u1FF4\\u1FF6\\u1FF7\\u210A\\u210E\\u210F\\u2113\\u212F\\u2134\\u2139\\u213C\\u213D\\u2146-\\u2149\\u214E\\u2184\\u2C30-\\u2C5E\\u2C61\\u2C65\\u2C66\\u2C68\\u2C6A\\u2C6C\\u2C71\\u2C73\\u2C74\\u2C76-\\u2C7C\\u2C81\\u2C83\\u2C85\\u2C87\\u2C89\\u2C8B\\u2C8D\\u2C8F\\u2C91\\u2C93\\u2C95\\u2C97\\u2C99\\u2C9B\\u2C9D\\u2C9F\\u2CA1\\u2CA3\\u2CA5\\u2CA7\\u2CA9\\u2CAB\\u2CAD\\u2CAF\\u2CB1\\u2CB3\\u2CB5\\u2CB7\\u2CB9\\u2CBB\\u2CBD\\u2CBF\\u2CC1\\u2CC3\\u2CC5\\u2CC7\\u2CC9\\u2CCB\\u2CCD\\u2CCF\\u2CD1\\u2CD3\\u2CD5\\u2CD7\\u2CD9\\u2CDB\\u2CDD\\u2CDF\\u2CE1\\u2CE3\\u2CE4\\u2CEC\\u2CEE\\u2D00-\\u2D25\\uA641\\uA643\\uA645\\uA647\\uA649\\uA64B\\uA64D\\uA64F\\uA651\\uA653\\uA655\\uA657\\uA659\\uA65B\\uA65D\\uA65F\\uA661\\uA663\\uA665\\uA667\\uA669\\uA66B\\uA66D\\uA681\\uA683\\uA685\\uA687\\uA689\\uA68B\\uA68D\\uA68F\\uA691\\uA693\\uA695\\uA697\\uA723\\uA725\\uA727\\uA729\\uA72B\\uA72D\\uA72F-\\uA731\\uA733\\uA735\\uA737\\uA739\\uA73B\\uA73D\\uA73F\\uA741\\uA743\\uA745\\uA747\\uA749\\uA74B\\uA74D\\uA74F\\uA751\\uA753\\uA755\\uA757\\uA759\\uA75B\\uA75D\\uA75F\\uA761\\uA763\\uA765\\uA767\\uA769\\uA76B\\uA76D\\uA76F\\uA771-\\uA778\\uA77A\\uA77C\\uA77F\\uA781\\uA783\\uA785\\uA787\\uA78C\\uA78E\\uA791\\uA7A1\\uA7A3\\uA7A5\\uA7A7\\uA7A9\\uA7FA\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF41-\\uFF5A\\u01C5\\u01C8\\u01CB\\u01F2\\u1F88-\\u1F8F\\u1F98-\\u1F9F\\u1FA8-\\u1FAF\\u1FBC\\u1FCC\\u1FFC\\u02B0-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0374\\u037A\\u0559\\u0640\\u06E5\\u06E6\\u07F4\\u07F5\\u07FA\\u081A\\u0824\\u0828\\u0971\\u0E46\\u0EC6\\u10FC\\u17D7\\u1843\\u1AA7\\u1C78-\\u1C7D\\u1D2C-\\u1D61\\u1D78\\u1D9B-\\u1DBF\\u2071\\u207F\\u2090-\\u209C\\u2C7D\\u2D6F\\u2E2F\\u3005\\u3031-\\u3035\\u303B\\u309D\\u309E\\u30FC-\\u30FE\\uA015\\uA4F8-\\uA4FD\\uA60C\\uA67F\\uA717-\\uA71F\\uA770\\uA788\\uA9CF\\uAA70\\uAADD\\uFF70\\uFF9E\\uFF9F\\u01BB\\u01C0-\\u01C3\\u0294\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u063F\\u0641-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u0800-\\u0815\\u0840-\\u0858\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0972-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10D0-\\u10FA\\u1100-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17DC\\u1820-\\u1842\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BC0-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C77\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u2135-\\u2138\\u2D30-\\u2D65\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3006\\u303C\\u3041-\\u3096\\u309F\\u30A1-\\u30FA\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FCB\\uA000-\\uA014\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA500-\\uA60B\\uA610-\\uA61F\\uA62A\\uA62B\\uA66E\\uA6A0-\\uA6E5\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA6F\\uAA71-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB\\uAADC\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA2D\\uFA30-\\uFA6D\\uFA70-\\uFAD9\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF66-\\uFF6F\\uFF71-\\uFF9D\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u16EE-\\u16F0\\u2160-\\u2182\\u2185-\\u2188\\u3007\\u3021-\\u3029\\u3038-\\u303A\\uA6E6-\\uA6EF]" }, + peg$c476 = "\uD82C", + peg$c477 = { type: "literal", value: "\uD82C", description: "\"\\uD82C\"" }, + peg$c478 = /^[\uDC00\uDC01]/, + peg$c479 = { type: "class", value: "[\\uDC00\\uDC01]", description: "[\\uDC00\\uDC01]" }, + peg$c480 = "\uD808", + peg$c481 = { type: "literal", value: "\uD808", description: "\"\\uD808\"" }, + peg$c482 = /^[\uDC00-\uDF6E]/, + peg$c483 = { type: "class", value: "[\\uDC00-\\uDF6E]", description: "[\\uDC00-\\uDF6E]" }, + peg$c484 = "\uD869", + peg$c485 = { type: "literal", value: "\uD869", description: "\"\\uD869\"" }, + peg$c486 = /^[\uDED6\uDF00]/, + peg$c487 = { type: "class", value: "[\\uDED6\\uDF00]", description: "[\\uDED6\\uDF00]" }, + peg$c488 = "\uD809", + peg$c489 = { type: "literal", value: "\uD809", description: "\"\\uD809\"" }, + peg$c490 = /^[\uDC00-\uDC62]/, + peg$c491 = { type: "class", value: "[\\uDC00-\\uDC62]", description: "[\\uDC00-\\uDC62]" }, + peg$c492 = "\uD835", + peg$c493 = { type: "literal", value: "\uD835", description: "\"\\uD835\"" }, + peg$c494 = /^[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]/, + peg$c495 = { type: "class", value: "[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]", description: "[\\uDC00-\\uDC19\\uDC34-\\uDC4D\\uDC68-\\uDC81\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB5\\uDCD0-\\uDCE9\\uDD04\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD38\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD6C-\\uDD85\\uDDA0-\\uDDB9\\uDDD4-\\uDDED\\uDE08-\\uDE21\\uDE3C-\\uDE55\\uDE70-\\uDE89\\uDEA8-\\uDEC0\\uDEE2-\\uDEFA\\uDF1C-\\uDF34\\uDF56-\\uDF6E\\uDF90-\\uDFA8\\uDFCA\\uDC1A-\\uDC33\\uDC4E-\\uDC54\\uDC56-\\uDC67\\uDC82-\\uDC9B\\uDCB6-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDCCF\\uDCEA-\\uDD03\\uDD1E-\\uDD37\\uDD52-\\uDD6B\\uDD86-\\uDD9F\\uDDBA-\\uDDD3\\uDDEE-\\uDE07\\uDE22-\\uDE3B\\uDE56-\\uDE6F\\uDE8A-\\uDEA5\\uDEC2-\\uDEDA\\uDEDC-\\uDEE1\\uDEFC-\\uDF14\\uDF16-\\uDF1B\\uDF36-\\uDF4E\\uDF50-\\uDF55\\uDF70-\\uDF88\\uDF8A-\\uDF8F\\uDFAA-\\uDFC2\\uDFC4-\\uDFC9\\uDFCB]" }, + peg$c496 = "\uD804", + peg$c497 = { type: "literal", value: "\uD804", description: "\"\\uD804\"" }, + peg$c498 = /^[\uDC03-\uDC37\uDC83-\uDCAF]/, + peg$c499 = { type: "class", value: "[\\uDC03-\\uDC37\\uDC83-\\uDCAF]", description: "[\\uDC03-\\uDC37\\uDC83-\\uDCAF]" }, + peg$c500 = "\uD800", + peg$c501 = { type: "literal", value: "\uD800", description: "\"\\uD800\"" }, + peg$c502 = /^[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1E\uDF30-\uDF40\uDF42-\uDF49\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]/, + peg$c503 = { type: "class", value: "[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1E\\uDF30-\\uDF40\\uDF42-\\uDF49\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]", description: "[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1E\\uDF30-\\uDF40\\uDF42-\\uDF49\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDD40-\\uDD74\\uDF41\\uDF4A\\uDFD1-\\uDFD5]" }, + peg$c504 = "\uD80C", + peg$c505 = { type: "literal", value: "\uD80C", description: "\"\\uD80C\"" }, + peg$c506 = /^[\uDC00-\uDFFF]/, + peg$c507 = { type: "class", value: "[\\uDC00-\\uDFFF]", description: "[\\uDC00-\\uDFFF]" }, + peg$c508 = "\uD801", + peg$c509 = { type: "literal", value: "\uD801", description: "\"\\uD801\"" }, + peg$c510 = /^[\uDC00-\uDC9D]/, + peg$c511 = { type: "class", value: "[\\uDC00-\\uDC9D]", description: "[\\uDC00-\\uDC9D]" }, + peg$c512 = "\uD86E", + peg$c513 = { type: "literal", value: "\uD86E", description: "\"\\uD86E\"" }, + peg$c514 = /^[\uDC1D]/, + peg$c515 = { type: "class", value: "[\\uDC1D]", description: "[\\uDC1D]" }, + peg$c516 = "\uD803", + peg$c517 = { type: "literal", value: "\uD803", description: "\"\\uD803\"" }, + peg$c518 = /^[\uDC00-\uDC48]/, + peg$c519 = { type: "class", value: "[\\uDC00-\\uDC48]", description: "[\\uDC00-\\uDC48]" }, + peg$c520 = "\uD840", + peg$c521 = { type: "literal", value: "\uD840", description: "\"\\uD840\"" }, + peg$c522 = /^[\uDC00]/, + peg$c523 = { type: "class", value: "[\\uDC00]", description: "[\\uDC00]" }, + peg$c524 = "\uD87E", + peg$c525 = { type: "literal", value: "\uD87E", description: "\"\\uD87E\"" }, + peg$c526 = /^[\uDC00-\uDE1D]/, + peg$c527 = { type: "class", value: "[\\uDC00-\\uDE1D]", description: "[\\uDC00-\\uDE1D]" }, + peg$c528 = "\uD86D", + peg$c529 = { type: "literal", value: "\uD86D", description: "\"\\uD86D\"" }, + peg$c530 = /^[\uDF34\uDF40]/, + peg$c531 = { type: "class", value: "[\\uDF34\\uDF40]", description: "[\\uDF34\\uDF40]" }, + peg$c532 = "\uD81A", + peg$c533 = { type: "literal", value: "\uD81A", description: "\"\\uD81A\"" }, + peg$c534 = /^[\uDC00-\uDE38]/, + peg$c535 = { type: "class", value: "[\\uDC00-\\uDE38]", description: "[\\uDC00-\\uDE38]" }, + peg$c536 = "\uD802", + peg$c537 = { type: "literal", value: "\uD802", description: "\"\\uD802\"" }, + peg$c538 = /^[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDD00-\uDD15\uDD20-\uDD39\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72]/, + peg$c539 = { type: "class", value: "[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72]", description: "[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72]" }, + peg$c540 = "\uD80D", + peg$c541 = { type: "literal", value: "\uD80D", description: "\"\\uD80D\"" }, + peg$c542 = /^[\uDC00-\uDC2E]/, + peg$c543 = { type: "class", value: "[\\uDC00-\\uDC2E]", description: "[\\uDC00-\\uDC2E]" }, + peg$c544 = /^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0900-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F\uA67C\uA67D\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u19B0-\u19C0\u19C8\u19C9\u1A19-\u1A1B\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF2\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BD-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]/, + peg$c545 = { type: "class", value: "[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0900-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFC-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]", description: "[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0900-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFC-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]" }, + peg$c546 = "\uDB40", + peg$c547 = { type: "literal", value: "\uDB40", description: "\"\\uDB40\"" }, + peg$c548 = /^[\uDD00-\uDDEF]/, + peg$c549 = { type: "class", value: "[\\uDD00-\\uDDEF]", description: "[\\uDD00-\\uDDEF]" }, + peg$c550 = "\uD834", + peg$c551 = { type: "literal", value: "\uD834", description: "\"\\uD834\"" }, + peg$c552 = /^[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44\uDD65\uDD66\uDD6D-\uDD72]/, + peg$c553 = { type: "class", value: "[\\uDD67-\\uDD69\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44\\uDD65\\uDD66\\uDD6D-\\uDD72]", description: "[\\uDD67-\\uDD69\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44\\uDD65\\uDD66\\uDD6D-\\uDD72]" }, + peg$c554 = /^[\uDC01\uDC38-\uDC46\uDC80\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8]/, + peg$c555 = { type: "class", value: "[\\uDC01\\uDC38-\\uDC46\\uDC80\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8]", description: "[\\uDC01\\uDC38-\\uDC46\\uDC80\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8]" }, + peg$c556 = /^[\uDDFD]/, + peg$c557 = { type: "class", value: "[\\uDDFD]", description: "[\\uDDFD]" }, + peg$c558 = /^[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F]/, + peg$c559 = { type: "class", value: "[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F]", description: "[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F]" }, + peg$c560 = /^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/, + peg$c561 = { type: "class", value: "[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]", description: "[0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]" }, + peg$c562 = /^[\uDFCE-\uDFFF]/, + peg$c563 = { type: "class", value: "[\\uDFCE-\\uDFFF]", description: "[\\uDFCE-\\uDFFF]" }, + peg$c564 = /^[\uDC66-\uDC6F]/, + peg$c565 = { type: "class", value: "[\\uDC66-\\uDC6F]", description: "[\\uDC66-\\uDC6F]" }, + peg$c566 = /^[\uDCA0-\uDCA9]/, + peg$c567 = { type: "class", value: "[\\uDCA0-\\uDCA9]", description: "[\\uDCA0-\\uDCA9]" }, + peg$c568 = /^[_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F]/, + peg$c569 = { type: "class", value: "[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]", description: "[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]" }, + peg$c570 = "\u200C", + peg$c571 = { type: "literal", value: "\u200C", description: "\"\\u200C\"" }, + peg$c572 = "\u200D", + peg$c573 = { type: "literal", value: "\u200D", description: "\"\\u200D\"" }, peg$currPos = 0, peg$reportedPos = 0, @@ -11061,6 +11073,21 @@ module.exports = (function() { s1 = peg$c203(); } s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 14) === peg$c204) { + s1 = peg$c204; + peg$currPos += 14; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c205); } + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c206(); + } + s0 = s1; + } } } } @@ -11093,7 +11120,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c204(); + s1 = peg$c207(); } s0 = s1; if (s0 === peg$FAILED) { @@ -11107,7 +11134,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c205(); + s1 = peg$c208(); } s0 = s1; } @@ -11129,12 +11156,12 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c206) { - s1 = peg$c206; + if (input.substr(peg$currPos, 2) === peg$c209) { + s1 = peg$c209; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c207); } + if (peg$silentFails === 0) { peg$fail(peg$c210); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -11154,7 +11181,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c208(s2); + s1 = peg$c211(s2); s0 = s1; } else { peg$currPos = s0; @@ -11166,12 +11193,12 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c209) { - s1 = peg$c209; + if (input.substr(peg$currPos, 2) === peg$c212) { + s1 = peg$c212; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c210); } + if (peg$silentFails === 0) { peg$fail(peg$c213); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -11191,7 +11218,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c211(s2); + s1 = peg$c214(s2); s0 = s1; } else { peg$currPos = s0; @@ -11203,12 +11230,12 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c212) { - s1 = peg$c212; + if (input.substr(peg$currPos, 2) === peg$c215) { + s1 = peg$c215; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c213); } + if (peg$silentFails === 0) { peg$fail(peg$c216); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -11228,7 +11255,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c214(s2); + s1 = peg$c217(s2); s0 = s1; } else { peg$currPos = s0; @@ -11242,20 +11269,20 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$parsedecimal(); if (s1 !== peg$FAILED) { - if (peg$c215.test(input.charAt(peg$currPos))) { + if (peg$c218.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c216); } + if (peg$silentFails === 0) { peg$fail(peg$c219); } } if (s2 !== peg$FAILED) { - if (peg$c217.test(input.charAt(peg$currPos))) { + if (peg$c220.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c218); } + if (peg$silentFails === 0) { peg$fail(peg$c221); } } if (s3 === peg$FAILED) { s3 = peg$c1; @@ -11264,7 +11291,7 @@ module.exports = (function() { s4 = peg$parsedecimal(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c219(s1, s2, s3, s4); + s1 = peg$c222(s1, s2, s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -11348,7 +11375,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c220(s1, s2); + s1 = peg$c223(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -11376,21 +11403,21 @@ module.exports = (function() { } if (input.charCodeAt(peg$currPos) === 48) { - s0 = peg$c221; + s0 = peg$c224; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c222); } + if (peg$silentFails === 0) { peg$fail(peg$c225); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$currPos; - if (peg$c223.test(input.charAt(peg$currPos))) { + if (peg$c226.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c224); } + if (peg$silentFails === 0) { peg$fail(peg$c227); } } if (s2 !== peg$FAILED) { s3 = []; @@ -11432,12 +11459,12 @@ module.exports = (function() { return cached.result; } - if (peg$c225.test(input.charAt(peg$currPos))) { + if (peg$c228.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c226); } + if (peg$silentFails === 0) { peg$fail(peg$c229); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -11456,12 +11483,12 @@ module.exports = (function() { return cached.result; } - if (peg$c227.test(input.charAt(peg$currPos))) { + if (peg$c230.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c228); } + if (peg$silentFails === 0) { peg$fail(peg$c231); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -11480,12 +11507,12 @@ module.exports = (function() { return cached.result; } - if (peg$c229.test(input.charAt(peg$currPos))) { + if (peg$c232.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c230); } + if (peg$silentFails === 0) { peg$fail(peg$c233); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -11504,12 +11531,12 @@ module.exports = (function() { return cached.result; } - if (peg$c231.test(input.charAt(peg$currPos))) { + if (peg$c234.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c232); } + if (peg$silentFails === 0) { peg$fail(peg$c235); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -11529,41 +11556,41 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c233) { - s1 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c236) { + s1 = peg$c236; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s5 = peg$c237; + s5 = peg$c240; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c237; + s6 = peg$c240; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s6 === peg$FAILED) { s6 = peg$c1; @@ -11572,11 +11599,11 @@ module.exports = (function() { s7 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s8 === peg$FAILED) { @@ -11612,29 +11639,29 @@ module.exports = (function() { s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s5 = peg$c237; + s5 = peg$c240; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c237; + s6 = peg$c240; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s6 === peg$FAILED) { s6 = peg$c1; @@ -11643,11 +11670,11 @@ module.exports = (function() { s7 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s8 === peg$FAILED) { @@ -11682,16 +11709,16 @@ module.exports = (function() { s2 = peg$c0; } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c233) { - s3 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c236) { + s3 = peg$c236; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c239(s2); + s1 = peg$c242(s2); s0 = s1; } else { peg$currPos = s0; @@ -11707,49 +11734,49 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c240) { - s1 = peg$c240; + if (input.substr(peg$currPos, 3) === peg$c243) { + s1 = peg$c243; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c241); } + if (peg$silentFails === 0) { peg$fail(peg$c244); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s3 = peg$c242; + s3 = peg$c245; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s6 = peg$c235; + s6 = peg$c238; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s6 === peg$FAILED) { s6 = peg$c1; @@ -11758,11 +11785,11 @@ module.exports = (function() { s7 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s8 = peg$c235; + s8 = peg$c238; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } peg$silentFails--; if (s8 === peg$FAILED) { @@ -11799,37 +11826,37 @@ module.exports = (function() { s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s3 = peg$c242; + s3 = peg$c245; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s6 = peg$c235; + s6 = peg$c238; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s6 === peg$FAILED) { s6 = peg$c1; @@ -11838,11 +11865,11 @@ module.exports = (function() { s7 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s8 = peg$c235; + s8 = peg$c238; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } peg$silentFails--; if (s8 === peg$FAILED) { @@ -11878,16 +11905,16 @@ module.exports = (function() { s2 = peg$c0; } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c240) { - s3 = peg$c240; + if (input.substr(peg$currPos, 3) === peg$c243) { + s3 = peg$c243; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c241); } + if (peg$silentFails === 0) { peg$fail(peg$c244); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c239(s2); + s1 = peg$c242(s2); s0 = s1; } else { peg$currPos = s0; @@ -11904,22 +11931,22 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c237; + s1 = peg$c240; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } while (s3 !== peg$FAILED) { @@ -11927,25 +11954,25 @@ module.exports = (function() { s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c244(s2); + s1 = peg$c247(s2); s0 = s1; } else { peg$currPos = s0; @@ -11962,30 +11989,30 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c235; + s1 = peg$c238; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s3 = peg$c242; + s3 = peg$c245; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } } } @@ -11994,34 +12021,34 @@ module.exports = (function() { s3 = peg$parsestringData(); if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s3 = peg$c242; + s3 = peg$c245; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } } } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c235; + s3 = peg$c238; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c244(s2); + s1 = peg$c247(s2); s0 = s1; } else { peg$currPos = s0; @@ -12055,23 +12082,23 @@ module.exports = (function() { return cached.result; } - if (peg$c245.test(input.charAt(peg$currPos))) { + if (peg$c248.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c246); } + if (peg$silentFails === 0) { peg$fail(peg$c249); } } if (s0 === peg$FAILED) { s0 = peg$parseUnicodeEscapeSequence(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c247) { - s1 = peg$c247; + if (input.substr(peg$currPos, 2) === peg$c250) { + s1 = peg$c250; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c248); } + if (peg$silentFails === 0) { peg$fail(peg$c251); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -12096,7 +12123,7 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c249(s2); + s1 = peg$c252(s2); s0 = s1; } else { peg$currPos = s0; @@ -12108,12 +12135,12 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c250) { - s1 = peg$c250; + if (input.substr(peg$currPos, 2) === peg$c253) { + s1 = peg$c253; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c251); } + if (peg$silentFails === 0) { peg$fail(peg$c254); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -12128,7 +12155,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c252(); + s1 = peg$c255(); s0 = s1; } else { peg$currPos = s0; @@ -12140,12 +12167,12 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c250) { - s1 = peg$c250; + if (input.substr(peg$currPos, 2) === peg$c253) { + s1 = peg$c253; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c251); } + if (peg$silentFails === 0) { peg$fail(peg$c254); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -12160,7 +12187,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c253(); + s1 = peg$c256(); s0 = s1; } else { peg$currPos = s0; @@ -12172,96 +12199,96 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c254) { - s1 = peg$c254; + if (input.substr(peg$currPos, 2) === peg$c257) { + s1 = peg$c257; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c255); } + if (peg$silentFails === 0) { peg$fail(peg$c258); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c256(); + s1 = peg$c259(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c257) { - s1 = peg$c257; + if (input.substr(peg$currPos, 2) === peg$c260) { + s1 = peg$c260; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c258); } + if (peg$silentFails === 0) { peg$fail(peg$c261); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c259(); + s1 = peg$c262(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c260) { - s1 = peg$c260; + if (input.substr(peg$currPos, 2) === peg$c263) { + s1 = peg$c263; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c261); } + if (peg$silentFails === 0) { peg$fail(peg$c264); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c262(); + s1 = peg$c265(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c263) { - s1 = peg$c263; + if (input.substr(peg$currPos, 2) === peg$c266) { + s1 = peg$c266; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c264); } + if (peg$silentFails === 0) { peg$fail(peg$c267); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c265(); + s1 = peg$c268(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c266) { - s1 = peg$c266; + if (input.substr(peg$currPos, 2) === peg$c269) { + s1 = peg$c269; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c267); } + if (peg$silentFails === 0) { peg$fail(peg$c270); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c268(); + s1 = peg$c271(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c269) { - s1 = peg$c269; + if (input.substr(peg$currPos, 2) === peg$c272) { + s1 = peg$c272; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c270); } + if (peg$silentFails === 0) { peg$fail(peg$c273); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c271(); + s1 = peg$c274(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c272; + s1 = peg$c275; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c273); } + if (peg$silentFails === 0) { peg$fail(peg$c276); } } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -12269,7 +12296,7 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c274); } + if (peg$silentFails === 0) { peg$fail(peg$c277); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; @@ -12286,11 +12313,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c242; + s1 = peg$c245; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -12351,12 +12378,12 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c233) { - s1 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c236) { + s1 = peg$c236; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s1 !== peg$FAILED) { s2 = []; @@ -12365,29 +12392,29 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 === peg$FAILED) { s5 = peg$currPos; s6 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s7 = peg$c237; + s7 = peg$c240; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s8 === peg$FAILED) { s8 = peg$c1; @@ -12396,11 +12423,11 @@ module.exports = (function() { s9 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s10 = peg$c237; + s10 = peg$c240; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s10 === peg$FAILED) { @@ -12436,29 +12463,29 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 === peg$FAILED) { s5 = peg$currPos; s6 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s7 = peg$c237; + s7 = peg$c240; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s8 === peg$FAILED) { s8 = peg$c1; @@ -12467,11 +12494,11 @@ module.exports = (function() { s9 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s10 = peg$c237; + s10 = peg$c240; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s10 === peg$FAILED) { @@ -12507,17 +12534,17 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c244(s4); + s4 = peg$c247(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c275) { - s4 = peg$c275; + if (input.substr(peg$currPos, 2) === peg$c278) { + s4 = peg$c278; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c276); } + if (peg$silentFails === 0) { peg$fail(peg$c279); } } if (s4 !== peg$FAILED) { s5 = peg$parse_(); @@ -12566,29 +12593,29 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 === peg$FAILED) { s5 = peg$currPos; s6 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s7 = peg$c237; + s7 = peg$c240; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s8 === peg$FAILED) { s8 = peg$c1; @@ -12597,11 +12624,11 @@ module.exports = (function() { s9 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s10 = peg$c237; + s10 = peg$c240; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s10 === peg$FAILED) { @@ -12637,29 +12664,29 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } if (s5 === peg$FAILED) { s5 = peg$currPos; s6 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s7 = peg$c237; + s7 = peg$c240; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s8 = peg$c237; + s8 = peg$c240; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s8 === peg$FAILED) { s8 = peg$c1; @@ -12668,11 +12695,11 @@ module.exports = (function() { s9 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 34) { - s10 = peg$c237; + s10 = peg$c240; peg$currPos++; } else { s10 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } peg$silentFails--; if (s10 === peg$FAILED) { @@ -12708,17 +12735,17 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c244(s4); + s4 = peg$c247(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c275) { - s4 = peg$c275; + if (input.substr(peg$currPos, 2) === peg$c278) { + s4 = peg$c278; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c276); } + if (peg$silentFails === 0) { peg$fail(peg$c279); } } if (s4 !== peg$FAILED) { s5 = peg$parse_(); @@ -12764,16 +12791,16 @@ module.exports = (function() { s2 = peg$c0; } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c233) { - s3 = peg$c233; + if (input.substr(peg$currPos, 3) === peg$c236) { + s3 = peg$c236; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c234); } + if (peg$silentFails === 0) { peg$fail(peg$c237); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c277(s2); + s1 = peg$c280(s2); s0 = s1; } else { peg$currPos = s0; @@ -12790,11 +12817,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c237; + s1 = peg$c240; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s1 !== peg$FAILED) { s2 = []; @@ -12803,11 +12830,11 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } if (s5 !== peg$FAILED) { @@ -12816,11 +12843,11 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } } @@ -12829,17 +12856,17 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c244(s4); + s4 = peg$c247(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c275) { - s4 = peg$c275; + if (input.substr(peg$currPos, 2) === peg$c278) { + s4 = peg$c278; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c276); } + if (peg$silentFails === 0) { peg$fail(peg$c279); } } if (s4 !== peg$FAILED) { s5 = peg$parse_(); @@ -12888,11 +12915,11 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } if (s5 !== peg$FAILED) { @@ -12901,11 +12928,11 @@ module.exports = (function() { s5 = peg$parsestringData(); if (s5 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s5 = peg$c235; + s5 = peg$c238; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c236); } + if (peg$silentFails === 0) { peg$fail(peg$c239); } } } } @@ -12914,17 +12941,17 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c244(s4); + s4 = peg$c247(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c275) { - s4 = peg$c275; + if (input.substr(peg$currPos, 2) === peg$c278) { + s4 = peg$c278; peg$currPos += 2; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c276); } + if (peg$silentFails === 0) { peg$fail(peg$c279); } } if (s4 !== peg$FAILED) { s5 = peg$parse_(); @@ -12971,15 +12998,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c237; + s3 = peg$c240; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c238); } + if (peg$silentFails === 0) { peg$fail(peg$c241); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c278(s2); + s1 = peg$c281(s2); s0 = s1; } else { peg$currPos = s0; @@ -13012,33 +13039,33 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c279) { - s1 = peg$c279; + if (input.substr(peg$currPos, 3) === peg$c282) { + s1 = peg$c282; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c280); } + if (peg$silentFails === 0) { peg$fail(peg$c283); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = []; - if (peg$c281.test(input.charAt(peg$currPos))) { + if (peg$c284.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c282); } + if (peg$silentFails === 0) { peg$fail(peg$c285); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c281.test(input.charAt(peg$currPos))) { + if (peg$c284.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c282); } + if (peg$silentFails === 0) { peg$fail(peg$c285); } } } } else { @@ -13046,29 +13073,29 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c283(); + s4 = peg$c286(); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; s5 = []; - if (peg$c284.test(input.charAt(peg$currPos))) { + if (peg$c287.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c285); } + if (peg$silentFails === 0) { peg$fail(peg$c288); } } if (s6 !== peg$FAILED) { while (s6 !== peg$FAILED) { s5.push(s6); - if (peg$c284.test(input.charAt(peg$currPos))) { + if (peg$c287.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c285); } + if (peg$silentFails === 0) { peg$fail(peg$c288); } } } } else { @@ -13080,7 +13107,7 @@ module.exports = (function() { s4 = s5; if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c286(s4); + s4 = peg$c289(s4); } s3 = s4; if (s3 === peg$FAILED) { @@ -13092,22 +13119,22 @@ module.exports = (function() { s2.push(s3); s3 = peg$currPos; s4 = []; - if (peg$c281.test(input.charAt(peg$currPos))) { + if (peg$c284.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c282); } + if (peg$silentFails === 0) { peg$fail(peg$c285); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c281.test(input.charAt(peg$currPos))) { + if (peg$c284.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c282); } + if (peg$silentFails === 0) { peg$fail(peg$c285); } } } } else { @@ -13115,29 +13142,29 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c283(); + s4 = peg$c286(); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$currPos; s5 = []; - if (peg$c284.test(input.charAt(peg$currPos))) { + if (peg$c287.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c285); } + if (peg$silentFails === 0) { peg$fail(peg$c288); } } if (s6 !== peg$FAILED) { while (s6 !== peg$FAILED) { s5.push(s6); - if (peg$c284.test(input.charAt(peg$currPos))) { + if (peg$c287.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c285); } + if (peg$silentFails === 0) { peg$fail(peg$c288); } } } } else { @@ -13149,7 +13176,7 @@ module.exports = (function() { s4 = s5; if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c286(s4); + s4 = peg$c289(s4); } s3 = s4; if (s3 === peg$FAILED) { @@ -13161,35 +13188,35 @@ module.exports = (function() { s2 = peg$c0; } if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c279) { - s3 = peg$c279; + if (input.substr(peg$currPos, 3) === peg$c282) { + s3 = peg$c282; peg$currPos += 3; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c280); } + if (peg$silentFails === 0) { peg$fail(peg$c283); } } if (s3 !== peg$FAILED) { s4 = []; - if (peg$c287.test(input.charAt(peg$currPos))) { + if (peg$c290.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c288); } + if (peg$silentFails === 0) { peg$fail(peg$c291); } } while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c287.test(input.charAt(peg$currPos))) { + if (peg$c290.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c288); } + if (peg$silentFails === 0) { peg$fail(peg$c291); } } } if (s4 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c289(s2, s4); + s1 = peg$c292(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -13210,11 +13237,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { - s1 = peg$c290; + s1 = peg$c293; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c291); } + if (peg$silentFails === 0) { peg$fail(peg$c294); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -13222,22 +13249,22 @@ module.exports = (function() { s4 = peg$parseregexpData(); if (s4 === peg$FAILED) { s4 = []; - if (peg$c292.test(input.charAt(peg$currPos))) { + if (peg$c295.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c293); } + if (peg$silentFails === 0) { peg$fail(peg$c296); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c292.test(input.charAt(peg$currPos))) { + if (peg$c295.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c293); } + if (peg$silentFails === 0) { peg$fail(peg$c296); } } } } else { @@ -13249,22 +13276,22 @@ module.exports = (function() { s4 = peg$parseregexpData(); if (s4 === peg$FAILED) { s4 = []; - if (peg$c292.test(input.charAt(peg$currPos))) { + if (peg$c295.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c293); } + if (peg$silentFails === 0) { peg$fail(peg$c296); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c292.test(input.charAt(peg$currPos))) { + if (peg$c295.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c293); } + if (peg$silentFails === 0) { peg$fail(peg$c296); } } } } else { @@ -13278,34 +13305,34 @@ module.exports = (function() { s2 = s3; if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 47) { - s3 = peg$c290; + s3 = peg$c293; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c291); } + if (peg$silentFails === 0) { peg$fail(peg$c294); } } if (s3 !== peg$FAILED) { s4 = []; - if (peg$c287.test(input.charAt(peg$currPos))) { + if (peg$c290.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c288); } + if (peg$silentFails === 0) { peg$fail(peg$c291); } } while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c287.test(input.charAt(peg$currPos))) { + if (peg$c290.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c288); } + if (peg$silentFails === 0) { peg$fail(peg$c291); } } } if (s4 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c294(s2, s4); + s1 = peg$c297(s2, s4); s0 = s1; } else { peg$currPos = s0; @@ -13351,24 +13378,24 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c295.test(input.charAt(peg$currPos))) { + if (peg$c298.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c296); } + if (peg$silentFails === 0) { peg$fail(peg$c299); } } if (s3 === peg$FAILED) { s3 = peg$parseregexpData(); } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c295.test(input.charAt(peg$currPos))) { + if (peg$c298.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c296); } + if (peg$silentFails === 0) { peg$fail(peg$c299); } } if (s3 === peg$FAILED) { s3 = peg$parseregexpData(); @@ -13400,11 +13427,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c272; + s1 = peg$c275; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c273); } + if (peg$silentFails === 0) { peg$fail(peg$c276); } } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -13412,7 +13439,7 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c274); } + if (peg$silentFails === 0) { peg$fail(peg$c277); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -13457,21 +13484,21 @@ module.exports = (function() { s4 = peg$parsehereregexpData(); if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c297(s4); + s4 = peg$c300(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (peg$c298.test(input.charAt(peg$currPos))) { + if (peg$c301.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c299); } + if (peg$silentFails === 0) { peg$fail(peg$c302); } } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c300(s4); + s4 = peg$c303(s4); } s3 = s4; } @@ -13481,21 +13508,21 @@ module.exports = (function() { s4 = peg$parsehereregexpData(); if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c297(s4); + s4 = peg$c300(s4); } s3 = s4; if (s3 === peg$FAILED) { s3 = peg$currPos; - if (peg$c298.test(input.charAt(peg$currPos))) { + if (peg$c301.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c299); } + if (peg$silentFails === 0) { peg$fail(peg$c302); } } if (s4 !== peg$FAILED) { peg$reportedPos = s3; - s4 = peg$c300(s4); + s4 = peg$c303(s4); } s3 = s4; } @@ -13510,7 +13537,7 @@ module.exports = (function() { } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c301(s2); + s1 = peg$c304(s2); s0 = s1; } else { peg$currPos = s0; @@ -13529,11 +13556,11 @@ module.exports = (function() { s1 = peg$currPos; s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s3 = peg$c272; + s3 = peg$c275; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c273); } + if (peg$silentFails === 0) { peg$fail(peg$c276); } } if (s3 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -13541,7 +13568,7 @@ module.exports = (function() { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c274); } + if (peg$silentFails === 0) { peg$fail(peg$c277); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; @@ -13560,7 +13587,7 @@ module.exports = (function() { s1 = s2; if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c302(s1); + s1 = peg$c305(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -13568,19 +13595,19 @@ module.exports = (function() { s1 = peg$currPos; s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { - s3 = peg$c290; + s3 = peg$c293; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c291); } + if (peg$silentFails === 0) { peg$fail(peg$c294); } } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 47) { - s4 = peg$c290; + s4 = peg$c293; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c291); } + if (peg$silentFails === 0) { peg$fail(peg$c294); } } if (s4 === peg$FAILED) { s4 = peg$c1; @@ -13589,11 +13616,11 @@ module.exports = (function() { s5 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 47) { - s6 = peg$c290; + s6 = peg$c293; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c291); } + if (peg$silentFails === 0) { peg$fail(peg$c294); } } peg$silentFails--; if (s6 === peg$FAILED) { @@ -13623,17 +13650,17 @@ module.exports = (function() { s1 = s2; if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c303(s1); + s1 = peg$c306(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c242; + s1 = peg$c245; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -13654,7 +13681,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c304(s1); + s1 = peg$c307(s1); s0 = s1; } else { peg$currPos = s0; @@ -13666,12 +13693,12 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c275) { - s1 = peg$c275; + if (input.substr(peg$currPos, 2) === peg$c278) { + s1 = peg$c278; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c276); } + if (peg$silentFails === 0) { peg$fail(peg$c279); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); @@ -13689,7 +13716,7 @@ module.exports = (function() { } if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c305(s3); + s1 = peg$c308(s3); s0 = s1; } else { peg$currPos = s0; @@ -13740,7 +13767,7 @@ module.exports = (function() { s3 = peg$parsesecondaryExpression(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c306(s3); + s1 = peg$c309(s3); s0 = s1; } else { peg$currPos = s0; @@ -13782,7 +13809,7 @@ module.exports = (function() { } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c307(s3); + s1 = peg$c310(s3); s0 = s1; } else { peg$currPos = s0; @@ -13817,7 +13844,7 @@ module.exports = (function() { s1 = peg$parseCONTINUE(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c308(); + s1 = peg$c311(); } s0 = s1; @@ -13841,7 +13868,7 @@ module.exports = (function() { s1 = peg$parseBREAK(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c309(); + s1 = peg$c312(); } s0 = s1; @@ -13865,7 +13892,7 @@ module.exports = (function() { s1 = peg$parseDEBUGGER(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c310(); + s1 = peg$c313(); } s0 = s1; @@ -13889,7 +13916,7 @@ module.exports = (function() { s1 = peg$parseUNDEFINED(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c311(); + s1 = peg$c314(); } s0 = s1; @@ -13913,7 +13940,7 @@ module.exports = (function() { s1 = peg$parseNULL(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c312(); + s1 = peg$c315(); } s0 = s1; @@ -13934,20 +13961,20 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c313) { - s1 = peg$c313; + if (input.substr(peg$currPos, 9) === peg$c316) { + s1 = peg$c316; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c314); } + if (peg$silentFails === 0) { peg$fail(peg$c317); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c315) { - s1 = peg$c315; + if (input.substr(peg$currPos, 4) === peg$c318) { + s1 = peg$c318; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c316); } + if (peg$silentFails === 0) { peg$fail(peg$c319); } } } if (s1 !== peg$FAILED) { @@ -14006,7 +14033,7 @@ module.exports = (function() { s2 = peg$parseidentifier(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c317(s2); + s1 = peg$c320(s2); s0 = s1; } else { peg$currPos = s0; @@ -14051,7 +14078,7 @@ module.exports = (function() { s2 = peg$parseidentifier(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c317(s2); + s1 = peg$c320(s2); s0 = s1; } else { peg$currPos = s0; @@ -14653,7 +14680,7 @@ module.exports = (function() { s1 = peg$parsecontextVar(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c318(s1); + s1 = peg$c321(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -14672,7 +14699,7 @@ module.exports = (function() { s2 = peg$parseidentifier(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c319(s2); + s1 = peg$c322(s2); s0 = s1; } else { peg$currPos = s0; @@ -14787,12 +14814,12 @@ module.exports = (function() { s0 = peg$parseUnicodeLetter(); if (s0 === peg$FAILED) { - if (peg$c320.test(input.charAt(peg$currPos))) { + if (peg$c323.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c321); } + if (peg$silentFails === 0) { peg$fail(peg$c324); } } if (s0 === peg$FAILED) { s0 = peg$parseUnicodeEscapeSequence(); @@ -14965,11 +14992,11 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s2 = peg$c242; + s2 = peg$c245; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s2 !== peg$FAILED) { s3 = []; @@ -14990,7 +15017,7 @@ module.exports = (function() { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c274); } + if (peg$silentFails === 0) { peg$fail(peg$c277); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; @@ -15022,7 +15049,7 @@ module.exports = (function() { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c274); } + if (peg$silentFails === 0) { peg$fail(peg$c277); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; @@ -15070,46 +15097,46 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c322) { - s2 = peg$c322; + if (input.substr(peg$currPos, 3) === peg$c325) { + s2 = peg$c325; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c323); } + if (peg$silentFails === 0) { peg$fail(peg$c326); } } if (s2 !== peg$FAILED) { - if (peg$c324.test(input.charAt(peg$currPos))) { + if (peg$c327.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c325); } + if (peg$silentFails === 0) { peg$fail(peg$c328); } } if (s3 !== peg$FAILED) { s4 = []; - if (peg$c324.test(input.charAt(peg$currPos))) { + if (peg$c327.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c325); } + if (peg$silentFails === 0) { peg$fail(peg$c328); } } if (s5 === peg$FAILED) { s5 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s6 = peg$c242; + s6 = peg$c245; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s7 = peg$c242; + s7 = peg$c245; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s7 === peg$FAILED) { s7 = peg$c1; @@ -15118,11 +15145,11 @@ module.exports = (function() { s8 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 35) { - s9 = peg$c242; + s9 = peg$c245; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } peg$silentFails--; if (s9 === peg$FAILED) { @@ -15149,29 +15176,29 @@ module.exports = (function() { } while (s5 !== peg$FAILED) { s4.push(s5); - if (peg$c324.test(input.charAt(peg$currPos))) { + if (peg$c327.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c325); } + if (peg$silentFails === 0) { peg$fail(peg$c328); } } if (s5 === peg$FAILED) { s5 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s6 = peg$c242; + s6 = peg$c245; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { - s7 = peg$c242; + s7 = peg$c245; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } if (s7 === peg$FAILED) { s7 = peg$c1; @@ -15180,11 +15207,11 @@ module.exports = (function() { s8 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 35) { - s9 = peg$c242; + s9 = peg$c245; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c243); } + if (peg$silentFails === 0) { peg$fail(peg$c246); } } peg$silentFails--; if (s9 === peg$FAILED) { @@ -15211,12 +15238,12 @@ module.exports = (function() { } } if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c322) { - s5 = peg$c322; + if (input.substr(peg$currPos, 3) === peg$c325) { + s5 = peg$c325; peg$currPos += 3; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c323); } + if (peg$silentFails === 0) { peg$fail(peg$c326); } } if (s5 !== peg$FAILED) { s2 = [s2, s3, s4, s5]; @@ -15258,49 +15285,49 @@ module.exports = (function() { return cached.result; } - if (peg$c326.test(input.charAt(peg$currPos))) { + if (peg$c329.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c327); } + if (peg$silentFails === 0) { peg$fail(peg$c330); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 13) { - s0 = peg$c328; + s0 = peg$c331; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c329); } + if (peg$silentFails === 0) { peg$fail(peg$c332); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s2 = peg$c272; + s2 = peg$c275; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c273); } + if (peg$silentFails === 0) { peg$fail(peg$c276); } } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 13) { - s3 = peg$c328; + s3 = peg$c331; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c329); } + if (peg$silentFails === 0) { peg$fail(peg$c332); } } if (s3 === peg$FAILED) { s3 = peg$c1; } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s4 = peg$c330; + s4 = peg$c333; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c331); } + if (peg$silentFails === 0) { peg$fail(peg$c334); } } if (s4 !== peg$FAILED) { s2 = [s2, s3, s4]; @@ -15344,15 +15371,15 @@ module.exports = (function() { s1 = peg$parse__(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61423) { - s2 = peg$c332; + s2 = peg$c335; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c333); } + if (peg$silentFails === 0) { peg$fail(peg$c336); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c334(s1); + s1 = peg$c337(s1); s0 = s1; } else { peg$currPos = s0; @@ -15405,15 +15432,15 @@ module.exports = (function() { s1 = s2; if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61438) { - s2 = peg$c335; + s2 = peg$c338; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c336); } + if (peg$silentFails === 0) { peg$fail(peg$c339); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c334(s1); + s1 = peg$c337(s1); s0 = s1; } else { peg$currPos = s0; @@ -15443,22 +15470,22 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; if (input.charCodeAt(peg$currPos) === 13) { - s2 = peg$c328; + s2 = peg$c331; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c329); } + if (peg$silentFails === 0) { peg$fail(peg$c332); } } if (s2 === peg$FAILED) { s2 = peg$c1; } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 10) { - s3 = peg$c330; + s3 = peg$c333; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c331); } + if (peg$silentFails === 0) { peg$fail(peg$c334); } } if (s3 !== peg$FAILED) { s2 = [s2, s3]; @@ -15478,15 +15505,15 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61439) { - s1 = peg$c337; + s1 = peg$c340; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c338); } + if (peg$silentFails === 0) { peg$fail(peg$c341); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c339(); + s1 = peg$c342(); } s0 = s1; } @@ -15642,12 +15669,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c340) { - s2 = peg$c340; + if (input.substr(peg$currPos, 3) === peg$c343) { + s2 = peg$c343; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c341); } + if (peg$silentFails === 0) { peg$fail(peg$c344); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15694,12 +15721,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c342) { - s2 = peg$c342; + if (input.substr(peg$currPos, 5) === peg$c345) { + s2 = peg$c345; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c343); } + if (peg$silentFails === 0) { peg$fail(peg$c346); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15746,12 +15773,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c344) { - s2 = peg$c344; + if (input.substr(peg$currPos, 2) === peg$c347) { + s2 = peg$c347; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c345); } + if (peg$silentFails === 0) { peg$fail(peg$c348); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15798,12 +15825,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c346) { - s2 = peg$c346; + if (input.substr(peg$currPos, 5) === peg$c349) { + s2 = peg$c349; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c347); } + if (peg$silentFails === 0) { peg$fail(peg$c350); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15850,12 +15877,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c348) { - s2 = peg$c348; + if (input.substr(peg$currPos, 8) === peg$c351) { + s2 = peg$c351; peg$currPos += 8; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c349); } + if (peg$silentFails === 0) { peg$fail(peg$c352); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15902,12 +15929,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c350) { - s2 = peg$c350; + if (input.substr(peg$currPos, 5) === peg$c353) { + s2 = peg$c353; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c351); } + if (peg$silentFails === 0) { peg$fail(peg$c354); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -15954,12 +15981,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c352) { - s2 = peg$c352; + if (input.substr(peg$currPos, 6) === peg$c355) { + s2 = peg$c355; peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c353); } + if (peg$silentFails === 0) { peg$fail(peg$c356); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16006,12 +16033,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c354) { - s2 = peg$c354; + if (input.substr(peg$currPos, 8) === peg$c357) { + s2 = peg$c357; peg$currPos += 8; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c355); } + if (peg$silentFails === 0) { peg$fail(peg$c358); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16058,12 +16085,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c356) { - s2 = peg$c356; + if (input.substr(peg$currPos, 2) === peg$c359) { + s2 = peg$c359; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c357); } + if (peg$silentFails === 0) { peg$fail(peg$c360); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16110,12 +16137,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c358) { - s2 = peg$c358; + if (input.substr(peg$currPos, 4) === peg$c361) { + s2 = peg$c361; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c359); } + if (peg$silentFails === 0) { peg$fail(peg$c362); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16162,12 +16189,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c360) { - s2 = peg$c360; + if (input.substr(peg$currPos, 7) === peg$c363) { + s2 = peg$c363; peg$currPos += 7; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c361); } + if (peg$silentFails === 0) { peg$fail(peg$c364); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16214,12 +16241,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c362) { - s2 = peg$c362; + if (input.substr(peg$currPos, 5) === peg$c365) { + s2 = peg$c365; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c363); } + if (peg$silentFails === 0) { peg$fail(peg$c366); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16266,12 +16293,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c364) { - s2 = peg$c364; + if (input.substr(peg$currPos, 7) === peg$c367) { + s2 = peg$c367; peg$currPos += 7; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c365); } + if (peg$silentFails === 0) { peg$fail(peg$c368); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16318,12 +16345,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c366) { - s2 = peg$c366; + if (input.substr(peg$currPos, 3) === peg$c369) { + s2 = peg$c369; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c367); } + if (peg$silentFails === 0) { peg$fail(peg$c370); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16370,12 +16397,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c368) { - s2 = peg$c368; + if (input.substr(peg$currPos, 2) === peg$c371) { + s2 = peg$c371; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c369); } + if (peg$silentFails === 0) { peg$fail(peg$c372); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16422,12 +16449,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c370) { - s2 = peg$c370; + if (input.substr(peg$currPos, 2) === peg$c373) { + s2 = peg$c373; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c371); } + if (peg$silentFails === 0) { peg$fail(peg$c374); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16474,12 +16501,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 10) === peg$c372) { - s2 = peg$c372; + if (input.substr(peg$currPos, 10) === peg$c375) { + s2 = peg$c375; peg$currPos += 10; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c373); } + if (peg$silentFails === 0) { peg$fail(peg$c376); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16526,12 +16553,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c374) { - s2 = peg$c374; + if (input.substr(peg$currPos, 2) === peg$c377) { + s2 = peg$c377; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c375); } + if (peg$silentFails === 0) { peg$fail(peg$c378); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16578,12 +16605,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c376) { - s2 = peg$c376; + if (input.substr(peg$currPos, 4) === peg$c379) { + s2 = peg$c379; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c377); } + if (peg$silentFails === 0) { peg$fail(peg$c380); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16630,12 +16657,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c378) { - s2 = peg$c378; + if (input.substr(peg$currPos, 4) === peg$c381) { + s2 = peg$c381; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c379); } + if (peg$silentFails === 0) { peg$fail(peg$c382); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16682,12 +16709,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c380) { - s2 = peg$c380; + if (input.substr(peg$currPos, 3) === peg$c383) { + s2 = peg$c383; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c381); } + if (peg$silentFails === 0) { peg$fail(peg$c384); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16734,12 +16761,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c382) { - s2 = peg$c382; + if (input.substr(peg$currPos, 2) === peg$c385) { + s2 = peg$c385; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c383); } + if (peg$silentFails === 0) { peg$fail(peg$c386); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16786,12 +16813,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c384) { - s2 = peg$c384; + if (input.substr(peg$currPos, 3) === peg$c387) { + s2 = peg$c387; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c385); } + if (peg$silentFails === 0) { peg$fail(peg$c388); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16838,12 +16865,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c386) { - s2 = peg$c386; + if (input.substr(peg$currPos, 4) === peg$c389) { + s2 = peg$c389; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c387); } + if (peg$silentFails === 0) { peg$fail(peg$c390); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16890,12 +16917,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c388) { - s2 = peg$c388; + if (input.substr(peg$currPos, 2) === peg$c391) { + s2 = peg$c391; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c389); } + if (peg$silentFails === 0) { peg$fail(peg$c392); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16942,12 +16969,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c390) { - s2 = peg$c390; + if (input.substr(peg$currPos, 3) === peg$c393) { + s2 = peg$c393; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c391); } + if (peg$silentFails === 0) { peg$fail(peg$c394); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -16994,12 +17021,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c392) { - s2 = peg$c392; + if (input.substr(peg$currPos, 2) === peg$c395) { + s2 = peg$c395; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c393); } + if (peg$silentFails === 0) { peg$fail(peg$c396); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17046,12 +17073,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c394) { - s2 = peg$c394; + if (input.substr(peg$currPos, 2) === peg$c397) { + s2 = peg$c397; peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c395); } + if (peg$silentFails === 0) { peg$fail(peg$c398); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17098,12 +17125,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c396) { - s2 = peg$c396; + if (input.substr(peg$currPos, 3) === peg$c399) { + s2 = peg$c399; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c397); } + if (peg$silentFails === 0) { peg$fail(peg$c400); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17150,12 +17177,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c398) { - s2 = peg$c398; + if (input.substr(peg$currPos, 6) === peg$c401) { + s2 = peg$c401; peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c399); } + if (peg$silentFails === 0) { peg$fail(peg$c402); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17202,12 +17229,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c400) { - s2 = peg$c400; + if (input.substr(peg$currPos, 6) === peg$c403) { + s2 = peg$c403; peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c401); } + if (peg$silentFails === 0) { peg$fail(peg$c404); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17254,12 +17281,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c402) { - s2 = peg$c402; + if (input.substr(peg$currPos, 4) === peg$c405) { + s2 = peg$c405; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c403); } + if (peg$silentFails === 0) { peg$fail(peg$c406); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17306,12 +17333,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c404) { - s2 = peg$c404; + if (input.substr(peg$currPos, 4) === peg$c407) { + s2 = peg$c407; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c405); } + if (peg$silentFails === 0) { peg$fail(peg$c408); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17358,12 +17385,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c406) { - s2 = peg$c406; + if (input.substr(peg$currPos, 5) === peg$c409) { + s2 = peg$c409; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c407); } + if (peg$silentFails === 0) { peg$fail(peg$c410); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17410,12 +17437,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c408) { - s2 = peg$c408; + if (input.substr(peg$currPos, 4) === peg$c411) { + s2 = peg$c411; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c409); } + if (peg$silentFails === 0) { peg$fail(peg$c412); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17462,12 +17489,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c410) { - s2 = peg$c410; + if (input.substr(peg$currPos, 3) === peg$c413) { + s2 = peg$c413; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c411); } + if (peg$silentFails === 0) { peg$fail(peg$c414); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17514,12 +17541,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c412) { - s2 = peg$c412; + if (input.substr(peg$currPos, 6) === peg$c415) { + s2 = peg$c415; peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c413); } + if (peg$silentFails === 0) { peg$fail(peg$c416); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17566,12 +17593,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c414) { - s2 = peg$c414; + if (input.substr(peg$currPos, 9) === peg$c417) { + s2 = peg$c417; peg$currPos += 9; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c415); } + if (peg$silentFails === 0) { peg$fail(peg$c418); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17618,12 +17645,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c416) { - s2 = peg$c416; + if (input.substr(peg$currPos, 6) === peg$c419) { + s2 = peg$c419; peg$currPos += 6; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c417); } + if (peg$silentFails === 0) { peg$fail(peg$c420); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17670,12 +17697,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c418) { - s2 = peg$c418; + if (input.substr(peg$currPos, 5) === peg$c421) { + s2 = peg$c421; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c419); } + if (peg$silentFails === 0) { peg$fail(peg$c422); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17722,12 +17749,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c420) { - s2 = peg$c420; + if (input.substr(peg$currPos, 4) === peg$c423) { + s2 = peg$c423; peg$currPos += 4; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c421); } + if (peg$silentFails === 0) { peg$fail(peg$c424); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17774,12 +17801,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c422) { - s2 = peg$c422; + if (input.substr(peg$currPos, 5) === peg$c425) { + s2 = peg$c425; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c423); } + if (peg$silentFails === 0) { peg$fail(peg$c426); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17826,12 +17853,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c424) { - s2 = peg$c424; + if (input.substr(peg$currPos, 3) === peg$c427) { + s2 = peg$c427; peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c425); } + if (peg$silentFails === 0) { peg$fail(peg$c428); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17878,12 +17905,12 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c426) { - s2 = peg$c426; + if (input.substr(peg$currPos, 5) === peg$c429) { + s2 = peg$c429; peg$currPos += 5; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c427); } + if (peg$silentFails === 0) { peg$fail(peg$c430); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; @@ -17929,212 +17956,212 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c408) { - s1 = peg$c408; + if (input.substr(peg$currPos, 4) === peg$c411) { + s1 = peg$c411; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c409); } + if (peg$silentFails === 0) { peg$fail(peg$c412); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c362) { - s1 = peg$c362; + if (input.substr(peg$currPos, 5) === peg$c365) { + s1 = peg$c365; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c363); } + if (peg$silentFails === 0) { peg$fail(peg$c366); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c386) { - s1 = peg$c386; + if (input.substr(peg$currPos, 4) === peg$c389) { + s1 = peg$c389; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c387); } + if (peg$silentFails === 0) { peg$fail(peg$c390); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c404) { - s1 = peg$c404; + if (input.substr(peg$currPos, 4) === peg$c407) { + s1 = peg$c407; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c405); } + if (peg$silentFails === 0) { peg$fail(peg$c408); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c380) { - s1 = peg$c380; + if (input.substr(peg$currPos, 3) === peg$c383) { + s1 = peg$c383; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c381); } + if (peg$silentFails === 0) { peg$fail(peg$c384); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c352) { - s1 = peg$c352; + if (input.substr(peg$currPos, 6) === peg$c355) { + s1 = peg$c355; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c353); } + if (peg$silentFails === 0) { peg$fail(peg$c356); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c412) { - s1 = peg$c412; + if (input.substr(peg$currPos, 6) === peg$c415) { + s1 = peg$c415; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c413); } + if (peg$silentFails === 0) { peg$fail(peg$c416); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c372) { - s1 = peg$c372; + if (input.substr(peg$currPos, 10) === peg$c375) { + s1 = peg$c375; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c373); } + if (peg$silentFails === 0) { peg$fail(peg$c376); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c370) { - s1 = peg$c370; + if (input.substr(peg$currPos, 2) === peg$c373) { + s1 = peg$c373; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c371); } + if (peg$silentFails === 0) { peg$fail(peg$c374); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c398) { - s1 = peg$c398; + if (input.substr(peg$currPos, 6) === peg$c401) { + s1 = peg$c401; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c399); } + if (peg$silentFails === 0) { peg$fail(peg$c402); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c406) { - s1 = peg$c406; + if (input.substr(peg$currPos, 5) === peg$c409) { + s1 = peg$c409; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c407); } + if (peg$silentFails === 0) { peg$fail(peg$c410); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c342) { - s1 = peg$c342; + if (input.substr(peg$currPos, 5) === peg$c345) { + s1 = peg$c345; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c343); } + if (peg$silentFails === 0) { peg$fail(peg$c346); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c348) { - s1 = peg$c348; + if (input.substr(peg$currPos, 8) === peg$c351) { + s1 = peg$c351; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c349); } + if (peg$silentFails === 0) { peg$fail(peg$c352); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c354) { - s1 = peg$c354; + if (input.substr(peg$currPos, 8) === peg$c357) { + s1 = peg$c357; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c355); } + if (peg$silentFails === 0) { peg$fail(peg$c358); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c368) { - s1 = peg$c368; + if (input.substr(peg$currPos, 2) === peg$c371) { + s1 = peg$c371; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c369); } + if (peg$silentFails === 0) { peg$fail(peg$c372); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c358) { - s1 = peg$c358; + if (input.substr(peg$currPos, 4) === peg$c361) { + s1 = peg$c361; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c359); } + if (peg$silentFails === 0) { peg$fail(peg$c362); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c400) { - s1 = peg$c400; + if (input.substr(peg$currPos, 6) === peg$c403) { + s1 = peg$c403; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c401); } + if (peg$silentFails === 0) { peg$fail(peg$c404); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c366) { - s1 = peg$c366; + if (input.substr(peg$currPos, 3) === peg$c369) { + s1 = peg$c369; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c367); } + if (peg$silentFails === 0) { peg$fail(peg$c370); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c422) { - s1 = peg$c422; + if (input.substr(peg$currPos, 5) === peg$c425) { + s1 = peg$c425; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c423); } + if (peg$silentFails === 0) { peg$fail(peg$c426); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c356) { - s1 = peg$c356; + if (input.substr(peg$currPos, 2) === peg$c359) { + s1 = peg$c359; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c357); } + if (peg$silentFails === 0) { peg$fail(peg$c360); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c410) { - s1 = peg$c410; + if (input.substr(peg$currPos, 3) === peg$c413) { + s1 = peg$c413; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c411); } + if (peg$silentFails === 0) { peg$fail(peg$c414); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c346) { - s1 = peg$c346; + if (input.substr(peg$currPos, 5) === peg$c349) { + s1 = peg$c349; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c347); } + if (peg$silentFails === 0) { peg$fail(peg$c350); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c364) { - s1 = peg$c364; + if (input.substr(peg$currPos, 7) === peg$c367) { + s1 = peg$c367; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c365); } + if (peg$silentFails === 0) { peg$fail(peg$c368); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c350) { - s1 = peg$c350; + if (input.substr(peg$currPos, 5) === peg$c353) { + s1 = peg$c353; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c351); } + if (peg$silentFails === 0) { peg$fail(peg$c354); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c360) { - s1 = peg$c360; + if (input.substr(peg$currPos, 7) === peg$c363) { + s1 = peg$c363; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c361); } + if (peg$silentFails === 0) { peg$fail(peg$c364); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c426) { - s1 = peg$c426; + if (input.substr(peg$currPos, 5) === peg$c429) { + s1 = peg$c429; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c427); } + if (peg$silentFails === 0) { peg$fail(peg$c430); } } } } @@ -18201,164 +18228,164 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c428) { - s1 = peg$c428; + if (input.substr(peg$currPos, 4) === peg$c431) { + s1 = peg$c431; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c429); } + if (peg$silentFails === 0) { peg$fail(peg$c432); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c430) { - s1 = peg$c430; + if (input.substr(peg$currPos, 7) === peg$c433) { + s1 = peg$c433; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c431); } + if (peg$silentFails === 0) { peg$fail(peg$c434); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c432) { - s1 = peg$c432; + if (input.substr(peg$currPos, 8) === peg$c435) { + s1 = peg$c435; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c433); } + if (peg$silentFails === 0) { peg$fail(peg$c436); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c434) { - s1 = peg$c434; + if (input.substr(peg$currPos, 3) === peg$c437) { + s1 = peg$c437; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c435); } + if (peg$silentFails === 0) { peg$fail(peg$c438); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c436) { - s1 = peg$c436; + if (input.substr(peg$currPos, 4) === peg$c439) { + s1 = peg$c439; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c437); } + if (peg$silentFails === 0) { peg$fail(peg$c440); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c438) { - s1 = peg$c438; + if (input.substr(peg$currPos, 4) === peg$c441) { + s1 = peg$c441; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c439); } + if (peg$silentFails === 0) { peg$fail(peg$c442); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c440) { - s1 = peg$c440; + if (input.substr(peg$currPos, 5) === peg$c443) { + s1 = peg$c443; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c441); } + if (peg$silentFails === 0) { peg$fail(peg$c444); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c442) { - s1 = peg$c442; + if (input.substr(peg$currPos, 3) === peg$c445) { + s1 = peg$c445; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c443); } + if (peg$silentFails === 0) { peg$fail(peg$c446); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c444) { - s1 = peg$c444; + if (input.substr(peg$currPos, 4) === peg$c447) { + s1 = peg$c447; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c445); } + if (peg$silentFails === 0) { peg$fail(peg$c448); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c446) { - s1 = peg$c446; + if (input.substr(peg$currPos, 6) === peg$c449) { + s1 = peg$c449; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c447); } + if (peg$silentFails === 0) { peg$fail(peg$c450); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c448) { - s1 = peg$c448; + if (input.substr(peg$currPos, 6) === peg$c451) { + s1 = peg$c451; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c449); } + if (peg$silentFails === 0) { peg$fail(peg$c452); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c450) { - s1 = peg$c450; + if (input.substr(peg$currPos, 6) === peg$c453) { + s1 = peg$c453; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c451); } + if (peg$silentFails === 0) { peg$fail(peg$c454); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c452) { - s1 = peg$c452; + if (input.substr(peg$currPos, 10) === peg$c455) { + s1 = peg$c455; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c453); } + if (peg$silentFails === 0) { peg$fail(peg$c456); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c454) { - s1 = peg$c454; + if (input.substr(peg$currPos, 9) === peg$c457) { + s1 = peg$c457; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c455); } + if (peg$silentFails === 0) { peg$fail(peg$c458); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c456) { - s1 = peg$c456; + if (input.substr(peg$currPos, 7) === peg$c459) { + s1 = peg$c459; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c457); } + if (peg$silentFails === 0) { peg$fail(peg$c460); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 7) === peg$c458) { - s1 = peg$c458; + if (input.substr(peg$currPos, 7) === peg$c461) { + s1 = peg$c461; peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c459); } + if (peg$silentFails === 0) { peg$fail(peg$c462); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 9) === peg$c460) { - s1 = peg$c460; + if (input.substr(peg$currPos, 9) === peg$c463) { + s1 = peg$c463; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c461); } + if (peg$silentFails === 0) { peg$fail(peg$c464); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c462) { - s1 = peg$c462; + if (input.substr(peg$currPos, 6) === peg$c465) { + s1 = peg$c465; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c463); } + if (peg$silentFails === 0) { peg$fail(peg$c466); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c464) { - s1 = peg$c464; + if (input.substr(peg$currPos, 6) === peg$c467) { + s1 = peg$c467; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c465); } + if (peg$silentFails === 0) { peg$fail(peg$c468); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c466) { - s1 = peg$c466; + if (input.substr(peg$currPos, 5) === peg$c469) { + s1 = peg$c469; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c467); } + if (peg$silentFails === 0) { peg$fail(peg$c470); } } } } @@ -18419,140 +18446,140 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c414) { - s1 = peg$c414; + if (input.substr(peg$currPos, 9) === peg$c417) { + s1 = peg$c417; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c415); } + if (peg$silentFails === 0) { peg$fail(peg$c418); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c402) { - s1 = peg$c402; + if (input.substr(peg$currPos, 4) === peg$c405) { + s1 = peg$c405; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c403); } + if (peg$silentFails === 0) { peg$fail(peg$c406); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c416) { - s1 = peg$c416; + if (input.substr(peg$currPos, 6) === peg$c419) { + s1 = peg$c419; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c417); } + if (peg$silentFails === 0) { peg$fail(peg$c420); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c418) { - s1 = peg$c418; + if (input.substr(peg$currPos, 5) === peg$c421) { + s1 = peg$c421; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c419); } + if (peg$silentFails === 0) { peg$fail(peg$c422); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c378) { - s1 = peg$c378; + if (input.substr(peg$currPos, 4) === peg$c381) { + s1 = peg$c381; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c379); } + if (peg$silentFails === 0) { peg$fail(peg$c382); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c390) { - s1 = peg$c390; + if (input.substr(peg$currPos, 3) === peg$c393) { + s1 = peg$c393; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c391); } + if (peg$silentFails === 0) { peg$fail(peg$c394); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c344) { - s1 = peg$c344; + if (input.substr(peg$currPos, 2) === peg$c347) { + s1 = peg$c347; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c345); } + if (peg$silentFails === 0) { peg$fail(peg$c348); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c420) { - s1 = peg$c420; + if (input.substr(peg$currPos, 4) === peg$c423) { + s1 = peg$c423; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c421); } + if (peg$silentFails === 0) { peg$fail(peg$c424); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c340) { - s1 = peg$c340; + if (input.substr(peg$currPos, 3) === peg$c343) { + s1 = peg$c343; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c341); } + if (peg$silentFails === 0) { peg$fail(peg$c344); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c394) { - s1 = peg$c394; + if (input.substr(peg$currPos, 2) === peg$c397) { + s1 = peg$c397; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c395); } + if (peg$silentFails === 0) { peg$fail(peg$c398); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c376) { - s1 = peg$c376; + if (input.substr(peg$currPos, 4) === peg$c379) { + s1 = peg$c379; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c377); } + if (peg$silentFails === 0) { peg$fail(peg$c380); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c374) { - s1 = peg$c374; + if (input.substr(peg$currPos, 2) === peg$c377) { + s1 = peg$c377; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c375); } + if (peg$silentFails === 0) { peg$fail(peg$c378); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c384) { - s1 = peg$c384; + if (input.substr(peg$currPos, 3) === peg$c387) { + s1 = peg$c387; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c385); } + if (peg$silentFails === 0) { peg$fail(peg$c388); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c424) { - s1 = peg$c424; + if (input.substr(peg$currPos, 3) === peg$c427) { + s1 = peg$c427; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c425); } + if (peg$silentFails === 0) { peg$fail(peg$c428); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c382) { - s1 = peg$c382; + if (input.substr(peg$currPos, 2) === peg$c385) { + s1 = peg$c385; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c383); } + if (peg$silentFails === 0) { peg$fail(peg$c386); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c392) { - s1 = peg$c392; + if (input.substr(peg$currPos, 2) === peg$c395) { + s1 = peg$c395; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c393); } + if (peg$silentFails === 0) { peg$fail(peg$c396); } } if (s1 === peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c388) { - s1 = peg$c388; + if (input.substr(peg$currPos, 2) === peg$c391) { + s1 = peg$c391; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c389); } + if (peg$silentFails === 0) { peg$fail(peg$c392); } } } } @@ -18642,12 +18669,12 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c468) { - s1 = peg$c468; + if (input.substr(peg$currPos, 2) === peg$c471) { + s1 = peg$c471; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c469); } + if (peg$silentFails === 0) { peg$fail(peg$c472); } } if (s1 !== peg$FAILED) { s2 = peg$parsehexDigit(); @@ -18659,7 +18686,7 @@ module.exports = (function() { s5 = peg$parsehexDigit(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c470(s2, s3, s4, s5); + s1 = peg$c473(s2, s3, s4, s5); s0 = s1; } else { peg$currPos = s0; @@ -18698,29 +18725,29 @@ module.exports = (function() { return cached.result; } - if (peg$c471.test(input.charAt(peg$currPos))) { + if (peg$c474.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c472); } + if (peg$silentFails === 0) { peg$fail(peg$c475); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55340) { - s1 = peg$c473; + s1 = peg$c476; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c474); } + if (peg$silentFails === 0) { peg$fail(peg$c477); } } if (s1 !== peg$FAILED) { - if (peg$c475.test(input.charAt(peg$currPos))) { + if (peg$c478.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c476); } + if (peg$silentFails === 0) { peg$fail(peg$c479); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18736,19 +18763,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55304) { - s1 = peg$c477; + s1 = peg$c480; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c478); } + if (peg$silentFails === 0) { peg$fail(peg$c481); } } if (s1 !== peg$FAILED) { - if (peg$c479.test(input.charAt(peg$currPos))) { + if (peg$c482.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c480); } + if (peg$silentFails === 0) { peg$fail(peg$c483); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18764,19 +18791,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55401) { - s1 = peg$c481; + s1 = peg$c484; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c482); } + if (peg$silentFails === 0) { peg$fail(peg$c485); } } if (s1 !== peg$FAILED) { - if (peg$c483.test(input.charAt(peg$currPos))) { + if (peg$c486.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c484); } + if (peg$silentFails === 0) { peg$fail(peg$c487); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18792,19 +18819,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55305) { - s1 = peg$c485; + s1 = peg$c488; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c486); } + if (peg$silentFails === 0) { peg$fail(peg$c489); } } if (s1 !== peg$FAILED) { - if (peg$c487.test(input.charAt(peg$currPos))) { + if (peg$c490.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c488); } + if (peg$silentFails === 0) { peg$fail(peg$c491); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18820,19 +18847,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55349) { - s1 = peg$c489; + s1 = peg$c492; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c490); } + if (peg$silentFails === 0) { peg$fail(peg$c493); } } if (s1 !== peg$FAILED) { - if (peg$c491.test(input.charAt(peg$currPos))) { + if (peg$c494.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c492); } + if (peg$silentFails === 0) { peg$fail(peg$c495); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18848,19 +18875,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55300) { - s1 = peg$c493; + s1 = peg$c496; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c494); } + if (peg$silentFails === 0) { peg$fail(peg$c497); } } if (s1 !== peg$FAILED) { - if (peg$c495.test(input.charAt(peg$currPos))) { + if (peg$c498.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c496); } + if (peg$silentFails === 0) { peg$fail(peg$c499); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18876,19 +18903,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55296) { - s1 = peg$c497; + s1 = peg$c500; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c498); } + if (peg$silentFails === 0) { peg$fail(peg$c501); } } if (s1 !== peg$FAILED) { - if (peg$c499.test(input.charAt(peg$currPos))) { + if (peg$c502.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c500); } + if (peg$silentFails === 0) { peg$fail(peg$c503); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18904,19 +18931,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55308) { - s1 = peg$c501; + s1 = peg$c504; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c502); } + if (peg$silentFails === 0) { peg$fail(peg$c505); } } if (s1 !== peg$FAILED) { - if (peg$c503.test(input.charAt(peg$currPos))) { + if (peg$c506.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c504); } + if (peg$silentFails === 0) { peg$fail(peg$c507); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18932,19 +18959,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55297) { - s1 = peg$c505; + s1 = peg$c508; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c506); } + if (peg$silentFails === 0) { peg$fail(peg$c509); } } if (s1 !== peg$FAILED) { - if (peg$c507.test(input.charAt(peg$currPos))) { + if (peg$c510.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c508); } + if (peg$silentFails === 0) { peg$fail(peg$c511); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18960,19 +18987,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55406) { - s1 = peg$c509; + s1 = peg$c512; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c510); } + if (peg$silentFails === 0) { peg$fail(peg$c513); } } if (s1 !== peg$FAILED) { - if (peg$c511.test(input.charAt(peg$currPos))) { + if (peg$c514.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c512); } + if (peg$silentFails === 0) { peg$fail(peg$c515); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -18988,19 +19015,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55299) { - s1 = peg$c513; + s1 = peg$c516; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c514); } + if (peg$silentFails === 0) { peg$fail(peg$c517); } } if (s1 !== peg$FAILED) { - if (peg$c515.test(input.charAt(peg$currPos))) { + if (peg$c518.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c516); } + if (peg$silentFails === 0) { peg$fail(peg$c519); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19016,19 +19043,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55360) { - s1 = peg$c517; + s1 = peg$c520; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c518); } + if (peg$silentFails === 0) { peg$fail(peg$c521); } } if (s1 !== peg$FAILED) { - if (peg$c519.test(input.charAt(peg$currPos))) { + if (peg$c522.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c520); } + if (peg$silentFails === 0) { peg$fail(peg$c523); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19044,19 +19071,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55422) { - s1 = peg$c521; + s1 = peg$c524; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c522); } + if (peg$silentFails === 0) { peg$fail(peg$c525); } } if (s1 !== peg$FAILED) { - if (peg$c523.test(input.charAt(peg$currPos))) { + if (peg$c526.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c524); } + if (peg$silentFails === 0) { peg$fail(peg$c527); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19072,19 +19099,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55405) { - s1 = peg$c525; + s1 = peg$c528; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c526); } + if (peg$silentFails === 0) { peg$fail(peg$c529); } } if (s1 !== peg$FAILED) { - if (peg$c527.test(input.charAt(peg$currPos))) { + if (peg$c530.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c528); } + if (peg$silentFails === 0) { peg$fail(peg$c531); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19100,19 +19127,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55322) { - s1 = peg$c529; + s1 = peg$c532; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c530); } + if (peg$silentFails === 0) { peg$fail(peg$c533); } } if (s1 !== peg$FAILED) { - if (peg$c531.test(input.charAt(peg$currPos))) { + if (peg$c534.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c532); } + if (peg$silentFails === 0) { peg$fail(peg$c535); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19128,19 +19155,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55298) { - s1 = peg$c533; + s1 = peg$c536; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c534); } + if (peg$silentFails === 0) { peg$fail(peg$c537); } } if (s1 !== peg$FAILED) { - if (peg$c535.test(input.charAt(peg$currPos))) { + if (peg$c538.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c536); } + if (peg$silentFails === 0) { peg$fail(peg$c539); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19156,19 +19183,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55309) { - s1 = peg$c537; + s1 = peg$c540; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c538); } + if (peg$silentFails === 0) { peg$fail(peg$c541); } } if (s1 !== peg$FAILED) { - if (peg$c539.test(input.charAt(peg$currPos))) { + if (peg$c542.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c540); } + if (peg$silentFails === 0) { peg$fail(peg$c543); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19215,29 +19242,29 @@ module.exports = (function() { return cached.result; } - if (peg$c541.test(input.charAt(peg$currPos))) { + if (peg$c544.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c542); } + if (peg$silentFails === 0) { peg$fail(peg$c545); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 56128) { - s1 = peg$c543; + s1 = peg$c546; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c544); } + if (peg$silentFails === 0) { peg$fail(peg$c547); } } if (s1 !== peg$FAILED) { - if (peg$c545.test(input.charAt(peg$currPos))) { + if (peg$c548.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c546); } + if (peg$silentFails === 0) { peg$fail(peg$c549); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19253,19 +19280,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55348) { - s1 = peg$c547; + s1 = peg$c550; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c548); } + if (peg$silentFails === 0) { peg$fail(peg$c551); } } if (s1 !== peg$FAILED) { - if (peg$c549.test(input.charAt(peg$currPos))) { + if (peg$c552.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c550); } + if (peg$silentFails === 0) { peg$fail(peg$c553); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19281,19 +19308,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55300) { - s1 = peg$c493; + s1 = peg$c496; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c494); } + if (peg$silentFails === 0) { peg$fail(peg$c497); } } if (s1 !== peg$FAILED) { - if (peg$c551.test(input.charAt(peg$currPos))) { + if (peg$c554.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c552); } + if (peg$silentFails === 0) { peg$fail(peg$c555); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19309,19 +19336,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55296) { - s1 = peg$c497; + s1 = peg$c500; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c498); } + if (peg$silentFails === 0) { peg$fail(peg$c501); } } if (s1 !== peg$FAILED) { - if (peg$c553.test(input.charAt(peg$currPos))) { + if (peg$c556.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c554); } + if (peg$silentFails === 0) { peg$fail(peg$c557); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19337,19 +19364,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55298) { - s1 = peg$c533; + s1 = peg$c536; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c534); } + if (peg$silentFails === 0) { peg$fail(peg$c537); } } if (s1 !== peg$FAILED) { - if (peg$c555.test(input.charAt(peg$currPos))) { + if (peg$c558.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c556); } + if (peg$silentFails === 0) { peg$fail(peg$c559); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19384,29 +19411,29 @@ module.exports = (function() { return cached.result; } - if (peg$c557.test(input.charAt(peg$currPos))) { + if (peg$c560.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c558); } + if (peg$silentFails === 0) { peg$fail(peg$c561); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55349) { - s1 = peg$c489; + s1 = peg$c492; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c490); } + if (peg$silentFails === 0) { peg$fail(peg$c493); } } if (s1 !== peg$FAILED) { - if (peg$c559.test(input.charAt(peg$currPos))) { + if (peg$c562.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c560); } + if (peg$silentFails === 0) { peg$fail(peg$c563); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19422,19 +19449,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55300) { - s1 = peg$c493; + s1 = peg$c496; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c494); } + if (peg$silentFails === 0) { peg$fail(peg$c497); } } if (s1 !== peg$FAILED) { - if (peg$c561.test(input.charAt(peg$currPos))) { + if (peg$c564.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c562); } + if (peg$silentFails === 0) { peg$fail(peg$c565); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19450,19 +19477,19 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 55297) { - s1 = peg$c505; + s1 = peg$c508; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c506); } + if (peg$silentFails === 0) { peg$fail(peg$c509); } } if (s1 !== peg$FAILED) { - if (peg$c563.test(input.charAt(peg$currPos))) { + if (peg$c566.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c564); } + if (peg$silentFails === 0) { peg$fail(peg$c567); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; @@ -19495,12 +19522,12 @@ module.exports = (function() { return cached.result; } - if (peg$c565.test(input.charAt(peg$currPos))) { + if (peg$c568.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c566); } + if (peg$silentFails === 0) { peg$fail(peg$c569); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -19520,11 +19547,11 @@ module.exports = (function() { } if (input.charCodeAt(peg$currPos) === 8204) { - s0 = peg$c567; + s0 = peg$c570; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c568); } + if (peg$silentFails === 0) { peg$fail(peg$c571); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -19544,11 +19571,11 @@ module.exports = (function() { } if (input.charCodeAt(peg$currPos) === 8205) { - s0 = peg$c569; + s0 = peg$c572; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c570); } + if (peg$silentFails === 0) { peg$fail(peg$c573); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; diff --git a/src/cli.coffee b/src/cli.coffee index 1d0c1485..0529cefc 100644 --- a/src/cli.coffee +++ b/src/cli.coffee @@ -210,6 +210,7 @@ else raw: options.raw or options.sourceMap or options.sourceMapFile or options.eval inputSource: inputSource literate: options.literate + targetES6: options.targetES6 catch e console.error e.message process.exit 1 diff --git a/src/grammar.pegcoffee b/src/grammar.pegcoffee index c1efbdbc..18eb9c18 100644 --- a/src/grammar.pegcoffee +++ b/src/grammar.pegcoffee @@ -932,6 +932,7 @@ macro / "__TIME__" { rp new CS.String (new Date).toTimeString()[0...8] } / "__DATETIMEMS__" { rp new CS.Int +new Date } / "__COFFEE_VERSION__" { rp new CS.String (require '../package.json').version } + / "__TARGET_ES6__" { rp new CS.Bool !!options.targetES6 } bool diff --git a/src/module.coffee b/src/module.coffee index 7a499b16..a2e4c1e2 100644 --- a/src/module.coffee +++ b/src/module.coffee @@ -37,6 +37,7 @@ CoffeeScript = parsed = Parser.parse preprocessed, raw: options.raw inputSource: options.inputSource + targetES6: options.targetES6 if options.optimise then Optimiser.optimise parsed else parsed catch e throw e unless e instanceof Parser.SyntaxError From 1a734f93fd35cfff0a017d5d20b61279f7d21d4a Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 21:44:37 -0400 Subject: [PATCH 52/64] documenting possible semantic differences --- README-ES6.md | 78 +++++++++++++++++++++++++++++++++++++++++++ test/functions.coffee | 21 ++++++++++-- 2 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 README-ES6.md diff --git a/README-ES6.md b/README-ES6.md new file mode 100644 index 00000000..273208aa --- /dev/null +++ b/README-ES6.md @@ -0,0 +1,78 @@ +# Notes for ES6 Mode + +The compiler option `--target-es6` enables opportunistic use of ES6 +features. This is useful if you are targeting a runtime wiht native +ES6 support, or if you are migrating a codebase from CoffeeScript to +ES6. + +Original PR: https://github.com/michaelficarra/CoffeeScriptRedux/pull/344 + +## What is eligible for ES6 tranpilation? + +The following describes the stuff we can convert to ES6. Anything that +is not convertible falls back to the normal CoffeeScript compilation +path. + + - Most classes are eligible for conversion directly into ES6 + classes. If you have a class that is not being converted, run the + compiler with the environment variable `DEBUG=es6` to see why yours + is being rejected. ES6 is significantly more strict than + CoffeeScript about what's legal in a class definition. + + - if you have a constructor, it needs to be a function expression + directly in the class definition. No "external constructors" + like: + + class Foo + constructor: someFunctionDeclaredElsewhere + + - we don't deal with compound class names like: + + class X.Foo + + You can get the same effect with assignment, like `X.Foo = + class ...`. + + - we don't deal with arbitrary expressions for the parent class: + + class X extends someFunctionThatRetunsAClass() + + - in ES6, a derived class's constructor *must* call `super()` and + it must do it before referencing `this`. We will automatically + insert a leading `super()` if you weren't manually calling + super at all, but if you already call `super` and you do it + after referencing `this`, we will not transpile your class. + + - if you have arbitrary expressions in your class body that do + not translate directly into methods, static methods, prototype + properties, or class properties we will ignore your class. + + - Array destructuring is eligible for conversion, with one exception: + ES6 only allows rest parameters at the end of an array pattern, not + in the middle. So `[a, b, c...]` gets converted to `[a, b, ...c]` + but `[a, b..., c]` will not be converted. + + - CoffeeScript bound functions (the fat arrow `=>`) are almost + completely analogous to ES6 arrow function expressions, except for + the meaning of the `arguments` keyword. We can safely rewrite every + practical case, but if you are using both positional arguments and + referencing the `arguments` keyword we will give up and fall back + to normal CoffeeScript compilation. + + +## Semantic Differences + +There are some differences in semantics that the compiler does not try +to patch over. + + - `super` is required in derived class constructors. If you don't + already call super, we will insert a `super()` call to make your + class legal. + + - In CoffeeScript, a parameter's default value is used if the given + value is `null` or `undefined`. In ES6, a parameter's default value + is only used if the given value is `undefined`. + + - The methods on an ES6 class are non-enumerable. The methods on a + CoffeeScript class are enumerable. + diff --git a/test/functions.coffee b/test/functions.coffee index 5564d8d9..2411bf08 100644 --- a/test/functions.coffee +++ b/test/functions.coffee @@ -139,7 +139,14 @@ suite 'Function Literals', -> eq nonceA, a(0) eq nonceB, a(0,0,nonceB) eq nonceA, a(0,0,undefined) - eq nonceA, a(0,0,null) + if __TARGET_ES6__ + # Deliberate semantic difference: ES6 default parameters take + # their default value only when their given value is + # undefined. Null is allowed to override the default + # value. + eq null, a(0,0,null) + else + eq nonceA, a(0,0,null) eq false , a(0,0,false) eq nonceB, a(undefined,undefined,nonceB,undefined) b = (_,arg=nonceA,_1,_2) -> arg @@ -147,7 +154,11 @@ suite 'Function Literals', -> eq nonceA, b(0) eq nonceB, b(0,nonceB) eq nonceA, b(0,undefined) - eq nonceA, b(0,null) + if __TARGET_ES6__ + # See above comment + eq null, b(0,null) + else + eq nonceA, b(0,null) eq false , b(0,false) eq nonceB, b(undefined,nonceB,undefined) c = (arg=nonceA,_,_1) -> arg @@ -155,7 +166,11 @@ suite 'Function Literals', -> eq 0, c(0) eq nonceB, c(nonceB) eq nonceA, c(undefined) - eq nonceA, c(null) + if __TARGET_ES6__ + # See above comment + eq null, c(null) + else + eq nonceA, c(null) eq false , c(false) eq nonceB, c(nonceB,undefined,undefined) From b9fcea072900ee0cb1f5df74bd9542da270d7672 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 22:51:30 -0400 Subject: [PATCH 53/64] minor docs edit --- README-ES6.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README-ES6.md b/README-ES6.md index 273208aa..a1161be5 100644 --- a/README-ES6.md +++ b/README-ES6.md @@ -33,7 +33,9 @@ path. You can get the same effect with assignment, like `X.Foo = class ...`. - - we don't deal with arbitrary expressions for the parent class: + - we don't deal with arbitrary expressions for the parent class + (even though ES6 does support this pattern, it has not been + implemented here): class X extends someFunctionThatRetunsAClass() From ae17c556f72774c95414ee4549420248a70e33e1 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 22:51:55 -0400 Subject: [PATCH 54/64] let CS classes extend ES6 classes --- lib/compiler.js | 98 +++++++++++++++++++++++++++++++-------------- src/compiler.coffee | 59 +++++++++++++++++++-------- 2 files changed, 110 insertions(+), 47 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 51fb7f4d..dc813622 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var all, any, assignment, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateCopyingWalker, generateMutatingWalker, generateSoak, generateWalker, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isDownwardScopeBoundary, isIdentifierName, isUpwardScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; +var all, any, assignment, baseExtends, beingDeclared, cache$, cache$1, collectIdentifiers, concat, concatMap, CS, debugES6, declarationsNeeded, declarationsNeededRecursive, declaredIdentifiers, defaultRules, describeClass, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, es6AssignmentPattern, es6SafeArrowExpression, es6SafeConstructor, exports, expr, find, findES6Methods, fn, foldl, foldl1, forceBlock, funcDecl, funcExpr, generateCopyingWalker, generateMutatingWalker, generateSoak, generateWalker, genSym, h, hasSoak, helperNames, helpers, inlineHelpers, intersect, isDownwardScopeBoundary, isIdentifierName, isUpwardScopeBoundary, JS, jsReserved, makeReturn, makeVarDeclaration, map, mapChildNodes, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression, variableDeclarations, zip; cache$ = require('./functional-helpers'); find = cache$.find; any = cache$.any; @@ -643,36 +643,69 @@ generateSoak = function () { }), e); }; }(); +baseExtends = function (myName, copyClassProperties) { + var block, child, ctor, parent, protoAccess; + protoAccess = function (e) { + return memberAccess(e, 'prototype'); + }; + child = new JS.Identifier('child'); + parent = new JS.Identifier('parent'); + ctor = new JS.Identifier('ctor'); + block = [ + copyClassProperties(parent, child), + funcDecl({ + id: ctor, + body: new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', memberAccess(new JS.ThisExpression, 'constructor'), child))]) + }), + new JS.AssignmentExpression('=', protoAccess(ctor), protoAccess(parent)), + new JS.AssignmentExpression('=', protoAccess(child), new JS.NewExpression(ctor, [])), + new JS.AssignmentExpression('=', memberAccess(child, '__super__'), protoAccess(parent)), + new JS.ReturnStatement(child) + ]; + return funcDecl({ + id: helperNames[myName], + params: [ + child, + parent + ], + body: new JS.BlockStatement(map(block, stmt)) + }); +}; helperNames = {}; helpers = { 'extends': function () { - var block, child, ctor, f, key, parent, protoAccess; - protoAccess = function (e) { - return memberAccess(e, 'prototype'); - }; - child = new JS.Identifier('child'); - parent = new JS.Identifier('parent'); - ctor = new JS.Identifier('ctor'); + var copyClassProperties, key; key = new JS.Identifier('key'); - block = [ - new JS.ForInStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(key, null)]), parent, new JS.IfStatement(helpers.isOwn(parent, key), f = stmt(new JS.AssignmentExpression('=', new JS.MemberExpression(true, child, key), new JS.MemberExpression(true, parent, key))))), - funcDecl({ - id: ctor, - body: new JS.BlockStatement([stmt(new JS.AssignmentExpression('=', memberAccess(new JS.ThisExpression, 'constructor'), child))]) - }), - new JS.AssignmentExpression('=', protoAccess(ctor), protoAccess(parent)), - new JS.AssignmentExpression('=', protoAccess(child), new JS.NewExpression(ctor, [])), - new JS.AssignmentExpression('=', memberAccess(child, '__super__'), protoAccess(parent)), - new JS.ReturnStatement(child) - ]; - return funcDecl({ - id: helperNames['extends'], - params: [ - child, - parent - ], - body: new JS.BlockStatement(map(block, stmt)) - }); + copyClassProperties = function (parent, child) { + var f; + return new JS.ForInStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(key, null)]), parent, new JS.IfStatement(helpers.isOwn(parent, key), f = stmt(new JS.AssignmentExpression('=', new JS.MemberExpression(true, child, key), new JS.MemberExpression(true, parent, key))))); + }; + return baseExtends('extends', copyClassProperties); + }, + extendsES6: function () { + var copyClassProperties; + copyClassProperties = function (parent, child) { + var condition, conditional, copyKey, func, key, propertyNames; + propertyNames = new JS.CallExpression(memberAccess(new JS.Identifier('Object'), 'getOwnPropertyNames'), [parent]); + key = new JS.Identifier('key'); + copyKey = new JS.AssignmentExpression('=', new JS.MemberExpression(true, child, key), new JS.MemberExpression(true, parent, key)); + condition = [ + 'callee', + 'caller', + 'arguments' + ].map(function (forbidden) { + return new JS.BinaryExpression('!==', key, new JS.Literal(forbidden)); + }).reduce(function (a, b) { + return new JS.BinaryExpression('&&', a, b); + }); + conditional = new JS.IfStatement(condition, forceBlock(copyKey)); + func = funcExpr({ + params: [key], + body: forceBlock(conditional) + }); + return new JS.CallExpression(memberAccess(propertyNames, 'forEach'), [func]); + }; + return baseExtends('extendsES6', copyClassProperties); }, construct: function () { var args, block, child, ctor, fn, result; @@ -1637,7 +1670,7 @@ exports.Compiler = function () { [ CS.Class, function (param$) { - var _, ancestry, args, block, body, c, cache$2, cache$3, classAssignment, classExpression, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, unmatched; + var _, ancestry, args, block, body, c, cache$2, cache$3, classAssignment, classExpression, classIdentifier, compile, ctorBody, ctorIndex, ctorRef, helper, i, iife, instance, member, memberName, methods, nameAssignee, options, params, parent, parentIdentifier, parentRef, properties, protoAssignOp, protoMember, ps, rewriteThis, unmatched; var ctor, name; { cache$2 = param$; @@ -1751,7 +1784,8 @@ exports.Compiler = function () { if (null != parent) { params.push(parentRef); args.push(parent); - block.body.unshift(stmt(helpers['extends'](name, parentRef))); + helper = options.targetES6 ? 'extendsES6' : 'extends'; + block.body.unshift(stmt(helpers[helper](name, parentRef))); } block.body.push(new JS.ReturnStatement(new JS.ThisExpression)); rewriteThis = generateMutatingWalker(function () { @@ -2476,13 +2510,15 @@ exports.Compiler = function () { [ CS.ExtendsOp, function (param$) { - var cache$2, left, right; + var cache$2, helper, left, options, right; { cache$2 = param$; left = cache$2.left; right = cache$2.right; + options = cache$2.options; } - return helpers['extends'](expr(left), expr(right)); + helper = options.targetES6 ? 'extendsES6' : 'extends'; + return helpers[helper](expr(left), expr(right)); } ], [ diff --git a/src/compiler.coffee b/src/compiler.coffee index 3aa0a3ac..ad5cf43e 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -361,26 +361,46 @@ generateSoak = do -> new CS.Conditional (foldl1 tests, (memo, t) -> new CS.LogicalAndOp memo, t), e +baseExtends = (myName, copyClassProperties) -> + protoAccess = (e) -> memberAccess e, 'prototype' + child = new JS.Identifier 'child' + parent = new JS.Identifier 'parent' + ctor = new JS.Identifier 'ctor' + + block = [ + copyClassProperties(parent, child) + funcDecl(id: ctor , body: new JS.BlockStatement [ + stmt new JS.AssignmentExpression '=', (memberAccess new JS.ThisExpression, 'constructor'), child + ]) + new JS.AssignmentExpression '=', (protoAccess ctor), protoAccess parent + new JS.AssignmentExpression '=', (protoAccess child), new JS.NewExpression ctor, [] + new JS.AssignmentExpression '=', (memberAccess child, '__super__'), protoAccess parent + new JS.ReturnStatement child + ] + funcDecl(id: helperNames[myName], params: [child, parent], body: (new JS.BlockStatement map block, stmt)) + helperNames = {} helpers = extends: -> - protoAccess = (e) -> memberAccess e, 'prototype' - child = new JS.Identifier 'child' - parent = new JS.Identifier 'parent' - ctor = new JS.Identifier 'ctor' key = new JS.Identifier 'key' - block = [ + copyClassProperties = (parent, child) -> new JS.ForInStatement (new JS.VariableDeclaration 'var', [new JS.VariableDeclarator key, null]), parent, new JS.IfStatement (helpers.isOwn parent, key), f = # TODO: figure out how we can allow this stmt new JS.AssignmentExpression '=', (new JS.MemberExpression yes, child, key), new JS.MemberExpression yes, parent, key - funcDecl(id: ctor , body: new JS.BlockStatement [ - stmt new JS.AssignmentExpression '=', (memberAccess new JS.ThisExpression, 'constructor'), child - ]) - new JS.AssignmentExpression '=', (protoAccess ctor), protoAccess parent - new JS.AssignmentExpression '=', (protoAccess child), new JS.NewExpression ctor, [] - new JS.AssignmentExpression '=', (memberAccess child, '__super__'), protoAccess parent - new JS.ReturnStatement child - ] - funcDecl(id: helperNames.extends, params: [child, parent], body: (new JS.BlockStatement map block, stmt)) + baseExtends('extends', copyClassProperties) + extendsES6: -> + # This version of the extends helper makes a CoffeeScript-style + # class able to extend a real ES6 class. The usual `extends` + # helper doesn't work because the properties we're trying to copy + # are non-enumerable. + copyClassProperties = (parent, child) -> + propertyNames = new JS.CallExpression (memberAccess new JS.Identifier('Object'), 'getOwnPropertyNames'), [parent] + key = new JS.Identifier 'key' + copyKey = new JS.AssignmentExpression('=', (new JS.MemberExpression yes, child, key), (new JS.MemberExpression yes, parent, key)) + condition = ['callee', 'caller', 'arguments'].map((forbidden) -> new JS.BinaryExpression('!==', key, new JS.Literal(forbidden))).reduce (a,b) -> new JS.BinaryExpression('&&', a, b) + conditional = new JS.IfStatement condition, forceBlock copyKey + func = funcExpr(params: [key], body: forceBlock conditional) + new JS.CallExpression (memberAccess propertyNames, 'forEach'), [func] + baseExtends('extendsES6', copyClassProperties) construct: -> child = new JS.Identifier 'child' ctor = new JS.Identifier 'ctor' @@ -1013,7 +1033,11 @@ class exports.Compiler if parent? params.push parentRef args.push parent - block.body.unshift stmt helpers.extends name, parentRef + helper = if options.targetES6 + 'extendsES6' + else + 'extends' + block.body.unshift stmt helpers[helper] name, parentRef block.body.push new JS.ReturnStatement new JS.ThisExpression rewriteThis = generateMutatingWalker -> @@ -1324,7 +1348,10 @@ class exports.Compiler else helpers.in (expr left), expr right ] - [CS.ExtendsOp, ({left, right}) -> helpers.extends (expr left), expr right] + [CS.ExtendsOp, ({left, right, options}) -> + helper = if options.targetES6 then 'extendsES6' else 'extends' + helpers[helper] (expr left), expr right + ] [CS.InstanceofOp, ({left, right}) -> new JS.BinaryExpression 'instanceof', (expr left), expr right] [CS.LogicalAndOp, ({left, right}) -> new JS.LogicalExpression '&&', (expr left), expr right] From bec2447a036ac54d8b9e8c9d00f824a9a19ea4de Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 22:57:50 -0400 Subject: [PATCH 55/64] fix a broken (in master) test This test was unintentionally calling a constructor without "new". ES6 puts the smack down on that kind of bug. --- test/classes.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/classes.coffee b/test/classes.coffee index abb69368..1ef27ced 100644 --- a/test/classes.coffee +++ b/test/classes.coffee @@ -468,7 +468,7 @@ suite 'Classes', -> # Ensure that constructors invoked with splats cache the function. called = 0 get = -> if called++ then false else class Type - new get() args... + new (get()) args... test '`new` shouldn\'t add extra parens', -> From 48104af6dde5b08c45f6025c507cdbcc08f311f7 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 31 May 2015 23:27:15 -0400 Subject: [PATCH 56/64] disabling some tests that can't work with ES6 classes --- README-ES6.md | 4 ++++ test/classes.coffee | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README-ES6.md b/README-ES6.md index a1161be5..5344cc0c 100644 --- a/README-ES6.md +++ b/README-ES6.md @@ -71,6 +71,10 @@ to patch over. already call super, we will insert a `super()` call to make your class legal. + - if you call `super` in a function that's not inside a class + definition, and try to attach that function to a class and use it, + the `super` is not going to work. + - In CoffeeScript, a parameter's default value is used if the given value is `null` or `undefined`. In ES6, a parameter's default value is only used if the given value is `undefined`. diff --git a/test/classes.coffee b/test/classes.coffee index 1ef27ced..bfc45fb3 100644 --- a/test/classes.coffee +++ b/test/classes.coffee @@ -4,6 +4,14 @@ suite 'Classes', -> test "Overriding the static property new doesn't clobber Function::new", -> + # This test doesn't work with ES6 classes. In CoffeesScript, + # class properties (like `new` below) are copied from parent + # class to child class. But in ES6 classes, they use real + # prototypical inheritance. So `delete TwoClass.new` doesn't do + # anything, and `TwoClass.new` will continue referring to + # OneClass's `new` via the prototype chain. + return if __TARGET_ES6__ + class OneClass @new: 'new' function: 'function' @@ -516,7 +524,11 @@ suite 'Classes', -> ok Base.static('word') is 'static/word' FirstChild::func = (string) -> - super('one/').length + string + if __TARGET_ES6__ + # you cannot use 'super' outside of the class definition in ES6. + Base.prototype.func.call(this, 'one/').length + string + else + super('one/').length + string result = (new ThirdChild).func 'four' # eq result, '9two/three/four' # can't pass super('one/').length + string From a96514d684cacfd76a8f5cf74ff7b40c764d5b1d Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 00:01:37 -0400 Subject: [PATCH 57/64] use SpreadElement in function application --- lib/compiler.js | 20 ++++++++++++++------ lib/js-nodes.js | 5 +++++ src/compiler.coffee | 20 ++++++++++++++------ src/js-nodes.coffee | 1 + 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index dc813622..e10f34da 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1965,10 +1965,15 @@ exports.Compiler = function () { } tagForES6 = function (node) { node.toES6Super = function () { - if (functionName === 'constructor') { - return new JS.CallExpression(new JS.Identifier('super'), map(args, expr)); + var callee; + callee = functionName === 'constructor' ? new JS.Identifier('super') : memberAccess(new JS.Identifier('super'), functionName); + if (args.length > 0) { + return new JS.CallExpression(callee, map(args, expr)); } else { - return new JS.CallExpression(memberAccess(new JS.Identifier('super'), functionName), map(args, expr)); + return new JS.CallExpression(memberAccess(callee, 'apply'), [ + new JS.ThisExpression, + new JS.Identifier('arguments') + ]); } }; return node; @@ -2039,15 +2044,16 @@ exports.Compiler = function () { [ CS.FunctionApplication, function (param$) { - var args, cache$2, compile, context, lhs; + var args, cache$2, compile, context, lhs, options; var fn; { cache$2 = param$; fn = cache$2['function']; args = cache$2['arguments']; compile = cache$2.compile; + options = cache$2.options; } - if (any(args, function (m) { + if (!options.targetES6 && any(args, function (m) { return m.spread; })) { lhs = this['function']; @@ -2070,7 +2076,9 @@ exports.Compiler = function () { } else if (hasSoak(this)) { return compile(generateSoak(this)); } else { - return new JS.CallExpression(expr(fn), map(args, expr)); + return new JS.CallExpression(expr(fn), map(args, function (a) { + return expr(options.targetES6 && a.spread ? new JS.SpreadElement(a.expression) : a); + })); } } ], diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 95874225..f07d6d2a 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -360,6 +360,11 @@ nodeData = [ false, ['expressions'] ], + [ + 'SpreadElement', + false, + ['argument'] + ], [ 'SwitchCase', true, diff --git a/src/compiler.coffee b/src/compiler.coffee index ad5cf43e..50e47450 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -1123,10 +1123,14 @@ class exports.Compiler # our enclosing class may turn out to be untranspilable. So for # now we just tag the node as eligible to be converted. node.toES6Super = -> - if functionName == 'constructor' - new JS.CallExpression new JS.Identifier('super'), (map args, expr) + callee = if functionName == 'constructor' + new JS.Identifier('super') else - new JS.CallExpression (memberAccess new JS.Identifier('super'), functionName), (map args, expr) + memberAccess new JS.Identifier('super'), functionName + if args.length > 0 + new JS.CallExpression callee, (map args, expr) + else + new JS.CallExpression (memberAccess callee, 'apply'), [new JS.ThisExpression, new JS.Identifier('arguments')] node classNode = find ancestry, (node) => @@ -1193,8 +1197,8 @@ class exports.Compiler new JS.CallExpression (memberAccess (memberAccess (memberAccess (new JS.Identifier className) , '__super__'), functionName), 'call'), calledExprs ] - [CS.FunctionApplication, ({function: fn, arguments: args, compile}) -> - if any args, (m) -> m.spread + [CS.FunctionApplication, ({function: fn, arguments: args, compile, options}) -> + if (not options.targetES6) and any args, (m) -> m.spread lhs = @function context = new CS.Null if needsCaching @function @@ -1212,7 +1216,11 @@ class exports.Compiler context = new CS.SoakedMemberAccessOp context, 'prototype' compile new CS.FunctionApplication (new CS.MemberAccessOp lhs, 'apply'), [context, new CS.ArrayInitialiser @arguments] else if hasSoak this then compile generateSoak this - else new JS.CallExpression (expr fn), map args, expr + else new JS.CallExpression (expr fn), map args, (a) -> + expr if options.targetES6 and a.spread + new JS.SpreadElement a.expression + else + a ] [CS.SoakedFunctionApplication, ({compile}) -> compile generateSoak this] [CS.NewOp, ({ctor, arguments: args, compile}) -> diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 445f761c..563466dc 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -82,6 +82,7 @@ nodeData = [ ['RestElement' , yes, ['argument']] ['ReturnStatement' , yes, ['argument']] ['SequenceExpression' , no , ['expressions']] + ['SpreadElement' , no, ['argument']] ['SwitchCase' , yes, ['test', 'consequent']] ['SwitchStatement' , yes, ['discriminant', 'cases']] ['ThisExpression' , no , []] From 4865d69ce703777b4868109037711580be409e74 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 00:18:21 -0400 Subject: [PATCH 58/64] use SpreadElement in array initializer --- lib/compiler.js | 13 +++++++++---- src/compiler.coffee | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index e10f34da..372e18d9 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1419,13 +1419,14 @@ exports.Compiler = function () { } }; return function (param$) { - var cache$2, compile, grouped, members; + var cache$2, compile, grouped, members, options; { cache$2 = param$; members = cache$2.members; compile = cache$2.compile; + options = cache$2.options; } - if (any(members, function (m) { + if (!options.targetES6 && any(members, function (m) { return m.spread; })) { grouped = map(groupMembers(members), expr); @@ -1435,7 +1436,9 @@ exports.Compiler = function () { return new JS.CallExpression(memberAccess(grouped[0], 'concat'), grouped.slice(1)); } } else { - return new JS.ArrayExpression(map(members, expr)); + return new JS.ArrayExpression(map(members, function (m) { + return expr(m.spread ? new JS.SpreadElement(m.expression) : m); + })); } }; }() @@ -2485,7 +2488,9 @@ exports.Compiler = function () { left = cache$2.left; right = cache$2.right; } - if (right['instanceof'](JS.ArrayExpression) && right.elements.length < 5) { + if (right['instanceof'](JS.ArrayExpression) && right.elements.length < 5 && all(right.elements, function (elt) { + return !(elt instanceof JS.SpreadElement); + })) { switch (right.elements.length) { case 0: if (needsCaching(this.left)) { diff --git a/src/compiler.coffee b/src/compiler.coffee index 50e47450..a6ccc8a0 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -805,13 +805,17 @@ class exports.Compiler [ys, zs] = [sliced, zs[1..]] else ys = new JS.ArrayExpression map ys, expr [ys].concat groupMembers zs - ({members, compile}) -> - if any members, (m) -> m.spread + ({members, compile, options}) -> + if (not options.targetES6) and any members, (m) -> m.spread grouped = map (groupMembers members), expr if grouped.length <= 1 then grouped[0] else new JS.CallExpression (memberAccess grouped[0], 'concat'), grouped[1..] else - new JS.ArrayExpression map members, expr + new JS.ArrayExpression map members, (m) -> + expr if m.spread + new JS.SpreadElement(m.expression) + else + m ] [CS.Spread, ({expression}) -> {spread: yes, expression: expr expression}] [CS.ObjectInitialiser, ({members}) -> new JS.ObjectExpression members] @@ -1338,7 +1342,7 @@ class exports.Compiler [CS.OfOp, ({left, right}) -> new JS.BinaryExpression 'in', (expr left), expr right] [CS.InOp, ({left, right}) -> - if (right.instanceof JS.ArrayExpression) and right.elements.length < 5 + if (right.instanceof JS.ArrayExpression) and right.elements.length < 5 and all right.elements, (elt) -> not (elt instanceof JS.SpreadElement) switch right.elements.length when 0 if needsCaching @left From 6190214edab8cd74851a962c29f2cac6ca26cea5 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 00:34:02 -0400 Subject: [PATCH 59/64] use spread element for invoking default super arguments --- lib/compiler.js | 10 ++-------- src/compiler.coffee | 7 ++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 372e18d9..893a32fb 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1970,14 +1970,8 @@ exports.Compiler = function () { node.toES6Super = function () { var callee; callee = functionName === 'constructor' ? new JS.Identifier('super') : memberAccess(new JS.Identifier('super'), functionName); - if (args.length > 0) { - return new JS.CallExpression(callee, map(args, expr)); - } else { - return new JS.CallExpression(memberAccess(callee, 'apply'), [ - new JS.ThisExpression, - new JS.Identifier('arguments') - ]); - } + args = args.length > 0 ? map(args, expr) : [new JS.SpreadElement(new JS.Identifier('arguments'))]; + return new JS.CallExpression(callee, args); }; return node; }; diff --git a/src/compiler.coffee b/src/compiler.coffee index a6ccc8a0..dd623448 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -1131,10 +1131,11 @@ class exports.Compiler new JS.Identifier('super') else memberAccess new JS.Identifier('super'), functionName - if args.length > 0 - new JS.CallExpression callee, (map args, expr) + args = if args.length > 0 + map args, expr else - new JS.CallExpression (memberAccess callee, 'apply'), [new JS.ThisExpression, new JS.Identifier('arguments')] + [new JS.SpreadElement(new JS.Identifier('arguments'))] + new JS.CallExpression callee, args node classNode = find ancestry, (node) => From 93690f6a3514b4b0cc822100b47eaf1e797de58f Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 01:05:53 -0400 Subject: [PATCH 60/64] object destructure --- lib/compiler.js | 7 +++++++ lib/js-nodes.js | 12 ++++++++++-- src/compiler.coffee | 6 ++++++ src/js-nodes.coffee | 6 ++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 893a32fb..b8dad800 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -430,6 +430,13 @@ es6AssignmentPattern = function (assignee) { }) && elements.length > 0) { return new JS.ArrayPattern(elements); } + } else if (assignee instanceof JS.ObjectExpression) { + return new JS.ObjectPattern(assignee.properties.map(function (p) { + if (p.value instanceof JS.Identifier && p.value.name === p.key.name) { + p.shorthand = true; + } + return p; + })); } }; assignment = function (assignee, expression, options, valueUsed) { diff --git a/lib/js-nodes.js b/lib/js-nodes.js index f07d6d2a..558a1e29 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 2.0.0-beta9-dev -var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, cache$, cache$1, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; +var ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, BinaryExpression, BlockStatement, cache$, cache$1, CallExpression, ClassBody, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, ObjectPattern, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration; difference = require('./functional-helpers').difference; exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this; createNode = function (type, props) { @@ -69,7 +69,8 @@ exports.Nodes = Nodes = function () { 'raw', 'expression', 'generator', - 'static' + 'static', + 'shorthand' ], i$2 = 0, length$2 = cache$.length; i$2 < length$2; ++i$2) { property = cache$[i$2]; if (null != this[property] && !in$(property, this.childNodes)) { @@ -332,6 +333,11 @@ nodeData = [ false, ['properties'] ], + [ + 'ObjectPattern', + false, + ['properties'] + ], [ 'Program', true, @@ -476,6 +482,7 @@ UnaryExpression = cache$1.UnaryExpression; NewExpression = cache$1.NewExpression; VariableDeclaration = cache$1.VariableDeclaration; ObjectExpression = cache$1.ObjectExpression; +ObjectPattern = cache$1.ObjectPattern; MemberExpression = cache$1.MemberExpression; UpdateExpression = cache$1.UpdateExpression; AssignmentExpression = cache$1.AssignmentExpression; @@ -538,6 +545,7 @@ handleLists(FunctionExpression, [ ]); handleLists(NewExpression, ['arguments']); handleLists(ObjectExpression, ['properties']); +handleLists(ObjectPattern, ['properties']); handleLists(Program, ['body']); handleLists(SequenceExpression, ['expressions']); handleLists(SwitchCase, ['consequent']); diff --git a/src/compiler.coffee b/src/compiler.coffee index dd623448..3ad72b10 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -233,6 +233,12 @@ es6AssignmentPattern = (assignee) -> es6AssignmentPattern(elt) if all(elements, (elt) -> elt?) and elements.length > 0 new JS.ArrayPattern(elements) + else if assignee instanceof JS.ObjectExpression + new JS.ObjectPattern assignee.properties.map (p) -> + if (p.value instanceof JS.Identifier) and p.value.name == p.key.name + p.shorthand = true + p + # TODO: rewrite this whole thing using the CS AST nodes assignment = (assignee, expression, options, valueUsed = no) -> diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index 563466dc..a1c05f38 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -30,7 +30,7 @@ exports.Nodes = class Nodes if @raw? then @offset + @raw.length else undefined ] - for property in ['leadingComments', 'raw', 'expression', 'generator', 'static'] + for property in ['leadingComments', 'raw', 'expression', 'generator', 'static', 'shorthand'] if this[property]? && property not in @childNodes obj[property] = this[property] obj @@ -77,6 +77,7 @@ nodeData = [ ['MethodDefinition' , no , ['key', 'value']] ['NewExpression' , no , ['callee', 'arguments']] ['ObjectExpression' , no , ['properties']] + ['ObjectPattern' , no , ['properties']] ['Program' , yes, ['body']] ['Property' , yes, ['key', 'value']] ['RestElement' , yes, ['argument']] @@ -105,7 +106,7 @@ for [node, isStatement, params] in nodeData { Program, BlockStatement, Literal, Identifier, FunctionExpression, CallExpression, SequenceExpression, ArrayExpression, ArrayPattern, BinaryExpression, - UnaryExpression, NewExpression, VariableDeclaration, ObjectExpression, + UnaryExpression, NewExpression, VariableDeclaration, ObjectExpression, ObjectPattern, MemberExpression, UpdateExpression, AssignmentExpression, LogicalExpression, GenSym, FunctionDeclaration, VariableDeclaration, SwitchStatement, SwitchCase, TryStatement, ArrowFunctionExpression, ClassBody @@ -146,6 +147,7 @@ handleLists FunctionDeclaration, ['params', 'defaults'] handleLists FunctionExpression, ['params', 'defaults'] handleLists NewExpression, ['arguments'] handleLists ObjectExpression, ['properties'] +handleLists ObjectPattern, ['properties'] handleLists Program, ['body'] handleLists SequenceExpression, ['expressions'] handleLists SwitchCase, ['consequent'] From d2baf9235784cded16510824151962b5fd8d975b Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 01:19:56 -0400 Subject: [PATCH 61/64] ObjectPattern keys don't create local bindings --- lib/compiler.js | 6 ++++++ src/compiler.coffee | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index b8dad800..b8a06ec3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -349,6 +349,12 @@ collectIdentifiers = function (node) { return [node.name]; case !(node['instanceof'](JS.MemberExpression) && !node.computed): return collectIdentifiers(node.object); + case !node['instanceof'](JS.ObjectPattern): + return map(node.properties, function (p) { + return collectIdentifiers(p.value); + }).reduce(function (a, b) { + return a.concat(b); + }, []); default: return mapChildNodes(node, collectIdentifiers, function (a, b) { return a.concat(b); diff --git a/src/compiler.coffee b/src/compiler.coffee index 3ad72b10..7b966774 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -182,6 +182,8 @@ collectIdentifiers = (node) -> nub switch when node.instanceof JS.Identifier then [node.name] when (node.instanceof JS.MemberExpression) and not node.computed collectIdentifiers node.object + when node.instanceof JS.ObjectPattern + map(node.properties, (p) -> collectIdentifiers(p.value)).reduce(((a,b) -> a.concat(b)), []) else mapChildNodes node, collectIdentifiers, ((a,b)->a.concat(b)), [] # TODO: something like Optimiser.mayHaveSideEffects From 9e8898219db1c9175bb035cdfa09669a53bbfe2e Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 03:13:18 -0400 Subject: [PATCH 62/64] support nested patterns inside object patterns --- src/compiler.coffee | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/compiler.coffee b/src/compiler.coffee index 7b966774..fc405370 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -236,10 +236,15 @@ es6AssignmentPattern = (assignee) -> if all(elements, (elt) -> elt?) and elements.length > 0 new JS.ArrayPattern(elements) else if assignee instanceof JS.ObjectExpression - new JS.ObjectPattern assignee.properties.map (p) -> - if (p.value instanceof JS.Identifier) and p.value.name == p.key.name - p.shorthand = true - p + props = assignee.properties.map (p) -> + if p.value instanceof JS.Identifier + if p.value.name == p.key.name + p.shorthand = true + p + else if (pattern = es6AssignmentPattern p.value) + new JS.Property p.key, pattern + if all(props, (elt) -> elt?) and props.length > 0 + new JS.ObjectPattern props # TODO: rewrite this whole thing using the CS AST nodes From 69966f0d0d773ac0194b0920e42ff1307d0a6e7d Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 03:13:42 -0400 Subject: [PATCH 63/64] transpile some ForIn to ForOf --- lib/compiler.js | 95 ++++++++++++++++++++++++++++++++++++++++----- lib/js-nodes.js | 14 +++++++ src/compiler.coffee | 48 ++++++++++++++++++++++- src/js-nodes.coffee | 2 + 4 files changed, 148 insertions(+), 11 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index b8a06ec3..5ffbe273 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -161,7 +161,7 @@ expr = function (s) { consequent = expr(null != s.consequent ? s.consequent : helpers.undef()); alternate = expr(null != s.alternate ? s.alternate : helpers.undef()); return new JS.ConditionalExpression(s.test, consequent, alternate); - } else if (s['instanceof'](JS.ForInStatement, JS.ForStatement, JS.WhileStatement)) { + } else if (s['instanceof'](JS.ForInStatement, JS.ForOfStatement, JS.ForStatement, JS.WhileStatement)) { accum = genSym('accum'); push = function (x) { return stmt(new JS.CallExpression(memberAccess(accum, 'push'), [x])); @@ -306,7 +306,7 @@ declarationsNeeded = function (node) { if (!(null != node)) { return []; } - if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' || node['instanceof'](JS.ForInStatement)) { + if (node['instanceof'](JS.AssignmentExpression) && node.operator === '=' || node['instanceof'](JS.ForInStatement) || node['instanceof'](JS.ForOfStatement)) { return declaredIdentifiers(node.left); } else { return []; @@ -421,7 +421,7 @@ dynamicMemberAccess = function (e, index) { } }; es6AssignmentPattern = function (assignee) { - var elements, elt, index; + var elements, elt, index, props; if (assignee instanceof JS.ArrayExpression) { elements = function (accum$) { for (var i$ = 0, length$ = assignee.elements.length; i$ < length$; ++i$) { @@ -437,12 +437,22 @@ es6AssignmentPattern = function (assignee) { return new JS.ArrayPattern(elements); } } else if (assignee instanceof JS.ObjectExpression) { - return new JS.ObjectPattern(assignee.properties.map(function (p) { - if (p.value instanceof JS.Identifier && p.value.name === p.key.name) { - p.shorthand = true; + props = assignee.properties.map(function (p) { + var pattern; + if (p.value instanceof JS.Identifier) { + if (p.value.name === p.key.name) { + p.shorthand = true; + } + return p; + } else if (pattern = es6AssignmentPattern(p.value)) { + return new JS.Property(p.key, pattern); } - return p; - })); + }); + if (all(props, function (elt) { + return null != elt; + }) && props.length > 0) { + return new JS.ObjectPattern(props); + } } }; assignment = function (assignee, expression, options, valueUsed) { @@ -785,6 +795,57 @@ helpers = { ], body: makeReturn(new JS.BlockStatement(map(functionBody, stmt))) }); + }, + range: function () { + var body, first, fn, i, init, isInclusive, last, step, test, update; + first = new JS.Identifier('first'); + last = new JS.Identifier('last'); + step = new JS.Identifier('step'); + isInclusive = new JS.Identifier('isInclusive'); + i = new JS.Identifier('i'); + init = new JS.VariableDeclaration('let', [new JS.VariableDeclarator(i, first)]); + test = new JS.ConditionalExpression(isInclusive, new JS.BinaryExpression('<=', i, last), new JS.BinaryExpression('<', i, last)); + update = new JS.AssignmentExpression('=', i, new JS.BinaryExpression('+', i, step)); + body = [new JS.ForStatement(init, test, update, new JS.BlockStatement([stmt(new JS.YieldExpression(i))]))]; + fn = funcDecl({ + id: helperNames.range, + params: [ + first, + last, + step, + isInclusive + ], + defaults: [ + null, + null, + new JS.Literal(1), + new JS.Literal(false) + ], + body: new JS.BlockStatement(map(body, stmt)) + }); + fn.generator = true; + return fn; + }, + inclusiveRange: function () { + var body, first, last, step; + first = new JS.Identifier('first'); + last = new JS.Identifier('last'); + step = new JS.Identifier('step'); + body = [makeReturn(helpers.range(first, last, step, new JS.Literal(true)))]; + return funcDecl({ + id: helperNames.inclusiveRange, + params: [ + first, + last, + step + ], + defaults: [ + null, + null, + new JS.Literal(1) + ], + body: new JS.BlockStatement(body) + }); } }; enabledHelpers = []; @@ -1141,7 +1202,7 @@ exports.Compiler = function () { [ CS.ForIn, function (param$) { - var block, body, cache$2, compile, e, filter, i, increment, k, keyAssignee, length, op, options, step, target, update, valAssignee, varDeclaration; + var block, body, cache$2, compile, e, es6Target, filter, i, increment, k, keyAssignee, length, op, options, rangeArgs, step, target, update, valAssignee, varDeclaration; { cache$2 = param$; valAssignee = cache$2.valAssignee; @@ -1153,6 +1214,22 @@ exports.Compiler = function () { compile = cache$2.compile; options = cache$2.options; } + if (options.targetES6 && !filter) { + es6Target = this.target['instanceof'](CS.Range) ? (rangeArgs = [ + compile(this.target.left), + compile(this.target.right) + ], !(step instanceof JS.Literal && step.value === 1) ? rangeArgs.push(step) : void 0, this.target.isInclusive ? helpers.inclusiveRange.apply(helpers, [].slice.call(rangeArgs)) : helpers.range.apply(helpers, [].slice.call(rangeArgs))) : step instanceof JS.Literal && step.value === 1 ? target : void 0; + if (es6Target) { + if (valAssignee && keyAssignee) { + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(new JS.ArrayPattern([ + keyAssignee, + valAssignee + ]))]), new JS.CallExpression(memberAccess(es6Target, 'entries'), []), forceBlock(body)); + } else if (valAssignee) { + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(valAssignee)]), es6Target, forceBlock(body)); + } + } + } i = genSym('i'); length = genSym('length'); block = forceBlock(body); diff --git a/lib/js-nodes.js b/lib/js-nodes.js index 558a1e29..582ade4e 100644 --- a/lib/js-nodes.js +++ b/lib/js-nodes.js @@ -227,6 +227,15 @@ nodeData = [ 'body' ] ], + [ + 'ForOfStatement', + true, + [ + 'left', + 'right', + 'body' + ] + ], [ 'ForStatement', true, @@ -454,6 +463,11 @@ nodeData = [ 'object', 'body' ] + ], + [ + 'YieldExpression', + false, + ['argument'] ] ]; for (var i$ = 0, length$ = nodeData.length; i$ < length$; ++i$) { diff --git a/src/compiler.coffee b/src/compiler.coffee index fc405370..cb722084 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -80,7 +80,7 @@ expr = (s) -> consequent = expr (s.consequent ? helpers.undef()) alternate = expr (s.alternate ? helpers.undef()) new JS.ConditionalExpression s.test, consequent, alternate - else if s.instanceof JS.ForInStatement, JS.ForStatement, JS.WhileStatement + else if s.instanceof JS.ForInStatement, JS.ForOfStatement, JS.ForStatement, JS.WhileStatement accum = genSym 'accum' # TODO: remove accidental mutation like this in these helpers push = (x) -> stmt new JS.CallExpression (memberAccess accum, 'push'), [x] @@ -160,7 +160,7 @@ declaredIdentifiers = (node) -> declarationsNeeded = (node) -> return [] unless node? - if ((node.instanceof JS.AssignmentExpression) and node.operator is '=') or (node.instanceof JS.ForInStatement) + if ((node.instanceof JS.AssignmentExpression) and node.operator is '=') or (node.instanceof JS.ForInStatement) or (node.instanceof JS.ForOfStatement) declaredIdentifiers(node.left) else [] @@ -452,6 +452,31 @@ helpers = new JS.Literal no ] funcDecl(id: helperNames.in, params: [member, list], body: (makeReturn new JS.BlockStatement map functionBody, stmt)) + range: -> + first = new JS.Identifier('first') + last = new JS.Identifier('last') + step = new JS.Identifier('step') + isInclusive = new JS.Identifier('isInclusive') + i = new JS.Identifier('i') + init = new JS.VariableDeclaration 'let', [ new JS.VariableDeclarator i, first ] + test = new JS.ConditionalExpression(isInclusive, (new JS.BinaryExpression '<=', i, last), (new JS.BinaryExpression '<', i, last)) + update = new JS.AssignmentExpression '=', i, new JS.BinaryExpression '+', i, step + body = [ + new JS.ForStatement init, test, update, new JS.BlockStatement [stmt new JS.YieldExpression i] + ] + fn = funcDecl(id: helperNames.range, params: [first, last, step, isInclusive], defaults: [null, null, new JS.Literal(1), new JS.Literal(false)], body: new JS.BlockStatement map body, stmt) + fn.generator = true + fn + + inclusiveRange: -> + first = new JS.Identifier('first') + last = new JS.Identifier('last') + step = new JS.Identifier('step') + body = [ + makeReturn helpers.range first, last, step, new JS.Literal(true) + ] + funcDecl(id: helperNames.inclusiveRange, params: [first, last, step], defaults: [null, null, new JS.Literal(1)], body: new JS.BlockStatement body ) + enabledHelpers = [] for own h, fn of helpers @@ -671,6 +696,25 @@ class exports.Compiler new JS.IfStatement (expr condition), (forceBlock consequent), alternate ] [CS.ForIn, ({valAssignee, keyAssignee, target, step, filter, body, compile, options}) -> + if options.targetES6 and !filter + es6Target = if @target.instanceof CS.Range + rangeArgs = [compile(@target.left), compile(@target.right)] + unless (step instanceof JS.Literal) and step.value == 1 + rangeArgs.push step + if @target.isInclusive + helpers.inclusiveRange(rangeArgs...) + else + helpers.range(rangeArgs...) + else if (step instanceof JS.Literal) and step.value == 1 + target + + if es6Target + if valAssignee and keyAssignee + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator new JS.ArrayPattern([keyAssignee, valAssignee])]), new JS.CallExpression((memberAccess es6Target, 'entries'), []), forceBlock body) + else if valAssignee + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator valAssignee]), es6Target, forceBlock body) + + i = genSym 'i' length = genSym 'length' block = forceBlock body diff --git a/src/js-nodes.coffee b/src/js-nodes.coffee index a1c05f38..32f5d1c8 100644 --- a/src/js-nodes.coffee +++ b/src/js-nodes.coffee @@ -64,6 +64,7 @@ nodeData = [ ['EmptyStatement' , yes, []] ['ExpressionStatement' , yes, ['expression']] ['ForInStatement' , yes, ['left', 'right', 'body']] + ['ForOfStatement' , yes, ['left', 'right', 'body']] ['ForStatement' , yes, ['init', 'test', 'update', 'body']] ['FunctionDeclaration' , yes, ['id', 'params', 'defaults', 'rest', 'body']] ['FunctionExpression' , no , ['id', 'params', 'defaults', 'rest', 'body']] @@ -95,6 +96,7 @@ nodeData = [ ['VariableDeclarator' , yes, ['id', 'init']] ['WhileStatement' , yes, ['test', 'body']] ['WithStatement' , yes, ['object', 'body']] + ['YieldExpression' , no, ['argument']] ] for [node, isStatement, params] in nodeData From b4ead4c3a3903d0147a5452d80d10263c496a62d Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 1 Jun 2015 03:31:11 -0400 Subject: [PATCH 64/64] support arbitrary patterns for ForIn value patterns --- lib/compiler.js | 12 ++++++------ src/compiler.coffee | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 5ffbe273..0379f88d 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1202,7 +1202,7 @@ exports.Compiler = function () { [ CS.ForIn, function (param$) { - var block, body, cache$2, compile, e, es6Target, filter, i, increment, k, keyAssignee, length, op, options, rangeArgs, step, target, update, valAssignee, varDeclaration; + var block, body, cache$2, compile, e, es6Target, filter, i, increment, k, keyAssignee, length, op, options, rangeArgs, step, target, update, valAssignee, valPattern, varDeclaration; { cache$2 = param$; valAssignee = cache$2.valAssignee; @@ -1219,14 +1219,14 @@ exports.Compiler = function () { compile(this.target.left), compile(this.target.right) ], !(step instanceof JS.Literal && step.value === 1) ? rangeArgs.push(step) : void 0, this.target.isInclusive ? helpers.inclusiveRange.apply(helpers, [].slice.call(rangeArgs)) : helpers.range.apply(helpers, [].slice.call(rangeArgs))) : step instanceof JS.Literal && step.value === 1 ? target : void 0; - if (es6Target) { - if (valAssignee && keyAssignee) { + if (es6Target && valAssignee && (valPattern = valAssignee instanceof JS.Identifier ? valAssignee : es6AssignmentPattern(valAssignee))) { + if (keyAssignee) { return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(new JS.ArrayPattern([ keyAssignee, - valAssignee + valPattern ]))]), new JS.CallExpression(memberAccess(es6Target, 'entries'), []), forceBlock(body)); - } else if (valAssignee) { - return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(valAssignee)]), es6Target, forceBlock(body)); + } else { + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator(valPattern)]), es6Target, forceBlock(body)); } } } diff --git a/src/compiler.coffee b/src/compiler.coffee index cb722084..7f3d0e28 100644 --- a/src/compiler.coffee +++ b/src/compiler.coffee @@ -708,11 +708,11 @@ class exports.Compiler else if (step instanceof JS.Literal) and step.value == 1 target - if es6Target - if valAssignee and keyAssignee - return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator new JS.ArrayPattern([keyAssignee, valAssignee])]), new JS.CallExpression((memberAccess es6Target, 'entries'), []), forceBlock body) - else if valAssignee - return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator valAssignee]), es6Target, forceBlock body) + if es6Target and valAssignee and (valPattern = if (valAssignee instanceof JS.Identifier) then valAssignee else es6AssignmentPattern(valAssignee)) + if keyAssignee + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator new JS.ArrayPattern([keyAssignee, valPattern])]), new JS.CallExpression((memberAccess es6Target, 'entries'), []), forceBlock body) + else + return new JS.ForOfStatement(new JS.VariableDeclaration('var', [new JS.VariableDeclarator valPattern]), es6Target, forceBlock body) i = genSym 'i'