Skip to content

Commit

Permalink
feat(devin-lang): extend language identifier regex to support spaces …
Browse files Browse the repository at this point in the history
…and dots #101

The language identifier regex in DevInLexer.flex has been updated to support identifiers that include spaces and dots, allowing for more flexible and natural language identifiers in the DevInLang grammar. This change has been accompanied by the addition of a new test case in DevInParsingTest.kt to ensure that the parser can handle complex language identifiers, and the creation of a new test file, ComplexLangId.devin, which contains an example of a complex language identifier in use.
  • Loading branch information
phodal committed Mar 13, 2024
1 parent fabb4fb commit 9ec0123
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion exts/devin-lang/src/grammar/DevInLexer.flex
Expand Up @@ -35,7 +35,7 @@ IDENTIFIER=[a-zA-Z0-9][_\-a-zA-Z0-9]*
VARIABLE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
AGENT_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
COMMAND_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
LANGUAGE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
LANGUAGE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9 .]*

TEXT_SEGMENT=[^$/@\n]+
CODE_CONTENT=[^\n]+
Expand Down
Expand Up @@ -27,4 +27,8 @@ class DevInParsingTest : ParsingTestCase("parser", "devin", DevInParserDefinitio
fun testBlockStartOnly() {
doTest(true)
}

fun testComplexLangId() {
doTest(true)
}
}
2 changes: 2 additions & 0 deletions exts/devin-lang/src/test/testData/parser/ComplexLangId.devin
@@ -0,0 +1,2 @@
```typescript jsx
```
8 changes: 8 additions & 0 deletions exts/devin-lang/src/test/testData/parser/ComplexLangId.txt
@@ -0,0 +1,8 @@
DevInFile
CodeBlockElement(CODE)
PsiElement(DevInTokenType.CODE_BLOCK_START)('```')
PsiElement(DevInTokenType.LANGUAGE_ID)('typescript jsx')
PsiElement(DevInTokenType.NEWLINE)('\n')
ASTWrapperPsiElement(CODE_CONTENTS)
<empty list>
PsiElement(DevInTokenType.CODE_BLOCK_END)('```')
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -7,7 +7,7 @@ pluginGroup = com.phodal.autodev
pluginName = AutoDev
pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
# SemVer format -> https://semver.org
pluginVersion = 1.7.1
pluginVersion = 1.7.2-SNAPSHOT

# Supported IDEs: idea, pycharm
baseIDE=idea
Expand Down

0 comments on commit 9ec0123

Please sign in to comment.