Skip to content

Commit

Permalink
Fix "null" string encoded as nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 27, 2024
1 parent 3a90d71 commit 2dfbce5
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 2dfbce5

Please sign in to comment.