Skip to content

Commit

Permalink
feat(devin-lang): add support for variables and commands #101
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
phodal committed Mar 11, 2024
1 parent 3a35ac6 commit e36d6f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 7 additions & 5 deletions exts/devin-lang/src/grammar/DevInLexer.flex
Expand Up @@ -18,15 +18,17 @@ import com.intellij.psi.TokenType;

CRLF=\R
WHITE_SPACE=[\ \n\t\f]
FIRST_VALUE_CHARACTER=[^ \n\f\\] | "\\"{CRLF} | "\\".
VALUE_CHARACTER=[^\n\f\\] | "\\"{CRLF} | "\\".
END_OF_LINE_COMMENT=("#"|"!")[^\r\n]*
SEPARATOR=[:=]
KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ "
// $ variable
STRING=\"([^\\\"\r\n]|\\[^\r\n])*\"?
VARIABLE="$" {STRING}

%state WAITING_VALUE

%%
<YYINITIAL> {
{STRING} { return DevInTypes.STRING; }
{VARIABLE} { return DevInTypes.VARIABLE; }
}

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

Expand Down
8 changes: 7 additions & 1 deletion exts/devin-lang/src/grammar/DevInParser.bnf
Expand Up @@ -17,4 +17,10 @@

DevInFile ::= item_*

private item_ ::= (CRLF)
private item_ ::= (VARIABLE|CRLF|STRING)

// $use-variable

// @use-agent

// /use-command

0 comments on commit e36d6f4

Please sign in to comment.