Skip to content

Commit 02cbe99

Browse files
committed
Fix entries starting with export
This is a workaround. The problem should be fixed in the grammar Signed-off-by: Ulysses Souza <[email protected]>
1 parent e75065b commit 02cbe99

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

envlang_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ A = "aaa ${B} ccc "
228228
"EMPTY_VAR": strPtr(""),
229229
},
230230
},
231+
{
232+
"PrefixExport",
233+
`export A = aaa"`,
234+
map[string]*string{
235+
"A": strPtr("aaa"),
236+
},
237+
nil,
238+
},
231239
}
232240

233241
for _, tt := range tests {
@@ -256,7 +264,7 @@ H="my_value"
256264
257265
I = bar baz
258266
259-
267+
export EXPORTED_VAR = exported_value
260268
261269
J = "foo bar"
262270
@@ -322,6 +330,7 @@ VAR_DEFAULT_EMPTY = "${EMPTY_VAR:-eee}"
322330
"VAR_DEFAULT_UNSET": strPtr("uuu"),
323331
"VAR_DEFAULT_UNSET_OR_EMPTY": strPtr(""),
324332
"VAR_DEFAULT_EMPTY": strPtr("eee"),
333+
"EXPORTED_VAR": strPtr("exported_value"),
325334
}
326335

327336
d := dao.NewDefaultDao()

handlers/filehandler.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func (l *EnvLangFileListener) ExitEntry(c *fileparser.EntryContext) {
3333
if id == "" {
3434
return
3535
}
36+
37+
// TODO: Implement the logic to handle the export keyword in the grammar file
38+
id, _ = strings.CutPrefix(id, "export ")
39+
id = strings.TrimSpace(id)
40+
3641
hasAssign := true
3742
if c.ASSIGN() == nil || c.ASSIGN().GetText() == "" {
3843
hasAssign = false

0 commit comments

Comments
 (0)