diff --git a/Objective-J/FileExecutable.js b/Objective-J/FileExecutable.js index 52173dce6..002586f0f 100644 --- a/Objective-J/FileExecutable.js +++ b/Objective-J/FileExecutable.js @@ -40,22 +40,8 @@ function FileExecutable(/*CFURL|String*/ aURL, /*Dictionary*/ aFilenameTranslate if (fileContents.match(/^@STATIC;/)) executable = decompile(fileContents, aURL); - else if ((extension === "j" || !extension) && !fileContents.match(/^{/)) - { - var start = new Date().getTime(); - if (!exports.ObjJCompiler.usedVersion || exports.ObjJCompiler.usedVersion === "acorn") - executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, ObjJCompiler.Flags.IncludeDebugSymbols); - else if (exports.ObjJCompiler.usedVersion === "objj_compiler2") - executable = exports.ObjJCompiler.compileFileDependencies(fileContents, aURL, ObjJCompiler.Flags.IncludeDebugSymbols); - else if (exports.ObjJCompiler.usedVersion === "preprocessor") - executable = exports.preprocess(fileContents, aURL, Preprocessor.Flags.IncludeDebugSymbols); - else - throw new Error("Compiler to use is set to " + exports.ObjJCompiler.usedVersion + " but we only support 'preprocessor' (old compiler), 'objj_compiler2' and 'acorn'"); - - var time = (new Date().getTime() - start) / 1000; - //print("Compile '" + (exports.ObjJCompiler.usedVersion || "preprocessor") + "' " + aURL + " in " + time + " seconds"); - } + executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, ObjJAcornCompiler.Flags.IncludeDebugSymbols); else executable = new Executable(fileContents, [], aURL); diff --git a/Objective-J/Includes.js b/Objective-J/Includes.js index f9026cad1..4bfcacad4 100644 --- a/Objective-J/Includes.js +++ b/Objective-J/Includes.js @@ -43,8 +43,6 @@ #include "CFBundle.js" #include "StaticResource.js" #include "Preprocessor.js" -#include "Parser.js" -#include "ObjJCompiler.js" #include "acorn.js" #include "acornwalk.js" #include "ObjJAcornCompiler.js" diff --git a/Objective-J/ObjJAcornCompiler.js b/Objective-J/ObjJAcornCompiler.js index 1eb696877..da456cada 100644 --- a/Objective-J/ObjJAcornCompiler.js +++ b/Objective-J/ObjJAcornCompiler.js @@ -197,6 +197,18 @@ ObjJAcornCompiler.prototype.compilePass2 = function() return this.jsBuffer.toString(); } +var currentCompilerFlags = ""; + +exports.setCurrentCompilerFlags = function(/*String*/ compilerFlags) +{ + currentCompilerFlags = compilerFlags; +} + +exports.currentCompilerFlags = function(/*String*/ compilerFlags) +{ + return currentCompilerFlags; +} + ObjJAcornCompiler.Flags = { }; ObjJAcornCompiler.Flags.IncludeDebugSymbols = 1 << 0; diff --git a/Objective-J/ObjJCompiler.js b/Objective-J/ObjJCompiler.js deleted file mode 100644 index 5b8a73652..000000000 --- a/Objective-J/ObjJCompiler.js +++ /dev/null @@ -1,4706 +0,0 @@ -/* - * ObjJCompiler.js - * Objective-J - * - * Created by Martin Carlberg. - * Copyright 2012, Martin Carlberg. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -var currentCompilerFlags = ""; - -var ObjJCompiler = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags, /*unsigned*/ pass) -{ - aString = aString.replace(/^\#.*/gm, ""); - this._URL = new CFURL(aURL); - this._pass = pass; - // If this is pass one we should not save anything in javascript buffer - if (pass === 1) - this._jsBuffer = null; - else - this._jsBuffer = new StringBuffer(); - this._imBuffer = null; - this._cmBuffer = null; - - //var start = new Date().getTime(); -#ifdef BROWSER - console.time("Parse - " + aURL); -#endif - this._tokens = exports.Parser.parse(aString); - //var end = new Date().getTime(); - //var time = (end - start) / 1000; - //print("Parse: " + aURL + " in " + time + " seconds"); -#ifdef BROWSER - console.timeEnd("Parse - " + aURL); -#endif - this._dependencies = []; - this._flags = flags | ObjJCompiler.Flags.IncludeDebugSymbols; - this._classDefs = {}; - //var start = new Date().getTime(); -#ifdef BROWSER - console.time("Compile pass " + pass + " - " + aURL); -#endif - try { - this.nodeDocument(this._tokens); - } - catch (e) { - #ifdef BROWSER - //console.log("Error: " + e + ", file content: " + aString); - #else - //print("Error: " + e + ", file content: " + aString); - #endif - throw e; - } - //var end = new Date().getTime(); - //var time = (end - start) / 1000; - //print("Compile pass 1: " + aURL + " in " + time + " seconds"); -#ifdef BROWSER - console.timeEnd("Compile pass " + pass + " - " + aURL); -#endif -// console.log("JS: " + this._jsBuffer); -} - -exports.ObjJCompiler = ObjJCompiler; - -exports.ObjJCompiler.compileToExecutable = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags) -{ - ObjJCompiler.currentCompileFile = aURL; - return new ObjJCompiler(aString, aURL, flags, 2).executable(); -} - -exports.ObjJCompiler.compileToIMBuffer = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags) -{ - return new ObjJCompiler(aString, aURL, flags, 2).IMBuffer(); -} - -exports.ObjJCompiler.compileFileDependencies = function(/*String*/ aString, /*CFURL*/ aURL, /*unsigned*/ flags) -{ - ObjJCompiler.currentCompileFile = aURL; - return new ObjJCompiler(aString, aURL, flags, 1).executable(); -} - -ObjJCompiler.prototype.compilePass2 = function() -{ - ObjJCompiler.currentCompileFile = this._URL; - this._pass = 2; - this._jsBuffer = new StringBuffer(); - //print("Start Compile2: " + this._URL); - //var start = new Date().getTime(); -#ifdef BROWSER - console.time("Compile pass 2" + this._pass + " - " + this._URL); -#endif - this.nodeDocument(this._tokens); - //var end = new Date().getTime(); - //var time = (end - start) / 1000; - //print("Compile pass 2: " + this._URL + " in " + time + " seconds"); -#ifdef BROWSER - console.timeEnd("Compile pass 2" + this._pass + " - " + this._URL); -#endif - return this._jsBuffer.toString(); -} - -// This will set the compiler version to use. -// These version works: -// "preprocessor" -> Old Cappuccino compiler -// "objj_compiler2" -> New Cappuccino compiler -// "acorn" -> New Cappuccino compiler with acorn parser - -GLOBAL(ObjJCompilerSetUsedVersion) = function(version) -{ - ObjJCompiler.usedVersion = version; -} - -ObjJCompiler.setCurrentUsedVersion = function(version) -{ - ObjJCompiler.usedVersion = version; -} - -exports.setCurrentCompilerFlags = function(/*String*/ compilerFlags) -{ - currentCompilerFlags = compilerFlags; -} - -exports.currentCompilerFlags = function(/*String*/ compilerFlags) -{ - return currentCompilerFlags; -} - -ObjJCompiler.Flags = { }; - -ObjJCompiler.Flags.IncludeDebugSymbols = 1 << 0; -ObjJCompiler.Flags.IncludeTypeSignatures = 1 << 1; - -ObjJCompiler.AstNodeDocument = "#document"; -ObjJCompiler.AstNodeStart = "start"; -ObjJCompiler.AstNodeFunctionBody = "FunctionBody"; -ObjJCompiler.AstNodeSourceElements = "SourceElements"; -ObjJCompiler.AstNodeSourceElement = "SourceElement"; -ObjJCompiler.AstNodeFunctionDeclaration = "FunctionDeclaration"; -ObjJCompiler.AstNodeFunctionExpression = "FunctionExpression"; -ObjJCompiler.AstNodeFormalParameterList = "FormalParameterList"; -ObjJCompiler.AstNodeStatementList = "StatementList"; -ObjJCompiler.AstNodeStatement = "Statement"; -ObjJCompiler.AstNodeBlock = "Block"; -ObjJCompiler.AstNodeVariableStatement = "VariableStatement"; -ObjJCompiler.AstNodeEmptyStatement = "EmptyStatement"; -ObjJCompiler.AstNodeExpressionStatement = "ExpressionStatement"; -ObjJCompiler.AstNodeIfStatement = "IfStatement"; -ObjJCompiler.AstNodeIterationStatement = "IterationStatement"; -ObjJCompiler.AstNodeContinueStatement = "ContinueStatement"; -ObjJCompiler.AstNodeBreakStatement = "BreakStatement"; -ObjJCompiler.AstNodeReturnStatement = "ReturnStatement"; -ObjJCompiler.AstNodeWithStatement = "WithStatement"; -ObjJCompiler.AstNodeLabelledStatement = "LabelledStatement"; -ObjJCompiler.AstNodeSwitchStatement = "SwitchStatement"; -ObjJCompiler.AstNodeThrowStatement = "ThrowStatement"; -ObjJCompiler.AstNodeTryStatement = "TryStatement"; -ObjJCompiler.AstNodeDebuggerStatement = "DebuggerStatement"; -ObjJCompiler.AstNodeImportStatement = "ImportStatement"; -ObjJCompiler.AstNodeVariableDeclaration = "VariableDeclaration"; -ObjJCompiler.AstNodeVariableDeclarationNoIn = "VariableDeclarationNoIn"; -ObjJCompiler.AstNodeVariableDeclarationListNoIn = "VariableDeclarationListNoIn"; -ObjJCompiler.AstNodeDoWhileStatement = "DoWhileStatement"; -ObjJCompiler.AstNodeWhileStatement = "WhileStatement"; -ObjJCompiler.AstNodeForStatement = "ForStatement"; -ObjJCompiler.AstNodeForFirstExpression = "ForFirstExpression"; -ObjJCompiler.AstNodeForInStatement = "ForInStatement"; -ObjJCompiler.AstNodeForInFirstExpression = "ForInFirstExpression"; -ObjJCompiler.AstNodeEachStatement = "EachStatement"; -ObjJCompiler.AstNodeCaseBlock = "CaseBlock"; -ObjJCompiler.AstNodeCaseClauses = "CaseClauses"; -ObjJCompiler.AstNodeCaseClause = "CaseClause"; -ObjJCompiler.AstNodeDefaultClause = "DefaultClause"; -ObjJCompiler.AstNodeCatch = "Catch"; -ObjJCompiler.AstNodeFinally = "Finally"; -ObjJCompiler.AstNodeLocalFilePath = "LocalFilePath"; -ObjJCompiler.AstNodeStandardFilePath = "StandardFilePath"; -ObjJCompiler.AstNodeClassDeclarationStatement = "ClassDeclarationStatement"; -ObjJCompiler.AstNodeSuperclassDeclaration = "SuperclassDeclaration"; -ObjJCompiler.AstNodeCategoryDeclaration = "CategoryDeclaration"; -ObjJCompiler.AstNodeCompoundIvarDeclaration = "CompoundIvarDeclaration"; -ObjJCompiler.AstNodeIvarType = "IvarType"; -ObjJCompiler.AstNodeIvarTypeElement = "IvarTypeElement"; -ObjJCompiler.AstNodeIvarDeclaration = "IvarDeclaration"; -ObjJCompiler.AstNodeAccessors = "Accessors"; -ObjJCompiler.AstNodeAccessorsConfiguration = "AccessorsConfiguration"; -ObjJCompiler.AstNodeIvarPropertyName = "IvarPropertyName"; -ObjJCompiler.AstNodeIvarGetterName = "IvarGetterName"; -ObjJCompiler.AstNodeIvarSetterName = "IvarSetterName"; -ObjJCompiler.AstNodeClassBody = "ClassBody"; -ObjJCompiler.AstNodeClassElements = "ClassElements"; -ObjJCompiler.AstNodeClassElement = "ClassElement"; -ObjJCompiler.AstNodeClassMethodDeclaration = "ClassMethodDeclaration"; -ObjJCompiler.AstNodeInstanceMethodDeclaration = "InstanceMethodDeclaration"; -ObjJCompiler.AstNodeMethodSelector = "MethodSelector"; -ObjJCompiler.AstNodeUnarySelector = "UnarySelector"; -ObjJCompiler.AstNodeKeywordSelector = "KeywordSelector"; -ObjJCompiler.AstNodeKeywordDeclarator = "KeywordDeclarator"; -ObjJCompiler.AstNodeSelector = "Selector"; -ObjJCompiler.AstNodeMethodType = "MethodType"; -ObjJCompiler.AstNodeACTION = "ACTION"; -ObjJCompiler.AstNodeExpression = "Expression"; -ObjJCompiler.AstNodeExpressionNoIn = "ExpressionNoIn"; -ObjJCompiler.AstNodeAssignmentExpression = "AssignmentExpression"; -ObjJCompiler.AstNodeAssignmentExpressionNoIn = "AssignmentExpressionNoIn"; -ObjJCompiler.AstNodeAssignmentOperator = "AssignmentOperator"; -ObjJCompiler.AstNodeConditionalExpression = "ConditionalExpression"; -ObjJCompiler.AstNodeConditionalExpressionNoIn = "ConditionalExpressionNoIn"; -ObjJCompiler.AstNodeLogicalOrExpression = "LogicalOrExpression"; -ObjJCompiler.AstNodeLogicalOrExpressionNoIn = "LogicalOrExpressionNoIn"; -ObjJCompiler.AstNodeLogicalAndExpression = "LogicalAndExpression"; -ObjJCompiler.AstNodeLogicalAndExpressionNoIn = "LogicalAndExpressionNoIn"; -ObjJCompiler.AstNodeBitwiseOrExpression = "BitwiseOrExpression"; -ObjJCompiler.AstNodeBitwiseOrExpressionNoIn = "BitwiseOrExpressionNoIn"; -ObjJCompiler.AstNodeBitwiseXOrExpression = "BitwiseXOrExpression"; -ObjJCompiler.AstNodeBitwiseXOrExpressionNoIn = "BitwiseXOrExpressionNoIn"; -ObjJCompiler.AstNodeBitwiseAndExpression = "BitwiseAndExpression"; -ObjJCompiler.AstNodeBitwiseAndExpressionNoIn = "BitwiseAndExpressionNoIn"; -ObjJCompiler.AstNodeEqualityExpression = "EqualityExpression"; -ObjJCompiler.AstNodeEqualityExpressionNoIn = "EqualityExpressionNoIn"; -ObjJCompiler.AstNodeEqualityOperator = "EqualityOperator"; -ObjJCompiler.AstNodeRelationalExpression = "RelationalExpression"; -ObjJCompiler.AstNodeRelationalOperator = "RelationalOperator"; -ObjJCompiler.AstNodeRelationalExpressionNoIn = "RelationalExpressionNoIn"; -ObjJCompiler.AstNodeRelationalOperatorNoIn = "RelationalOperatorNoIn"; -ObjJCompiler.AstNodeShiftExpression = "ShiftExpression"; -ObjJCompiler.AstNodeShiftOperator = "ShiftOperator"; -ObjJCompiler.AstNodeAdditiveExpression = "AdditiveExpression"; -ObjJCompiler.AstNodeAdditiveOperator = "AdditiveOperator"; -ObjJCompiler.AstNodeMultiplicativeExpression = "MultiplicativeExpression"; -ObjJCompiler.AstNodeMultiplicativeOperator = "MultiplicativeOperator"; -ObjJCompiler.AstNodeUnaryExpression = "UnaryExpression"; -ObjJCompiler.AstNodePostfixExpression = "PostfixExpression"; -ObjJCompiler.AstNodeLeftHandSideExpression = "LeftHandSideExpression"; -ObjJCompiler.AstNodeNewExpression = "NewExpression"; -ObjJCompiler.AstNodeCallExpression = "CallExpression"; -ObjJCompiler.AstNodeMemberExpression = "MemberExpression"; -ObjJCompiler.AstNodeBracketedAccessor = "BracketedAccessor"; -ObjJCompiler.AstNodeDotAccessor = "DotAccessor"; -ObjJCompiler.AstNodeArguments = "Arguments"; -ObjJCompiler.AstNodeArgumentList = "ArgumentList"; -ObjJCompiler.AstNodePrimaryExpression = "PrimaryExpression"; -ObjJCompiler.AstNodeMessageExpression = "MessageExpression"; -ObjJCompiler.AstNodeSUPER = "SUPER"; -ObjJCompiler.AstNodeSelectorCall = "SelectorCall"; -ObjJCompiler.AstNodeKeywordSelectorCall = "KeywordSelectorCall"; -ObjJCompiler.AstNodeKeywordCall = "KeywordCall"; -ObjJCompiler.AstNodeArrayLiteral = "ArrayLiteral"; -ObjJCompiler.AstNodeElementList = "ElementList"; -ObjJCompiler.AstNodeObjectLiteral = "ObjectLiteral"; -ObjJCompiler.AstNodePropertyNameAndValueList = "PropertyNameAndValueList"; -ObjJCompiler.AstNodePropertyAssignment = "PropertyAssignment"; -ObjJCompiler.AstNodePropertyGetter = "PropertyGetter"; -ObjJCompiler.AstNodePropertySetter = "PropertySetter"; -ObjJCompiler.AstNodePropertyName = "PropertyName"; -ObjJCompiler.AstNodePropertySetParameterList = "PropertySetParameterList"; -ObjJCompiler.AstNodeLiteral = "Literal"; -ObjJCompiler.AstNodeNullLiteral = "NullLiteral"; -ObjJCompiler.AstNodeBooleanLiteral = "BooleanLiteral"; -ObjJCompiler.AstNodeNumericLiteral = "NumericLiteral"; -ObjJCompiler.AstNodeDecimalLiteral = "DecimalLiteral"; -ObjJCompiler.AstNodeDecimalIntegerLiteral = "DecimalIntegerLiteral"; -ObjJCompiler.AstNodeDecimalDigit = "DecimalDigit"; -ObjJCompiler.AstNodeExponentPart = "ExponentPart"; -ObjJCompiler.AstNodeSignedInteger = "SignedInteger"; -ObjJCompiler.AstNodeHexIntegerLiteral = "HexIntegerLiteral"; -ObjJCompiler.AstNodeHexDigit = "HexDigit"; -ObjJCompiler.AstNodeStringLiteral = "StringLiteral"; -ObjJCompiler.AstNodeDoubleStringCharacter = "DoubleStringCharacter"; -ObjJCompiler.AstNodeSingleStringCharacter = "SingleStringCharacter"; -ObjJCompiler.AstNodeLineContinuation = "LineContinuation"; -ObjJCompiler.AstNodeEscapeSequence = "EscapeSequence"; -ObjJCompiler.AstNodeCharacterEscapeSequence = "CharacterEscapeSequence"; -ObjJCompiler.AstNodeSingleEscapeCharacter = "SingleEscapeCharacter"; -ObjJCompiler.AstNodeNonEscapeCharacter = "NonEscapeCharacter"; -ObjJCompiler.AstNodeEscapeCharacter = "EscapeCharacter"; -ObjJCompiler.AstNodeHexEscapeSequence = "HexEscapeSequence"; -ObjJCompiler.AstNodeUnicodeEscapeSequence = "UnicodeEscapeSequence"; -ObjJCompiler.AstNodeRegularExpressionLiteral = "RegularExpressionLiteral"; -ObjJCompiler.AstNodeRegularExpressionBody = "RegularExpressionBody"; -ObjJCompiler.AstNodeRegularExpressionFirstChar = "RegularExpressionFirstChar"; -ObjJCompiler.AstNodeRegularExpressionChar = "RegularExpressionChar"; -ObjJCompiler.AstNodeRegularExpressionBackslashSequence = "RegularExpressionBackslashSequence"; -ObjJCompiler.AstNodeRegularExpressionNonTerminator = "RegularExpressionNonTerminator"; -ObjJCompiler.AstNodeRegularExpressionClass = "RegularExpressionClass"; -ObjJCompiler.AstNodeRegularExpressionClassChar = "RegularExpressionClassChar"; -ObjJCompiler.AstNodeRegularExpressionFlags = "RegularExpressionFlags"; -ObjJCompiler.AstNodeSelectorLiteral = "SelectorLiteral"; -ObjJCompiler.AstNodeSelectorLiteralContents = "SelectorLiteralContents"; -ObjJCompiler.AstNodeUnderline = "_"; -ObjJCompiler.AstNodeUnderlineNoLineBreak = "__"; -ObjJCompiler.AstNodeWhiteSpace = "WhiteSpace"; -ObjJCompiler.AstNodeLineTerminator = "LineTerminator"; -ObjJCompiler.AstNodeLineTerminatorSequence = "LineTerminatorSequence"; -ObjJCompiler.AstNodeComment = "Comment"; -ObjJCompiler.AstNodeMultiLineComment = "MultiLineComment"; -ObjJCompiler.AstNodeSingleLineMultiLineComment = "SingleLineMultiLineComment"; -ObjJCompiler.AstNodeSingleLineComment = "SingleLineComment"; -ObjJCompiler.AstNodeSingleLineCommentChar = "SingleLineCommentChar"; -ObjJCompiler.AstNodeEOS = "EOS"; -ObjJCompiler.AstNodeSemicolonInsertionEOS = "SemicolonInsertionEOS"; -ObjJCompiler.AstNodeEOF = "EOF"; -ObjJCompiler.AstNodeReservedWord = "ReservedWord"; -ObjJCompiler.AstNodeKeyword = "Keyword"; -ObjJCompiler.AstNodeFutureReservedWord = "FutureReservedWord"; -ObjJCompiler.AstNodeIdentifier = "Identifier"; -ObjJCompiler.AstNodeBadIdentifier = "BadIdentifier"; -ObjJCompiler.AstNodeReservedWordIdentifier = "ReservedWordIdentifier"; -ObjJCompiler.AstNodeDigitIdentifier = "DigitIdentifier"; -ObjJCompiler.AstNodeIdentifierName = "IdentifierName"; -ObjJCompiler.AstNodeIdentifierStart = "IdentifierStart"; -ObjJCompiler.AstNodeIdentifierPart = "IdentifierPart"; -ObjJCompiler.AstNodeUnicodeLetter = "UnicodeLetter"; -ObjJCompiler.AstNodeUnicodeCombiningMark = "UnicodeCombiningMark"; -ObjJCompiler.AstNodeUnicodeDigit = "UnicodeDigit"; -ObjJCompiler.AstNodeUnicodeConnectorPunctuation = "UnicodeConnectorPunctuation"; -ObjJCompiler.AstNodeZWNJ = "ZWNJ"; -ObjJCompiler.AstNodeZWJ = "ZWJ"; -ObjJCompiler.AstNodeFALSE = "FALSE"; -ObjJCompiler.AstNodeTRUE = "TRUE"; -ObjJCompiler.AstNodeNULL = "NULL"; -ObjJCompiler.AstNodeBREAK = "BREAK"; -ObjJCompiler.AstNodeCONTINUE = "CONTINUE"; -ObjJCompiler.AstNodeDEBUGGER = "DEBUGGER"; -ObjJCompiler.AstNodeIN = "IN"; -ObjJCompiler.AstNodeINSTANCEOF = "INSTANCEOF"; -ObjJCompiler.AstNodeDELETE = "DELETE"; -ObjJCompiler.AstNodeFUNCTION = "FUNCTION"; -ObjJCompiler.AstNodeNEW = "NEW"; -ObjJCompiler.AstNodeTHIS = "THIS"; -ObjJCompiler.AstNodeTYPEOF = "TYPEOF"; -ObjJCompiler.AstNodeVOID = "VOID"; -ObjJCompiler.AstNodeIF = "IF"; -ObjJCompiler.AstNodeELSE = "ELSE"; -ObjJCompiler.AstNodeDO = "DO"; -ObjJCompiler.AstNodeWHILE = "WHILE"; -ObjJCompiler.AstNodeFOR = "FOR"; -ObjJCompiler.AstNodeVAR = "VAR"; -ObjJCompiler.AstNodeRETURN = "RETURN"; -ObjJCompiler.AstNodeCASE = "CASE"; -ObjJCompiler.AstNodeDEFAULT = "DEFAULT"; -ObjJCompiler.AstNodeSWITCH = "SWITCH"; -ObjJCompiler.AstNodeTHROW = "THROW"; -ObjJCompiler.AstNodeCATCH = "CATCH"; -ObjJCompiler.AstNodeFINALLY = "FINALLY"; -ObjJCompiler.AstNodeTRY = "TRY"; -ObjJCompiler.AstNodeWITH = "WITH"; - -#if DEBUG -ObjJCompiler.prototype.assertNode = function(/*SyntaxNode*/ astNode, /*String*/ astNodeName) -{ - if (!astNode || astNode.name !== astNodeName) - { -// debugger; - throw new SyntaxError(this.error_message("Expected node " + astNodeName + " but got " + (astNode ? astNode.name : astNode), astNode)); - } -} -#endif - -ObjJCompiler.prototype.nodeDocument = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDocument); -#endif - this.nodeStart(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeStart = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeStart); -#endif - var children = astNode.children, - lastUnderlineIndex = 1; - - this.nodeUnderline(children[0], false); - - if (children.length === 3) - { - this.nodeSourceElements(children[1]); - lastUnderlineIndex++; - } - this.nodeUnderline(children[lastUnderlineIndex], false) -} - -ObjJCompiler.prototype.nodeFunctionBody = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFunctionBody); -#endif - var children = astNode.children, - lastUnderlineIndex = 1; - - this.nodeUnderline(children[0], false); - - if (children.length === 3) - { - this.nodeSourceElements(children[1]); - lastUnderlineIndex++; - } - this.nodeUnderline(children[lastUnderlineIndex], false) -} - -ObjJCompiler.prototype.nodeSourceElements = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSourceElements); -#endif - var children = astNode.children; - - this.nodeSourceElement(children[0]); - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - this.nodeSourceElement(children[i + 1]); - } -} - -ObjJCompiler.prototype.nodeSourceElement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSourceElement); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeStatement) - this.nodeStatement(child); - else if (child && child.name === ObjJCompiler.AstNodeFunctionDeclaration) - if (this._pass === 2) // Skip this if it is the first pass - this.nodeFunctionDeclaration(child); - else - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeStatement + " or " + ObjJCompiler.AstNodeFunctionDeclaration + " but got " + child, child)); -} - -ObjJCompiler.prototype.nodeFunctionDeclaration = function(/*SyntaxNode*/ astNode) -{ - // Safari can't handle function declarations of the form function [name]([arguments]) { } - // in evals. It requires them to be in the form [name] = function([arguments]) { }. So we - // need format them like that. -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFunctionDeclaration); -#endif - var children = astNode.children, - child = children[6], - offset = 0, - saveJSBuffer = this._jsBuffer, - parameterList; - - this._jsBuffer = null; - this.nodeFUNCTION(children[0]); - this.nodeUnderline(children[1], true); - var identifier = this.nodeIdentifier(children[2]); - this.nodeUnderline(children[3], false); - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, identifier); - CONCAT(saveJSBuffer, " = function"); - } - this._jsBuffer = saveJSBuffer; - this.nodeOpenParenthesis(children[4]); - this.nodeUnderline(children[5], false); - - if (child && child.name === ObjJCompiler.AstNodeFormalParameterList) - { - parameterList = this.nodeFormalParameterList(children[6]); - offset++; - } - this.nodeUnderline(children[6 + offset], false); - this.nodeCloseParenthesis(children[7 + offset]); - this.nodeUnderline(children[8 + offset], false); - this.nodeOpenBrace(children[9 + offset]); - this.nodeUnderline(children[10 + offset], false); - var currentClassMethods = this._currentMethod; - - if (currentClassMethods) - { - // If we have a parameter list push those otherwise an empty dictionary - currentClassMethods.lvarStack.push(parameterList ? parameterList : {}); - } - this.nodeFunctionBody(children[11 + offset]); - if (currentClassMethods) - currentClassMethods.lvarStack.pop(); - this.nodeUnderline(children[12 + offset], false); - this.nodeCloseBrace(children[13 + offset]); -} - -ObjJCompiler.prototype.nodeFunctionExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFunctionExpression); -#endif - var children = astNode.children, - child = children[2], - offset = 0, - saveJSBuffer = this._jsBuffer, - parameterList; - - this._jsBuffer = null; - this.nodeFUNCTION(children[0]); - this.nodeUnderline(children[1], true); - var identifier = null; - if (child && child.name === ObjJCompiler.AstNodeIdentifier) - { - identifier = this.nodeIdentifier(child); - offset++; - } - this.nodeUnderline(children[2 + offset], false); - if (saveJSBuffer) - if (identifier) - { - CONCAT(saveJSBuffer, identifier); - CONCAT(saveJSBuffer, " = function"); - } - else - { - CONCAT(saveJSBuffer, "function"); - } - this._jsBuffer = saveJSBuffer; - this.nodeOpenParenthesis(children[3 + offset]); - this.nodeUnderline(children[4 + offset], false); - - child = children[5 + offset]; - - if (child && child.name ===ObjJCompiler.AstNodeFormalParameterList) - { - parameterList = this.nodeFormalParameterList(child); - offset++; - } - this.nodeUnderline(children[5 + offset], false); - this.nodeCloseParenthesis(children[6 + offset]); - this.nodeUnderline(children[7 + offset], false); - this.nodeOpenBrace(children[8 + offset]); - this.nodeUnderline(children[9 + offset], false); - var currentClassMethods = this._currentMethod; - - if (currentClassMethods) - { - currentClassMethods.lvarStack.push(parameterList ? parameterList : {}); - } - this.nodeFunctionBody(children[10 + offset]); - if (currentClassMethods) - currentClassMethods.lvarStack.pop(); - this.nodeUnderline(children[11 + offset], false); - this.nodeCloseBrace(children[12 + offset]); -} - -ObjJCompiler.prototype.nodeFormalParameterList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFormalParameterList); -#endif - var children = astNode.children, - parameterList = {}; - - var identifier = this.nodeIdentifier(children[0]); - - parameterList[identifier] = {"identifier": identifier}; - - for (var i = 1; i + 3 < children.length; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - identifier = this.nodeIdentifier(children[i + 3]); - parameterList[identifier] = {"identifier": identifier}; - } - - return parameterList; -} - -ObjJCompiler.prototype.nodeStatementList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeStatementList); -#endif - var children = astNode.children; - - this.nodeStatement(children[0]); - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - this.nodeStatement(children[i + 1]); - } -} - -ObjJCompiler.prototype.nodeStatement = function(/*SyntaxNode*/ astNode) -{ - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeBlock: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeBlock(child); - break; - case ObjJCompiler.AstNodeVariableStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeVariableStatement(child); - break; - case ObjJCompiler.AstNodeEmptyStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeEmptyStatement(child); - break; - case ObjJCompiler.AstNodeExpressionStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeExpressionStatement(child); - break; - case ObjJCompiler.AstNodeIfStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeIfStatement(child); - break; - case ObjJCompiler.AstNodeIterationStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeIterationStatement(child); - break; - case ObjJCompiler.AstNodeContinueStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeContinueStatement(child); - break; - case ObjJCompiler.AstNodeBreakStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeBreakStatement(child); - break; - case ObjJCompiler.AstNodeReturnStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeReturnStatement(child); - break; - case ObjJCompiler.AstNodeWithStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeWithStatement(child); - break; - case ObjJCompiler.AstNodeLabelledStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeLabelledStatement(child); - break; - case ObjJCompiler.AstNodeSwitchStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeSwitchStatement(child); - break; - case ObjJCompiler.AstNodeThrowStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeThrowStatement(child); - break; - case ObjJCompiler.AstNodeTryStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeTryStatement(child); - break; - case ObjJCompiler.AstNodeDebuggerStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeDebuggerStatement(child); - break; - case ObjJCompiler.AstNodeFunctionDeclaration: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeFunctionDeclaration(child); - break; - case ObjJCompiler.AstNodeFunctionExpression: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeFunctionExpression(child); - break; - case ObjJCompiler.AstNodeImportStatement: - this.nodeImportStatement(child); - break; - case ObjJCompiler.AstNodeClassDeclarationStatement: - if (this._pass === 2) // Skip this if it is the first pass - this.nodeClassDeclationStatement(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeStatement + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeBlock = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBlock); -#endif - var children = astNode.children; - - this.nodeOpenBrace(children[0]); - this.nodeUnderline(children[1], false); - var offset = 0; - if (children.length === 5) - { - this.nodeStatementList(children[2]); - offset++; - } - this.nodeUnderline(children[2 + offset], false); - this.nodeCloseBrace(children[3 + offset]); - // TODO: Handle BadBlock with missing close brace -} - -ObjJCompiler.prototype.nodeVariableStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVariableStatement); -#endif - var children = astNode.children; - - this.nodeVAR(children[0]); - this.nodeUnderline(children[1], true); - this.nodeVariableDeclaration(children[2]); - - for (var i = 3; i + 3 < children.length; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeVariableDeclaration(children[i + 3]); - } - this.nodeEOS(children[i]); -} - -ObjJCompiler.prototype.nodeVariableDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVariableDeclaration); -#endif - var children = astNode.children, - identifier = this.nodeIdentifier(children[0]); - - if (children.length === 5) - { - this.nodeUnderline(children[1], false); - this.nodeEQUALS(children[2]); - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpression(children[4]); - } - - this.createLocalVariable({"identifier": identifier}); -} - -ObjJCompiler.prototype.nodeVariableDeclarationNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVariableDeclarationNoIn); -#endif - var children = astNode.children, - identifier = this.nodeIdentifier(children[0]); - - if (children.length === 5) - { - this.nodeUnderline(children[1], false); - this.nodeEQUALS(children[2]); - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpressionNoIn(children[4]); - } - - this.createLocalVariable({"identifier": identifier}); -} - -ObjJCompiler.prototype.nodeVariableDeclarationListNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVariableDeclarationListNoIn); -#endif - var children = astNode.children; - - this.nodeVariableDeclarationNoIn(children[0]); - - for (var i = 1; i + 3 < children.length; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeVariableDeclarationNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeEmptyStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEmptyStatement); -#endif - - this.nodeWORD(astNode.children[0]); // ";" -} - -ObjJCompiler.prototype.nodeExpressionStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeExpressionStatement); -#endif - var children = astNode.children; - - this.nodeExpression(children[0]); - this.nodeEOS(children[1]); -} - -ObjJCompiler.prototype.nodeIfStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIfStatement); -#endif - var children = astNode.children; - - this.nodeIF(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeExpression(children[4]); - this.nodeUnderline(children[5], false); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeStatement(children[8]); - - if (children.length === 13) - { - this.nodeUnderline(children[9], false); - this.nodeELSE(children[10], false); - this.nodeUnderline(children[11], true); - this.nodeStatement(children[12]); - } -} - -ObjJCompiler.prototype.nodeIterationStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIterationStatement); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeDoWhileStatement: - this.nodeDoWhileStatement(child); - break; - case ObjJCompiler.AstNodeWhileStatement: - this.nodeWhileStatement(child); - break; - case ObjJCompiler.AstNodeForStatement: - this.nodeForStatement(child); - break; - case ObjJCompiler.AstNodeForInStatement: - this.nodeForInStatement(child); - break; - case ObjJCompiler.AstNodeEachStatement: - this.nodeEachStatement(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeIterationStatement + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeDoWhileStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDoWhileStatement); -#endif - var children = astNode.children; - - this.nodeDO(children[0]); - this.nodeUnderline(children[1], true); - this.nodeStatement(children[2]); - this.nodeUnderline(children[3], true); - this.nodeWHILE(children[4]); - this.nodeUnderline(children[5], false); - this.nodeOpenParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeExpression(children[8]); - this.nodeUnderline(children[9], false); - this.nodeCloseParenthesis(children[10]); - this.nodeEOS(children[11]); -} - -ObjJCompiler.prototype.nodeWhileStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeWhileStatement); -#endif - var children = astNode.children; - - this.nodeWHILE(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeExpression(children[4]); - this.nodeUnderline(children[5], false); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeStatement(children[8]); -} - -ObjJCompiler.prototype.nodeForStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeForStatement); -#endif - var children = astNode.children, - child = children[4]; - - this.nodeFOR(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - var offset = 0; - if (!child || child.name !== ObjJCompiler.AstNodeUnderline) - { - this.nodeForFirstExpression(children[4]); - offset++; - } - this.nodeUnderline(children[4 + offset], false); - this.nodeWORD(children[5 + offset]); // ";" - this.nodeUnderline(children[6 + offset], false); - child = children[7 + offset]; - if (!child || child.name !== ObjJCompiler.AstNodeUnderline) - { - this.nodeExpression(child); - offset++; - } - this.nodeUnderline(children[7 + offset], false); - this.nodeWORD(children[8 + offset]); // ";" - this.nodeUnderline(children[9 + offset], false); - child = children[10 + offset]; - if (!child || child.name !== ObjJCompiler.AstNodeUnderline) - { - this.nodeExpression(children[10 + offset]); - offset++; - } - this.nodeUnderline(children[10 + offset], false); - this.nodeCloseParenthesis(children[11 + offset]); - this.nodeUnderline(children[12 + offset], false); - this.nodeStatement(children[13 + offset]); -} - -ObjJCompiler.prototype.nodeForFirstExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeForFirstExpression); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeVAR) - { - this.nodeVAR(child); - this.nodeUnderline(children[1], true); - this.nodeVariableDeclarationListNoIn(children[2]); - } - else - this.nodeExpressionNoIn(children[0]); -} - -ObjJCompiler.prototype.nodeForInStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeForInStatement); -#endif - var children = astNode.children; - - this.nodeFOR(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeForInFirstExpression(children[4]); - this.nodeUnderline(children[5], true); - this.nodeIN(children[6]); - this.nodeUnderline(children[7], true); - this.nodeExpression(children[8]); // ";" - this.nodeUnderline(children[9], false); - this.nodeCloseParenthesis(children[10]); - this.nodeUnderline(children[11], false); - this.nodeStatement(children[12]); -} - -ObjJCompiler.prototype.nodeForInFirstExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeForInFirstExpression); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeVAR) - { - this.nodeVAR(child); - this.nodeUnderline(children[1], true); - this.nodeVariableDeclarationNoIn(children[2]); - } - else - this.nodeLeftHandSideExpression(child); -} - -ObjJCompiler.prototype.nodeEachStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEachStatement); -#endif - var children = astNode.children; - - this.nodeEACH(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeForInFirstExpression(children[4]); - this.nodeUnderline(children[5], true); - this.nodeIN(children[6]); - this.nodeUnderline(children[7], true); - this.nodeExpression(children[8]); // ";" - this.nodeUnderline(children[9], false); - this.nodeCloseParenthesis(children[10]); - this.nodeUnderline(children[11], false); - this.nodeStatement(children[12]); -} - -ObjJCompiler.prototype.nodeContinueStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeContinueStatement); -#endif - var children = astNode.children, - child = children[2]; - - this.nodeCONTINUE(children[0]); - this.nodeUnderlineNoLineBreak(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeIdentifier) - { - this.nodeIdentifier(child); - this.nodeEOS(children[3]); - } - else - this.nodeSemicolonInsertionEOS(children[2]); -} - -ObjJCompiler.prototype.nodeBreakStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBreakStatement); -#endif - var children = astNode.children, - child = children[2]; - - this.nodeBREAK(children[0]); - this.nodeUnderlineNoLineBreak(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeIdentifier) - { - this.nodeIdentifier(child); - this.nodeEOS(children[3]); - } - else - this.nodeSemicolonInsertionEOS(children[2]); -} - -ObjJCompiler.prototype.nodeReturnStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeReturnStatement); -#endif - var children = astNode.children, - child = children[2]; - - this.nodeRETURN(children[0]); - this.nodeUnderlineNoLineBreak(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeExpression) - { - this.nodeExpression(child); - this.nodeEOS(children[3]); - } - else - this.nodeSemicolonInsertionEOS(child); -} - -ObjJCompiler.prototype.nodeWithStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeWithStatement); -#endif - var children = astNode.children; - - this.nodeWITH(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeExpression(children[4]); - this.nodeUnderline(children[5], true); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeStatement(children[8]); -} - -ObjJCompiler.prototype.nodeSwitchStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSwitchStatement); -#endif - var children = astNode.children; - - this.nodeSWITCH(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeExpression(children[4]); - this.nodeUnderline(children[5], true); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeCaseBlock(children[8]); -} - -ObjJCompiler.prototype.nodeCaseBlock = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCaseBlock); -#endif - var children = astNode.children, - child = children[2]; - - this.nodeOpenBrace(children[0]); - this.nodeUnderline(children[1], false); - var offset = 0; - if (child && child.name === ObjJCompiler.AstNodeCaseClauses) - { - this.nodeCaseClauses(child); - offset++; - } - this.nodeUnderline(children[2 + offset], false); - child = children[3 + offset]; - if (child && child.name === ObjJCompiler.AstNodeDefaultClause) - { - this.nodeDefaultClause(child); - offset++; - } - this.nodeUnderline(children[3 + offset], false); - child = children[4 + offset]; - if (child && child.name === ObjJCompiler.AstNodeCaseClauses) - { - this.nodeCaseClauses(child); - offset++; - } - this.nodeUnderline(children[4 + offset], false); - this.nodeCloseBrace(children[5 + offset]); -} - -ObjJCompiler.prototype.nodeCaseClauses = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCaseClauses); -#endif - var children = astNode.children; - - this.nodeCaseClause(children[0]); - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - this.nodeCaseClause(children[i + 1]); - } -} - -ObjJCompiler.prototype.nodeCaseClause = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCaseClause); -#endif - var children = astNode.children, - child = children[5]; - - this.nodeCASE(children[0]); - this.nodeUnderline(children[1], true); - this.nodeExpression(children[2]); - this.nodeUnderline(children[3], false); - this.nodeCOLON(children[4]); - if (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - this.nodeStatementList(children[6]); - } -} - -ObjJCompiler.prototype.nodeDefaultClause = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDefaultClause); -#endif - var children = astNode.children, - child = children[3]; - - this.nodeDEFAULT(children[0]); - this.nodeUnderline(children[1], true); - this.nodeCOLON(children[2]); - if (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - this.nodeStatementList(children[4]); - } -} - -ObjJCompiler.prototype.nodeLabelledStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLabelledStatement); -#endif - var children = astNode.children; - - this.nodeIdentifier(children[0]); - this.nodeUnderline(children[1], true); - this.nodeCOLON(children[2]); - this.nodeUnderline(children[3], false); - this.nodeStatementList(children[4]); -} - -ObjJCompiler.prototype.nodeThrowStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeThrowStatement); -#endif - var children = astNode.children, - child = children[2]; - - this.nodeTHROW(children[0]); - this.nodeUnderlineNoLineBreak(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeExpression) - { - this.nodeExpression(child); - this.nodeEOS(children[3]); - } - else - this.nodeSemicolonInsertionEOS(children[2]); -} - -ObjJCompiler.prototype.nodeTryStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTryStatement); -#endif - var children = astNode.children, - child = children[4]; - - this.nodeTRY(children[0]); - this.nodeUnderline(children[1], false); - this.nodeBlock(children[2]); - this.nodeUnderline(children[3], false); - if (child && child.name === ObjJCompiler.AstNodeCatch) - { - this.nodeCatch(child); - child = children[5]; - if (child && child.name === ObjJCompiler.AstNodeFinally) - { - this.nodeFinally(child); - } - } - else - this.nodeFinally(child); -} - -ObjJCompiler.prototype.nodeCatch = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCatch); -#endif - var children = astNode.children; - - this.nodeCATCH(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - this.nodeIdentifier(children[4]); - this.nodeUnderline(children[5], false); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeBlock(children[8]); -} - -ObjJCompiler.prototype.nodeFinally = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFinally); -#endif - var children = astNode.children; - - this.nodeFINALLY(children[0]); - this.nodeUnderline(children[1], false); - this.nodeBlock(children[2]); -} - -ObjJCompiler.prototype.nodeDebuggerStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDebuggerStatement); -#endif - var children = astNode.children; - - this.nodeDEBUGGER(children[0]); - this.nodeEOS(children[1]); -} - -ObjJCompiler.prototype.nodeImportStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeImportStatement); -#endif - var children = astNode.children, - child = children[2], - isQuoted = null, - urlString = null, - saveJSBuffer = this._jsBuffer; - - this._jsBuffer = null; - this.nodeIMPORT(children[0]); - this.nodeUnderline(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeLocalFilePath) - { - urlString = this.nodeLocalFilePath(child); - isQuoted = true; - } - else - { - urlString = this.nodeStandardFilePath(children[2]); - isQuoted = false; - } - this.nodeEOS(children[3]); - - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, "objj_executeFile(\""); - CONCAT(saveJSBuffer, urlString); - CONCAT(saveJSBuffer, isQuoted ? "\", YES);" : "\", NO);"); - } - - this._dependencies.push(new FileDependency(new CFURL(urlString), isQuoted)); - this._jsBuffer = saveJSBuffer; -} - -ObjJCompiler.prototype.nodeLocalFilePath = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLocalFilePath); -#endif - - return this.nodeStringLiteral(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeStandardFilePath = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeStandardFilePath); -#endif - var children = astNode.children, - size = children.length, - string = ""; - - this.nodeLESSTHEN(children[0]); - this.nodeUnderline(children[1], false); - for (var i = 2; i < size - 2; i++) - { - string += this.nodeWORD(children[i]); - } - this.nodeUnderline(children[size - 2], false); - this.nodeGREATERTHEN(children[size - 1]); - - return string; -} - -ObjJCompiler.prototype.nodeClassDeclationStatement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeClassDeclarationStatement); -#endif - var children = astNode.children, - child = children[4], - offset = 0, - saveJSBuffer = this._jsBuffer, // Save the javascript buffer - saveObjJBuffer = this._objJBuffer, // Save the objJ buffer - classBodyBuffer = new StringBuffer(); // Create a buffer for javascript statements and functions inside the class declaration - - // Make sure nothing is copied to the javascript buffer - this._jsBuffer = null; - // Crate an objJ buffer if we need to create accessors - this._objJBuffer = new StringBuffer(); - - this.nodeIMPLEMENTATION(children[0]); - this.nodeUnderline(children[1], true); - - var className = this.nodeIdentifier(children[2]), - superClassName = null, - classDef = null, - isCategoryDeclaration = false; - - this.nodeUnderline(children[3], false); - - if (child && child.name === ObjJCompiler.AstNodeSuperclassDeclaration) - { - superClassName = this.nodeSuperclassDeclaration(child); - offset++; - - if (this.getClassDef(className)) - throw new SyntaxError(this.error_message("Duplicate class " + className, children[2])); - if (!this.getClassDef(superClassName)) - throw new SyntaxError(this.error_message("Can't find superclass " + superClassName, child)); - - classDef = {"className": className, "superClassName": superClassName, "ivars": {}, "methods": {}}; - - this._classDefs[className] = classDef; - - if (saveJSBuffer) - CONCAT(saveJSBuffer, "{var the_class = objj_allocateClassPair(" + superClassName + ", \"" + className + "\"),\nmeta_class = the_class.isa;"); - } - else if (child && child.name === ObjJCompiler.AstNodeCategoryDeclaration) - { - isCategoryDeclaration = true; - this.nodeCategoryDeclaration(child); - offset++; - - classDef = this.getClassDef(className); - if (!classDef) - throw new SyntaxError(this.error_message("Class " + className + " not found ", children[2])); - - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, "{\nvar the_class = objj_getClass(\"" + className + "\")\n"); - CONCAT(saveJSBuffer, "if(!the_class) throw new SyntaxError(\"*** Could not find definition for class \\\"" + className + "\\\"\");\n"); - CONCAT(saveJSBuffer, "var meta_class = the_class.isa;"); - } - } - else - { - classDef = {"className": className, "superClassName": null, "ivars": {}, "methods": {}}; - - this._classDefs[className] = classDef; - - if (saveJSBuffer) - CONCAT(saveJSBuffer, "{var the_class = objj_allocateClassPair(Nil, \"" + className + "\"),\nmeta_class = the_class.isa;"); - } - - this._currentSuperClass = "objj_getClass(\"" + className + "\").super_class"; - this._currentSuperMetaClass = "objj_getMetaClass(\"" + className + "\").super_class"; - - this.nodeUnderline(children[4 + offset], false); - this._imBuffer = new StringBuffer(); - this._cmBuffer = new StringBuffer(); - this._classBodyBuffer = new StringBuffer(); - child = children[5 + offset]; - - if (!child || child.name !== ObjJCompiler.AstNodeUnderline) - { - this.nodeOpenBrace(child); - offset++; - var firstIvarDeclaration = true, - ivars = classDef.ivars, - hasAccessors = false; - - child = children[6 + offset]; - - while (child && child.name === ObjJCompiler.AstNodeCompoundIvarDeclaration) - { - this.nodeUnderline(children[5 + offset++], false); - - var ivarDeclaration = this.nodeCompoundIvarDeclaration(child, ivars), // This will save the declaration in ivars and return the declaration. - type = ivarDeclaration.type; - - for (var name in ivarDeclaration.ivars) - { - if (firstIvarDeclaration) - { - firstIvarDeclaration = false; - if (saveJSBuffer) - CONCAT(saveJSBuffer, "class_addIvars(the_class, ["); - } - else - if (saveJSBuffer) - CONCAT(saveJSBuffer, ", "); - - if (saveJSBuffer) - if (this._flags & ObjJCompiler.Flags.IncludeTypeSignatures) - CONCAT(saveJSBuffer, "new objj_ivar(\"" + name + "\", \"" + type + "\")"); - else - CONCAT(saveJSBuffer, "new objj_ivar(\"" + name + "\")"); - - if (!hasAccessors && ivarDeclaration.ivars[name].accessors) - hasAccessors = true; - } - - child = children[6 + ++offset]; - } - if (!firstIvarDeclaration) - if (saveJSBuffer) - CONCAT(saveJSBuffer, "]);\n"); - - this.nodeUnderline(children[5 + offset++], false); - this.nodeCloseBrace(children[5 + offset++]); - - if (hasAccessors) - { - var getterSetterBuffer = new StringBuffer(); - - // Add the class declaration to compile accessors correctly - CONCAT(getterSetterBuffer, this._objJBuffer); - CONCAT(getterSetterBuffer, "\n"); - - for (var name in ivars) - { - var ivarDecl = ivars[name], - type = ivarDecl.type, - accessors = ivarDecl.accessors; - - if (!accessors) - continue; - - var property = accessors["property"] || name, - getterName = accessors["getter"] || property, - getterCode = "- (" + (type ? type : "id") + ")" + getterName + "\n{\nreturn " + name + ";\n}\n"; - - CONCAT(getterSetterBuffer, getterCode); - - if (accessors["readonly"]) - continue; - - var setterName = accessors["setter"]; - - if (!setterName) - { - var start = property.charAt(0) == '_' ? 1 : 0; - setterName = (start ? "_" : "") + "set" + property.substr(start, 1).toUpperCase() + property.substring(start + 1) + ":"; - } - - var setterCode = "- (void)" + setterName + "(" + (type ? type : "id") + ")newValue\n{\n"; - - if (accessors["copy"]) - setterCode += "if (" + name + " !== newValue)\n" + name + " = [newValue copy];\n}\n"; - else - setterCode += name + " = newValue;\n}\n"; - - CONCAT(getterSetterBuffer, setterCode); - } - - CONCAT(getterSetterBuffer, "\n@end"); - // Remove all @accessors or we will get a recursive loop in infinity - var b = getterSetterBuffer.toString().replace(/@accessors(\(.*\))?/g, ""); - var imBuffer = ObjJCompiler.compileToIMBuffer(b, "getter", this._flags); - - CONCAT(this._imBuffer, imBuffer); - } - } - this.nodeUnderline(children[5 + offset], false); - this._currentClassDef = classDef; - - this._jsBuffer = classBodyBuffer; - this.nodeClassBody(children[6 + offset]); - this._currentClassDef = null; - this._jsBuffer = null; - - this.nodeUnderline(children[7 + offset], false); - this.nodeEND(children[8 + offset]); - this.nodeEOS(children[9 + offset]); - - if (saveJSBuffer) - { - // We must make a new class object for our class definition. - if (!isCategoryDeclaration) { - CONCAT(saveJSBuffer, "objj_registerClassPair(the_class);\n"); - } - - if (IS_NOT_EMPTY(this._imBuffer)) - { - CONCAT(saveJSBuffer, "class_addMethods(the_class, ["); - CONCAT(saveJSBuffer, this._imBuffer); - CONCAT(saveJSBuffer, "]);\n"); - } - - if (IS_NOT_EMPTY(this._cmBuffer)) - { - CONCAT(saveJSBuffer, "class_addMethods(meta_class, ["); - CONCAT(saveJSBuffer, this._cmBuffer); - CONCAT(saveJSBuffer, "]);\n"); - } - - CONCAT(saveJSBuffer, "}"); - - // FIXME: Maybe we should add this before we add the class implementation? - // We might have variable/function declarations etc that is needed before class declaration? - // Maybe not? Needs some investigation.... - CONCAT(saveJSBuffer, this._classBodyBuffer); - } - // Restore javascript buffer - this._jsBuffer = saveJSBuffer; - // Restore objJ buffer - if (saveObjJBuffer) - CONCAT(saveObjJBuffer, this._objJBuffer); - this._objJBuffer = saveObjJBuffer; -} - -ObjJCompiler.prototype.nodeSuperclassDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSuperclassDeclaration); -#endif - var children = astNode.children; - - this.nodeCOLON(children[0]); - this.nodeUnderline(children[1], false); - return this.nodeIdentifier(children[2]); -} - -ObjJCompiler.prototype.nodeCategoryDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCategoryDeclaration); -#endif - var children = astNode.children; - - this.nodeOpenParenthesis(children[0]); - this.nodeUnderline(children[1], false); - this.nodeIdentifier(children[2]); - this.nodeUnderline(children[3], false); - this.nodeCloseParenthesis(children[4]); -} - -ObjJCompiler.prototype.nodeCompoundIvarDeclaration = function(/*SyntaxNode*/ astNode, classDefIvars) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCompoundIvarDeclaration); -#endif - var children = astNode.children, - type = this.nodeIvarType(children[0]); - - this.nodeUnderline(children[1], true); - var ivar = this.nodeIvarDeclaration(children[2]), - ivars = {}; - - ivars[ivar.identifier] = ivar; - classDefIvars[ivar.identifier] = {"type": type, "name": ivar.identifier, "accessors": ivar.accessors}; - for (var i = 3; i + 3 < children.length; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "," - this.nodeUnderline(children[i + 2], false); - ivar = this.nodeIvarDeclaration(children[i + 3]); - if (classDefIvars[ivar.identifier]) // FIXME: Must look at classes not in this file - throw new SyntaxError(this.error_message("Duplicate member " + ivar.identifier, children[i + 3])); - ivars[ivar.identifier] = ivar; - classDefIvars[ivar.identifier] = {"type": type, "name": ivar.identifier, "accessors": ivar.accessors}; - } - this.nodeEOS(children[i]); - return {"type": type, "ivars": ivars}; -} - -// This grammar is not correct. You should not be able to have multiple IvarTypeElement. -// Maybe should be one type element and one extra @outlet? Or something...... -// IvarType = -// IvarTypeElement (_ IvarTypeElement)* - -ObjJCompiler.prototype.nodeIvarType = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarType); -#endif - var children = astNode.children, - type = ""; - - var newType = this.nodeIvarTypeElement(children[0]); - // Maybe we should return the outlet information and save it along the ivars for the class.... - if (newType !== "@outlet") - type = newType; - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - newType = this.nodeIvarTypeElement(children[i + 1]); - // Maybe we should return the outlet information and save it along the ivars for the class.... - if (newType !== "@outlet") - type += " " + newType; - } - - return type; -} - -ObjJCompiler.prototype.nodeIvarTypeElement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarTypeElement); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeIdentifierName) - return this.nodeIdentifierName(child); - else - return this.nodeOUTLET(child); -} - -ObjJCompiler.prototype.nodeIvarDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarDeclaration); -#endif - var children = astNode.children, - child = children[2], - ivar = {}; - - ivar.identifier = this.nodeIdentifier(children[0]); - this.nodeUnderline(children[1], false); - - if (child && child.name === ObjJCompiler.AstNodeAccessors) - ivar.accessors = this.nodeAccessors(child); - return ivar; -} - -ObjJCompiler.prototype.nodeAccessors = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAccessors); -#endif - var children = astNode.children, - size = children.length, - accessors = {}; - - this.nodeACCESSORS(children[0]); - if (size > 1) - { - this.nodeOpenParenthesis(children[1]); - var offset = 0, - child = children[2]; - if (child && child.name === ObjJCompiler.AstNodeAccessorsConfiguration) - { - accessors = this.nodeAccessorsConfiguration(child); - child = children[2 + ++offset] - while (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(children[2 + offset++], false); - this.nodeWORD(children[2 + offset++]); // "," - this.nodeUnderline(children[2 + offset++], false); - var moreAccessors = this.nodeAccessorsConfiguration(children[2 + offset++]); - for (var attrname in moreAccessors) // Clang takes the last if many exists so just Merge in moreAccessors - accessors[attrname] = moreAccessors[attrname]; - child = children[2 + offset]; - } - } - this.nodeCloseParenthesis(child); - } - return accessors; -} - -ObjJCompiler.prototype.nodeAccessorsConfiguration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAccessorsConfiguration); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeIvarPropertyName: - return {"property": this.nodeIvarPropertyName(child)}; - case ObjJCompiler.AstNodeIvarGetterName: - return {"getter": this.nodeIvarGetterName(child)}; - case ObjJCompiler.AstNodeIvarSetterName: - return {"setter": this.nodeIvarSetterName(child)}; - default: - // Here we accept anything the parser accepts: "readonly", "copy" or "readwrite" - this.nodeWORD(child); - var r = {}; - r[child] = true; - return r; - } -} - -ObjJCompiler.prototype.nodeIvarPropertyName = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarPropertyName); -#endif - var children = astNode.children; - - this.nodePROPERTY(children[0]); - this.nodeUnderline(children[1], false); - this.nodeEQUALS(children[2]); - this.nodeUnderline(children[3], false); - return this.nodeIdentifier(children[4]); -} - -ObjJCompiler.prototype.nodeIvarGetterName = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarGetterName); -#endif - var children = astNode.children; - - this.nodeGETTER(children[0]); - this.nodeUnderline(children[1], false); - this.nodeEQUALS(children[2]); - this.nodeUnderline(children[3], false); - return this.nodeIdentifier(children[4]); -} - -ObjJCompiler.prototype.nodeIvarSetterName = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIvarSetterName); -#endif - var children = astNode.children; - - this.nodeSETTER(children[0]); - this.nodeUnderline(children[1], false); - this.nodeEQUALS(children[2]); - this.nodeUnderline(children[3], false); - var setterName = this.nodeIdentifier(children[4]); - - // I think the grammar is wrong here! You should always include the colon. - // IvarSetterName = - // "setter" _ "=" _ Identifier (_ ":")? - - if (children.length > 6) - { - this.nodeUnderline(children[5], false); - setterName += this.nodeCOLON(children[6]); - } - else - { - setterName += ":"; - } - - return setterName; -} - -ObjJCompiler.prototype.nodeClassBody = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeClassBody); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeClassElements) - this.nodeClassElements(child); -} - -ObjJCompiler.prototype.nodeClassElements = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeClassElements); -#endif - var children = astNode.children; - - this.nodeClassElement(children[0]); - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - this.nodeClassElement(children[i + 1]); - } -} - -ObjJCompiler.prototype.nodeClassElement = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeClassElement); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeClassMethodDeclaration: - this.nodeClassMethodDeclaration(child); - break; - case ObjJCompiler.AstNodeInstanceMethodDeclaration: - this.nodeInstanceMethodDeclaration(child); - break; - case ObjJCompiler.AstNodeStatement: - this._jsBuffer = this._classBodyBuffer; - this.nodeStatement(child); - this._jsBuffer = null; - break; - case ObjJCompiler.AstNodeFunctionDeclaration: - this._jsBuffer = this._classBodyBuffer; - this.nodeFunctionDeclaration(child); - this._jsBuffer = null; - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeClassElement + " but got " + child, child)); - break; - } -} - -ObjJCompiler.prototype.nodeClassMethodDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeClassMethodDeclaration); -#endif - this.nodePLUS(astNode.children[0]); - this._classMethod = true; - this.genericMethodDeclaration(astNode, this._cmBuffer); -} - -ObjJCompiler.prototype.nodeInstanceMethodDeclaration = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeInstanceMethodDeclaration); -#endif - this.nodeMINUS(astNode.children[0]); - this._classMethod = false; - this.genericMethodDeclaration(astNode, this._imBuffer); -} - -ObjJCompiler.prototype.genericMethodDeclaration = function(/*SyntaxNode*/ astNode, /*StringBuffer*/ buffer) -{ - var children = astNode.children, - child = children[2], - offset = 0, - returnTypes = [null], - classDef = this._currentClassDef, - currentClassMethods = classDef ? classDef.methods : null; - - if (child && child.name === ObjJCompiler.AstNodeMethodType) - { - this.nodeUnderline(children[1 + offset++], false); - returnTypes = this.nodeMethodType(children[1 + offset++]); - } - this.nodeUnderline(children[1 + offset], false); - var methodSelector = this.nodeMethodSelector(children[2 + offset]), - selector = methodSelector.selector, - types = [returnTypes[0]]; // First type is return type? We might handle only one type? The grammar MethodType can be many types - - if (IS_NOT_EMPTY(buffer)) // Add comma separator if this is not first method in this buffer - CONCAT(buffer, ", "); - CONCAT(buffer, "new objj_method(sel_getUid(\""); - CONCAT(buffer, selector); - CONCAT(buffer, "\"), function"); - -// this._currentSelector = selector; - - if (this._flags & ObjJCompiler.Flags.IncludeDebugSymbols) - { - CONCAT(buffer, " $" + this._currentClassDef.className + "__" + selector.replace(/:/g, "_")); - } - - CONCAT(buffer, "(self, _cmd"); - - for (var identifier in methodSelector.parameters) - { - var parameter = methodSelector.parameters[identifier]; - - CONCAT(buffer, ", "); - CONCAT(buffer, parameter.identifier); - types.push(parameter.type); - } - - if (currentClassMethods) - { - var currentMethodSelector = currentClassMethods[methodSelector.selector]; - if (currentMethodSelector) - { - // Method already declared. May be a warning? - } - currentClassMethods[methodSelector.selector] = methodSelector; - methodSelector.lvarStack = [{}]; - this._currentMethod = methodSelector; - } - - CONCAT(buffer, ")\n{\n"); - - this.nodeUnderline(children[3 + offset], false); - - child = children[4 + offset]; - if (child && child.name !== ObjJCompiler.AstNodeUnderline) - { - this.nodeSEMICOLON(children[4 + offset++]); - } - this.nodeUnderline(children[4 + offset], false); - this.nodeOpenBrace(children[5 + offset]); - this.nodeUnderline(children[6 + offset], false); - this._jsBuffer = buffer; // Now write the FunctionBody to buffer - this.nodeFunctionBody(children[7 + offset]); - this._jsBuffer = null; // Turn back off again so nothing is written - this.nodeUnderline(children[8 + offset], false); - this.nodeCloseBrace(children[9 + offset]); - CONCAT(buffer, "}\n"); - if (this._flags & ObjJCompiler.Flags.IncludeDebugSymbols) //flags.IncludeTypeSignatures) - CONCAT(buffer, ","+JSON.stringify(types)); - CONCAT(buffer, ")"); - - this._currentMethod = null; -} - -ObjJCompiler.prototype.nodeMethodSelector = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMethodSelector); -#endif - var children = astNode.children, - child = children[0], - size = children.length; - - if (child && child.name === ObjJCompiler.AstNodeKeywordSelector) - { - var keywordSelector = this.nodeKeywordSelector(child); - if (size > 1) - { - this.nodeUnderline(children[1], false); - this.nodeCOMMA(children[2]); - this.nodeUnderline(children[3], false); - // FIXME: Handle argument list. If we need to? - this.nodeWORD(children[4]); // ... - } - return keywordSelector; - } - else - return {"selector": this.nodeUnarySelector(child)}; -} - -ObjJCompiler.prototype.nodeUnarySelector = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnarySelector); -#endif - return this.nodeSelector(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeKeywordSelector = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeKeywordSelector); -#endif - var children = astNode.children, - keywordDecl = this.nodeKeywordDeclarator(children[0]), - typeAndIndentifier = {"type": keywordDecl.methodType, "identifier": keywordDecl.identifier}, - keywordSelector = {"selector": keywordDecl.selector, "parameters":{}}; - - keywordSelector.parameters[keywordDecl.identifier] = typeAndIndentifier; - - for (var i = 1; i + 1 < children.length; i += 2) - { - this.nodeUnderline(children[i], false); - var nextKeywordDecl = this.nodeKeywordDeclarator(children[i + 1]); - - keywordSelector.selector += nextKeywordDecl.selector; - keywordSelector.parameters[nextKeywordDecl.identifier] = {"type": nextKeywordDecl.methodType, "identifier": nextKeywordDecl.identifier}; - } - return keywordSelector; -} - -ObjJCompiler.prototype.nodeKeywordDeclarator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeKeywordDeclarator); -#endif - var children = astNode.children, - child = children[0], - offset = 0, - selector = "", - methodType = null; - - if (child && child.name === ObjJCompiler.AstNodeSelector) - { - selector = this.nodeSelector(children[0 + offset++]); - this.nodeUnderline(children[0 + offset++], false); - } - - this.nodeCOLON(children[0 + offset]); - selector += ":"; - child = children[2 + offset]; - - if (child && child.name === ObjJCompiler.AstNodeMethodType) - { - this.nodeUnderline(children[1 + offset++], false); - // TODO: Parser allows multiple MethodType. Need to find out what to do if we get more then one - methodType = this.nodeMethodType(children[1 + offset++])[0]; - } - - this.nodeUnderline(children[1 + offset], false); - var identifier = this.nodeIdentifier(children[2 + offset]); - - return {"selector": selector, "methodType": methodType, "identifier": identifier}; -} - -ObjJCompiler.prototype.nodeSelector = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSelector); -#endif - return this.nodeIdentifierName(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeMethodType = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMethodType); -#endif - var children = astNode.children, - child = children[2], - size = children.length, - methodTypes = [], - offset = 3; - - this.nodeOpenParenthesis(children[0]); - this.nodeUnderline(children[1], false); - - if (child && child.name === ObjJCompiler.AstNodeACTION) - methodTypes.push(this.nodeACTION(child)); - else - { - methodTypes.push(this.nodeIdentifierName(child)); - if (children[4] === "<") - { - this.nodeUnderline(children[3], false); - this.nodeWORD(children[4]); // "<" - this.nodeUnderline(children[5], false); - this.nodeIdentifierName(children[6]); - this.nodeUnderline(children[7], false); - this.nodeWORD(children[8]); // ">" - offset += 6; - } - } - - for (var i = offset; i + 1 < size - 2; i += 2) - { - this.nodeUnderline(children[i], true); - child = children[i + 1]; - if (child && child.name === ObjJCompiler.AstNodeACTION) - methodTypes.push(this.nodeACTION(child)); - else - { - methodTypes.push(this.nodeIdentifierName(child)); - if (i + 7 < size && children[i + 3] === "<") - { - this.nodeUnderline(children[i++ + 2], false); - this.nodeWORD(children[i++ + 2]); // "<" - this.nodeUnderline(children[i++ + 2], false); - this.nodeIdentifierName(children[i++ + 2]); - this.nodeUnderline(children[i++ + 2], false); - this.nodeWORD(children[i++ + 2]); // ">" - } - } - } - - this.nodeUnderline(children[size - 2], false); - this.nodeCloseParenthesis(children[size - 1]); - return methodTypes; -} - -ObjJCompiler.prototype.nodeACTION = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeACTION); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeAssignmentExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "," - this.nodeUnderline(children[i + 2], false); - this.nodeAssignmentExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeAssignmentExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "," - this.nodeUnderline(children[i + 2], false); - this.nodeAssignmentExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeAssignmentExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAssignmentExpression); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeLeftHandSideExpression) - { - this.nodeLeftHandSideExpression(child); - this.nodeUnderline(children[1], false); - this.nodeAssignmentOperator(children[2]); - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpression(children[4]); - } - else - this.nodeConditionalExpression(child); -} - -ObjJCompiler.prototype.nodeAssignmentExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAssignmentExpressionNoIn); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeLeftHandSideExpression) - { - this.nodeLeftHandSideExpression(child); - this.nodeUnderline(children[1], false); - this.nodeAssignmentOperator(children[2]); - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpressionNoIn(children[4]); - } - else - this.nodeConditionalExpressionNoIn(child); -} - -ObjJCompiler.prototype.nodeAssignmentOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAssignmentOperator); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeConditionalExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeConditionalExpression); -#endif - var children = astNode.children, - child = children[1]; - - this.nodeLogicalOrExpression(children[0]); - if (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - this.nodeWORD(children[2]); // "?" - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpression(children[4]); - this.nodeUnderline(children[5], false); - this.nodeWORD(children[6]); // ":" - this.nodeUnderline(children[7], false); - this.nodeAssignmentExpression(children[8]); - } -} - -ObjJCompiler.prototype.nodeConditionalExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeConditionalExpressionNoIn); -#endif - var children = astNode.children, - child = children[1]; - - this.nodeLogicalOrExpressionNoIn(children[0]); - if (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - this.nodeWORD(children[2]); // "?" - this.nodeUnderline(children[3], false); - this.nodeAssignmentExpressionNoIn(children[4]); - this.nodeUnderline(children[5], false); - this.nodeWORD(children[6]); // ":" - this.nodeUnderline(children[7], false); - this.nodeAssignmentExpressionNoIn(children[8]); - } -} - -ObjJCompiler.prototype.nodeLogicalOrExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLogicalOrExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeLogicalAndExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "||" - this.nodeUnderline(children[i + 2], false); - this.nodeLogicalAndExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeLogicalOrExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLogicalOrExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeLogicalAndExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "||" - this.nodeUnderline(children[i + 2], false); - this.nodeLogicalAndExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeLogicalAndExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLogicalAndExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseOrExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "&&" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseOrExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeLogicalAndExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLogicalAndExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseOrExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "&&" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseOrExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseOrExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseOrExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseXOrExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "|" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseXOrExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseOrExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseOrExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseXOrExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "|" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseXOrExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseXOrExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseXOrExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseAndExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "^" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseAndExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseXOrExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseXOrExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeBitwiseAndExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "^" - this.nodeUnderline(children[i + 2], false); - this.nodeBitwiseAndExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseAndExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseAndExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeEqualityExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "&" - this.nodeUnderline(children[i + 2], false); - this.nodeEqualityExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeBitwiseAndExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBitwiseAndExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeEqualityExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeWORD(children[i + 1]); // "&" - this.nodeUnderline(children[i + 2], false); - this.nodeEqualityExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeEqualityExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEqualityExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeRelationalExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeEqualityOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeRelationalExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeEqualityExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEqualityExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeRelationalExpressionNoIn(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeEqualityOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeRelationalExpressionNoIn(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeEqualityOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEqualityOperator); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeRelationalExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRelationalExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeShiftExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeRelationalOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeShiftExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeRelationalOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRelationalOperator); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeIN: - this.nodeIN(child); - break; - case ObjJCompiler.AstNodeINSTANCEOF: - this.nodeINSTANCEOF(child); - break; - default: - this.nodeWORD(child); - } -} - -ObjJCompiler.prototype.nodeRelationalExpressionNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRelationalExpressionNoIn); -#endif - var children = astNode.children, - size = children.length; - - this.nodeShiftExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeRelationalOperatorNoIn(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeShiftExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeRelationalOperatorNoIn = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRelationalOperatorNoIn); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeINSTANCEOF: - this.nodeINSTANCEOF(child); - break; - default: - this.nodeWORD(child); - } -} - -ObjJCompiler.prototype.nodeShiftExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeShiftExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeAdditiveExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeShiftOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeAdditiveExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeShiftOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeShiftOperator); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeAdditiveExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAdditiveExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeMultiplicativeExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeAdditiveOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeMultiplicativeExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeAdditiveOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeAdditiveOperator); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeMultiplicativeExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMultiplicativeExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeUnaryExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeMultiplicativeOperator(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeUnaryExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodeMultiplicativeOperator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMultiplicativeOperator); -#endif - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeUnaryExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnaryExpression); -#endif - var children = astNode.children, - child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodePostfixExpression: - this.nodePostfixExpression(child); - break; - case ObjJCompiler.AstNodeDELETE: - this.nodeDELETE(child); - this.nodeUnderline(children[1], true); - this.nodeUnaryExpression(children[2]); - break; - case ObjJCompiler.AstNodeVOID: - this.nodeVOID(child); - this.nodeUnderline(children[1], true); - this.nodeUnaryExpression(children[2]); - break; - case ObjJCompiler.AstNodeTYPEOF: - this.nodeTYPEOF(child); - this.nodeUnderline(children[1], true); - this.nodeUnaryExpression(children[2]); - break; - default: - this.nodeWORD(child); - this.nodeUnderline(children[1], false); - this.nodeUnaryExpression(children[2]); - } -} - -ObjJCompiler.prototype.nodePostfixExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePostfixExpression); -#endif - var children = astNode.children; - - this.nodeLeftHandSideExpression(children[0]); - - if (children.length > 1) - { - this.nodeUnderlineNoLineBreak(children[1], false); - this.nodeWORD(children[2]); // "++" or "--" - } -} - -ObjJCompiler.prototype.nodeLeftHandSideExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLeftHandSideExpression); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeCallExpression) - this.nodeCallExpression(child) - else - this.nodeNewExpression(child); -} - -ObjJCompiler.prototype.nodeNewExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNewExpression); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeMemberExpression) - this.nodeMemberExpression(child) - else - { - this.nodeNEW(child); - this.nodeUnderline(children[1], true); - this.nodeNewExpression(children[2]); - } -} - -ObjJCompiler.prototype.nodeCallExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCallExpression); -#endif - var children = astNode.children, - size = children.length; - - this.nodeMemberExpression(children[0]); - this.nodeUnderline(children[1], false); - this.nodeArguments(children[2]); - - for (var i = 3; i + 1 < size; i += 2) - { - this.nodeUnderline(children[i], false); - var child = children[i + 1], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeArguments: - this.nodeArguments(child); - break; - case ObjJCompiler.AstNodeBracketedAccessor: - this.nodeBracketedAccessor(child); - break; - case ObjJCompiler.AstNodeDotAccessor: - this.nodeDotAccessor(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeArguments + ", " + ObjJCompiler.AstNodeBracketedAccessor + " or " + ObjJCompiler.AstNodeDotAccessor + " but got " + child, child)); - } - } -} - -ObjJCompiler.prototype.nodeMemberExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMemberExpression); -#endif - var children = astNode.children, - size = children.length, - child = children[0], - name = child ? child.name : null, - offset = 1; - - switch(name) - { - case ObjJCompiler.AstNodePrimaryExpression: - this.nodePrimaryExpression(child); - break; - case ObjJCompiler.AstNodeFunctionExpression: - this.nodeFunctionExpression(child); - break; - case ObjJCompiler.AstNodeMessageExpression: - this.nodeMessageExpression(child); - break; - default: - this.nodeNEW(child); - this.nodeUnderline(children[offset++], true); - this.nodeMemberExpression(children[offset++]); - this.nodeUnderline(children[offset++], false); - this.nodeArguments(children[offset++]); - } - - for (var i = offset; i + 1 < size; i += 2) - { - this.nodeUnderline(children[i], false); - var child = children[i + 1], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeBracketedAccessor: - this.nodeBracketedAccessor(child); - break; - case ObjJCompiler.AstNodeDotAccessor: - this.nodeDotAccessor(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeBracketedAccessor + " or " + ObjJCompiler.AstNodeDotAccessor + " but got " + child, child)); - } - } -} - -ObjJCompiler.prototype.nodeBracketedAccessor = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBracketedAccessor); -#endif - var children = astNode.children; - - this.nodeOpenBracket(children[0]); - this.nodeUnderline(children[1], false); - this.nodeExpression(children[2]); - this.nodeUnderline(children[3], false); - this.nodeCloseBracket(children[4]); -} - -ObjJCompiler.prototype.nodeDotAccessor = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDotAccessor); -#endif - var children = astNode.children; - - this.nodeDOT(children[0]); - this.nodeUnderline(children[1], false); - this.nodeIdentifierName(children[2]); -} - -ObjJCompiler.prototype.nodeArguments = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeArguments); -#endif - var children = astNode.children, - child = children[2], - offset = 0; - - this.nodeOpenParenthesis(children[0]); - this.nodeUnderline(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeArgumentList) - { - this.nodeArgumentList(child); - offset++; - } - this.nodeUnderline(children[2 + offset], false); - this.nodeCloseParenthesis(children[3 + offset]); -} - -ObjJCompiler.prototype.nodeArgumentList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeArgumentList); -#endif - var children = astNode.children, - size = children.length; - - this.nodeAssignmentExpression(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodeAssignmentExpression(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodePrimaryExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePrimaryExpression); -#endif - var children = astNode.children, - child = children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeTHIS: - this.nodeTHIS(child); - break; - case ObjJCompiler.AstNodeIdentifier: - var saveJSBuffer = this._jsBuffer; - - this._jsBuffer = null; - var identifier = this.nodeIdentifier(child); - this._jsBuffer = saveJSBuffer; - - if (saveJSBuffer) - { - var lvar = this.getLvarForCurrentMethod(identifier), - ivar = this.getIvarForCurrentClass(identifier); - - if (ivar) - { - if (lvar) - 0 == 0; // Warning: Local declaration of 'identifier' hides instance variable - else - { - CONCAT(saveJSBuffer, "self."); - } - } - - CONCAT(saveJSBuffer, identifier); - } - break; - case ObjJCompiler.AstNodeLiteral: - this.nodeLiteral(child); - break; - case ObjJCompiler.AstNodeArrayLiteral: - this.nodeArrayLiteral(child); - break; - case ObjJCompiler.AstNodeObjectLiteral: - this.nodeObjectLiteral(child); - break; - default: - this.nodeOpenParenthesis(child); - this.nodeUnderline(children[1], false); - this.nodeExpression(children[2]); - this.nodeUnderline(children[3], false); - this.nodeCloseParenthesis(children[4]); - } -} - -ObjJCompiler.prototype.nodeMessageExpression = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMessageExpression); -#endif - var children = astNode.children, - child = children[2], - saveJSBuffer = this._jsBuffer; - - this._jsBuffer = null; - this.nodeOpenBracket(children[0]); - this.nodeUnderline(children[1], false); - if (child && child.name === ObjJCompiler.AstNodeExpression) - { - var buffer = new StringBuffer(); - - this._jsBuffer = buffer; - this.nodeExpression(child); - this._jsBuffer = null; - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, "objj_msgSend("); - CONCAT(saveJSBuffer, buffer); - } - } - else - { - this.nodeSUPER(child); - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, "objj_msgSendSuper("); - CONCAT(saveJSBuffer, "{ receiver:self, super_class:" + (this._classMethod ? this._currentSuperMetaClass : this._currentSuperClass ) + " }"); - } - } - - this.nodeUnderline(children[3], false); - var selector = this.nodeSelectorCall(children[4]); - - if (saveJSBuffer) - { - CONCAT(saveJSBuffer, ", \""); - CONCAT(saveJSBuffer, selector.selector); // FIXME: sel_getUid(selector.selector + "") ? - CONCAT(saveJSBuffer, "\""); - - if (selector.expressions) - for (var i = 0; i < selector.expressions.length; i++) - CONCAT(saveJSBuffer, ", " + selector.expressions[i]); - - CONCAT(saveJSBuffer, ")"); - } - - this.nodeUnderline(children[5], false); - this.nodeCloseBracket(children[6]); - - this._jsBuffer = saveJSBuffer; -} - -ObjJCompiler.prototype.nodeSelectorCall = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSelectorCall); -#endif - var children = astNode.children, - size = children.length, - child = children[0], - selector = {}; - - if (child && child.name === ObjJCompiler.AstNodeUnarySelector) - selector.selector = this.nodeUnarySelector(child); - else - { - selector = this.nodeKeywordSelectorCall(child); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - var buffer = new StringBuffer(); - this._jsBuffer = buffer; - this.nodeExpression(children[i + 3]); - selector.parameters.push(buffer.toString()); - this._jsBuffer = null; - } - } - return selector; -} - -ObjJCompiler.prototype.nodeKeywordSelectorCall = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeKeywordSelectorCall); -#endif - var children = astNode.children, - size = children.length; - - var keywordCall = this.nodeKeywordCall(children[0]), - selector = keywordCall.selector, - expressions = [keywordCall.expression]; - - for (var i = 1; i + 1 < size; i += 2) - { - this.nodeUnderline(children[i], false); - keywordCall = this.nodeKeywordCall(children[i + 1]); - selector += keywordCall.selector; - expressions.push(keywordCall.expression); - } - return {"selector": selector, "expressions": expressions}; -} - -ObjJCompiler.prototype.nodeKeywordCall = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeKeywordCall); -#endif - var children = astNode.children, - child = children[0], - offset = 0, - selector = "", - buffer = new StringBuffer(); - - if (child && child.name === ObjJCompiler.AstNodeSelector) - selector += this.nodeSelector(children[offset++]); - - this.nodeUnderline(children[offset++], false); - this.nodeCOLON(children[offset++]); - selector += ":"; - this.nodeUnderline(children[offset++], false); - this._jsBuffer = buffer; - this.nodeExpression(children[offset]); - this._jsBuffer = null; - - return {"selector": selector, "expression": buffer.toString()}; -} - -ObjJCompiler.prototype.nodeArrayLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeArrayLiteral); -#endif - var children = astNode.children; - - this.nodeOpenBracket(children[0]); - this.nodeUnderline(children[1], false); - this.nodeElementList(children[2]); - this.nodeUnderline(children[3], false); - this.nodeCloseBracket(children[4]); -} - -ObjJCompiler.prototype.nodeElementList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeElementList); -#endif - var children = astNode.children, - offset = 0; - - while (children[offset] === ",") - { - this.nodeCOMMA(children[offset++]); - this.nodeUnderline(children[offset++], false); - } - - var child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - child = children[++offset]; - if (child && child.name === ObjJCompiler.AstNodeAssignmentExpression) - this.nodeAssignmentExpression(child); - else if (child === ",") - this.nodeCOMMA(child); - - child = children[++offset]; - } -} - -ObjJCompiler.prototype.nodeObjectLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeObjectLiteral); -#endif - var children = astNode.children, - child = children[2], - offset = 2; - - this.nodeOpenBrace(children[0]); - this.nodeUnderline(children[1], false); - if (child && child.name === ObjJCompiler.AstNodePropertyNameAndValueList) - { - this.nodePropertyNameAndValueList(children[offset++]); - this.nodeUnderline(children[offset++], false); - if (children[offset] === ",") - this.nodeCOMMA(children[offset++]); - } - this.nodeUnderline(children[offset++], false); - this.nodeCloseBrace(children[offset]); -} - -ObjJCompiler.prototype.nodePropertyNameAndValueList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertyNameAndValueList); -#endif - var children = astNode.children, - size = children.length; - - this.nodePropertyAssignment(children[0]); - - for (var i = 1; i + 3 < size; i += 4) - { - this.nodeUnderline(children[i], false); - this.nodeCOMMA(children[i + 1]); - this.nodeUnderline(children[i + 2], false); - this.nodePropertyAssignment(children[i + 3]); - } -} - -ObjJCompiler.prototype.nodePropertyAssignment = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertyAssignment); -#endif - var children = astNode.children, - child = children[4], - name = child ? child.name : null; - - this.nodePropertyName(children[0]); - this.nodeUnderline(children[1], false); - this.nodeCOLON(children[2]); - this.nodeUnderline(children[3], false); - - switch(name) - { - case ObjJCompiler.AstNodeAssignmentExpression: - this.nodeAssignmentExpression(child); - break; - case ObjJCompiler.AstNodePropertyGetter: - this.nodePropertyGetter(child); - break; - case ObjJCompiler.AstNodePropertySetter: - this.nodePropertySetter(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeAssignmentExpression + ", " + ObjJCompiler.AstNodePropertyGetter + " or " + ObjJCompiler.AstNodePropertySetter + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodePropertyGetter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertyGetter); -#endif - var children = astNode.children, - child = children[4]; - - this.nodeGET(children[0]); - this.nodeUnderline(children[1], true); - this.nodePropertyName(children[2]); - this.nodeUnderline(children[3], false); - this.nodeOpenParenthesis(children[4]); - this.nodeUnderline(children[5], false); - this.nodeCloseParenthesis(children[6]); - this.nodeUnderline(children[7], false); - this.nodeOpenBrace(children[8]); - this.nodeUnderline(children[9], false); - this.nodeFunctionBody(children[10]); - this.nodeUnderline(children[11], false); - this.nodeCloseBrace(children[12]); -} - -function PropertySetter(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertyGetter); -#endif - var children = astNode.children, - child = children[4]; - - this.nodeGET(children[0]); - this.nodeUnderline(children[1], true); - this.nodePropertyName(children[2]); - this.nodeUnderline(children[3], false); - this.nodeOpenParenthesis(children[4]); - this.nodeUnderline(children[5], false); - this.nodePropertySetParameterList(children[6]); - this.nodeUnderline(children[7], false); - this.nodeCloseParenthesis(children[8]); - this.nodeUnderline(children[9], false); - this.nodeOpenBrace(children[10]); - this.nodeUnderline(children[11], false); - this.nodeFunctionBody(children[12]); - this.nodeUnderline(children[13], false); - this.nodeCloseBrace(children[14]); -} - -ObjJCompiler.prototype.nodePropertyName = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertyName); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeIdentifierName: - this.nodeIdentifierName(child); - break; - case ObjJCompiler.AstNodeStringLiteral: - this.nodeStringLiteral(child); - break; - case ObjJCompiler.AstNodeNumericLiteral: - this.nodeNumericLiteral(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeIdentifierName + ", " + ObjJCompiler.AstNodeStringLiteral + " or " + ObjJCompiler.AstNodeNumericLiteral + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodePropertySetParameterList = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodePropertySetParameterList); -#endif - - this.nodeIdentifier(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLiteral); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeNullLiteral: - this.nodeNullLiteral(child); - break; - case ObjJCompiler.AstNodeBooleanLiteral: - this.nodeBooleanLiteral(child); - break; - case ObjJCompiler.AstNodeNumericLiteral: - this.nodeNumericLiteral(child); - break; - case ObjJCompiler.AstNodeStringLiteral: - this.nodeStringLiteral(child); - break; - case ObjJCompiler.AstNodeRegularExpressionLiteral: - this.nodeRegularExpressionLiteral(child); - break; - case ObjJCompiler.AstNodeSelectorLiteral: - this.nodeSelectorLiteral(child); - break; - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeLiteral + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeSelectorLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSelectorLiteral); -#endif - var children = astNode.children, - saveJSBuffer = this._jsBuffer, - selectorBuffer = new StringBuffer(); - - this._jsBuffer = null; - this.nodeSELECTOR(children[0]); - this.nodeUnderline(children[1], false); - this.nodeOpenParenthesis(children[2]); - this.nodeUnderline(children[3], false); - if (saveJSBuffer) - CONCAT(selectorBuffer, "sel_getUid(\""); - this._jsBuffer = selectorBuffer; - this.nodeSelectorLiteralContents(children[4]); - CONCAT(selectorBuffer, "\")"); - this._jsBuffer = null; - this.nodeUnderline(children[5], false); - this.nodeCloseParenthesis(children[6]); - this._jsBuffer = saveJSBuffer; - if (saveJSBuffer) - CONCAT(saveJSBuffer, selectorBuffer); -} - -ObjJCompiler.prototype.nodeSelectorLiteralContents = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSelectorLiteralContents); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeIdentifier) - this.nodeIdentifier(child); - else - { - var size = children.length, - offset = 0; - - while (offset < size) - { - child = children[offset]; - if (child && child.name === ObjJCompiler.AstNodeSelector) - this.nodeSelector(children[offset++]); - this.nodeUnderline(children[offset++], false); - this.nodeCOLON(children[offset++]); - this.nodeUnderline(children[offset++], false); - } - } -} - -ObjJCompiler.prototype.nodeNullLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNullLiteral); -#endif - - this.nodeNULL(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeBooleanLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBooleanLiteral); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeTRUE) - this.nodeTRUE(child); - else - this.nodeFALSE(child); -} - -ObjJCompiler.prototype.nodeNumericLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNumericLiteral); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeHexIntegerLiteral) - this.nodeHexIntegerLiteral(child); - else - this.nodeDecimalLiteral(child); -} - -ObjJCompiler.prototype.nodeDecimalLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDecimalLiteral); -#endif - var children = astNode.children, - offset = 0, - number = "", - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeDecimalIntegerLiteral) - { - number += this.nodeDecimalIntegerLiteral(child); - child = children[++offset]; - } - - if (child === ".") - { - number += this.nodeWORD(child); // "." - child = children[++offset]; - } - - while (child && child.name === ObjJCompiler.AstNodeDecimalDigit) - { - number += this.nodeDecimalDigit(child); - child = children[++offset] - } - - if (child && child.name === ObjJCompiler.AstNodeExponentPart) - number += this.nodeExponentPart(child); -} - -ObjJCompiler.prototype.nodeDecimalIntegerLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDecimalIntegerLiteral); -#endif - var children = astNode.children, - offset = 1, - number = ""; - - if (children[0] === "0") - number = this.nodeWORD(children[0]); - else - { - number = this.nodeWORD(children[0]); - } - - var child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeDecimalDigit) - { - number += this.nodeDecimalDigit(child); - child = children[++offset] - } - - return number; -} - -ObjJCompiler.prototype.nodeDecimalDigit = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDecimalDigit); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeExponentPart = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeExponentPart); -#endif - var children = astNode.children; - - return this.nodeWORD(children[0]) + this.nodeSignedInteger(children[1]); -} - -ObjJCompiler.prototype.nodeSignedInteger = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSignedInteger); -#endif - var children = astNode.children, - offset = 1, - number = "", - child = children[0]; - - if (child === "+" || child === "-") - { - number = this.nodeWORD(child); - child = children[offset++]; - } - - while (child && child.name === ObjJCompiler.AstNodeDecimalDigit) - { - number += this.nodeDecimalDigit(child); - child = children[offset++]; - } - - return number; -} - -ObjJCompiler.prototype.nodeHexIntegerLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeHexIntegerLiteral); -#endif - var children = astNode.children, - offset = 2, - hex = this.nodeWORD(children[0]); - - hex += this.nodeWORD(children[1]); - - var child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeHexDigit) - { - hex += this.nodeHexDigit(child); - child = children[++offset]; - } - - return hex; -} - -ObjJCompiler.prototype.nodeHexDigit = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeHexDigit); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeStringLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeStringLiteral); -#endif - var children = astNode.children, - offset = 0, - string = ""; - - if (children[0] === "@") - { - var saveJSBuffer = this._jsBuffer; - - this._jsBuffer = null; - this.nodeWORD(children[offset++]); - this._jsBuffer = saveJSBuffer; - this.nodeUnderline(children[offset++], false); - } - - var quoteCharacter = children[offset++], - stringCharacterFunction = null; - - this.nodeWORD(quoteCharacter); - - if (quoteCharacter === '"') - stringCharacterFunction = this.nodeDoubleStringCharacter; - else - stringCharacterFunction = this.nodeSingleStringCharacter; - - while (children[offset] !== quoteCharacter) - { - string += stringCharacterFunction.call(this, children[offset++]); - } - - this.nodeWORD(children[offset]); - - return string; -} - -ObjJCompiler.prototype.nodeDoubleStringCharacter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDoubleStringCharacter); -#endif - var children = astNode.children, - child = children[0]; - - if (child === "\\") - return this.nodeWORD(child) + this.nodeEscapeSequence(children[1]); - else if (child && child.name === ObjJCompiler.AstNodeLineContinuation) - return this.nodeLineContinuation(child); - else - return this.nodeWORD(child); -} - -ObjJCompiler.prototype.nodeSingleStringCharacter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSingleStringCharacter); -#endif - var children = astNode.children, - child = children[0]; - - if (child === "\\") - return this.nodeWORD(child) + this.nodeEscapeSequence(children[1]); - else if (child && child.name === ObjJCompiler.AstNodeLineContinuation) - return this.nodeLineContinuation(child); - else - return this.nodeWORD(child); -} - -ObjJCompiler.prototype.nodeLineContinuation = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLineContinuation); -#endif - var children = astNode.children; - - return this.nodeWORD(children[0]) + nodeLineTerminatorSequence(children[1]); -} - -ObjJCompiler.prototype.nodeEscapeSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEscapeSequence); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeCharacterEscapeSequence: - return this.nodeCharacterEscapeSequence(child); - case ObjJCompiler.AstNodeHexEscapeSequence: - return this.nodeHexEscapeSequence(child); - case ObjJCompiler.AstNodeUnicodeEscapeSequence: - return this.nodeUnicodeEscapeSequence(child); - default: - return this.nodeWORD(child); - } -} - -ObjJCompiler.prototype.nodeCharacterEscapeSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCharacterEscapeSequence); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeSingleEscapeCharacter) - return this.nodeSingleEscapeCharacter(child); - else - return this.nodeNonEscapeCharacter(child); -} - -ObjJCompiler.prototype.nodeSingleEscapeCharacter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSingleEscapeCharacter); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeNonEscapeCharacter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNonEscapeCharacter); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeHexEscapeSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeHexEscapeSequence); -#endif - var children = astNode.children; - - return children[0] + this.nodeHexDigit(children[1]) + nodeHexDigit(children[2]); -} - -ObjJCompiler.prototype.nodeUnicodeEscapeSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnicodeEscapeSequence); -#endif - var children = astNode.children; - - return this.nodeWORD(children[0]) + this.nodeHexDigit(children[1]) + this.nodeHexDigit(children[2]) + this.nodeHexDigit(children[3]) + this.nodeHexDigit(children[4]); -} - -ObjJCompiler.prototype.nodeRegularExpressionLiteral = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionLiteral); -#endif - var children = astNode.children; - - return this.nodeWORD(children[0]) + this.nodeRegularExpressionBody(children[1]) + this.nodeWORD(children[2]) + this.nodeRegularExpressionFlags(children[3]); -} - -ObjJCompiler.prototype.nodeRegularExpressionBody = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionBody); -#endif - var children = astNode.children, - regString = this.nodeRegularExpressionFirstChar(children[0]), - offset = 1, - child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeRegularExpressionChar) - { - regString += this.nodeRegularExpressionChar(child); - child = children[++offset]; - } - return regString; -} - -ObjJCompiler.prototype.nodeRegularExpressionFirstChar = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionFirstChar); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeRegularExpressionNonTerminator: - return this.nodeRegularExpressionNonTerminator(child); - case ObjJCompiler.AstNodeRegularExpressionBackslashSequence: - return this.nodeRegularExpressionBackslashSequence(child); - case ObjJCompiler.AstNodeRegularExpressionClass: - return this.nodeRegularExpressionClass(child); - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeRegularExpressionNonTerminator + ", " + ObjJCompiler.AstNodeRegularExpressionBackslashSequence + " or " + ObjJCompiler.AstNodeRegularExpressionClass + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeRegularExpressionChar = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionChar); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeRegularExpressionNonTerminator: - return this.nodeRegularExpressionNonTerminator(child); - case ObjJCompiler.AstNodeRegularExpressionBackslashSequence: - return this.nodeRegularExpressionBackslashSequence(child); - case ObjJCompiler.AstNodeRegularExpressionClass: - return this.nodeRegularExpressionClass(child); - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeRegularExpressionNonTerminator + ", " + ObjJCompiler.AstNodeRegularExpressionBackslashSequence + " or " + ObjJCompiler.AstNodeRegularExpressionClass + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeRegularExpressionBackslashSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionBackslashSequence); -#endif - var children = astNode.children; - - return this.nodeWORD(children[0]) + this.nodeRegularExpressionNonTerminator(children[1]); -} - -ObjJCompiler.prototype.nodeRegularExpressionNonTerminator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionNonTerminator); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeRegularExpressionClass = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionClass); -#endif - var children = astNode.children, - offset = 1, - regString = this.nodeWORD(children[0]), - child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeRegularExpressionClassChar) - { - regString += this.nodeRegularExpressionClassChar(children[offset++]); - child = children[offset]; - } - - return regString + this.nodeWORD(child); -} - -ObjJCompiler.prototype.nodeRegularExpressionClassChar = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionClassChar); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeRegularExpressionNonTerminator) - return this.nodeRegularExpressionNonTerminator(child); - else - return this.nodeRegularExpressionBackslashSequence(child); -} - -ObjJCompiler.prototype.nodeRegularExpressionFlags = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRegularExpressionFlags); -#endif - var children = astNode.children, - offset = 0, - regString = "", - child = children[offset]; - - while (child && child.name === ObjJCompiler.AstNodeIdentifierPart) - { - regString += this.nodeIdentifierPart(child); - child = children[++offset]; - } - - return regString; -} - -ObjJCompiler.prototype.nodeUnderline = function(/*SyntaxNode*/ astNode, /*boolean*/ mustHaveOneSpace) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnderline); -#endif - var children = astNode.children, - size = children.length; - string = ""; - - for (var i = 0; i < size; i++) - { - var child = children[i], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeWhiteSpace: - string += this.nodeWhiteSpace(child); - break; - case ObjJCompiler.AstNodeLineTerminator: - string += this.nodeLineTerminator(child); - break; - case ObjJCompiler.AstNodeComment: - string += this.nodeComment(child); - break - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeWhiteSpace + ", " + ObjJCompiler.AstNodeLineTerminator + " or " + ObjJCompiler.AstNodeComment + " but got " + child.name, child)); - } - } - // FIXME: Do something smart with this..... -} - -ObjJCompiler.prototype.nodeUnderlineNoLineBreak = function(/*SyntaxNode*/ astNode, /*boolean*/ mustHaveOneSpace) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnderlineNoLineBreak); -#endif - var children = astNode.children, - size = children.length; - string = ""; - - for (var i = 0; i < size; i++) - { - var child = children[i], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeWhiteSpace: - string += this.nodeWhiteSpace(child); - break - case ObjJCompiler.AstNodeSingleLineMultiLineComment: - string += this.nodeSingleLineMultiLineComment(child); - break - case AstSingleLineComment: - string += this.nodeSingleLineComment(child); - break - default: - throw new SyntaxError(this.error_message("Expected node " + ObjJCompiler.AstNodeWhiteSpace + ", " + ObjJCompiler.AstNodeSingleLineMultiLineComment + " or " + ObjJCompiler.AstSingleLineComment + " but got " + child.name, child)); - } - } - // FIXME: Do something smart with this..... -} - -ObjJCompiler.prototype.nodeWhiteSpace = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeWhiteSpace); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeLineTerminator = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLineTerminator); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeLineTerminatorSequence = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeLineTerminatorSequence); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeComment = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeComment); -#endif - var child = astNode.children[0]; - - if (child && child.name === ObjJCompiler.AstNodeMultiLineComment) - return this.nodeMultiLineComment(child); - else - return this.nodeSingleLineComment(child); -} - -ObjJCompiler.prototype.nodeMultiLineComment = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeMultiLineComment); -#endif - var children = astNode.children, - size = children.length; - string = ""; - - for (var i = 0; i < size; i++) - { - string += this.nodeWORD(children[i]); - } - - return string; -} - -ObjJCompiler.prototype.nodeSingleLineMultiLineComment = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSingleLineMultiLineComment); -#endif - var children = astNode.children, - size = children.length, - string = ""; - - for (var i = 0; i < size; i++) - { - string += this.nodeWORD(children[i]); - } - - return string; -} - -ObjJCompiler.prototype.nodeSingleLineComment = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSingleLineComment); -#endif - var children = astNode.children, - size = children.length, - string = children[0]; - - this.nodeWORD(string); - for (var i = 1; i < size; i++) - { - string += this.nodeSingleLineCommentChar(children[i]) - } - - return string; -} - -ObjJCompiler.prototype.nodeSingleLineCommentChar = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSingleLineCommentChar); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeEOS = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEOS); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeUnderline) - { - this.nodeUnderline(child, false); - this.nodeSEMICOLON(children[1]); - } - else - { - this.nodeUnderlineNoLineBreak(child, false); - child = children[1]; - - if (child && child.name === ObjJCompiler.AstNodeLineTerminatorSequence) - this.nodeLineTerminatorSequence(child); - else if (child && child.name === ObjJCompiler.AstNodeEOF) - this.nodeEOF(child); - } -} - -ObjJCompiler.prototype.nodeSemicolonInsertionEOS = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSemicolonInsertionEOS); -#endif - var children = astNode.children, - child = children[1]; - - this.nodeUnderlineNoLineBreak(children[0], false) - if (child && child.name === ObjJCompiler.AstNodeLineTerminatorSequence) - this.nodeLineTerminatorSequence(child); - else if (child && child.name === ObjJCompiler.AstNodeEOF) - this.nodeEOF(child); - else if (children.length > 1) - this.nodeSEMICOLON(child); -} - -ObjJCompiler.prototype.nodeEOF = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeEOF); -#endif -} - -ObjJCompiler.prototype.nodeIdentifier = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIdentifier); -#endif - - return this.nodeIdentifierName(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeIdentifierName = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIdentifierName); -#endif - var children = astNode.children, - size = children.length, - string = this.nodeIdentifierStart(children[0]); - - for (var i = 1; i < size; i++) - { - string += this.nodeIdentifierPart(children[i]); - } - - return string; -} - -ObjJCompiler.prototype.nodeIdentifierStart = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIdentifierStart); -#endif - var children = astNode.children, - child = children[0]; - - if (child && child.name === ObjJCompiler.AstNodeUnicodeLetter) - return this.nodeUnicodeLetter(child); - else if (child === "\\") - return this.nodeWORD(child) + nodeUnicodeEscapeSequence(children[1]); - else - return this.nodeWORD(child); -} - -ObjJCompiler.prototype.nodeIdentifierPart = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIdentifierPart); -#endif - var child = astNode.children[0], - name = child ? child.name : null; - - switch(name) - { - case ObjJCompiler.AstNodeIdentifierStart: - return this.nodeIdentifierStart(child); - case ObjJCompiler.AstNodeUnicodeCombiningMark: - return this.nodeUnicodeCombiningMark(child); - case ObjJCompiler.AstNodeUnicodeDigit: - return this.nodeUnicodeDigit(child); - case ObjJCompiler.AstNodeUnicodeConnectorPunctuation: - return this.nodeUnicodeConnectorPunctuation(child); - case ObjJCompiler.AstNodeZWNJ: - return this.nodeZWNJ(child); - case ObjJCompiler.AstNodeZWJ: - return this.nodeZWJ(child); - default: - throw new SyntaxError(this.error_message("Expected children of " + ObjJCompiler.AstNodeIdentifierPart + " but got " + child, child)); - } -} - -ObjJCompiler.prototype.nodeZWNJ = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeZWNJ); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeZWJ = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeZWJ); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeUnicodeLetter = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnicodeLetter); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeUnicodeCombiningMark = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnicodeCombiningMark); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeUnicodeDigit = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnicodeDigit); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeUnicodeConnectorPunctuation = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeUnicodeConnectorPunctuation); -#endif - - return this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeFALSE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFALSE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeTRUE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTRUE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeNULL = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNULL); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeBREAK = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeBREAK); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeCONTINUE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCONTINUE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeDEBUGGER = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDEBUGGER); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeIN = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIN); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeINSTANCEOF = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeINSTANCEOF); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeDELETE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDELETE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeFUNCTION = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFUNCTION); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeNEW = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeNEW); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeTHIS = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTHIS); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeTYPEOF = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTYPEOF); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeVOID = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVOID); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeIF = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeIF); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeELSE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeELSE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeDO = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDO); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeWHILE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeWHILE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeFOR = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFOR); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeVAR = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeVAR); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeRETURN = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeRETURN); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeCASE = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCASE); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeDEFAULT = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeDEFAULT); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeSWITCH = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSWITCH); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeTHROW = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTHROW); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeCATCH = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeCATCH); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeFINALLY = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeFINALLY); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeTRY = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeTRY); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeWITH = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeWITH); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeSUPER = function(/*SyntaxNode*/ astNode) -{ -#if DEBUG - this.assertNode(astNode, ObjJCompiler.AstNodeSUPER); -#endif - - this.nodeWORD(astNode.children[0]); -} - -ObjJCompiler.prototype.nodeCOMMA = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeCOLON = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeSEMICOLON = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeOpenParenthesis = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeCloseParenthesis = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeOpenBrace = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeCloseBrace = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeOpenBracket = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeCloseBracket = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeDOT = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeIMPLEMENTATION = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeEND = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeIMPORT = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeOUTLET = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeSELECTOR = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeACCESSORS = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodePROPERTY = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeGETTER = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeSETTER = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeLESSTHEN = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeGREATERTHEN = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeEQUALS = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodePLUS = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeMINUS = function(/*SyntaxNode*/ astNode) -{ - return this.nodeWORD(astNode); -} - -ObjJCompiler.prototype.nodeWORD = function(/*SyntaxNode*/ astNode) -{ -// if (typeof astNode !== "string") -// debugger; - if (this._jsBuffer) - CONCAT(this._jsBuffer, astNode); - if (this._objJBuffer) - CONCAT(this._objJBuffer, astNode); - return astNode; -} - -ObjJCompiler.prototype.getClassDef = function(/* String */ aClassName) -{ - var c = this._classDefs[aClassName]; - - if (c) return c; - - if (objj_getClass) - { - var aClass = objj_getClass(aClassName); - if (aClass) - { - var ivars = class_copyIvarList(aClass), - ivarSize = ivars.length, - myIvars = {}, - superClass = aClass.super_class; - - for (var i = 0; i < ivarSize; i++) - { - var ivar = ivars[i]; - - myIvars[ivar.name] = {"type": ivar.type, "name": ivar.name}; - } - c = {"className": aClassName, "ivars": myIvars}; - - if (superClass) - c.superClassName = superClass.name; - this._classDefs[aClassName] = c; - return c; - } - } - - return null; -// classDef = {"className": className, "superClassName": superClassName, "ivars": {}, "methods": {}}; -} - -ObjJCompiler.prototype.getIvarForCurrentClass = function(/* String */ ivarName) -{ - var c = this._currentClassDef; - - while (c) - { - var ivars = c.ivars; - if (ivars) - { - var ivarDef = ivars[ivarName]; - if (ivarDef) - return ivarDef; - } - c = this.getClassDef(c.superClassName); - } - - return null; -} - -ObjJCompiler.prototype.getLvarForCurrentMethod = function(/* String */ lvarName) -{ - var currentClassMethods = this._currentMethod; - - if (currentClassMethods) - { - var lvarStack = currentClassMethods.lvarStack; - - for (var i = lvarStack.length - 1; i >= 0; i--) - { - var lvars = lvarStack[i]; - - if (lvars && lvars[lvarName]) - { - return lvars[lvarName]; - } - } - // Check the parameters in the method declaration - if (currentClassMethods.parameters && currentClassMethods.parameters[lvarName]) - return currentClassMethods.parameters[lvarName]; - } - - return null; -} - -ObjJCompiler.prototype.createLocalVariable = function(/*Variable*/ variable) -{ - var currentClassMethods = this._currentMethod; - - if (currentClassMethods) - { - var lvarStack = currentClassMethods.lvarStack; - var lvars = lvarStack[lvarStack.length - 1]; // Get last - - var declaredVariable = lvars[variable.identifier]; - if (declaredVariable) - { - // Local variable already declared! Maybe a warning? - } - else - { - lvars[variable.identifier] = variable; - } - } -} - -ObjJCompiler.prototype.executable = function() -{ - if (!this._executable) - this._executable = new Executable(this._jsBuffer ? this._jsBuffer.toString() : null, this._dependencies, this._URL, null, this); - return this._executable; -} - -ObjJCompiler.prototype.IMBuffer = function() -{ - return this._imBuffer; -} - -ObjJCompiler.prototype.JSBuffer = function() -{ - return this._jsBuffer; -} - -ObjJCompiler.prototype.error_message = function(errorMessage, astNode) -{ - return errorMessage + " "; -} diff --git a/Objective-J/Parser.js b/Objective-J/Parser.js deleted file mode 100644 index 4859744ba..000000000 --- a/Objective-J/Parser.js +++ /dev/null @@ -1,382 +0,0 @@ - -var Parser = { }; - -var compiledGrammar = {"table":[[0,"source",1],[0,"start",2],[4,3,4,3],[0,"_",5],[8,6],[6,7],[0,"SourceElements",8],[3,9,10,11],[4,12,13],[0,"WhiteSpace",14],[0,"LineTerminator",15],[0,"Comment",16],[0,"SourceElement",17],[6,18],[2,"[\\u0009\\u000B\\u000C\\u0020\\u00A0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]"],[2,"[\\u000A\\u000D\\u2028\\u2029]"],[3,19,20],[3,21,22],[4,3,12],[0,"MultiLineComment",23],[0,"SingleLineComment",24],[0,"Statement",25],[0,"FunctionDeclaration",26],[4,27,28,29],[4,30,31],[3,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,22,47,48,49],[4,50,3,51,3,52,3,53,3,54,3,55,3,56,3,57],[5,"/*"],[6,58],[5,"*/"],[5,"//"],[6,59],[0,"Block",60],[0,"VariableStatement",61],[0,"EmptyStatement",62],[0,"ExpressionStatement",63],[0,"IfStatement",64],[0,"IterationStatement",65],[0,"ContinueStatement",66],[0,"BreakStatement",67],[0,"ReturnStatement",68],[0,"WithStatement",69],[0,"LabelledStatement",70],[0,"SwitchStatement",71],[0,"ThrowStatement",72],[0,"TryStatement",73],[0,"DebuggerStatement",74],[0,"FunctionExpression",75],[0,"ImportStatement",76],[0,"ClassDeclarationStatement",77],[0,"FUNCTION",78],[0,"Identifier",79],[5,"("],[8,80],[5,")"],[5,"{"],[0,"FunctionBody",2],[5,"}"],[4,81,82],[0,"SingleLineCommentChar",83],[4,55,3,84,3,57],[4,85,3,86,87,88],[5,";"],[4,89,90,88],[4,91,3,52,3,90,3,54,3,21,92],[3,93,94,95,96,97],[4,98,99,100],[4,101,99,100],[4,102,99,103],[4,104,3,52,3,90,3,54,3,21],[4,51,3,105,3,21],[4,106,3,52,3,90,3,54,3,107],[4,108,99,103],[4,109,3,32,3,110],[4,111,88],[4,50,3,112,3,52,3,53,3,54,3,55,3,56,3,57],[4,113,3,114,88],[4,115,3,51,3,116,3,117,3,118,3,119,88],[4,120,121],[4,122,123],[0,"FormalParameterList",124],[9,29],[1],[4,125,82],[8,126],[0,"VAR",127],[0,"VariableDeclaration",128],[6,129],[0,"EOS",130],[9,131],[0,"Expression",132],[0,"IF",133],[8,134],[0,"DoWhileStatement",135],[0,"WhileStatement",136],[0,"ForStatement",137],[0,"ForInStatement",138],[0,"EachStatement",139],[0,"CONTINUE",140],[0,"__",141],[3,142,143],[0,"BREAK",144],[0,"RETURN",145],[3,143,146],[0,"WITH",147],[5,":"],[0,"SWITCH",148],[0,"CaseBlock",149],[0,"THROW",150],[0,"TRY",151],[3,152,153],[0,"DEBUGGER",154],[8,51],[5,"@import"],[3,155,156],[5,"@implementation"],[8,157],[8,158],[0,"ClassBody",159],[5,"@end"],[5,"function"],[9,160],[9,161],[0,"IdentifierName",162],[4,51,163],[9,10],[0,"StatementList",164],[4,165,121],[4,51,166],[4,3,167,3,86],[3,168,169,170,171],[3,55,50],[4,172,173],[4,174,121],[4,3,175,3,21],[4,176,3,21,3,177,3,52,3,90,3,54,88],[4,177,3,52,3,90,3,54,3,21],[4,178,3,52,3,179,3,62,3,180,3,62,3,180,3,54,3,21],[4,178,3,52,3,181,3,182,3,90,3,54,3,21],[4,183,3,52,3,181,3,182,3,90,3,54,3,21],[4,184,121],[6,185],[4,51,88],[0,"SemicolonInsertionEOS",186],[4,187,121],[4,188,121],[4,90,88],[4,189,121],[4,190,121],[4,55,3,191,3,192,3,191,3,57],[4,193,121],[4,194,121],[4,195,196],[0,"Finally",197],[4,198,121],[0,"LocalFilePath",199],[0,"StandardFilePath",200],[3,201,202],[4,55,203,3,57],[8,204],[0,"IdentifierPart",205],[4,206,121],[4,207,208],[6,209],[4,21,210],[5,"var"],[8,211],[5,","],[4,3,62],[4,99,212],[4,99,213],[4,99,214],[0,"AssignmentExpression",215],[6,216],[5,"if"],[0,"ELSE",217],[0,"DO",218],[0,"WHILE",219],[0,"FOR",220],[8,221],[8,90],[0,"ForInFirstExpression",222],[0,"IN",223],[5,"@each"],[5,"continue"],[3,9,224,20],[3,225,169,170,171],[5,"break"],[5,"return"],[5,"with"],[5,"switch"],[8,226],[8,227],[5,"throw"],[5,"try"],[0,"Catch",228],[8,229],[4,230,3,32],[5,"debugger"],[0,"StringLiteral",231],[4,232,3,233,3,234],[0,"SuperclassDeclaration",235],[0,"CategoryDeclaration",236],[6,237],[0,"ClassElements",238],[3,207,239,240,241,242,243],[0,"ReservedWord",244],[0,"IdentifierStart",245],[6,160],[4,3,167,3,51],[6,246],[4,3,247,248,3,172],[0,"LineTerminatorSequence",249],[10,57],[0,"EOF",250],[3,251,252],[4,3,167,3,172],[4,253,121],[4,254,121],[4,255,121],[4,256,121],[0,"ForFirstExpression",257],[3,258,259],[4,260,121],[0,"SingleLineMultiLineComment",261],[4,99,62],[0,"CaseClauses",262],[0,"DefaultClause",263],[4,264,3,52,3,51,3,54,3,32],[4,3,153],[0,"FINALLY",265],[3,266,267],[5,"<"],[6,268],[5,">"],[4,105,3,51],[4,52,3,51,3,54],[4,3,269],[4,270,271],[0,"UnicodeCombiningMark",272],[0,"UnicodeDigit",273],[0,"UnicodeConnectorPunctuation",274],[0,"ZWNJ",275],[0,"ZWJ",276],[3,277,278,279,280],[3,281,282,283],[4,3,21],[5,"="],[9,247],[3,284,285,286,287,288],[9,82],[4,258,3,289,3,172],[0,"ConditionalExpression",290],[5,"else"],[5,"do"],[5,"while"],[5,"for"],[3,291,292],[0,"LeftHandSideExpression",293],[4,85,3,294],[5,"in"],[4,27,295,29],[4,296,297],[4,298,3,105,299],[0,"CATCH",300],[4,301,121],[4,302,303,304,303],[4,305,306,305],[3,307,308],[0,"CompoundIvarDeclaration",309],[0,"ClassElement",310],[6,311],[3,312,313,314,315,316,317],[3,318,319,320,321],[2,"[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]"],[5,"\u200C"],[5,"\u200D"],[0,"Keyword",322],[0,"FutureReservedWord",323],[0,"NullLiteral",324],[0,"BooleanLiteral",325],[0,"UnicodeLetter",326],[2,"[$_]"],[4,327,328],[5,"\n"],[4,288,329],[5,"\u2028"],[5,"\u2029"],[5,"\r"],[0,"AssignmentOperator",330],[4,331,332],[0,"ExpressionNoIn",333],[4,85,3,334],[3,335,336],[0,"VariableDeclarationNoIn",337],[6,338],[0,"CaseClause",339],[6,340],[0,"DEFAULT",341],[8,342],[4,343,121],[5,"finally"],[8,344],[5,"\""],[6,345],[5,"'"],[6,346],[5,"\\>"],[4,347,82],[4,348,3,349,350,88],[3,351,352,21,22],[4,3,270],[2,"[\\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]"],[4,353,354],[4,355,356],[4,357,358],[4,359,360],[4,361,362],[2,"[\\u0030-\\u0039\\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]"],[4,363,364],[4,357,365],[4,366,367],[3,187,368,343,184,198,369,370,254,253,301,256,120,174,371,260,372,188,190,373,193,194,374,165,375,255,189],[3,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405],[0,"NULL",406],[3,407,408],[3,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426],[5,"\\"],[0,"UnicodeEscapeSequence",427],[8,284],[3,428,429,430,431,432,433,434,435,436,437,438,439],[0,"LogicalOrExpression",440],[8,441],[4,442,443],[0,"VariableDeclarationListNoIn",444],[0,"CallExpression",445],[0,"NewExpression",446],[4,51,447],[4,81,125,82],[4,448,3,90,3,105,299],[4,3,296],[4,369,121],[4,3,126],[5,"catch"],[4,449,3],[0,"DoubleStringCharacter",450],[0,"SingleStringCharacter",451],[9,234],[0,"IvarType",452],[0,"IvarDeclaration",453],[6,454],[0,"ClassMethodDeclaration",455],[0,"InstanceMethodDeclaration",456],[5,"\uDB40"],[2,"[\\uDD00-\\uDDEF]"],[5,"\uD834"],[2,"[\\uDD67-\\uDD69\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44\\uDD65\\uDD66\\uDD6D-\\uDD72]"],[5,"\uD804"],[2,"[\\uDC01\\uDC38-\\uDC46\\uDC80\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8]"],[5,"\uD800"],[2,"[\\uDDFD]"],[5,"\uD802"],[2,"[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F]"],[5,"\uD835"],[2,"[\\uDFCE-\\uDFFF]"],[2,"[\\uDC66-\\uDC6F]"],[5,"\uD801"],[2,"[\\uDCA0-\\uDCA9]"],[5,"case"],[5,"default"],[5,"delete"],[5,"instanceof"],[5,"new"],[5,"this"],[5,"typeof"],[5,"void"],[5,"abstract"],[5,"boolean"],[5,"byte"],[5,"char"],[5,"class"],[5,"const"],[5,"double"],[5,"enum"],[5,"export"],[5,"extends"],[5,"final"],[5,"float"],[5,"goto"],[5,"implements"],[5,"import"],[5,"interface"],[5,"int"],[5,"long"],[5,"native"],[5,"package"],[5,"private"],[5,"protected"],[5,"public"],[5,"short"],[5,"static"],[5,"super"],[5,"synchronized"],[5,"throws"],[5,"transient"],[5,"volatile"],[4,457,121],[0,"TRUE",458],[0,"FALSE",459],[2,"[\\u0041-\\u005A\\u00C0-\\u00D6\\u00D8-\\u00DE\\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-\\uFF3A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00DF-\\u00F6\\u00F8-\\u00FF\\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]"],[4,460,461],[4,462,463],[4,464,465],[4,466,467],[4,363,468],[4,357,469],[4,359,470],[4,471,472],[4,366,473],[4,474,475],[4,476,477],[4,478,479],[4,480,481],[4,482,483],[4,484,485],[4,361,486],[4,487,488],[4,489,490,490,490,490],[4,247,248],[5,"*="],[5,"/="],[5,"%="],[5,"+="],[5,"-="],[5,"<<="],[5,">>="],[5,">>>="],[5,"&="],[5,"^="],[5,"|="],[4,491,492],[4,3,493,3,172,3,105,3,172],[0,"AssignmentExpressionNoIn",494],[6,495],[4,294,496],[4,497,3,498,499],[3,497,500],[8,501],[0,"CASE",502],[5,"@"],[3,503,504,505],[3,506,504,505],[4,507,508],[4,51,3,509],[4,3,167,3,349],[4,510,511,3,512,3,513,3,55,3,56,3,57],[4,514,511,3,512,3,513,3,55,3,56,3,57],[5,"null"],[4,515,121],[4,516,121],[5,"\uD82C"],[2,"[\\uDC00\\uDC01]"],[5,"\uD808"],[2,"[\\uDC00-\\uDF6E]"],[5,"\uD869"],[2,"[\\uDED6\\uDF00]"],[5,"\uD809"],[2,"[\\uDC00-\\uDC62]"],[2,"[\\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]"],[2,"[\\uDC03-\\uDC37\\uDC83-\\uDCAF]"],[2,"[\\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]"],[5,"\uD80C"],[2,"[\\uDC00-\\uDFFF]"],[2,"[\\uDC00-\\uDC9D]"],[5,"\uD86E"],[2,"[\\uDC1D]"],[5,"\uD803"],[2,"[\\uDC00-\\uDC48]"],[5,"\uD840"],[2,"[\\uDC00]"],[5,"\uD87E"],[2,"[\\uDC00-\\uDE1D]"],[5,"\uD86D"],[2,"[\\uDF34\\uDF40]"],[5,"\uD81A"],[2,"[\\uDC00-\\uDE38]"],[2,"[\\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]"],[5,"\uD80D"],[2,"[\\uDC00-\\uDC2E]"],[5,"u"],[0,"HexDigit",517],[0,"LogicalAndExpression",518],[6,519],[5,"?"],[3,520,521],[4,3,167,3,442],[6,522],[0,"MemberExpression",523],[0,"Arguments",524],[6,525],[4,526,3,336],[4,3,247,248,3,442],[4,368,121],[4,527,82],[4,327,528],[0,"LineContinuation",529],[4,530,82],[0,"IvarTypeElement",531],[6,532],[8,533],[5,"+"],[8,534],[0,"MethodSelector",535],[8,62],[5,"-"],[5,"true"],[5,"false"],[2,"[0-9a-fA-F]"],[4,536,537],[4,3,538,3,491],[4,258,3,289,3,442],[0,"ConditionalExpressionNoIn",539],[4,3,167,3,294],[4,540,541],[4,52,3,542,3,54],[4,3,543],[0,"NEW",544],[9,545],[0,"EscapeSequence",546],[4,327,212],[9,547],[4,548,549],[4,3,507],[0,"Accessors",550],[4,3,551],[3,552,553],[0,"BitwiseOrExpression",554],[6,555],[5,"||"],[4,556,557],[3,558,47,559,560],[6,561],[8,562],[3,498,563,564],[4,372,121],[3,565,327,10],[3,566,567,568,328],[3,569,327,10],[9,570],[3,123,571],[4,572,573],[0,"MethodType",574],[4,575,576],[0,"UnarySelector",577],[4,578,579],[4,3,580,3,536],[0,"LogicalOrExpressionNoIn",581],[8,582],[0,"PrimaryExpression",583],[0,"MessageExpression",584],[4,526,3,497,3,498],[4,3,585],[0,"ArgumentList",132],[0,"BracketedAccessor",586],[0,"DotAccessor",587],[2,"[\"]"],[0,"CharacterEscapeSequence",588],[4,589,590],[0,"HexEscapeSequence",591],[2,"[']"],[4,549,3,592],[5,"@outlet"],[5,"@accessors"],[8,593],[4,52,3,594,595,3,54],[0,"KeywordSelector",596],[8,597],[0,"Selector",123],[0,"BitwiseXOrExpression",598],[6,599],[5,"&&"],[4,600,601],[4,3,493,3,442,3,105,3,442],[3,602,51,603,604,605,606],[4,607,3,608,3,609,3,610],[3,563,564],[4,607,3,90,3,610],[4,611,3,123],[3,612,613],[5,"0"],[9,614],[4,615,490,490],[3,533,88,167],[4,52,616,54],[3,617,618],[6,619],[4,620,621],[4,3,167,3,622],[4,623,624],[4,3,625,248,3,578],[0,"LogicalAndExpressionNoIn",626],[6,627],[0,"THIS",628],[0,"Literal",629],[0,"ArrayLiteral",630],[0,"ObjectLiteral",631],[4,52,3,90,3,54],[5,"["],[3,632,90],[0,"SelectorCall",633],[5,"]"],[5,"."],[0,"SingleEscapeCharacter",634],[0,"NonEscapeCharacter",635],[0,"DecimalDigit",636],[5,"x"],[8,637],[0,"ACTION",638],[4,123,639],[4,3,594],[0,"KeywordDeclarator",640],[6,641],[5,"..."],[0,"BitwiseAndExpression",642],[6,643],[5,"|"],[4,644,645],[4,3,538,3,600],[4,373,121],[3,279,280,646,199,647,648],[4,607,3,649,3,610],[4,55,3,650,3,57],[0,"SUPER",651],[3,652,553],[2,"['\"\\\\bfnrtv]"],[4,125,653,82],[2,"[0-9]"],[4,654,655],[3,656,657],[8,658],[4,659,105,511,3,51],[4,3,620],[4,660,661],[4,3,662,248,3,623],[0,"BitwiseOrExpressionNoIn",663],[6,664],[0,"NumericLiteral",665],[0,"RegularExpressionLiteral",666],[0,"SelectorLiteral",667],[0,"ElementList",668],[8,669],[4,401,121],[4,670,671],[9,672],[0,"AccessorsConfiguration",673],[6,674],[4,675,121],[4,676,121],[4,3,232,3,123,3,234],[8,677],[0,"EqualityExpression",678],[6,679],[5,"^"],[4,680,681],[4,3,580,3,644],[4,682,683],[4,684,685,684,686],[4,687,3,52,3,688,3,54],[4,689,690,3,691],[4,692,3,693],[0,"KeywordSelectorCall",694],[6,695],[0,"EscapeCharacter",696],[3,697,698,699,700,701,702],[4,3,167,3,654],[5,"@action"],[5,"IBAction"],[4,577,3],[4,703,704],[4,3,705,248,3,660],[0,"BitwiseXOrExpressionNoIn",706],[6,707],[3,708,709],[9,207],[5,"/"],[0,"RegularExpressionBody",710],[0,"RegularExpressionFlags",208],[5,"@selector"],[0,"SelectorLiteralContents",711],[6,712],[6,713],[8,172],[0,"PropertyNameAndValueList",714],[8,167],[4,715,716],[4,3,167,3,90],[3,612,614,615,489],[0,"IvarPropertyName",717],[0,"IvarGetterName",718],[0,"IvarSetterName",719],[5,"readonly"],[5,"readwrite"],[5,"copy"],[0,"RelationalExpression",720],[6,721],[5,"&"],[4,722,723],[4,3,625,248,3,680],[0,"HexIntegerLiteral",724],[0,"DecimalLiteral",725],[4,726,727],[3,728,51],[4,167,3],[4,3,172,729],[4,730,731],[0,"KeywordCall",732],[6,733],[4,734,3,247,3,51],[4,735,3,247,3,51],[4,736,3,247,3,51,737],[4,738,739],[4,3,740,3,703],[0,"BitwiseAndExpressionNoIn",741],[6,742],[4,589,743,744],[4,745,746],[0,"RegularExpressionFirstChar",747],[6,748],[7,749],[7,750],[0,"PropertyAssignment",751],[6,752],[4,753,3,105,3,90],[4,3,715],[5,"property"],[5,"getter"],[5,"setter"],[8,754],[0,"ShiftExpression",755],[6,756],[0,"EqualityOperator",757],[4,758,759],[4,3,662,248,3,722],[2,"[Xx]"],[7,490],[3,760,761,762],[8,763],[3,764,765,766],[0,"RegularExpressionChar",767],[4,753,3,105,3],[4,3,167],[3,768,769,770],[4,3,167,3,730],[8,577],[4,3,105],[4,771,772],[4,3,773,3,738],[3,774,775,776,777],[0,"EqualityExpressionNoIn",778],[6,779],[4,762,611,780],[4,611,781],[0,"DecimalIntegerLiteral",782],[0,"ExponentPart",783],[4,784,785],[0,"RegularExpressionBackslashSequence",786],[0,"RegularExpressionClass",787],[3,788,765,766],[4,789,3,105,3,172],[0,"PropertyGetter",790],[0,"PropertySetter",791],[0,"AdditiveExpression",792],[6,793],[0,"RelationalOperator",794],[5,"==="],[5,"!=="],[5,"=="],[5,"!="],[4,795,796],[4,3,705,248,3,758],[6,614],[7,614],[3,589,797],[4,798,799],[9,800],[0,"RegularExpressionNonTerminator",83],[4,327,785],[4,607,801,610],[4,802,785],[0,"PropertyName",803],[4,804,3,789,3,52,3,54,3,55,3,56,3,57],[4,805,3,789,3,52,3,806,3,54,3,55,3,56,3,57],[4,807,808],[4,3,809,3,771],[3,810,811,232,234,812,182],[0,"RelationalExpressionNoIn",813],[6,814],[4,815,780],[2,"[eE]"],[0,"SignedInteger",816],[2,"[*\\u005C/[]"],[6,817],[9,818],[3,123,199,646],[5,"get"],[5,"set"],[0,"PropertySetParameterList",51],[0,"MultiplicativeExpression",819],[6,820],[0,"ShiftOperator",821],[5,"<="],[5,">="],[0,"INSTANCEOF",822],[4,738,823],[4,3,740,3,795],[2,"[1-9]"],[4,824,781],[0,"RegularExpressionClassChar",825],[2,"[\\u005C/[]"],[4,826,827],[4,3,828,3,807],[3,829,830,831],[4,371,121],[6,832],[8,833],[3,834,765],[0,"UnaryExpression",835],[6,836],[0,"AdditiveOperator",837],[5,"<<"],[5,">>"],[5,">>>"],[4,3,838,3,738],[2,"[+-]"],[4,839,785],[3,840,841,842,843,844,845,846,847,848,849],[4,3,850,3,826],[4,851,248],[0,"RelationalOperatorNoIn",852],[9,853],[0,"PostfixExpression",854],[4,855,3,826],[4,856,3,826],[4,857,3,826],[4,858,3,826],[4,859,3,826],[4,510,3,826],[4,514,3,826],[4,860,3,826],[4,861,3,826],[0,"MultiplicativeOperator",862],[3,863,864],[3,810,811,232,234,812],[2,"[\\u005C\\]]"],[4,258,865],[0,"DELETE",866],[0,"VOID",867],[0,"TYPEOF",868],[5,"++"],[5,"--"],[5,"~"],[5,"!"],[4,869,248],[4,510,870],[4,514,871],[8,872],[4,370,121],[4,375,121],[4,374,121],[3,873,684,874],[9,510],[9,514],[4,99,875],[5,"*"],[5,"%"],[3,858,859],[0,"%start",877],[4,878,879,878],[0,"%_",880],[8,881],[6,882],[0,"%SourceElements",883],[3,884,885,886],[4,887,888],[0,"%WhiteSpace",14],[0,"%LineTerminator",15],[0,"%Comment",889],[0,"%SourceElement",890],[6,891],[3,892,893],[3,894,895],[4,878,887],[0,"%MultiLineComment",23],[0,"%SingleLineComment",896],[0,"%Statement",897],[0,"%FunctionDeclaration",898],[4,30,899],[3,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,895,915,916,917],[4,918,878,919,878,52,878,920,878,54,878,55,878,921,878,57],[6,922],[0,"%Block",923],[0,"%VariableStatement",924],[0,"%EmptyStatement",62],[0,"%ExpressionStatement",925],[0,"%IfStatement",926],[0,"%IterationStatement",927],[0,"%ContinueStatement",928],[0,"%BreakStatement",929],[0,"%ReturnStatement",930],[0,"%WithStatement",931],[0,"%LabelledStatement",932],[0,"%SwitchStatement",933],[0,"%ThrowStatement",934],[0,"%TryStatement",935],[0,"%DebuggerStatement",936],[0,"%FunctionExpression",937],[0,"%ImportStatement",938],[0,"%ClassDeclarationStatement",939],[0,"%FUNCTION",940],[0,"%Identifier",941],[8,942],[0,"%FunctionBody",877],[0,"%SingleLineCommentChar",943],[12,944,945],[4,946,878,947,948,949],[4,950,951,949],[4,952,878,52,878,951,878,54,878,894,953],[3,954,955,956,957,958],[4,959,960,961],[4,962,960,961],[4,963,960,964],[4,965,878,52,878,951,878,54,878,894],[4,919,878,105,878,894],[4,966,878,52,878,951,878,54,878,967],[4,968,960,964],[4,969,878,900,878,970],[4,971,949],[4,918,878,972,878,52,878,920,878,54,878,55,878,921,878,57],[4,113,878,973,949],[4,115,878,919,878,974,878,975,878,976,878,119,949],[4,120,977],[12,978,979],[0,"%FormalParameterList",980],[4,981,82],[4,55,878,982,878,57],[11,"%BadBlock",983,"Missing ending brace"],[0,"%VAR",984],[0,"%VariableDeclaration",985],[6,986],[0,"%EOS",987],[9,988],[0,"%Expression",989],[0,"%IF",990],[8,991],[0,"%DoWhileStatement",992],[0,"%WhileStatement",993],[0,"%ForStatement",994],[0,"%ForInStatement",995],[0,"%EachStatement",996],[0,"%CONTINUE",997],[0,"%__",998],[3,999,1000],[0,"%BREAK",1001],[0,"%RETURN",1002],[3,1000,1003],[0,"%WITH",1004],[0,"%SWITCH",1005],[0,"%CaseBlock",1006],[0,"%THROW",1007],[0,"%TRY",1008],[3,1009,1010],[0,"%DEBUGGER",1011],[8,919],[3,1012,1013],[8,1014],[8,1015],[0,"%ClassBody",1016],[9,1017],[4,1018,1019],[0,"%BadIdentifier",1020],[4,919,1021],[9,885],[8,1022],[4,55,878,982,878],[4,165,977],[4,919,1023],[4,878,167,878,947],[3,1024,1025,1026,1027],[3,55,918],[4,1028,1029],[4,174,977],[4,878,1030,878,894],[4,1031,878,894,878,1032,878,52,878,951,878,54,949],[4,1032,878,52,878,951,878,54,878,894],[4,1033,878,52,878,1034,878,62,878,1035,878,62,878,1035,878,54,878,894],[4,1033,878,52,878,1036,878,1037,878,951,878,54,878,894],[4,183,878,52,878,1036,878,1037,878,951,878,54,878,894],[4,184,977],[6,1038],[4,919,949],[0,"%SemicolonInsertionEOS",1039],[4,187,977],[4,188,977],[4,951,949],[4,189,977],[4,190,977],[4,55,878,1040,878,1041,878,1040,878,57],[4,193,977],[4,194,977],[4,1042,1043],[0,"%Finally",1044],[4,198,977],[0,"%LocalFilePath",1045],[0,"%StandardFilePath",1046],[3,1047,1048],[4,55,1049,878,57],[8,1050],[0,"%IdentifierPart",1051],[9,1052],[0,"%IdentifierName",1053],[3,1054,1055],[6,1056],[0,"%StatementList",1057],[8,1058],[4,878,62],[4,960,1059],[4,960,213],[4,960,1060],[0,"%AssignmentExpression",1061],[6,1062],[0,"%ELSE",1063],[0,"%DO",1064],[0,"%WHILE",1065],[0,"%FOR",1066],[8,1067],[8,951],[0,"%ForInFirstExpression",1068],[0,"%IN",1069],[3,884,1070,893],[3,1071,1025,1026,1027],[8,1072],[8,1073],[0,"%Catch",1074],[8,1075],[4,1076,878,900],[0,"%StringLiteral",1077],[4,232,878,233,878,234],[0,"%SuperclassDeclaration",1078],[0,"%CategoryDeclaration",1079],[6,1080],[0,"%ClassElements",1081],[3,1082,1083,1084,1085,1086,1087],[4,1088,977],[4,1082,1089],[11,"%ReservedWordIdentifier",1052,"Identifier cannot be a reserved word"],[11,"%DigitIdentifier",1090,"Identifier cannot start with a digit"],[4,878,167,878,919],[4,894,1091],[4,878,247,248,878,1028],[0,"%LineTerminatorSequence",249],[0,"%EOF",250],[3,1092,1093],[4,878,167,878,1028],[4,253,977],[4,254,977],[4,255,977],[4,256,977],[0,"%ForFirstExpression",1094],[3,1095,1096],[4,260,977],[0,"%SingleLineMultiLineComment",1097],[4,960,62],[0,"%CaseClauses",1098],[0,"%DefaultClause",1099],[4,1100,878,52,878,919,878,54,878,900],[4,878,1010],[0,"%FINALLY",1101],[3,1102,1103],[4,105,878,919],[4,52,878,919,878,54],[4,878,1104],[4,1105,1106],[0,"%IdentifierStart",1107],[0,"%UnicodeCombiningMark",272],[0,"%UnicodeDigit",273],[0,"%UnicodeConnectorPunctuation",274],[0,"%ZWNJ",275],[0,"%ZWJ",276],[0,"%ReservedWord",1108],[6,1017],[4,1084,1109],[6,1110],[4,1095,878,1111,878,1028],[0,"%ConditionalExpression",1112],[3,1113,1114],[0,"%LeftHandSideExpression",1115],[4,946,878,1116],[4,27,1117,29],[4,1118,1119],[4,1120,878,105,1121],[0,"%CATCH",1122],[4,301,977],[4,1123,303,1124,303],[4,305,1125,305],[0,"%CompoundIvarDeclaration",1126],[0,"%ClassElement",1127],[6,1128],[3,1129,282,1130],[3,1131,1132,1133,1134],[7,1017],[4,878,894],[0,"%AssignmentOperator",330],[4,1135,1136],[0,"%ExpressionNoIn",1137],[4,946,878,1138],[3,1139,1140],[0,"%VariableDeclarationNoIn",1141],[6,1142],[0,"%CaseClause",1143],[6,1144],[0,"%DEFAULT",1145],[8,1146],[4,343,977],[8,1147],[6,1148],[6,1149],[4,1150,878,1151,1152,949],[3,1153,1154,894,895],[4,878,1105],[0,"%UnicodeLetter",326],[4,327,1155],[0,"%Keyword",322],[0,"%FutureReservedWord",323],[0,"%NullLiteral",1156],[0,"%BooleanLiteral",1157],[0,"%LogicalOrExpression",1158],[8,1159],[4,1160,1161],[0,"%VariableDeclarationListNoIn",1162],[0,"%CallExpression",1163],[0,"%NewExpression",1164],[4,919,1165],[4,81,981,82],[4,1166,878,951,878,105,1121],[4,878,1118],[4,369,977],[4,878,1022],[4,449,878],[0,"%DoubleStringCharacter",1167],[0,"%SingleStringCharacter",1168],[0,"%IvarType",1169],[0,"%IvarDeclaration",1170],[6,1171],[0,"%ClassMethodDeclaration",1172],[0,"%InstanceMethodDeclaration",1173],[0,"%UnicodeEscapeSequence",1174],[0,"%NULL",1175],[3,1176,1177],[4,1178,1179],[4,878,493,878,1028,878,105,878,1028],[0,"%AssignmentExpressionNoIn",1180],[6,1181],[4,1116,1182],[4,1183,878,1184,1185],[3,1183,1186],[8,1187],[0,"%CASE",1188],[3,1189,1190,1191],[3,1192,1190,1191],[4,1193,1194],[4,919,878,1195],[4,878,167,878,1151],[4,510,1196,878,1197,878,513,878,55,878,921,878,57],[4,514,1196,878,1197,878,513,878,55,878,921,878,57],[4,489,1198,1198,1198,1198],[4,457,977],[0,"%TRUE",1199],[0,"%FALSE",1200],[0,"%LogicalAndExpression",1201],[6,1202],[3,1203,1204],[4,878,167,878,1160],[6,1205],[0,"%MemberExpression",1206],[0,"%Arguments",1207],[6,1208],[4,1209,878,1140],[4,878,247,248,878,1160],[4,368,977],[4,1210,82],[4,327,1211],[0,"%LineContinuation",1212],[4,1213,82],[0,"%IvarTypeElement",1214],[6,1215],[8,1216],[8,1217],[0,"%MethodSelector",1218],[0,"%HexDigit",517],[4,515,977],[4,516,977],[4,1219,1220],[4,878,538,878,1178],[4,1095,878,1111,878,1160],[0,"%ConditionalExpressionNoIn",1221],[4,878,167,878,1116],[4,1222,1223],[4,52,878,1224,878,54],[4,878,1225],[0,"%NEW",1226],[9,1227],[0,"%EscapeSequence",1228],[4,327,1059],[9,1229],[4,1230,1231],[4,878,1193],[0,"%Accessors",1232],[4,878,1233],[3,1234,1235],[0,"%BitwiseOrExpression",1236],[6,1237],[4,1238,1239],[3,1240,915,1241,1242],[6,1243],[8,1244],[3,1184,1245,1246],[4,372,977],[3,565,327,885],[3,1247,1248,1249,1155],[3,569,327,885],[9,1250],[3,1019,571],[4,572,1251],[0,"%MethodType",1252],[4,1253,1254],[0,"%UnarySelector",1255],[4,1256,1257],[4,878,580,878,1219],[0,"%LogicalOrExpressionNoIn",1258],[8,1259],[0,"%PrimaryExpression",1260],[0,"%MessageExpression",1261],[4,1209,878,1183,878,1184],[4,878,1262],[0,"%ArgumentList",989],[0,"%BracketedAccessor",1263],[0,"%DotAccessor",1264],[0,"%CharacterEscapeSequence",1265],[4,589,1266],[0,"%HexEscapeSequence",1267],[4,1231,878,1268],[8,1269],[4,52,878,1270,1271,878,54],[0,"%KeywordSelector",1272],[8,1273],[0,"%Selector",1019],[0,"%BitwiseXOrExpression",1274],[6,1275],[4,1276,1277],[4,878,493,878,1160,878,105,878,1160],[3,1278,919,1279,1280,1281,1282],[4,607,878,1283,878,1284,878,610],[3,1245,1246],[4,607,878,951,878,610],[4,611,878,1019],[3,1285,1286],[9,1287],[4,615,1198,1198],[3,1216,949,167],[4,52,1288,54],[3,1289,1290],[6,1291],[4,1292,1293],[4,878,167,878,622],[4,1294,1295],[4,878,625,248,878,1256],[0,"%LogicalAndExpressionNoIn",1296],[6,1297],[0,"%THIS",1298],[0,"%Literal",1299],[0,"%ArrayLiteral",1300],[0,"%ObjectLiteral",1301],[4,52,878,951,878,54],[3,1302,951],[0,"%SelectorCall",1303],[0,"%SingleEscapeCharacter",634],[0,"%NonEscapeCharacter",1304],[0,"%DecimalDigit",636],[8,1305],[0,"%ACTION",1306],[4,1019,1307],[4,878,1270],[0,"%KeywordDeclarator",1308],[6,1309],[0,"%BitwiseAndExpression",1310],[6,1311],[4,1312,1313],[4,878,538,878,1276],[4,373,977],[3,1133,1134,1314,1045,1315,1316],[4,607,878,1317,878,610],[4,55,878,1318,878,57],[0,"%SUPER",1319],[3,1320,1235],[4,981,1321,82],[4,1322,1323],[3,1324,1325],[8,1326],[4,1327,105,1196,878,919],[4,878,1292],[4,1328,1329],[4,878,662,248,878,1294],[0,"%BitwiseOrExpressionNoIn",1330],[6,1331],[0,"%NumericLiteral",1332],[0,"%RegularExpressionLiteral",1333],[0,"%SelectorLiteral",1334],[0,"%ElementList",1335],[8,1336],[4,401,977],[4,1337,1338],[9,1339],[0,"%AccessorsConfiguration",1340],[6,1341],[4,675,977],[4,676,977],[4,878,232,878,1019,878,234],[8,1342],[0,"%EqualityExpression",1343],[6,1344],[4,1345,1346],[4,878,580,878,1312],[4,1347,1348],[4,684,1349,684,1350],[4,687,878,52,878,1351,878,54],[4,1352,1353,878,1354],[4,1355,878,693],[0,"%KeywordSelectorCall",1356],[6,1357],[0,"%EscapeCharacter",1358],[3,1359,1360,1361,700,701,702],[4,878,167,878,1322],[4,1255,878],[4,1362,1363],[4,878,705,248,878,1328],[0,"%BitwiseXOrExpressionNoIn",1364],[6,1365],[3,1366,1367],[9,1082],[0,"%RegularExpressionBody",1368],[0,"%RegularExpressionFlags",1089],[0,"%SelectorLiteralContents",1369],[6,1370],[6,1371],[8,1028],[0,"%PropertyNameAndValueList",1372],[4,1373,1374],[4,878,167,878,951],[3,1285,1287,615,489],[0,"%IvarPropertyName",1375],[0,"%IvarGetterName",1376],[0,"%IvarSetterName",1377],[0,"%RelationalExpression",1378],[6,1379],[4,1380,1381],[4,878,625,248,878,1345],[0,"%HexIntegerLiteral",1382],[0,"%DecimalLiteral",1383],[4,1384,1385],[3,1386,919],[4,167,878],[4,878,1028,1387],[4,1388,1389],[0,"%KeywordCall",1390],[6,1391],[4,734,878,247,878,919],[4,735,878,247,878,919],[4,736,878,247,878,919,1392],[4,1393,1394],[4,878,1395,878,1362],[0,"%BitwiseAndExpressionNoIn",1396],[6,1397],[4,589,743,1398],[4,1399,1400],[0,"%RegularExpressionFirstChar",1401],[6,1402],[7,1403],[7,1404],[0,"%PropertyAssignment",1405],[6,1406],[4,1407,878,105,878,951],[4,878,1373],[8,1408],[0,"%ShiftExpression",1409],[6,1410],[0,"%EqualityOperator",757],[4,1411,1412],[4,878,662,248,878,1380],[7,1198],[3,1413,1414,1415],[8,1416],[3,1417,1418,1419],[0,"%RegularExpressionChar",1420],[4,1407,878,105,878],[4,878,167],[3,1421,1422,1423],[4,878,167,878,1388],[8,1255],[4,878,105],[4,1424,1425],[4,878,1426,878,1393],[0,"%EqualityExpressionNoIn",1427],[6,1428],[4,1415,611,1429],[4,611,1430],[0,"%DecimalIntegerLiteral",1431],[0,"%ExponentPart",1432],[4,784,1433],[0,"%RegularExpressionBackslashSequence",1434],[0,"%RegularExpressionClass",1435],[3,1436,1418,1419],[4,1437,878,105,878,1028],[0,"%PropertyGetter",1438],[0,"%PropertySetter",1439],[0,"%AdditiveExpression",1440],[6,1441],[0,"%RelationalOperator",1442],[4,1443,1444],[4,878,705,248,878,1411],[6,1287],[7,1287],[3,589,1445],[4,798,1446],[0,"%RegularExpressionNonTerminator",943],[4,327,1433],[4,607,1447,610],[4,802,1433],[0,"%PropertyName",1448],[4,804,878,1437,878,52,878,54,878,55,878,921,878,57],[4,805,878,1437,878,52,878,1449,878,54,878,55,878,921,878,57],[4,1450,1451],[4,878,1452,878,1424],[3,810,811,232,234,1453,1037],[0,"%RelationalExpressionNoIn",1454],[6,1455],[4,815,1429],[0,"%SignedInteger",1456],[6,1457],[3,1019,1045,1314],[0,"%PropertySetParameterList",919],[0,"%MultiplicativeExpression",1458],[6,1459],[0,"%ShiftOperator",821],[0,"%INSTANCEOF",1460],[4,1393,1461],[4,878,1395,878,1443],[4,824,1430],[0,"%RegularExpressionClassChar",1462],[4,1463,1464],[4,878,1465,878,1450],[4,371,977],[6,1466],[3,1467,1418],[0,"%UnaryExpression",1468],[6,1469],[0,"%AdditiveOperator",837],[4,878,1470,878,1393],[4,839,1433],[3,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480],[4,878,1481,878,1463],[0,"%RelationalOperatorNoIn",1482],[0,"%PostfixExpression",1483],[4,1484,878,1463],[4,1485,878,1463],[4,1486,878,1463],[4,858,878,1463],[4,859,878,1463],[4,510,878,1463],[4,514,878,1463],[4,860,878,1463],[4,861,878,1463],[0,"%MultiplicativeOperator",862],[3,810,811,232,234,1453],[4,1095,1487],[0,"%DELETE",1488],[0,"%VOID",1489],[0,"%TYPEOF",1490],[8,1491],[4,370,977],[4,375,977],[4,374,977],[4,960,875]],"nameToUID":{"start":1,"_":3,"SourceElements":6,"WhiteSpace":9,"LineTerminator":10,"Comment":11,"SourceElement":12,"MultiLineComment":19,"SingleLineComment":20,"Statement":21,"FunctionDeclaration":22,"Block":32,"VariableStatement":33,"EmptyStatement":34,"ExpressionStatement":35,"IfStatement":36,"IterationStatement":37,"ContinueStatement":38,"BreakStatement":39,"ReturnStatement":40,"WithStatement":41,"LabelledStatement":42,"SwitchStatement":43,"ThrowStatement":44,"TryStatement":45,"DebuggerStatement":46,"FunctionExpression":47,"ImportStatement":48,"ClassDeclarationStatement":49,"FUNCTION":50,"Identifier":51,"FunctionBody":56,"SingleLineCommentChar":59,"FormalParameterList":80,"VAR":85,"VariableDeclaration":86,"EOS":88,"Expression":90,"IF":91,"DoWhileStatement":93,"WhileStatement":94,"ForStatement":95,"ForInStatement":96,"EachStatement":97,"CONTINUE":98,"__":99,"BREAK":101,"RETURN":102,"WITH":104,"SWITCH":106,"CaseBlock":107,"THROW":108,"TRY":109,"DEBUGGER":111,"ClassBody":118,"IdentifierName":123,"StatementList":126,"SemicolonInsertionEOS":143,"Finally":153,"LocalFilePath":155,"StandardFilePath":156,"IdentifierPart":160,"AssignmentExpression":172,"ELSE":175,"DO":176,"WHILE":177,"FOR":178,"ForInFirstExpression":181,"IN":182,"Catch":195,"StringLiteral":199,"SuperclassDeclaration":201,"CategoryDeclaration":202,"ClassElements":204,"ReservedWord":206,"IdentifierStart":207,"LineTerminatorSequence":212,"EOF":214,"ForFirstExpression":221,"SingleLineMultiLineComment":224,"CaseClauses":226,"DefaultClause":227,"FINALLY":230,"UnicodeCombiningMark":239,"UnicodeDigit":240,"UnicodeConnectorPunctuation":241,"ZWNJ":242,"ZWJ":243,"ConditionalExpression":252,"LeftHandSideExpression":258,"CATCH":264,"CompoundIvarDeclaration":269,"ClassElement":270,"Keyword":277,"FutureReservedWord":278,"NullLiteral":279,"BooleanLiteral":280,"UnicodeLetter":281,"AssignmentOperator":289,"ExpressionNoIn":291,"VariableDeclarationNoIn":294,"CaseClause":296,"DEFAULT":298,"NULL":324,"UnicodeEscapeSequence":328,"LogicalOrExpression":331,"VariableDeclarationListNoIn":334,"CallExpression":335,"NewExpression":336,"DoubleStringCharacter":345,"SingleStringCharacter":346,"IvarType":348,"IvarDeclaration":349,"ClassMethodDeclaration":351,"InstanceMethodDeclaration":352,"TRUE":407,"FALSE":408,"AssignmentExpressionNoIn":442,"CASE":448,"HexDigit":490,"LogicalAndExpression":491,"MemberExpression":497,"Arguments":498,"LineContinuation":505,"IvarTypeElement":507,"MethodSelector":512,"ConditionalExpressionNoIn":521,"NEW":526,"EscapeSequence":528,"Accessors":533,"BitwiseOrExpression":536,"MethodType":551,"UnarySelector":553,"LogicalOrExpressionNoIn":556,"PrimaryExpression":558,"MessageExpression":559,"ArgumentList":562,"BracketedAccessor":563,"DotAccessor":564,"CharacterEscapeSequence":566,"HexEscapeSequence":568,"KeywordSelector":575,"Selector":577,"BitwiseXOrExpression":578,"LogicalAndExpressionNoIn":600,"THIS":602,"Literal":603,"ArrayLiteral":604,"ObjectLiteral":605,"SelectorCall":609,"SingleEscapeCharacter":612,"NonEscapeCharacter":613,"DecimalDigit":614,"ACTION":617,"KeywordDeclarator":620,"BitwiseAndExpression":623,"SUPER":632,"BitwiseOrExpressionNoIn":644,"NumericLiteral":646,"RegularExpressionLiteral":647,"SelectorLiteral":648,"ElementList":649,"AccessorsConfiguration":654,"EqualityExpression":660,"KeywordSelectorCall":670,"EscapeCharacter":672,"BitwiseXOrExpressionNoIn":680,"RegularExpressionBody":685,"RegularExpressionFlags":686,"SelectorLiteralContents":688,"PropertyNameAndValueList":692,"IvarPropertyName":697,"IvarGetterName":698,"IvarSetterName":699,"RelationalExpression":703,"HexIntegerLiteral":708,"DecimalLiteral":709,"KeywordCall":715,"BitwiseAndExpressionNoIn":722,"RegularExpressionFirstChar":726,"PropertyAssignment":730,"ShiftExpression":738,"EqualityOperator":740,"RegularExpressionChar":748,"EqualityExpressionNoIn":758,"DecimalIntegerLiteral":762,"ExponentPart":763,"RegularExpressionBackslashSequence":765,"RegularExpressionClass":766,"PropertyGetter":769,"PropertySetter":770,"AdditiveExpression":771,"RelationalOperator":773,"RegularExpressionNonTerminator":785,"PropertyName":789,"RelationalExpressionNoIn":795,"SignedInteger":799,"PropertySetParameterList":806,"MultiplicativeExpression":807,"ShiftOperator":809,"INSTANCEOF":812,"RegularExpressionClassChar":817,"UnaryExpression":826,"AdditiveOperator":828,"RelationalOperatorNoIn":838,"PostfixExpression":840,"MultiplicativeOperator":850,"DELETE":855,"VOID":856,"TYPEOF":857,"%start":876,"%_":878,"%SourceElements":881,"%WhiteSpace":884,"%LineTerminator":885,"%Comment":886,"%SourceElement":887,"%MultiLineComment":892,"%SingleLineComment":893,"%Statement":894,"%FunctionDeclaration":895,"%Block":900,"%VariableStatement":901,"%EmptyStatement":902,"%ExpressionStatement":903,"%IfStatement":904,"%IterationStatement":905,"%ContinueStatement":906,"%BreakStatement":907,"%ReturnStatement":908,"%WithStatement":909,"%LabelledStatement":910,"%SwitchStatement":911,"%ThrowStatement":912,"%TryStatement":913,"%DebuggerStatement":914,"%FunctionExpression":915,"%ImportStatement":916,"%ClassDeclarationStatement":917,"%FUNCTION":918,"%Identifier":919,"%FunctionBody":921,"%SingleLineCommentChar":922,"%FormalParameterList":942,"%BadBlock":945,"%VAR":946,"%VariableDeclaration":947,"%EOS":949,"%Expression":951,"%IF":952,"%DoWhileStatement":954,"%WhileStatement":955,"%ForStatement":956,"%ForInStatement":957,"%EachStatement":958,"%CONTINUE":959,"%__":960,"%BREAK":962,"%RETURN":963,"%WITH":965,"%SWITCH":966,"%CaseBlock":967,"%THROW":968,"%TRY":969,"%DEBUGGER":971,"%ClassBody":976,"%BadIdentifier":979,"%SemicolonInsertionEOS":1000,"%Finally":1010,"%LocalFilePath":1012,"%StandardFilePath":1013,"%IdentifierPart":1017,"%IdentifierName":1019,"%StatementList":1022,"%AssignmentExpression":1028,"%ELSE":1030,"%DO":1031,"%WHILE":1032,"%FOR":1033,"%ForInFirstExpression":1036,"%IN":1037,"%Catch":1042,"%StringLiteral":1045,"%SuperclassDeclaration":1047,"%CategoryDeclaration":1048,"%ClassElements":1050,"%ReservedWordIdentifier":1054,"%DigitIdentifier":1055,"%LineTerminatorSequence":1059,"%EOF":1060,"%ForFirstExpression":1067,"%SingleLineMultiLineComment":1070,"%CaseClauses":1072,"%DefaultClause":1073,"%FINALLY":1076,"%IdentifierStart":1082,"%UnicodeCombiningMark":1083,"%UnicodeDigit":1084,"%UnicodeConnectorPunctuation":1085,"%ZWNJ":1086,"%ZWJ":1087,"%ReservedWord":1088,"%ConditionalExpression":1093,"%LeftHandSideExpression":1095,"%CATCH":1100,"%CompoundIvarDeclaration":1104,"%ClassElement":1105,"%AssignmentOperator":1111,"%ExpressionNoIn":1113,"%VariableDeclarationNoIn":1116,"%CaseClause":1118,"%DEFAULT":1120,"%UnicodeLetter":1129,"%Keyword":1131,"%FutureReservedWord":1132,"%NullLiteral":1133,"%BooleanLiteral":1134,"%LogicalOrExpression":1135,"%VariableDeclarationListNoIn":1138,"%CallExpression":1139,"%NewExpression":1140,"%DoubleStringCharacter":1148,"%SingleStringCharacter":1149,"%IvarType":1150,"%IvarDeclaration":1151,"%ClassMethodDeclaration":1153,"%InstanceMethodDeclaration":1154,"%UnicodeEscapeSequence":1155,"%NULL":1156,"%AssignmentExpressionNoIn":1160,"%CASE":1166,"%TRUE":1176,"%FALSE":1177,"%LogicalAndExpression":1178,"%MemberExpression":1183,"%Arguments":1184,"%LineContinuation":1191,"%IvarTypeElement":1193,"%MethodSelector":1197,"%HexDigit":1198,"%ConditionalExpressionNoIn":1204,"%NEW":1209,"%EscapeSequence":1211,"%Accessors":1216,"%BitwiseOrExpression":1219,"%MethodType":1233,"%UnarySelector":1235,"%LogicalOrExpressionNoIn":1238,"%PrimaryExpression":1240,"%MessageExpression":1241,"%ArgumentList":1244,"%BracketedAccessor":1245,"%DotAccessor":1246,"%CharacterEscapeSequence":1247,"%HexEscapeSequence":1249,"%KeywordSelector":1253,"%Selector":1255,"%BitwiseXOrExpression":1256,"%LogicalAndExpressionNoIn":1276,"%THIS":1278,"%Literal":1279,"%ArrayLiteral":1280,"%ObjectLiteral":1281,"%SelectorCall":1284,"%SingleEscapeCharacter":1285,"%NonEscapeCharacter":1286,"%DecimalDigit":1287,"%ACTION":1289,"%KeywordDeclarator":1292,"%BitwiseAndExpression":1294,"%SUPER":1302,"%BitwiseOrExpressionNoIn":1312,"%NumericLiteral":1314,"%RegularExpressionLiteral":1315,"%SelectorLiteral":1316,"%ElementList":1317,"%AccessorsConfiguration":1322,"%EqualityExpression":1328,"%KeywordSelectorCall":1337,"%EscapeCharacter":1339,"%BitwiseXOrExpressionNoIn":1345,"%RegularExpressionBody":1349,"%RegularExpressionFlags":1350,"%SelectorLiteralContents":1351,"%PropertyNameAndValueList":1355,"%IvarPropertyName":1359,"%IvarGetterName":1360,"%IvarSetterName":1361,"%RelationalExpression":1362,"%HexIntegerLiteral":1366,"%DecimalLiteral":1367,"%KeywordCall":1373,"%BitwiseAndExpressionNoIn":1380,"%RegularExpressionFirstChar":1384,"%PropertyAssignment":1388,"%ShiftExpression":1393,"%EqualityOperator":1395,"%RegularExpressionChar":1402,"%EqualityExpressionNoIn":1411,"%DecimalIntegerLiteral":1415,"%ExponentPart":1416,"%RegularExpressionBackslashSequence":1418,"%RegularExpressionClass":1419,"%PropertyGetter":1422,"%PropertySetter":1423,"%AdditiveExpression":1424,"%RelationalOperator":1426,"%RegularExpressionNonTerminator":1433,"%PropertyName":1437,"%RelationalExpressionNoIn":1443,"%SignedInteger":1446,"%PropertySetParameterList":1449,"%MultiplicativeExpression":1450,"%ShiftOperator":1452,"%INSTANCEOF":1453,"%RegularExpressionClassChar":1457,"%UnaryExpression":1463,"%AdditiveOperator":1465,"%RelationalOperatorNoIn":1470,"%PostfixExpression":1471,"%MultiplicativeOperator":1481,"%DELETE":1484,"%VOID":1485,"%TYPEOF":1486}}; - - -//function Parser(/*String | CompiledGrammar*/ aGrammar) -/*{ - if (typeof aGrammar.valueOf() === "string") - this.compiledGrammar = new (require("./compiledgrammar"))(aGrammar); - else - this.compiledGrammar = aGrammar; - - return this; -}*/ - -//exports.Parser = Parser; - -var Parser = function(/*CompiledGrammar*/ aGrammar) -{ - this.compiledGrammar = aGrammar; -} - -//Parser.compiledGrammar = compiledGrammar; - -Parser.prototype.parse = function(input) -{ - return parse(this.compiledGrammar, input); -} - -var NAME = 0, - DOT = 1, - CHARACTER_CLASS = 2, - ORDERED_CHOICE = 3, - SEQUENCE = 4, - STRING_LITERAL = 5, - ZERO_OR_MORE = 6, - ONE_OR_MORE = 7, - OPTIONAL = 8, - NEGATIVE_LOOK_AHEAD = 9, - POSITIVE_LOOK_AHEAD = 10, - ERROR_NAME = 11, - ERROR_CHOICE = 12; - -function parse(aCompiledGrammar, input, name) -{ - var node = new SyntaxNode("#document", input, 0, 0), - table = aCompiledGrammar.table, - nameToUID = aCompiledGrammar.nameToUID; - - name = name || "start"; - - // This is a stupid check. - if (aCompiledGrammar.nameToUID["EOF"] !== undefined) - table[0] = [SEQUENCE, nameToUID[name], nameToUID["EOF"]]; - - if (!evaluate(new context(input, table), node, table, 0)) - { - // This is a stupid check. - if (aCompiledGrammar.nameToUID["EOF"] !== undefined) - table[0] = [SEQUENCE, nameToUID["%" + name], nameToUID["EOF"]]; - - node.children.length = 0; - - evaluate(new context(input, table), node, table, 0); - - node.traverse( - { - traverseTextNodes:false, - enteredNode:function(node) - { - if (node.error) - console.log(node.message() + "\n"); - } - }); - } - - return node; -} - -exports.parse = parse; - -function context(input, table) -{ - this.position = 0; - this.input = input; - this.memos = []; - for (var i=0;i input_length) - { - memos[uid] = false; - return false; - } - - var index = 0; - - for (; index < string_length; ++context.position, ++index) - if (context.input.charCodeAt(context.position) !== string.charCodeAt(index)) - { - context.position -= index; - memos[uid] = false; - return false; - } - -// memos[uid] = string; - if (parent) - parent.children.push(string); - - return true; - case DOT: - if (context.position < input_length) - { - if (parent) - parent.children.push(context.input.charAt(context.position)); - ++context.position; - return true; - } - memos[uid] = false; - return false; - case POSITIVE_LOOK_AHEAD: - case NEGATIVE_LOOK_AHEAD: - var position = context.position, - result = evaluate(context, null, rules, rule[1]) === (type === POSITIVE_LOOK_AHEAD); - context.position = position; - memos[uid] = result; - - return result; - - case ZERO_OR_MORE: - var child, - position = context.position, - childCount = parent && parent.children.length; - - while (evaluate(context, parent, rules, rule[1])) - { - position = context.position, - childCount = parent && parent.children.length; - } - - context.position = position; - if (parent) - parent.children.length = childCount; - - return true; - - case ONE_OR_MORE: - var position = context.position, - childCount = parent && parent.children.length; - if (!evaluate(context, parent, rules, rule[1])) - { - memos[uid] = false; - context.position = position; - if (parent) - parent.children.length = childCount; - return false; - } - position = context.position, - childCount = parent && parent.children.length; - while (evaluate(context, parent, rules, rule[1])) - { - position = context.position; - childCount = parent && parent.children.length; - } - context.position = position; - if (parent) - parent.children.length = childCount; - return true; - - case OPTIONAL: - var position = context.position, - childCount = parent && parent.children.length; - - if (!evaluate(context, parent, rules, rule[1])) - { - context.position = position; - - if (parent) - parent.children.length = childCount; - } - - return true; - } -} - -function SyntaxNode(/*String*/ aName, /*String*/ aSource, /*Number*/ aLocation, /*Number*/ aLength, /*String*/anErrorMessage) -{ - this.name = aName; - this.source = aSource; - this.range = { location:aLocation, length:aLength }; - this.children = []; - - if (anErrorMessage) - this.error = anErrorMessage; -} - -SyntaxNode.prototype.message = function() -{ - var source = this.source, - lineNumber = 1, - index = 0, - start = 0, - length = source.length, - range = this.range; - - for (; index < range.location; ++index) - if (source.charAt(index) === '\n') - { - ++lineNumber; - start = index + 1; - } - - for (; index < length; ++index) - if (source.charAt(index) === '\n') - break; - - var line = source.substring(start, index); - message = line + "\n"; - - message += (new Array(this.range.location - start + 1)).join(" "); - message += (new Array(Math.min(range.length, line.length) + 1)).join("^") + "\n"; - message += "ERROR line " + lineNumber + ": " + this.error; - - return message; -} - -SyntaxNode.prototype.toString = function(/*String*/ spaces) -{ - if (!spaces) - spaces = ""; - - var string = spaces + this.name + " <" + this.innerText() + "> ", - children = this.children, - index = 0, - count = children.length; - - for (; index < count; ++index) - { - var child = children[index]; - - if (typeof child === "string") - string += "\n" + spaces + "\t" + child; - - else - string += "\n" + children[index].toString(spaces + '\t'); - } - - return string; -} - -SyntaxNode.prototype.innerText = function() -{ - var range = this.range; - - return this.source.substr(range.location, range.length); -} - -SyntaxNode.prototype.traverse = function(walker) -{ - if (!walker.enteredNode || walker.enteredNode(this) !== false) - { - var children = this.children, - index = 0, - count = children && children.length; - - for (; index < count; ++index) - { - var child = children[index]; - - if (typeof child !== "string") - child.traverse(walker); - - else if (walker.traversesTextNodes) - { - walker.enteredNode(child); - walker.exitedNode(child); - } - } - } - - if (walker.exitedNode) - walker.exitedNode(this); -} - - -exports.Parser = new Parser(compiledGrammar); -