From 9dcdd9166e224e2a00c25bb3464564650ea81a95 Mon Sep 17 00:00:00 2001 From: ice1000 Date: Fri, 23 Aug 2019 21:55:44 -0400 Subject: [PATCH] [ voile ] Remove deprecated syntax, optimize imports --- grammar/voile.bnf | 8 ------- grammar/voile.flex | 1 - .../ice1000/tt/editing/acore/lex-highlight.kt | 5 ----- .../ice1000/tt/editing/agda/lex-highlight.kt | 5 ----- .../tt/editing/cubicaltt/lex-highlight.kt | 4 ---- .../tt/editing/minitt/lex-highlight.kt | 5 ----- .../tt/editing/mlpolyr/lex-highlight.kt | 5 ----- .../tt/editing/redprl/lex-highlight.kt | 5 ----- .../ice1000/tt/editing/voile/lex-highlight.kt | 22 +++++++++++-------- .../tt/editing/yacctt/lex-highlight.kt | 4 ---- 10 files changed, 13 insertions(+), 51 deletions(-) diff --git a/grammar/voile.bnf b/grammar/voile.bnf index e2c0f0b..d21ecb0 100644 --- a/grammar/voile.bnf +++ b/grammar/voile.bnf @@ -37,7 +37,6 @@ expr ::= | dollarExpr | commaExpr | pipeExpr - | sumExpr | appExpr | litExpr | lamExpr @@ -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 } @@ -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'] diff --git a/grammar/voile.flex b/grammar/voile.flex index 75693d5..f72b57a 100644 --- a/grammar/voile.flex +++ b/grammar/voile.flex @@ -45,7 +45,6 @@ _ { return META; } : { return COLON; } , { return COMMA; } \^ { return UP; } -\+ { return SUM; } \. { return DOT; } \! { return BOT; } \* { return SIG; } diff --git a/src/org/ice1000/tt/editing/acore/lex-highlight.kt b/src/org/ice1000/tt/editing/acore/lex-highlight.kt index 005f2d2..8ba5d0b 100644 --- a/src/org/ice1000/tt/editing/acore/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/acore/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/agda/lex-highlight.kt b/src/org/ice1000/tt/editing/agda/lex-highlight.kt index efbee47..f1fe419 100644 --- a/src/org/ice1000/tt/editing/agda/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/agda/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/cubicaltt/lex-highlight.kt b/src/org/ice1000/tt/editing/cubicaltt/lex-highlight.kt index 9c20657..d58981c 100644 --- a/src/org/ice1000/tt/editing/cubicaltt/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/cubicaltt/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/minitt/lex-highlight.kt b/src/org/ice1000/tt/editing/minitt/lex-highlight.kt index 5dba7b7..dcbca10 100644 --- a/src/org/ice1000/tt/editing/minitt/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/minitt/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/mlpolyr/lex-highlight.kt b/src/org/ice1000/tt/editing/mlpolyr/lex-highlight.kt index 0c7a1c9..d545b95 100644 --- a/src/org/ice1000/tt/editing/mlpolyr/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/mlpolyr/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/redprl/lex-highlight.kt b/src/org/ice1000/tt/editing/redprl/lex-highlight.kt index bb9c1f7..24e4dfa 100644 --- a/src/org/ice1000/tt/editing/redprl/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/redprl/lex-highlight.kt @@ -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 diff --git a/src/org/ice1000/tt/editing/voile/lex-highlight.kt b/src/org/ice1000/tt/editing/voile/lex-highlight.kt index c607433..efd2068 100644 --- a/src/org/ice1000/tt/editing/voile/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/voile/lex-highlight.kt @@ -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 ) @@ -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() } } @@ -61,8 +65,8 @@ class VoileColorSettingsPage : VoileGeneratedColorSettingsPage() { override fun getAttributeDescriptors() = DESCRIPTORS @Language("Voile") override fun getDemoText() = """ -val id: (A: Type) -> A -> {| lab: A |}; +val id: (A: Type) -> A -> Rec { lab: A; }; // Identity function definition -let id = \A a. { lab = a }; +let id = \A a. {| lab = a; |}; """ } diff --git a/src/org/ice1000/tt/editing/yacctt/lex-highlight.kt b/src/org/ice1000/tt/editing/yacctt/lex-highlight.kt index c7f0987..de2a05e 100644 --- a/src/org/ice1000/tt/editing/yacctt/lex-highlight.kt +++ b/src/org/ice1000/tt/editing/yacctt/lex-highlight.kt @@ -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