-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikita Gusakov
committed
Sep 22, 2014
1 parent
7b62d11
commit e8a9929
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.zephir.lang; | ||
|
||
import com.intellij.lang.BracePair; | ||
import com.intellij.lang.PairedBraceMatcher; | ||
import com.intellij.psi.PsiFile; | ||
import com.intellij.psi.tree.IElementType; | ||
import com.zephir.psi.ZephirTypes; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* @author Nikita Gusakov | ||
*/ | ||
public class ZephirBraceMatcher implements PairedBraceMatcher { | ||
private static final BracePair[] BRACE_PAIRS = { | ||
new BracePair(ZephirTypes.BRACKET_OPEN, ZephirTypes.BRACKET_CLOSE, true), | ||
new BracePair(ZephirTypes.SBRACKET_OPEN, ZephirTypes.SBRACKET_CLOSE, false), | ||
new BracePair(ZephirTypes.PARENTHESES_OPEN, ZephirTypes.PARENTHESES_CLOSE, false) | ||
}; | ||
|
||
@Override | ||
public BracePair[] getPairs() { | ||
return BRACE_PAIRS; | ||
} | ||
|
||
@Override | ||
public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType braceType, @Nullable IElementType contextType) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public int getCodeConstructStart(PsiFile file, int openingBraceOffset) { | ||
return openingBraceOffset; | ||
} | ||
} |