fix: issue #9 reserved keyword 'key' + issue #10 empty string treated as NULL
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
Issue 9: Add backtick-quoted identifier support in lexer.nim - Users can now write `key` to use reserved keywords as column/table names Issue 10: Use \N as internal NULL marker instead of empty string - isNull() now checks for \N instead of value.len == 0 - Empty strings can now be stored in NOT NULL columns - NULL values properly distinguished from empty strings in storage, wire protocol, and HTTP JSON responses
This commit is contained in:
@@ -481,6 +481,16 @@ proc readString(l: var Lexer, quote: char): string =
|
||||
if l.pos < l.input.len:
|
||||
discard l.advance() # skip closing quote
|
||||
|
||||
proc readBacktickIdent(l: var Lexer, startLine, startCol: int): Token =
|
||||
var ident = ""
|
||||
discard l.advance() # skip opening backtick
|
||||
while l.pos < l.input.len and l.input[l.pos] != '`':
|
||||
ident.add(l.input[l.pos])
|
||||
discard l.advance()
|
||||
if l.pos < l.input.len:
|
||||
discard l.advance() # skip closing backtick
|
||||
return Token(kind: tkIdent, value: ident, line: startLine, col: startCol)
|
||||
|
||||
proc readNumber(l: var Lexer, startLine, startCol: int): Token =
|
||||
var numStr = ""
|
||||
var isFloat = false
|
||||
@@ -692,6 +702,8 @@ proc nextToken*(l: var Lexer): Token =
|
||||
of '#':
|
||||
l.skipLineComment()
|
||||
return l.nextToken()
|
||||
of '`':
|
||||
return l.readBacktickIdent(startLine, startCol)
|
||||
else:
|
||||
if ch in Digits:
|
||||
return l.readNumber(startLine, startCol)
|
||||
|
||||
Reference in New Issue
Block a user