Skip to content

Commit

Permalink
fix(exts/devin-lang): Allow code blocks to start without content #101
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phodal committed Mar 13, 2024
1 parent 71099a9 commit 50cfdc7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exts/devin-lang/src/grammar/DevInParser.bnf
Expand Up @@ -35,6 +35,6 @@ used ::= (
| VARIABLE_START VARIABLE_ID?
)

code ::= CODE_BLOCK_START LANGUAGE_ID? NEWLINE code_contents CODE_BLOCK_END
code ::= CODE_BLOCK_START LANGUAGE_ID? NEWLINE? code_contents? CODE_BLOCK_END?

code_contents ::= (NEWLINE | CODE_CONTENT)*
Expand Up @@ -23,4 +23,8 @@ class DevInParsingTest : ParsingTestCase("parser", "devin", DevInParserDefinitio
fun testJavaAnnotation() {
doTest(true)
}

fun testBlockStartOnly() {
doTest(true)
}
}
@@ -0,0 +1 @@
```

0 comments on commit 50cfdc7

Please sign in to comment.