JavaScript シンタックス

[Up] [Prev] [Next]

概要

まだブラウザで未実装のものもありますが、ES8/ES2018 の文法を整理しました。

JavaScript

◆ JavaScript
JavaScript: Scriptopt Moduleopt
◆ Scripts
Script: ScriptBodyopt ScriptBody: StatementList[~Yield, ~Await, ~Return]

Statements

◆ Statements
StatementList[Yield, Await, Return]: StatementListItem[?Yield, ?Await, ?Return] StatementList[?Yield, ?Await, ?Return]StatementListItem[?Yield, ?Await, ?Return] StatementListItem[Yield, Await, Return]: Statement[?Yield, ?Await, ?Return] Declaration[?Yield, ?Await] Statement[Yield, Await, Return]: BlockStatement[?Yield, ?Await, ?Return] VariableStatement[?Yield, ?Await] EmptyStatement ExpressionStatement[?Yield, ?Await] IfStatement[?Yield, ?Await, ?Return] BreakableStatement[?Yield, ?Await, ?Return] ContinueStatement[?Yield, ?Await] BreakStatement[?Yield, ?Await] [+Return]ReturnStatement[?Yield, ?Await] WithStatement[?Yield, ?Await, ?Return] LabelledStatement[?Yield, ?Await, ?Return] ThrowStatement[?Yield, ?Await] TryStatement[?Yield, ?Await, ?Return] DebuggerStatement Declaration[Yield, Await]: HoistableDeclaration[?Yield, ?Await, ~Default] ClassDeclaration[?Yield, ?Await, ~Default] LexicalDeclaration[+In, ?Yield, ?Await] HoistableDeclaration[Yield, Await, Default]: FunctionDeclaration[?Yield, ?Await, ?Default] GeneratorDeclaration[?Yield, ?Await, ?Default] AsyncFunctionDeclaration[?Yield, ?Await, ?Default] BreakableStatement[Yield, Await, Return]: IterationStatement[?Yield, ?Await, ?Return] SwitchStatement[?Yield, ?Await, ?Return]
◆ Block Statement
BlockStatement[Yield, Await, Return]: Block[?Yield, ?Await, ?Return] Block[Yield, Await, Return]: {StatementList[?Yield, ?Await, ?Return]opt}
◆ Variable Statement
VariableStatement[Yield, Await]: varVariableDeclarationList[+In, ?Yield, ?Await]; VariableDeclarationList[In, Yield, Await]: VariableDeclaration[?In, ?Yield, ?Await] VariableDeclarationList[?In, ?Yield, ?Await],VariableDeclaration[?In, ?Yield, ?Await] VariableDeclaration[In, Yield, Await]: BindingIdentifier[?Yield, ?Await]Initializer[?In, ?Yield, ?Await]opt BindingPattern[?Yield, ?Await]Initializer[?In, ?Yield, ?Await] BindingPattern[Yield, Await]: ObjectBindingPattern[?Yield, ?Await] ArrayBindingPattern[?Yield, ?Await] ObjectBindingPattern[Yield, Await]: {} {BindingPropertyList[?Yield, ?Await]} {BindingPropertyList[?Yield, ?Await],} ArrayBindingPattern[Yield, Await]: [ElisionoptBindingRestElement[?Yield, ?Await]opt] [BindingElementList[?Yield, ?Await]] [BindingElementList[?Yield, ?Await],ElisionoptBindingRestElement[?Yield, ?Await]opt] BindingPropertyList[Yield, Await]: BindingProperty[?Yield, ?Await] BindingPropertyList[?Yield, ?Await],BindingProperty[?Yield, ?Await] BindingElementList[Yield, Await]: BindingElisionElement[?Yield, ?Await] BindingElementList[?Yield, ?Await],BindingElisionElement[?Yield, ?Await] BindingElisionElement[Yield, Await]: ElisionoptBindingElement[?Yield, ?Await] BindingProperty[Yield, Await]: SingleNameBinding[?Yield, ?Await] PropertyName[?Yield, ?Await]:BindingElement[?Yield, ?Await] BindingElement[Yield, Await]: SingleNameBinding[?Yield, ?Await] BindingPattern[?Yield, ?Await]Initializer[+In, ?Yield, ?Await]opt SingleNameBinding[Yield, Await]: BindingIdentifier[?Yield, ?Await]Initializer[+In, ?Yield, ?Await]opt BindingRestElement[Yield, Await]: ...BindingIdentifier[?Yield, ?Await] ...BindingPattern[?Yield, ?Await]
◆ Empty Statement
EmptyStatement: ;
◆ Expression Statement
ExpressionStatement[Yield, Await]: [lookahead ? { {, function, async [no LineTerminator here] function, class, let [ }]Expression[+In, ?Yield, ?Await];
◆ If Statement
IfStatement[Yield, Await, Return]: if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return] if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
◆ Iteration Statement
IterationStatement[Yield, Await, Return]: doStatement[?Yield, ?Await, ?Return]while(Expression[+In, ?Yield, ?Await]); while(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for([lookahead ? { let [ }]Expression[~In, ?Yield, ?Await]opt;Expression[+In, ?Yield, ?Await]opt;Expression[+In, ?Yield, ?Await]opt)Statement[?Yield, ?Await, ?Return] for(varVariableDeclarationList[~In, ?Yield, ?Await];Expression[+In, ?Yield, ?Await]opt;Expression[+In, ?Yield, ?Await]opt)Statement[?Yield, ?Await, ?Return] for(LexicalDeclaration[~In, ?Yield, ?Await]Expression[+In, ?Yield, ?Await]opt;Expression[+In, ?Yield, ?Await]opt)Statement[?Yield, ?Await, ?Return] for([lookahead ? { let [ }]LeftHandSideExpression[?Yield, ?Await]inExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for(varForBinding[?Yield, ?Await]inExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for(ForDeclaration[?Yield, ?Await]inExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for([lookahead ≠ let]LeftHandSideExpression[?Yield, ?Await]ofAssignmentExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for(varForBinding[?Yield, ?Await]ofAssignmentExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] for(ForDeclaration[?Yield, ?Await]ofAssignmentExpression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return] ForDeclaration[Yield, Await]: LetOrConstForBinding[?Yield, ?Await] ForBinding[Yield, Await]: BindingIdentifier[?Yield, ?Await] BindingPattern[?Yield, ?Await]
◆ Switch Statement
SwitchStatement[Yield, Await, Return]: switch(Expression[+In, ?Yield, ?Await])CaseBlock[?Yield, ?Await, ?Return] CaseBlock[Yield, Await, Return]: {CaseClauses[?Yield, ?Await, ?Return]opt} {CaseClauses[?Yield, ?Await, ?Return]optDefaultClause[?Yield, ?Await, ?Return]CaseClauses[?Yield, ?Await, ?Return]opt} CaseClauses[Yield, Await, Return]: CaseClause[?Yield, ?Await, ?Return] CaseClauses[?Yield, ?Await, ?Return]CaseClause[?Yield, ?Await, ?Return] CaseClause[Yield, Await, Return]: caseExpression[+In, ?Yield, ?Await]:StatementList[?Yield, ?Await, ?Return]opt DefaultClause[Yield, Await, Return]: default:StatementList[?Yield, ?Await, ?Return]opt
◆ Continue Statement
ContinueStatement[Yield, Await]: continue; continue[no LineTerminator here]LabelIdentifier[?Yield, ?Await];
◆ Break Statement
BreakStatement[Yield, Await]: break; break[no LineTerminator here]LabelIdentifier[?Yield, ?Await];
◆ Return Statement
ReturnStatement[Yield, Await]: return; return[no LineTerminator here]Expression[+In, ?Yield, ?Await];
◆ With Statement
WithStatement[Yield, Await, Return]: with(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
◆ Labelled Statement
LabelledStatement[Yield, Await, Return]: LabelIdentifier[?Yield, ?Await]:LabelledItem[?Yield, ?Await, ?Return] LabelledItem[Yield, Await, Return]: Statement[?Yield, ?Await, ?Return] FunctionDeclaration[?Yield, ?Await, ~Default] LabelIdentifier[Yield, Await]: Identifier [~Yield]yield [~Await]await
◆ Throw Statement
ThrowStatement[Yield, Await]: throw[no LineTerminator here]Expression[+In, ?Yield, ?Await];
◆ Try Statement
TryStatement[Yield, Await, Return]: tryBlock[?Yield, ?Await, ?Return]Catch[?Yield, ?Await, ?Return] tryBlock[?Yield, ?Await, ?Return]Finally[?Yield, ?Await, ?Return] tryBlock[?Yield, ?Await, ?Return]Catch[?Yield, ?Await, ?Return]Finally[?Yield, ?Await, ?Return] Catch[Yield, Await, Return]: catch(CatchParameter[?Yield, ?Await])Block[?Yield, ?Await, ?Return] Finally[Yield, Await, Return]: finallyBlock[?Yield, ?Await, ?Return] CatchParameter[Yield, Await]: BindingIdentifier[?Yield, ?Await] BindingPattern[?Yield, ?Await]
◆ Debugger Statement
DebuggerStatement: debugger;
◆ Function Declaration
FunctionDeclaration[Yield, Await, Default]: functionBindingIdentifier[?Yield, ?Await](FormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]} [+Default]function(FormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]} FunctionExpression: functionBindingIdentifier[~Yield, ~Await]opt(FormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]} UniqueFormalParameters[Yield, Await]: FormalParameters[?Yield, ?Await] FormalParameters[Yield, Await]: [empty] FunctionRestParameter[?Yield, ?Await] FormalParameterList[?Yield, ?Await] FormalParameterList[?Yield, ?Await], FormalParameterList[?Yield, ?Await],FunctionRestParameter[?Yield, ?Await] FormalParameterList[Yield, Await]: FormalParameter[?Yield, ?Await] FormalParameterList[?Yield, ?Await],FormalParameter[?Yield, ?Await] FunctionRestParameter[Yield, Await]: BindingRestElement[?Yield, ?Await] FormalParameter[Yield, Await]: BindingElement[?Yield, ?Await] FunctionBody[Yield, Await]: FunctionStatementList[?Yield, ?Await] FunctionStatementList[Yield, Await]: StatementList[?Yield, ?Await, +Return]opt
◆ Arrow Function
ArrowFunction[In, Yield, Await]: ArrowParameters[?Yield, ?Await][no LineTerminator here]=>ConciseBody[?In] ArrowParameters[Yield, Await]: BindingIdentifier[?Yield, ?Await] CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] ConciseBody[In]: [lookahead ≠ {]AssignmentExpression[?In, ~Yield, ~Await] {FunctionBody[~Yield, ~Await]}

When the production ArrowParameters[Yield, Await]:CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] is recognized the following grammar is used to refine the interpretation of CoverParenthesizedExpressionAndArrowParameterList:

ArrowFormalParameters[Yield, Await]: (UniqueFormalParameters[?Yield, ?Await])
◆ Async Arrow Function
AsyncArrowFunction[In, Yield, Await]: async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] AsyncConciseBody[In]: [lookahead ≠ {]AssignmentExpression[?In, ~Yield, +Await] {AsyncFunctionBody}

When the production AsyncArrowFunction[In, Yield, Await]:CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] is recognized the following grammar is used to refine the interpretation of CoverParenthesizedExpressionAndArrowParameterList:

AsyncArrowBindingIdentifier[Yield]: BindingIdentifier[?Yield, +Await] AsyncArrowHead: async[no LineTerminator here]ArrowFormalParameters[~Yield, +Await] MethodDefinition[Yield, Await]: PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]} GeneratorMethod[?Yield, ?Await] AsyncMethod[?Yield, ?Await] getPropertyName[?Yield, ?Await](){FunctionBody[~Yield, ~Await]} setPropertyName[?Yield, ?Await](PropertySetParameterList){FunctionBody[~Yield, ~Await]} PropertySetParameterList: FormalParameter[~Yield, ~Await] GeneratorMethod[Yield, Await]: *PropertyName[?Yield, ?Await](UniqueFormalParameters[+Yield, ~Await]){GeneratorBody} AsyncMethod[Yield, Await]: async[no LineTerminator here]PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, +Await]){AsyncFunctionBody}
◆ Generator Declaration
GeneratorDeclaration[Yield, Await, Default]: function*BindingIdentifier[?Yield, ?Await](FormalParameters[+Yield, ~Await]){GeneratorBody} [+Default]function*(FormalParameters[+Yield, ~Await]){GeneratorBody} GeneratorExpression: function*BindingIdentifier[+Yield, ~Await]opt(FormalParameters[+Yield, ~Await]){GeneratorBody} GeneratorBody: FunctionBody[+Yield, ~Await]
◆ Async Function Declaration
AsyncFunctionDeclaration[Yield, Await, Default]: async[no LineTerminator here]functionBindingIdentifier[?Yield, ?Await](FormalParameters[~Yield, ?Await]){AsyncFunctionBody} [+Default]async[no LineTerminator here]function(FormalParameters[~Yield, ?Await]){AsyncFunctionBody} AsyncFunctionExpression: async[no LineTerminator here]function(FormalParameters[~Yield, +Await]){AsyncFunctionBody} async[no LineTerminator here]functionBindingIdentifier[~Yield, +Await](FormalParameters[~Yield, +Await]){AsyncFunctionBody} AsyncFunctionBody: FunctionBody[~Yield, +Await]
◆ Await Expression
AwaitExpression[Yield]: awaitUnaryExpression[?Yield, +Await]
◆ Class Declaration
ClassDeclaration[Yield, Await, Default]: classBindingIdentifier[?Yield, ?Await]ClassTail[?Yield, ?Await] [+Default]classClassTail[?Yield, ?Await] ClassExpression[Yield, Await]: classBindingIdentifier[?Yield, ?Await]optClassTail[?Yield, ?Await] ClassTail[Yield, Await]: ClassHeritage[?Yield, ?Await]opt{ClassBody[?Yield, ?Await]opt} ClassHeritage[Yield, Await]: extendsLeftHandSideExpression[?Yield, ?Await] ClassBody[Yield, Await]: ClassElementList[?Yield, ?Await] ClassElementList[Yield, Await]: ClassElement[?Yield, ?Await] ClassElementList[?Yield, ?Await]ClassElement[?Yield, ?Await] ClassElement[Yield, Await]: MethodDefinition[?Yield, ?Await] staticMethodDefinition[?Yield, ?Await] ;
◆ Lexical Declaration
LexicalDeclaration[In, Yield, Await]: LetOrConstBindingList[?In, ?Yield, ?Await]; LetOrConst: let const BindingList[In, Yield, Await]: LexicalBinding[?In, ?Yield, ?Await] BindingList[?In, ?Yield, ?Await],LexicalBinding[?In, ?Yield, ?Await] LexicalBinding[In, Yield, Await]: BindingIdentifier[?Yield, ?Await]Initializer[?In, ?Yield, ?Await]opt BindingPattern[?Yield, ?Await]Initializer[?In, ?Yield, ?Await]

