Skip to content

Commit 9ec0123

Browse files
committed
feat(devin-lang): extend language identifier regex to support spaces 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.
1 parent fabb4fb commit 9ec0123

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

exts/devin-lang/src/grammar/DevInLexer.flex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ IDENTIFIER=[a-zA-Z0-9][_\-a-zA-Z0-9]*
3535
VARIABLE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
3636
AGENT_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
3737
COMMAND_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
38-
LANGUAGE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9]*
38+
LANGUAGE_ID=[a-zA-Z0-9][_\-a-zA-Z0-9 .]*
3939

4040
TEXT_SEGMENT=[^$/@\n]+
4141
CODE_CONTENT=[^\n]+

exts/devin-lang/src/test/kotlin/cc/unitmesh/language/DevInParsingTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ class DevInParsingTest : ParsingTestCase("parser", "devin", DevInParserDefinitio
2727
fun testBlockStartOnly() {
2828
doTest(true)
2929
}
30+
31+
fun testComplexLangId() {
32+
doTest(true)
33+
}
3034
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```typescript jsx
2+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DevInFile
2+
CodeBlockElement(CODE)
3+
PsiElement(DevInTokenType.CODE_BLOCK_START)('```')
4+
PsiElement(DevInTokenType.LANGUAGE_ID)('typescript jsx')
5+
PsiElement(DevInTokenType.NEWLINE)('\n')
6+
ASTWrapperPsiElement(CODE_CONTENTS)
7+
<empty list>
8+
PsiElement(DevInTokenType.CODE_BLOCK_END)('```')

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pluginGroup = com.phodal.autodev
77
pluginName = AutoDev
88
pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
99
# SemVer format -> https://semver.org
10-
pluginVersion = 1.7.1
10+
pluginVersion = 1.7.2-SNAPSHOT
1111

1212
# Supported IDEs: idea, pycharm
1313
baseIDE=idea

0 commit comments

Comments
 (0)