Esprima from 30,000 feet
Here’s a complete list of functions inside of Esprima. I’m not going to try to document Esprima, but just organize the list in a quick pass so that we can see how Esprima looks from a 30,000 foot perspective.
NOTE: Esprima is organized quite beautifully as an iife with flat
function calls and shared state, so it's a safe assumption that one function could perhaps call another
List of things that are parsed
-
Pattern ArrayPattern, PropertyPattern, ObjectPattern, PatternWithDefault, ArrayInitialiser, PropertyFunction, PropertyMethodFunction, ObjectPropertyKey, ObjectProperty, ObjectInitialiser, TemplateElement, TemplateLiteral, GroupExpression, PrimaryExpression, Arguments, NonComputedProperty, NonComputedMember, ComputedMember, tryMethodDefinition
-
NewExpression, LeftHandSideExpressionAllowCall, LeftHandSideExpression, PostfixExpression, UnaryExpression, binaryPrecedence, BinaryExpression, ConditionalExpression, ConciseBody, reinterpretAsCoverFormalsList, ArrowFunctionExpression, YieldExpression, AssignmentExpression, Expression, StatementListItem, StatementList, Block
-
VariableIdentifier, VariableDeclaration, VariableDeclarationList, VariableStatement, LexicalBinding, BindingList, LexicalDeclaration, RestElement, EmptyStatement, ExpressionStatement, IfStatement, DoWhileStatement, WhileStatement, ForStatement, ContinueStatement, BreakStatement, ReturnStatement, WithStatement, SwitchCase, SwitchStatement, ThrowStatement, CatchClause, TryStatement, DebuggerStatement, Statement, FunctionSourceElements, Param, Params, FunctionDeclaration, FunctionExpression, ScriptBody, Program, ClassBody, ClassDeclaration, ClassExpression
-
ModuleSpecifier, ExportSpecifier, ExportNamedDeclaration, ExportDefaultDeclaration, ExportAllDeclaration, ExportDeclaration, ImportSpecifier, NamedImports, ImportDefaultSpecifier, ImportNamespaceSpecifier ImportDeclaration
Functions
Utilities
- assert
- isDecimalDigit
- isHexDigit
- isOctalDigit
- octalToDecimal
- isWhiteSpace
- isLineTerminator
- isIdentifierStart
- isIdentifierPart
- isFutureReservedWord
- isStrictModeReservedWord
- isRestrictedWord
- isKeyword
- isIdentifierName
- addComment
- recordError
- createError
- throwError
- tolerateError
- unexpectedTokenError
- throwUnexpectedToken
- tolerateUnexpectedToken
- expect
- expectCommaSeparator
- expectKeyword
- match
- matchKeyword
- matchContextualKeyword
- matchAssign
Lexing / Scanning
- skipSingleLineComment
- skipMultiLineComment
- skipComment
- scanHexEscape
- scanUnicodeCodePointEscape
- getEscapedIdentifier
- getIdentifier
- scanIdentifier
- scanPunctuator
- scanHexLiteral
- scanBinaryLiteral
- scanOctalLiteral
- isImplicitOctalLiteral
- scanNumericLiteral
- scanStringLiteral
- scanTemplate
- testRegExp
- scanRegExpBody
- scanRegExpFlags
- scanRegExp
- collectRegex
- advanceSlash
- advance
- collectToken
- lex
- peek
- Position
- SourceLocation
- WrappingSourceLocation
- Node
- consumeSemicolon
- isolateCoverGrammar
- inheritCoverGrammar
- lookaheadPropertyName
- filterTokenLocation
- tokenize
- checkPatternParam
Parsers
- parseArrayPattern
- parsePropertyPattern
- parseObjectPattern
- parsePattern
- parsePatternWithDefault
- parseArrayInitialiser
- parsePropertyFunction
- parsePropertyMethodFunction
- parseObjectPropertyKey
- tryParseMethodDefinition
- parseObjectProperty
- parseObjectInitialiser
- reinterpretExpressionAsPattern
- parseTemplateElement
- parseTemplateLiteral
- parseGroupExpression
- parsePrimaryExpression
- parseArguments
- parseNonComputedProperty
- parseNonComputedMember
- parseComputedMember
- parseNewExpression
- parseLeftHandSideExpressionAllowCall
- parseLeftHandSideExpression
- parsePostfixExpression
- parseUnaryExpression
- binaryPrecedence
- parseBinaryExpression
- parseConditionalExpression
- parseConciseBody
- reinterpretAsCoverFormalsList
- parseArrowFunctionExpression
- parseYieldExpression
- parseAssignmentExpression
- parseExpression
- parseStatementListItem
- parseStatementList
- parseBlock
- parseVariableIdentifier
- parseVariableDeclaration
- parseVariableDeclarationList
- parseVariableStatement
- parseLexicalBinding
- parseBindingList
- parseLexicalDeclaration
- parseRestElement
- parseEmptyStatement
- parseExpressionStatement
- parseIfStatement
- parseDoWhileStatement
- parseWhileStatement
- parseForStatement
- parseContinueStatement
- parseBreakStatement
- parseReturnStatement
- parseWithStatement
- parseSwitchCase
- parseSwitchStatement
- parseThrowStatement
- parseCatchClause
- parseTryStatement
- parseDebuggerStatement
- parseStatement
- parseFunctionSourceElements
- validateParam
- parseParam
- parseParams
- parseFunctionDeclaration
- parseFunctionExpression
- parseClassBody
- parseClassDeclaration
- parseClassExpression
- parseModuleSpecifier
- parseExportSpecifier
- parseExportNamedDeclaration
- parseExportDefaultDeclaration
- parseExportAllDeclaration
- parseExportDeclaration
- parseImportSpecifier
- parseNamedImports
- parseImportDefaultSpecifier
- parseImportNamespaceSpecifier
- parseImportDeclaration
- parseScriptBody
- parseProgram
- parse
Wrapping Nodes
- WrappingNode
- WrappingNode.processComment
- WrappingNode.finish
- WrappingNode.finishArrayExpression
- WrappingNode.finishArrayPattern
- WrappingNode.finishArrowFunctionExpression
- WrappingNode.finishAssignmentExpression
- WrappingNode.finishAssignmentPattern
- WrappingNode.finishBinaryExpression
- WrappingNode.finishBlockStatement
- WrappingNode.finishBreakStatement
- WrappingNode.finishCallExpression
- WrappingNode.finishCatchClause
- WrappingNode.finishClassBody
- WrappingNode.finishClassDeclaration
- WrappingNode.finishClassExpression
- WrappingNode.finishConditionalExpression
- WrappingNode.finishContinueStatement
- WrappingNode.finishDebuggerStatement
- WrappingNode.finishDoWhileStatement
- WrappingNode.finishEmptyStatement
- WrappingNode.finishExpressionStatement
- WrappingNode.finishForStatement
- WrappingNode.finishForOfStatement
- WrappingNode.finishForInStatement
- WrappingNode.finishFunctionDeclaration
- WrappingNode.finishFunctionExpression
- WrappingNode.finishIdentifier
- WrappingNode.finishIfStatement
- WrappingNode.finishLabeledStatement
- WrappingNode.finishLiteral
- WrappingNode.finishMemberExpression
- WrappingNode.finishMetaProperty
- WrappingNode.finishNewExpression
- WrappingNode.finishObjectExpression
- WrappingNode.finishObjectPattern
- WrappingNode.finishPostfixExpression
- WrappingNode.finishProgram
- WrappingNode.finishProperty
- WrappingNode.finishRestElement
- WrappingNode.finishReturnStatement
- WrappingNode.finishSequenceExpression
- WrappingNode.finishSpreadElement
- WrappingNode.finishSwitchCase
- WrappingNode.finishSuper
- WrappingNode.finishSwitchStatement
- WrappingNode.finishTaggedTemplateExpression
- WrappingNode.finishTemplateElement
- WrappingNode.finishTemplateLiteral
- WrappingNode.finishThisExpression
- WrappingNode.finishThrowStatement
- WrappingNode.finishTryStatement
- WrappingNode.finishUnaryExpression
- WrappingNode.finishVariableDeclaration
- WrappingNode.finishLexicalDeclaration
- WrappingNode.finishVariableDeclarator
- WrappingNode.finishWhileStatement
- WrappingNode.finishWithStatement
- WrappingNode.finishExportSpecifier
- WrappingNode.finishImportDefaultSpecifier
- WrappingNode.finishImportNamespaceSpecifier
- WrappingNode.finishExportNamedDeclaration
- WrappingNode.finishExportDefaultDeclaration
- WrappingNode.finishExportAllDeclaration
- WrappingNode.finishImportSpecifier
- WrappingNode.finishImportDeclaration
- WrappingNode.finishYieldExpression