diff --git a/src/main/java/dev/blachut/svelte/lang/SvelteLanguage.java b/src/main/java/dev/blachut/svelte/lang/SvelteLanguage.java deleted file mode 100644 index 1da1d610..00000000 --- a/src/main/java/dev/blachut/svelte/lang/SvelteLanguage.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.blachut.svelte.lang; - -import com.intellij.lang.Language; - -// Kotlin class trips up plugin.xml inspections -public class SvelteLanguage extends Language { - public static final SvelteLanguage INSTANCE = new SvelteLanguage(); - - private SvelteLanguage() { - super("Svelte"); - } -} diff --git a/src/main/java/dev/blachut/svelte/lang/parsing/top/Svelte.flex b/src/main/java/dev/blachut/svelte/lang/parsing/top/Svelte.flex deleted file mode 100644 index 624beeb7..00000000 --- a/src/main/java/dev/blachut/svelte/lang/parsing/top/Svelte.flex +++ /dev/null @@ -1,69 +0,0 @@ -package dev.blachut.svelte.lang.parsing.top; - -import java.util.*; -import com.intellij.lexer.FlexLexer; -import com.intellij.psi.tree.IElementType; - -import static dev.blachut.svelte.lang.psi.SvelteTokenTypes.*; - -%% - -//%debug -%public -%class _SvelteLexer -%implements FlexLexer -%function advance -%type IElementType -%unicode - -%{ - private int bracesNestingLevel = 0; - - private IElementType quotedToken; - - private Stack stack = new Stack<>(); - - private void pushState(int newState) { - stack.push(yystate()); - yybegin(newState); - } - - private void popState() { - yybegin(stack.pop()); - } - - private IElementType beginQuote(int quoteState, IElementType token) { - quotedToken = token; - pushState(quoteState); - return quotedToken; - }} -%} - -WHITE_SPACE=\s+ -ID=[$_a-zA-Z0-9]+ -SINGLE_QUOTE="'" -DOUBLE_QUOTE="\"" -TICKED_QUOTE="`" - -%state SVELTE_TAG -%xstate SINGLE_QUOTE -%xstate DOUBLE_QUOTE -%xstate TICKED_QUOTE - -%% - { - {SINGLE_QUOTE} { return beginQuote(SINGLE_QUOTE, CODE_FRAGMENT); } - {DOUBLE_QUOTE} { return beginQuote(DOUBLE_QUOTE, CODE_FRAGMENT); } - {TICKED_QUOTE} { return beginQuote(TICKED_QUOTE, CODE_FRAGMENT); } -} - - {SINGLE_QUOTE} { popState(); return quotedToken; } - {DOUBLE_QUOTE} { popState(); return quotedToken; } - {TICKED_QUOTE} { popState(); return quotedToken; } - - { - \\[^] { return quotedToken; } - [^] { return quotedToken; } -} - -[^] { return HTML_FRAGMENT; } diff --git a/src/main/java/dev/blachut/svelte/lang/parsing/top/SvelteParserDefinition.kt b/src/main/java/dev/blachut/svelte/lang/parsing/top/SvelteParserDefinition.kt deleted file mode 100644 index 4f94a8c8..00000000 --- a/src/main/java/dev/blachut/svelte/lang/parsing/top/SvelteParserDefinition.kt +++ /dev/null @@ -1,40 +0,0 @@ -package dev.blachut.svelte.lang.parsing.top - -import com.intellij.lang.ASTNode -import com.intellij.lang.ParserDefinition -import com.intellij.lang.PsiParser -import com.intellij.lexer.Lexer -import com.intellij.openapi.project.Project -import com.intellij.psi.FileViewProvider -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.tree.IFileElementType -import com.intellij.psi.tree.TokenSet -import dev.blachut.svelte.lang.parsing.html.SvelteHTMLParserDefinition -import dev.blachut.svelte.lang.psi.SvelteElementTypes - -class SvelteParserDefinition : ParserDefinition { - override fun createLexer(project: Project): Lexer { - throw RuntimeException("createLexer") - } - - override fun getCommentTokens(): TokenSet = TokenSet.EMPTY - - override fun getStringLiteralElements(): TokenSet = TokenSet.EMPTY - - override fun createParser(project: Project): PsiParser { - throw RuntimeException("createParser") - } - - override fun getFileNodeType(): IFileElementType { - return SvelteHTMLParserDefinition.FILE - } - - override fun createFile(viewProvider: FileViewProvider): PsiFile { - throw RuntimeException("createFile") - } - - override fun createElement(node: ASTNode): PsiElement { - return SvelteElementTypes.createElement(node) - } -} diff --git a/src/main/java/dev/blachut/svelte/lang/psi/SvelteElementType.kt b/src/main/java/dev/blachut/svelte/lang/psi/SvelteElementType.kt index 100399a9..e75cb7f3 100644 --- a/src/main/java/dev/blachut/svelte/lang/psi/SvelteElementType.kt +++ b/src/main/java/dev/blachut/svelte/lang/psi/SvelteElementType.kt @@ -1,9 +1,9 @@ package dev.blachut.svelte.lang.psi import com.intellij.psi.tree.IElementType -import dev.blachut.svelte.lang.SvelteLanguage +import dev.blachut.svelte.lang.SvelteHTMLLanguage import org.jetbrains.annotations.NonNls -class SvelteElementType(@NonNls debugName: String) : IElementType(debugName, SvelteLanguage.INSTANCE) +class SvelteElementType(@NonNls debugName: String) : IElementType(debugName, SvelteHTMLLanguage.INSTANCE) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 68197ee3..20351957 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -60,8 +60,6 @@ - - + diff --git a/src/test/java/dev/blachut/svelte/lang/parsing/SvelteParsingTest.kt b/src/test/java/dev/blachut/svelte/lang/parsing/SvelteParsingTest.kt index c600d572..5fc3a03a 100644 --- a/src/test/java/dev/blachut/svelte/lang/parsing/SvelteParsingTest.kt +++ b/src/test/java/dev/blachut/svelte/lang/parsing/SvelteParsingTest.kt @@ -5,7 +5,7 @@ import dev.blachut.svelte.lang.parsing.html.SvelteHTMLParserDefinition import dev.blachut.svelte.lang.parsing.js.SvelteJSParserDefinition import dev.blachut.svelte.lang.parsing.top.SvelteParserDefinition -class SvelteParsingTest : ParsingTestCase("dev/blachut/svelte/lang/parsing", "svelte", SvelteParserDefinition(), SvelteJSParserDefinition(), SvelteHTMLParserDefinition()) { +class SvelteParsingTest : ParsingTestCase("dev/blachut/svelte/lang/parsing", "svelte", SvelteJSParserDefinition(), SvelteHTMLParserDefinition()) { override fun getTestDataPath(): String = "src/test/resources" fun testIfElseIf() = doTest()