Expressions

◆ Expression
Expression[In, Yield, Await]: AssignmentExpression[?In, ?Yield, ?Await] Expression[?In, ?Yield, ?Await],AssignmentExpression[?In, ?Yield, ?Await]
◆ Assignment Expression
AssignmentExpression[In, Yield, Await]: ConditionalExpression[?In, ?Yield, ?Await] [+Yield]YieldExpression[?In, ?Await] ArrowFunction[?In, ?Yield, ?Await] AsyncArrowFunction[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await]=AssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await]AssignmentOperatorAssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[Yield, Await]: NewExpression[?Yield, ?Await] CallExpression[?Yield, ?Await]

In certain circumstances when processing an instance of the production AssignmentExpression[In, Yield, Await]:LeftHandSideExpression[?Yield, ?Await]=AssignmentExpression[?In, ?Yield, ?Await] the following grammar is used to refine the interpretation of LeftHandSideExpression:

AssignmentPattern[Yield, Await]: ObjectAssignmentPattern[?Yield, ?Await] ArrayAssignmentPattern[?Yield, ?Await] ObjectAssignmentPattern[Yield, Await]: {} {AssignmentPropertyList[?Yield, ?Await]} {AssignmentPropertyList[?Yield, ?Await],} ArrayAssignmentPattern[Yield, Await]: [ElisionoptAssignmentRestElement[?Yield, ?Await]opt] [AssignmentElementList[?Yield, ?Await]] [AssignmentElementList[?Yield, ?Await],ElisionoptAssignmentRestElement[?Yield, ?Await]opt] AssignmentPropertyList[Yield, Await]: AssignmentProperty[?Yield, ?Await] AssignmentPropertyList[?Yield, ?Await],AssignmentProperty[?Yield, ?Await] AssignmentElementList[Yield, Await]: AssignmentElisionElement[?Yield, ?Await] AssignmentElementList[?Yield, ?Await],AssignmentElisionElement[?Yield, ?Await] AssignmentElisionElement[Yield, Await]: ElisionoptAssignmentElement[?Yield, ?Await] AssignmentProperty[Yield, Await]: IdentifierReference[?Yield, ?Await]Initializer[+In, ?Yield, ?Await]opt PropertyName[?Yield, ?Await]:AssignmentElement[?Yield, ?Await] AssignmentElement[Yield, Await]: DestructuringAssignmentTarget[?Yield, ?Await]Initializer[+In, ?Yield, ?Await]opt AssignmentRestElement[Yield, Await]: ...DestructuringAssignmentTarget[?Yield, ?Await] DestructuringAssignmentTarget[Yield, Await]: LeftHandSideExpression[?Yield, ?Await]
◆ Conditional Expression
ConditionalExpression[In, Yield, Await]: LogicalORExpression[?In, ?Yield, ?Await] LogicalORExpression[?In, ?Yield, ?Await]?AssignmentExpression[+In, ?Yield, ?Await]:AssignmentExpression[?In, ?Yield, ?Await]
◆ Yield Expression
YieldExpression[In, Await]: yield yield[no LineTerminator here]AssignmentExpression[?In, +Yield, ?Await] yield[no LineTerminator here]*AssignmentExpression[?In, +Yield, ?Await]
◆ Update Expression
UpdateExpression[Yield, Await]: LeftHandSideExpression[?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await][no LineTerminator here]++ LeftHandSideExpression[?Yield, ?Await][no LineTerminator here]-- ++UnaryExpression[?Yield, ?Await] --UnaryExpression[?Yield, ?Await]
◆ Unary Expression
UnaryExpression[Yield, Await]: UpdateExpression[?Yield, ?Await] deleteUnaryExpression[?Yield, ?Await] voidUnaryExpression[?Yield, ?Await] typeofUnaryExpression[?Yield, ?Await] +UnaryExpression[?Yield, ?Await] -UnaryExpression[?Yield, ?Await] ~UnaryExpression[?Yield, ?Await] !UnaryExpression[?Yield, ?Await] [+Await]AwaitExpression[?Yield]
◆ Multiplicative Expression
MultiplicativeExpression[Yield, Await]: ExponentiationExpression[?Yield, ?Await] MultiplicativeExpression[?Yield, ?Await]MultiplicativeOperatorExponentiationExpression[?Yield, ?Await]
◆ Exponentiation Expression
ExponentiationExpression[Yield, Await]: UnaryExpression[?Yield, ?Await] UpdateExpression[?Yield, ?Await]**ExponentiationExpression[?Yield, ?Await]
◆ Primary Expression
PrimaryExpression[Yield, Await]: this IdentifierReference[?Yield, ?Await] Literal ArrayLiteral[?Yield, ?Await] ObjectLiteral[?Yield, ?Await] FunctionExpression ClassExpression[?Yield, ?Await] GeneratorExpression AsyncFunctionExpression RegularExpressionLiteral TemplateLiteral[?Yield, ?Await] CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] CoverParenthesizedExpressionAndArrowParameterList[Yield, Await]: (Expression[+In, ?Yield, ?Await]) (Expression[+In, ?Yield, ?Await],) () (...BindingIdentifier[?Yield, ?Await]) (...BindingPattern[?Yield, ?Await]) (Expression[+In, ?Yield, ?Await],...BindingIdentifier[?Yield, ?Await]) (Expression[+In, ?Yield, ?Await],...BindingPattern[?Yield, ?Await])

