Skip to content

Commit 50cfdc7

Browse files
committed
fix(exts/devin-lang): Allow code blocks to start without content #101
The DevInParser.bnf has been modified to support code blocks that start with a CODE_BLOCK_START token without requiring mandatory content. This change ensures that code blocks are not incorrectly parsed when they are intended to be empty. Two test cases have been added to DevInParsingTest.kt to validate the parser's behavior with both empty and non-empty code blocks. The testData directory has been updated with a new file, BlockStartOnly.devin, which contains a code block starting with CODE_BLOCK_START without any content, illustrating a valid usage scenario. This commit adheres to the Conventional Commits specification for fixes related to the DevInLanguage extension.
1 parent 71099a9 commit 50cfdc7

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

exts/devin-lang/src/grammar/DevInParser.bnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ used ::= (
3535
| VARIABLE_START VARIABLE_ID?
3636
)
3737

38-
code ::= CODE_BLOCK_START LANGUAGE_ID? NEWLINE code_contents CODE_BLOCK_END
38+
code ::= CODE_BLOCK_START LANGUAGE_ID? NEWLINE? code_contents? CODE_BLOCK_END?
3939

4040
code_contents ::= (NEWLINE | CODE_CONTENT)*

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
@@ -23,4 +23,8 @@ class DevInParsingTest : ParsingTestCase("parser", "devin", DevInParserDefinitio
2323
fun testJavaAnnotation() {
2424
doTest(true)
2525
}
26+
27+
fun testBlockStartOnly() {
28+
doTest(true)
29+
}
2630
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
```

0 commit comments

Comments
 (0)