Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove expensive !stabOperatorPrefix #943

Merged
merged 13 commits into from
Dec 5, 2017
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