Skip to content

Commit

Permalink
Fix entries starting with export
Browse files Browse the repository at this point in the history
This is a workaround. The problem should be fixed in the grammar

Signed-off-by: Ulysses Souza <[email protected]>
  • Loading branch information
ulyssessouza committed Mar 23, 2024
1 parent e75065b commit 02cbe99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion envlang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ A = "aaa ${B} ccc "
"EMPTY_VAR": strPtr(""),
},
},
{
"PrefixExport",
`export A = aaa"`,
map[string]*string{
"A": strPtr("aaa"),
},
nil,
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -256,7 +264,7 @@ H="my_value"
I = bar baz
export EXPORTED_VAR = exported_value
J = "foo bar"
Expand Down Expand Up @@ -322,6 +330,7 @@ VAR_DEFAULT_EMPTY = "${EMPTY_VAR:-eee}"
"VAR_DEFAULT_UNSET": strPtr("uuu"),
"VAR_DEFAULT_UNSET_OR_EMPTY": strPtr(""),
"VAR_DEFAULT_EMPTY": strPtr("eee"),
"EXPORTED_VAR": strPtr("exported_value"),
}

d := dao.NewDefaultDao()
Expand Down
5 changes: 5 additions & 0 deletions handlers/filehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func (l *EnvLangFileListener) ExitEntry(c *fileparser.EntryContext) {
if id == "" {
return
}

// TODO: Implement the logic to handle the export keyword in the grammar file
id, _ = strings.CutPrefix(id, "export ")
id = strings.TrimSpace(id)

hasAssign := true
if c.ASSIGN() == nil || c.ASSIGN().GetText() == "" {
hasAssign = false
Expand Down

0 comments on commit 02cbe99

Please sign in to comment.