Skip to content

Commit

Permalink
[ voile ] Remove deprecated syntax, optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Aug 24, 2019
1 parent 6961a87 commit 9dcdd91
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 51 deletions.
8 changes: 0 additions & 8 deletions grammar/voile.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ expr ::=
| dollarExpr
| commaExpr
| pipeExpr
| sumExpr
| appExpr
| litExpr
| lamExpr
Expand All @@ -51,12 +50,6 @@ expr ::=
| telescopicExpr
| parenExpr

/*
singleCase ::= KW_CASE CONS nameDecl ARROW expr { pin=1 }
caseExpr ::= singleCase+ defaultMatch? { pin=1 }
private defaultMatch ::= KW_OTHERWISE expr
*/

row ::= KW_SUM | KW_REC
rowPolymorpicExpr ::= row LBRACE property* defaultFields? RBRACE { pin=2 }
rowKindExpr ::= row LBRACK label+ RBRACK { pin=2 }
Expand Down Expand Up @@ -84,7 +77,6 @@ telescopicExpr ::= LPAREN nameDecl+ COLON expr RPAREN {
dollarExpr ::= expr DOLLAR expr
pipeExpr ::= expr PIPE expr
commaExpr ::= expr COMMA expr
sumExpr ::= expr SUM expr
lamExpr ::= LAM nameDecl+ DOT expr {
pin=1
implements=['com.intellij.psi.PsiNameIdentifierOwner']
Expand Down
1 change: 0 additions & 1 deletion grammar/voile.flex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ _ { return META; }
: { return COLON; }
, { return COMMA; }
\^ { return UP; }
\+ { return SUM; }
\. { return DOT; }
\! { return BOT; }
\* { return SIG; }
Expand Down
5 changes: 0 additions & 5 deletions src/org/ice1000/tt/editing/acore/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.ice1000.tt.editing.acore

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.ACoreFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.acore.ACoreTokenType
import org.ice1000.tt.psi.acore.ACoreTypes
Expand Down
5 changes: 0 additions & 5 deletions src/org/ice1000/tt/editing/agda/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.ice1000.tt.editing.agda

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.AgdaFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.agda.AgdaTokenType
import org.ice1000.tt.psi.agda.AgdaTypes
Expand Down
4 changes: 0 additions & 4 deletions src/org/ice1000/tt/editing/cubicaltt/lex-highlight.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ package org.ice1000.tt.editing.cubicaltt

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.CubicalTTFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.cubicaltt.CubicalTTTokenType
import org.ice1000.tt.psi.cubicaltt.CubicalTTTypes
Expand Down
5 changes: 0 additions & 5 deletions src/org/ice1000/tt/editing/minitt/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.ice1000.tt.editing.minitt

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.MiniTTFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.minitt.MiniTTTokenType
import org.ice1000.tt.psi.minitt.MiniTTTypes
Expand Down
5 changes: 0 additions & 5 deletions src/org/ice1000/tt/editing/mlpolyr/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.ice1000.tt.editing.mlpolyr

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.MLPolyRFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.mlpolyr.MLPolyRTokenType
import org.ice1000.tt.psi.mlpolyr.MLPolyRTypes
Expand Down
5 changes: 0 additions & 5 deletions src/org/ice1000/tt/editing/redprl/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.ice1000.tt.editing.redprl

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.RedPrlFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.redprl.RedPrlTokenType
import org.ice1000.tt.psi.redprl.RedPrlTypes
Expand Down
22 changes: 13 additions & 9 deletions src/org/ice1000/tt/editing/voile/lex-highlight.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package org.ice1000.tt.editing.voile

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.fileTypes.SyntaxHighlighter
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.TTBundle
import org.ice1000.tt.VoileFileType
import org.ice1000.tt.psi.voile.VoileTokenType
import org.ice1000.tt.psi.voile.VoileTypes
import org.intellij.lang.annotations.Language

object VoileHighlighter : VoileGeneratedSyntaxHighlighter() {
@JvmField val KEYWORDS = listOf(
VoileTypes.KW_VAL,
VoileTypes.KW_LET,
VoileTypes.KW_CASE,
VoileTypes.KW_OR,
VoileTypes.KW_NOCASES,
VoileTypes.KW_SUM,
VoileTypes.KW_REC,
VoileTypes.KW_TYPE
)
@JvmField val OPERATORS = listOf(
VoileTypes.DOLLAR,
VoileTypes.ARROW,
VoileTypes.SUM,
VoileTypes.DOT,
VoileTypes.SIG
)
Expand All @@ -29,11 +33,11 @@ object VoileHighlighter : VoileGeneratedSyntaxHighlighter() {
VoileTypes.COMMA -> COMMA_KEY
VoileTypes.IDENTIFIER -> IDENTIFIER_KEY
VoileTokenType.LINE_COMMENT -> LINE_COMMENT_KEY
VoileTypes.KW_VAL, VoileTypes.KW_LET, VoileTypes.KW_TYPE -> KEYWORD_KEY
VoileTypes.LPAREN, VoileTypes.RPAREN -> PAREN_KEY
VoileTypes.LBRACE, VoileTypes.RBRACE -> BRACE_KEY
VoileTypes.LBRACE2, VoileTypes.RBRACE2 -> BRACE2_KEY
in OPERATORS -> OPERATOR_KEY
in KEYWORDS -> KEYWORD_KEY
else -> emptyArray()
}
}
Expand Down Expand Up @@ -61,8 +65,8 @@ class VoileColorSettingsPage : VoileGeneratedColorSettingsPage() {
override fun getAttributeDescriptors() = DESCRIPTORS
@Language("Voile")
override fun getDemoText() = """
val <FD>id</FD>: (A: Type) -> A -> {| lab: A |};
val <FD>id</FD>: (A: Type) -> A -> Rec { lab: A; };
// Identity function definition
let <FD>id</FD> = \A a. { lab = a };
let <FD>id</FD> = \A a. {| lab = a; |};
"""
}
4 changes: 0 additions & 4 deletions src/org/ice1000/tt/editing/yacctt/lex-highlight.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ package org.ice1000.tt.editing.yacctt

import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.options.colors.AttributesDescriptor
import com.intellij.openapi.options.colors.ColorDescriptor
import com.intellij.openapi.options.colors.ColorSettingsPage
import com.intellij.psi.tree.IElementType
import icons.TTIcons
import org.ice1000.tt.YaccTTFileType
import org.ice1000.tt.TTBundle
import org.ice1000.tt.psi.yacctt.YaccTTTokenType
import org.ice1000.tt.psi.yacctt.YaccTTTypes
Expand Down

0 comments on commit 9dcdd91

Please sign in to comment.