Skip to content

Commit

Permalink
Fix "null" string encoded as nil (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
denieryd authored Oct 28, 2024
1 parent 8ad318c commit e77cb4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,12 @@ func reservedKeywordToken(typ Type, value, org string, pos *Position) *Token {

func init() {
for _, keyword := range reservedNullKeywords {
reservedKeywordMap[keyword] = func(value, org string, pos *Position) *Token {
f := func(value, org string, pos *Position) *Token {
return reservedKeywordToken(NullType, value, org, pos)
}

reservedKeywordMap[keyword] = f
reservedEncKeywordMap[keyword] = f
}
for _, keyword := range reservedBoolKeywords {
f := func(value, org string, pos *Position) *Token {
Expand Down
4 changes: 4 additions & 0 deletions token/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func TestIsNeedQuoted(t *testing.T) {
" a",
" a ",
"a ",
"null",
"Null",
"NULL",
"~",
}
for i, test := range needQuotedTests {
if !token.IsNeedQuoted(test) {
Expand Down

0 comments on commit e77cb4d

Please sign in to comment.