When processing an instance of the production PrimaryExpression[Yield, Await]:CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] the interpretation of CoverParenthesizedExpressionAndArrowParameterList is refined using the following grammar:

◆ Parenthesized Expression
ParenthesizedExpression[Yield, Await]: (Expression[+In, ?Yield, ?Await])

Literal

◆ Literal
Literal: NullLiteral BooleanLiteral NumericLiteral StringLiteral
◆ Null Literal
NullLiteral:: null
◆ Boolean Literal
BooleanLiteral:: true false
◆ Numeric Literal
NumericLiteral:: DecimalLiteral BinaryIntegerLiteral OctalIntegerLiteral HexIntegerLiteral
◆ Decimal Literal
DecimalLiteral:: DecimalIntegerLiteral.DecimalDigitsoptExponentPartopt .DecimalDigitsExponentPartopt DecimalIntegerLiteralExponentPartopt DecimalIntegerLiteral:: 0 NonZeroDigitDecimalDigitsopt DecimalDigits:: DecimalDigit DecimalDigitsDecimalDigit DecimalDigit::one of 0123456789 NonZeroDigit::one of 123456789 ExponentPart:: ExponentIndicatorSignedInteger ExponentIndicator::one of eE
◆ Signed Integer Literal
SignedInteger:: DecimalDigits +DecimalDigits -DecimalDigits
◆ Binary Integer Literal
BinaryIntegerLiteral:: 0bBinaryDigits 0BBinaryDigits BinaryDigits:: BinaryDigit BinaryDigitsBinaryDigit BinaryDigit::one of 01
◆ Octal Integer Literal
OctalIntegerLiteral:: 0oOctalDigits 0OOctalDigits OctalDigits:: OctalDigit OctalDigitsOctalDigit OctalDigit::one of 01234567
◆ Hex Integer Literal
HexIntegerLiteral:: 0xHexDigits 0XHexDigits HexDigits:: HexDigit HexDigitsHexDigit HexDigit::one of 0123456789abcdefABCDEF
◆ String Numeric Literal
StringNumericLiteral::: StrWhiteSpaceopt StrWhiteSpaceoptStrNumericLiteralStrWhiteSpaceopt StrWhiteSpace::: StrWhiteSpaceCharStrWhiteSpaceopt StrWhiteSpaceChar::: WhiteSpace LineTerminator StrNumericLiteral::: StrDecimalLiteral BinaryIntegerLiteral OctalIntegerLiteral HexIntegerLiteral StrDecimalLiteral::: StrUnsignedDecimalLiteral +StrUnsignedDecimalLiteral -StrUnsignedDecimalLiteral StrUnsignedDecimalLiteral::: Infinity DecimalDigits.DecimalDigitsoptExponentPartopt .DecimalDigitsExponentPartopt DecimalDigitsExponentPartopt

