Skip to content

Commit e36d6f4

Browse files
committed
feat(devin-lang): add support for variables and commands #101
The DevInLexer and DevInParser have been updated to support variables, agent usage, and commands in DevInLang. This change introduces a more flexible grammar that recognizes strings and variables, allowing for more complex and expressive scripting within the language.
1 parent 3a35ac6 commit e36d6f4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ import com.intellij.psi.TokenType;
1818

1919
CRLF=\R
2020
WHITE_SPACE=[\ \n\t\f]
21-
FIRST_VALUE_CHARACTER=[^ \n\f\\] | "\\"{CRLF} | "\\".
22-
VALUE_CHARACTER=[^\n\f\\] | "\\"{CRLF} | "\\".
23-
END_OF_LINE_COMMENT=("#"|"!")[^\r\n]*
24-
SEPARATOR=[:=]
25-
KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ "
21+
// $ variable
22+
STRING=\"([^\\\"\r\n]|\\[^\r\n])*\"?
23+
VARIABLE="$" {STRING}
2624

2725
%state WAITING_VALUE
2826

2927
%%
28+
<YYINITIAL> {
29+
{STRING} { return DevInTypes.STRING; }
30+
{VARIABLE} { return DevInTypes.VARIABLE; }
31+
}
3032

3133
({CRLF}|{WHITE_SPACE})+ { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
3234

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@
1717

1818
DevInFile ::= item_*
1919

20-
private item_ ::= (CRLF)
20+
private item_ ::= (VARIABLE|CRLF|STRING)
21+
22+
// $use-variable
23+
24+
// @use-agent
25+
26+
// /use-command

0 commit comments

Comments
 (0)