Skip to content

Commit

Permalink
cue: no quotes needed for identifiers with $
Browse files Browse the repository at this point in the history
Change-Id: I3e915eb4e574f6ddcb429d8fd286c66eef518ad4
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4321
Reviewed-by: Marcel van Lohuizen <[email protected]>
  • Loading branch information
mpvl committed Dec 5, 2019
1 parent 13628f1 commit 5a0a3f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cue/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (p *exporter) label(f label) ast.Label {
return &ast.BasicLit{Value: str}
}
for i, r := range orig {
if unicode.IsLetter(r) || r == '_' {
if unicode.IsLetter(r) || r == '_' || r == '$' {
continue
}
if i > 0 && unicode.IsDigit(r) {
Expand Down
2 changes: 2 additions & 0 deletions cue/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ func TestExport(t *testing.T) {
multiSep + `"""`,
}, {
in: `{
$type: 3
"_": int
"_foo": int
_bar: int
}`,
out: unindent(`
{
$type: 3
"_": int
"_foo": int
_bar: int
Expand Down

0 comments on commit 5a0a3f2

Please sign in to comment.