Skip to content

Commit

Permalink
Support associations (=>) in types
Browse files Browse the repository at this point in the history
  • Loading branch information
KronicDeth committed Jan 1, 2016
1 parent 8931c13 commit 67da72d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 38 deletions.

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

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

10 changes: 1 addition & 9 deletions src/org/elixir_lang/Elixir.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -2007,15 +2007,7 @@ private associationInfixOperator ::= EOL* ASSOCIATION_OPERATOR EOL*

// @see https://github.com/elixir-lang/elixir/blob/de39bbaca277002797e52ffbde617ace06233a2b/lib/elixir/src/elixir_parser.yrl#L505
containerAssociationOperation ::= containerExpression associationInfixOperator containerExpression
{
implements = "org.elixir_lang.psi.AssociationOperation"
methods = [
leftOperand
operator
quote
rightOperand
]
}
{ implements = "org.elixir_lang.psi.AssociationOperation" methods = [quote] }

left maxDotCall ::= dotInfixOperator parenthesesArguments parenthesesArguments?
{ elementType = matchedDotCall }
Expand Down
5 changes: 4 additions & 1 deletion src/org/elixir_lang/annonator/ModuleAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ private void highlightTypesAndTypeParameterUsages(PsiElement psiElement,
typeTextAttributesKey
);
} else if (psiElement instanceof ElixirAccessExpression ||
psiElement instanceof ElixirAssociationsBase ||
psiElement instanceof ElixirAssociations ||
psiElement instanceof ElixirContainerAssociationOperation ||
psiElement instanceof ElixirKeywordPair ||
psiElement instanceof ElixirKeywords ||
psiElement instanceof ElixirList ||
Expand Down Expand Up @@ -783,7 +786,7 @@ private void highlightTypesAndTypeParameterUsages(PsiElement psiElement,
psiElement instanceof ElixirStringLine ||
psiElement instanceof ElixirUnaryNumericOperation) {
// leave normal highlighting
} else if (psiElement instanceof ElixirMapOperation) {
} else if (psiElement instanceof ElixirMapOperation) {
highlightTypesAndTypeParameterUsages(
(ElixirMapOperation) psiElement,
typeParameterNameSet,
Expand Down
8 changes: 5 additions & 3 deletions src/org/elixir_lang/psi/AssociationOperation.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.elixir_lang.psi;

import com.intellij.psi.PsiElement;

/**
* A binary operator with a left operand, association operator, and right operand
* A binary operator with a left operand, association operator, and right operand, but the association operator is
* ignored for quoting, so not an {@link InfixOperation}.
*/
public interface AssociationOperation extends InfixOperation {

public interface AssociationOperation extends Quotable {
}

0 comments on commit 67da72d

Please sign in to comment.