All grammar symbols not explicitly defined by the StringNumericLiteral grammar have the definitions used in the Lexical Grammar for numeric literals.

◆ String Literal
StringLiteral:: "DoubleStringCharactersopt" 'SingleStringCharactersopt' DoubleStringCharacters:: DoubleStringCharacterDoubleStringCharactersopt SingleStringCharacters:: SingleStringCharacterSingleStringCharactersopt DoubleStringCharacter:: SourceCharacterbut not one of " or \ or LineTerminator \EscapeSequence LineContinuation SingleStringCharacter:: SourceCharacterbut not one of ' or \ or LineTerminator \EscapeSequence LineContinuation LineContinuation:: \LineTerminatorSequence EscapeSequence:: CharacterEscapeSequence 0[lookahead ? DecimalDigit] HexEscapeSequence UnicodeEscapeSequence CharacterEscapeSequence:: SingleEscapeCharacter NonEscapeCharacter SingleEscapeCharacter::one of '"\bfnrtv NonEscapeCharacter:: SourceCharacterbut not one of EscapeCharacter or LineTerminator EscapeCharacter:: SingleEscapeCharacter DecimalDigit x u HexEscapeSequence:: xHexDigitHexDigit UnicodeEscapeSequence:: uHex4Digits u{HexDigits} Hex4Digits:: HexDigitHexDigitHexDigitHexDigit
◆ Regular Expression Literal
RegularExpressionLiteral:: /RegularExpressionBody/RegularExpressionFlags RegularExpressionBody:: RegularExpressionFirstCharRegularExpressionChars RegularExpressionChars:: [empty] RegularExpressionCharsRegularExpressionChar RegularExpressionFirstChar:: RegularExpressionNonTerminatorbut not one of * or \ or / or [ RegularExpressionBackslashSequence RegularExpressionClass RegularExpressionChar:: RegularExpressionNonTerminatorbut not one of \ or / or [ RegularExpressionBackslashSequence RegularExpressionClass RegularExpressionBackslashSequence:: \RegularExpressionNonTerminator RegularExpressionNonTerminator:: SourceCharacterbut not LineTerminator RegularExpressionClass:: [RegularExpressionClassChars] RegularExpressionClassChars:: [empty] RegularExpressionClassCharsRegularExpressionClassChar RegularExpressionClassChar:: RegularExpressionNonTerminatorbut not one of ] or \ RegularExpressionBackslashSequence RegularExpressionFlags:: [empty] RegularExpressionFlagsIdentifierPart
◆ Regular Expression Pattern
Pattern[U]:: Disjunction[?U] Disjunction[U]:: Alternative[?U] Alternative[?U]|Disjunction[?U] Alternative[U]:: [empty] Alternative[?U]Term[?U] Term[U]:: Assertion[?U] Atom[?U] Atom[?U]Quantifier Assertion[U]:: ^ $ \b \B (?=Disjunction[?U]) (?!Disjunction[?U]) Quantifier:: QuantifierPrefix QuantifierPrefix? QuantifierPrefix:: * + ? {DecimalDigits} {DecimalDigits,} {DecimalDigits,DecimalDigits} Atom[U]:: PatternCharacter . \AtomEscape[?U] CharacterClass[?U] (Disjunction[?U]) (?:Disjunction[?U]) SyntaxCharacter::one of ^$\.*+?()[]{}| PatternCharacter:: SourceCharacterbut not SyntaxCharacter AtomEscape[U]:: DecimalEscape CharacterClassEscape CharacterEscape[?U] CharacterEscape[U]:: ControlEscape cControlLetter 0[lookahead ? DecimalDigit] HexEscapeSequence RegExpUnicodeEscapeSequence[?U] IdentityEscape[?U] ControlEscape::one of fnrtv ControlLetter::one of abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ RegExpUnicodeEscapeSequence[U]::[+U]uLeadSurrogate\uTrailSurrogate [+U]uLeadSurrogate [+U]uTrailSurrogate [+U]uNonSurrogate [~U]uHex4Digits [+U]u{HexDigits}

Each \u TrailSurrogate for which the choice of associated u LeadSurrogate is ambiguous shall be associated with the nearest possible u LeadSurrogate that would otherwise have no corresponding \u TrailSurrogate.

LeadSurrogate:: Hex4Digitsbut only if the SV of Hex4Digits is in the inclusive range 0xD800 to 0xDBFF TrailSurrogate:: Hex4Digitsbut only if the SV of Hex4Digits is in the inclusive range 0xDC00 to 0xDFFF NonSurrogate:: Hex4Digitsbut only if the SV of Hex4Digits is not in the inclusive range 0xD800 to 0xDFFF IdentityEscape[U]::[+U]SyntaxCharacter [+U]/ [~U]SourceCharacterbut not UnicodeIDContinue DecimalEscape:: NonZeroDigitDecimalDigitsopt[lookahead ? DecimalDigit] CharacterClassEscape::one of dDsSwW CharacterClass[U]:: [[lookahead ? { ^ }]ClassRanges[?U]] [^ClassRanges[?U]] ClassRanges[U]:: [empty] NonemptyClassRanges[?U] NonemptyClassRanges[U]:: ClassAtom[?U] ClassAtom[?U]NonemptyClassRangesNoDash[?U] ClassAtom[?U]-ClassAtom[?U]ClassRanges[?U] NonemptyClassRangesNoDash[U]:: ClassAtom[?U] ClassAtomNoDash[?U]NonemptyClassRangesNoDash[?U] ClassAtomNoDash[?U]-ClassAtom[?U]ClassRanges[?U] ClassAtom[U]:: - ClassAtomNoDash[?U] ClassAtomNoDash[U]:: SourceCharacterbut not one of \ or ] or - \ClassEscape[?U] ClassEscape[U]:: b [+U]- CharacterClassEscape CharacterEscape[?U]
◆ Template Literal
Template:: NoSubstitutionTemplate TemplateHead NoSubstitutionTemplate:: `TemplateCharactersopt` TemplateHead:: `TemplateCharactersopt${ TemplateSubstitutionTail:: TemplateMiddle TemplateTail TemplateMiddle:: }TemplateCharactersopt${ TemplateTail:: }TemplateCharactersopt` TemplateCharacters:: TemplateCharacterTemplateCharactersopt TemplateCharacter:: $[lookahead ≠ {] \EscapeSequence LineContinuation LineTerminatorSequence SourceCharacterbut not one of ` or \ or $ or LineTerminator
◆ Array Literal
ArrayLiteral[Yield, Await]: [Elisionopt] [ElementList[?Yield, ?Await]] [ElementList[?Yield, ?Await],Elisionopt] ElementList[Yield, Await]: ElisionoptAssignmentExpression[+In, ?Yield, ?Await] ElisionoptSpreadElement[?Yield, ?Await] ElementList[?Yield, ?Await],ElisionoptAssignmentExpression[+In, ?Yield, ?Await] ElementList[?Yield, ?Await],ElisionoptSpreadElement[?Yield, ?Await] Elision: , Elision, SpreadElement[Yield, Await]: ...AssignmentExpression[+In, ?Yield, ?Await]
◆ Object Literal
ObjectLiteral[Yield, Await]: {} {PropertyDefinitionList[?Yield, ?Await]} {PropertyDefinitionList[?Yield, ?Await],} PropertyDefinitionList[Yield, Await]: PropertyDefinition[?Yield, ?Await] PropertyDefinitionList[?Yield, ?Await],PropertyDefinition[?Yield, ?Await] PropertyDefinition[Yield, Await]: IdentifierReference[?Yield, ?Await] CoverInitializedName[?Yield, ?Await] PropertyName[?Yield, ?Await]:AssignmentExpression[+In, ?Yield, ?Await] MethodDefinition[?Yield, ?Await] PropertyName[Yield, Await]: LiteralPropertyName ComputedPropertyName[?Yield, ?Await] LiteralPropertyName: IdentifierName StringLiteral NumericLiteral ComputedPropertyName[Yield, Await]: [AssignmentExpression[+In, ?Yield, ?Await]] CoverInitializedName[Yield, Await]: IdentifierReference[?Yield, ?Await]Initializer[+In, ?Yield, ?Await] Initializer[In, Yield, Await]: =AssignmentExpression[?In, ?Yield, ?Await] TemplateLiteral[Yield, Await]: NoSubstitutionTemplate TemplateHeadExpression[+In, ?Yield, ?Await]TemplateSpans[?Yield, ?Await] TemplateSpans[Yield, Await]: TemplateTail TemplateMiddleList[?Yield, ?Await]TemplateTail TemplateMiddleList[Yield, Await]: TemplateMiddleExpression[+In, ?Yield, ?Await] TemplateMiddleList[?Yield, ?Await]TemplateMiddleExpression[+In, ?Yield, ?Await] MemberExpression[Yield, Await]: PrimaryExpression[?Yield, ?Await] MemberExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] MemberExpression[?Yield, ?Await].IdentifierName MemberExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] SuperProperty[?Yield, ?Await] MetaProperty newMemberExpression[?Yield, ?Await]Arguments[?Yield, ?Await] SuperProperty[Yield, Await]: super[Expression[+In, ?Yield, ?Await]] super.IdentifierName MetaProperty: NewTarget NewTarget: new.target NewExpression[Yield, Await]: MemberExpression[?Yield, ?Await] newNewExpression[?Yield, ?Await] CallExpression[Yield, Await]:CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] SuperCall[?Yield, ?Await] CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] CallExpression[?Yield, ?Await].IdentifierName CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] CoverCallExpressionAndAsyncArrowHead[Yield, Await]: MemberExpression[?Yield, ?Await]Arguments[?Yield, ?Await]

When processing an instance of the production CallExpression[Yield, Await]:CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] the interpretation of CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:

CallMemberExpression[Yield, Await]: MemberExpression[?Yield, ?Await]Arguments[?Yield, ?Await] SuperCall[Yield, Await]: superArguments[?Yield, ?Await] Arguments[Yield, Await]: () (ArgumentList[?Yield, ?Await]) (ArgumentList[?Yield, ?Await],) ArgumentList[Yield, Await]: AssignmentExpression[+In, ?Yield, ?Await] ...AssignmentExpression[+In, ?Yield, ?Await] ArgumentList[?Yield, ?Await],AssignmentExpression[+In, ?Yield, ?Await] ArgumentList[?Yield, ?Await],...AssignmentExpression[+In, ?Yield, ?Await]

Operators

◆ Operators
AssignmentOperator:one of *=/=%=+=-=<<=>>=>>>=&=^=|=**= MultiplicativeOperator:one of */%
◆ Additive Operators
AdditiveExpression[Yield, Await]: MultiplicativeExpression[?Yield, ?Await] AdditiveExpression[?Yield, ?Await]+MultiplicativeExpression[?Yield, ?Await] AdditiveExpression[?Yield, ?Await]-MultiplicativeExpression[?Yield, ?Await]
◆ Shift Operators
ShiftExpression[Yield, Await]: AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await]<<AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await]>>AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await]>>>AdditiveExpression[?Yield, ?Await]
◆ Comparison Operators
RelationalExpression[In, Yield, Await]: ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await]<ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await]>ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await]<=ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await]>=ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await]instanceofShiftExpression[?Yield, ?Await] [+In]RelationalExpression[+In, ?Yield, ?Await]inShiftExpression[?Yield, ?Await] EqualityExpression[In, Yield, Await]: RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await]==RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await]!=RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await]===RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await]!==RelationalExpression[?In, ?Yield, ?Await]
◆ Bitwise Operators
BitwiseANDExpression[In, Yield, Await]: EqualityExpression[?In, ?Yield, ?Await] BitwiseANDExpression[?In, ?Yield, ?Await]&EqualityExpression[?In, ?Yield, ?Await] BitwiseXORExpression[In, Yield, Await]: BitwiseANDExpression[?In, ?Yield, ?Await] BitwiseXORExpression[?In, ?Yield, ?Await]^BitwiseANDExpression[?In, ?Yield, ?Await] BitwiseORExpression[In, Yield, Await]: BitwiseXORExpression[?In, ?Yield, ?Await] BitwiseORExpression[?In, ?Yield, ?Await]|BitwiseXORExpression[?In, ?Yield, ?Await]
◆ Logical Operators
LogicalANDExpression[In, Yield, Await]: BitwiseORExpression[?In, ?Yield, ?Await] LogicalANDExpression[?In, ?Yield, ?Await]&&BitwiseORExpression[?In, ?Yield, ?Await] LogicalORExpression[In, Yield, Await]: LogicalANDExpression[?In, ?Yield, ?Await] LogicalORExpression[?In, ?Yield, ?Await]||LogicalANDExpression[?In, ?Yield, ?Await]

Modules

◆ Modules
Module: ModuleBodyopt ModuleBody: ModuleItemList ModuleItemList: ModuleItem ModuleItemListModuleItem ModuleItem: ImportDeclaration ExportDeclaration StatementListItem[~Yield, ~Await, ~Return]
◆ Import
ImportDeclaration: importImportClauseFromClause; importModuleSpecifier; ImportClause: ImportedDefaultBinding NameSpaceImport NamedImports ImportedDefaultBinding,NameSpaceImport ImportedDefaultBinding,NamedImports ImportedDefaultBinding: ImportedBinding NameSpaceImport: *asImportedBinding NamedImports: {} {ImportsList} {ImportsList,} FromClause: fromModuleSpecifier ImportsList: ImportSpecifier ImportsList,ImportSpecifier ImportSpecifier: ImportedBinding IdentifierNameasImportedBinding ModuleSpecifier: StringLiteral ImportedBinding: BindingIdentifier[~Yield, ~Await]
◆ Export
ExportDeclaration: export*FromClause; exportExportClauseFromClause; exportExportClause; exportVariableStatement[~Yield, ~Await] exportDeclaration[~Yield, ~Await] exportdefaultHoistableDeclaration[~Yield, ~Await, +Default] exportdefaultClassDeclaration[~Yield, ~Await, +Default] exportdefault[lookahead ? { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await]; ExportClause: {} {ExportsList} {ExportsList,} ExportsList: ExportSpecifier ExportsList,ExportSpecifier ExportSpecifier: IdentifierName IdentifierNameasIdentifierName

Identifier

◆ Identifier
IdentifierReference[Yield, Await]: Identifier [~Yield]yield [~Await]await BindingIdentifier[Yield, Await]: Identifier [~Yield]yield [~Await]await Identifier: IdentifierNamebut not ReservedWord IdentifierName:: IdentifierStart IdentifierNameIdentifierPart IdentifierStart:: UnicodeIDStart $ _ \UnicodeEscapeSequence IdentifierPart:: UnicodeIDContinue $ _ \UnicodeEscapeSequence <ZWNJ> <ZWJ> UnicodeIDStart:: any Unicode code point with the Unicode property "ID_Start" UnicodeIDContinue:: any Unicode code point with the Unicode property "ID_Continue"
◆ Reserved Word
ReservedWord:: Keyword FutureReservedWord NullLiteral BooleanLiteral Keyword:: await break casecatchclassconstcontinue debuggerdefaultdeletedo elseexportextends finallyforfunction ifimportininstanceof new return superswitch thisthrowtrytypeof varvoid whilewith yield

await is only treated as a FutureReservedWord when Module is the goal symbol of the syntactic grammar.

The following tokens are also considered to be FutureReservedWords when parsing strict mode code:

implements  package  protected
interface  private  public

FutureReservedWord:: enum
◆ Universal Resource Identifier
uri::: uriCharactersopt uriCharacters::: uriCharacteruriCharactersopt uriCharacter::: uriReserved uriUnescaped uriEscaped uriReserved:::one of ;/?:@&=+$, uriUnescaped::: uriAlpha DecimalDigit uriMark uriEscaped::: %HexDigitHexDigit uriAlpha:::one of abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ uriMark:::one of -_.!~*'()

Source Code

◆ Source Text
SourceCharacter:: any Unicode code point

Lexical Grammar

◆ Lexical Grammar
InputElementDiv:: WhiteSpace LineTerminator Comment CommonToken DivPunctuator RightBracePunctuator InputElementRegExp:: WhiteSpace LineTerminator Comment CommonToken RightBracePunctuator RegularExpressionLiteral InputElementRegExpOrTemplateTail:: WhiteSpace LineTerminator Comment CommonToken RegularExpressionLiteral TemplateSubstitutionTail InputElementTemplateTail:: WhiteSpace LineTerminator Comment CommonToken DivPunctuator TemplateSubstitutionTail DivPunctuator:: / /= RightBracePunctuator:: }
◆ White Space
WhiteSpace:: <TAB> <VT> <FF> <SP> <NBSP> <ZWNBSP> <USP>
◆ Line Terminator
LineTerminator:: <LF> <CR> <LS> <PS> LineTerminatorSequence:: <LF> <CR>[lookahead ≠ <LF>] <LS> <PS> <CR><LF>
◆ Comment
Comment:: MultiLineComment SingleLineComment MultiLineComment:: /*MultiLineCommentCharsopt*/ MultiLineCommentChars:: MultiLineNotAsteriskCharMultiLineCommentCharsopt *PostAsteriskCommentCharsopt PostAsteriskCommentChars:: MultiLineNotForwardSlashOrAsteriskCharMultiLineCommentCharsopt *PostAsteriskCommentCharsopt MultiLineNotAsteriskChar:: SourceCharacterbut not * MultiLineNotForwardSlashOrAsteriskChar:: SourceCharacterbut not one of / or * SingleLineComment:: //SingleLineCommentCharsopt SingleLineCommentChars:: SingleLineCommentCharSingleLineCommentCharsopt SingleLineCommentChar:: SourceCharacterbut not LineTerminator
◆ Common Token
CommonToken:: IdentifierName Punctuator NumericLiteral StringLiteral Template Punctuator:: {()[] ....;, <><=>= ==!====!== +-*%** ++-- <<>>>>> &|^ !~ &&|| ?: =+=-=*=%=**=<<=>>=>>>=&=|=^= =>
[Up] [Prev] [Next]
Copyright (C) 2017 杜甫々
改訂版初版:2017年12月17日、最終更新:2017年12月17日
http://www.tohoho-web.com/js/syntax.htm