diff --git a/src/lsp/intellij-plugin/src/main/kotlin/Lexer.kt b/src/lsp/intellij-plugin/src/main/kotlin/Lexer.kt index be118e5f..72377050 100644 --- a/src/lsp/intellij-plugin/src/main/kotlin/Lexer.kt +++ b/src/lsp/intellij-plugin/src/main/kotlin/Lexer.kt @@ -96,6 +96,7 @@ class Lexer : IntellijLexer() { override fun advance() { index++ + state = index } override fun getBufferEnd() = buffer.toString().length diff --git a/src/lsp/intellij-plugin/src/main/kotlin/Parser.kt b/src/lsp/intellij-plugin/src/main/kotlin/Parser.kt index 1eb04224..b94f2d18 100644 --- a/src/lsp/intellij-plugin/src/main/kotlin/Parser.kt +++ b/src/lsp/intellij-plugin/src/main/kotlin/Parser.kt @@ -57,15 +57,15 @@ class Parser : PsiParser { } } - fun parseDef() { + fun parseRef() { when { builder.eof() -> return builder.def() -> return builder.tokenType == CUSTOM_TYPE -> { val customTypeMarker = builder.mark() builder.advanceLexer() - customTypeMarker.done(CustomTypeDef()) - parseDef() + customTypeMarker.done(CustomTypeRef()) + parseRef() } builder.tokenType == LEFT_CURLY -> { @@ -74,7 +74,25 @@ class Parser : PsiParser { parseBody() bodyMarker.done(Body()) builder.advanceLexer() - parseDef() + parseRef() + } + + else -> { + builder.advanceLexer() + parseRef() + } + } + } + + fun parseDef() { + when { + builder.eof() -> return + builder.def() -> return + builder.tokenType == CUSTOM_TYPE -> { + val customTypeMarker = builder.mark() + builder.advanceLexer() + customTypeMarker.done(CustomTypeDef()) + parseRef() } else -> {