Skip to content

Instantly share code, notes, and snippets.

@pvdz
Created June 5, 2017 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvdz/78f6dd3964b0b212d791d3a18f5ce22c to your computer and use it in GitHub Desktop.
Save pvdz/78f6dd3964b0b212d791d3a18f5ce22c to your computer and use it in GitHub Desktop.
Statement -> ExpressionStatement -> Expression -> AssignmentExpression ->
AssignmentExpression -> ConditionalExpression -> LogicalORExpression -> LogicalANDExpression ->
BitwiseORExpression -> BitwiseXORExpression -> BitwiseANDExpression -> EqualityExpression ->
RelationalExpression -> ShiftExpression -> AdditiveExpression -> MultiplicativeExpression
MultiplicativeExpression -> MultiplicativeExpression MultiplicativeOperator ExponentiationExpression
MultiplicativeOperator -> one of * / %
// We can match * on MultiplicativeOperator, continue left and right up to PrimaryExpression
// proceeding to match the arrow on the right side
ExponentiationExpression -> UnaryExpression -> UpdateExpression -> LeftHandSideExpression -> NewExpression ->
MemberExpression -> PrimaryExpression
// matching the regex:
PrimaryExpression -> RegularExpressionLiteral
// matching the arrow:
PrimaryExpression -> CoverParenthesizedExpressionAndArrowParameterList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment