Skip to content

Commit

Permalink
Land #943: Remove expensive !stabOperatorPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
KronicDeth authored Dec 5, 2017
2 parents c80d1d0 + f5b45f7 commit f214865
Show file tree
Hide file tree
Showing 178 changed files with 3,033 additions and 2,377 deletions.
82 changes: 62 additions & 20 deletions gen/org/elixir_lang/parser/ElixirParser.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/org/elixir_lang/Elixir.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ private expression ::= emptyParentheses |
// CLOSING_* because they are endings to subexpressions
// STAB_OPERATOR because it ends when clause for no parentheses stab guard clauses
// blockIdentifier for one-liner blockItems where there isn't a newline between block expressions and following blockIdentifier.
private expressionRecoverUntil ::= EOL | CLOSING_BIT | CLOSING_BRACKET | CLOSING_CURLY | CLOSING_PARENTHESIS | INTERPOLATION_END | SEMICOLON | STAB_OPERATOR | END | blockIdentifier | EEX_CLOSING
private expressionRecoverUntil ::= EOL | CLOSING_BIT | CLOSING_BRACKET | CLOSING_CURLY | CLOSING_PARENTHESIS | COMMA | INTERPOLATION_END | SEMICOLON | STAB_OPERATOR | END | blockIdentifier | EEX_CLOSING
private expressionRecoverWhile ::= !expressionRecoverUntil

private expressionList ::= expression (endOfExpression expression)*
Expand Down Expand Up @@ -2149,10 +2149,9 @@ stabInfixOperator ::= eolStar STAB_OPERATOR eolStar
* for grouping stab followed by expression into stab, so it is equivalent to expr_list (expressionList)
*/
private stabOperationPrefix ::= stabParenthesesSignature stabInfixOperator |
stabNoParenthesesSignature stabInfixOperator |
stabInfixOperator
stabNoParenthesesSignature stabInfixOperator
private stabBodyExpression ::= EEX_CLOSING eex EEX_OPENING |
!stabOperationPrefix expression
expression !(infixComma | stabInfixOperator)
private stabBodyExpressionSeparator ::= EEX_EMPTY_MARKER | endOfExpression
private stabBodyExpressionSeparatorMaybe ::= stabBodyExpressionSeparator?
stabBody ::= stabBodyExpression (stabBodyExpressionSeparator stabBodyExpression)*
Expand All @@ -2164,6 +2163,8 @@ stabBody ::= stabBodyExpression (stabBodyExpressionSeparator stabBodyExpression)
]
}

noArgumentStabOperation ::= stabInfixOperator stabBody?
{ elementType = stabOperation }
stabOperation ::= stabOperationPrefix stabBody?
{
implements = "org.elixir_lang.psi.Quotable"
Expand All @@ -2176,7 +2177,8 @@ stabOperation ::= stabOperationPrefix stabBody?
]
}

private stabOperations ::= stabOperation (stabBodyExpressionSeparator stabOperation)*
private stabOperations ::= noArgumentStabOperation |
stabOperation (stabBodyExpressionSeparator stabOperation)*

// @see https://github.com/elixir-lang/elixir/blob/de39bbaca277002797e52ffbde617ace06233a2b/lib/elixir/src/elixir_parser.yrl#L268-L269
stab ::= stabOperations | stabBody
Expand Down
Loading

0 comments on commit f214865

Please sign in to comment.