util::json::parseValue (private)
util::json::parseValue tokens nrTokens tokenCursorName
Defined in packages/acs-tcl/tcl/json-procs.tcl
Parse a value
- Parameters:
- tokens (required)
- list of tokens
- nrTokens (required)
- length of $tokens
- tokenCursorName (required)
- name (in caller's context) of variable holding current position in $tokens
- Returns:
- parsed value (dict, list, string, number)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar $tokenCursorName tokenCursor if {$tokenCursor == $nrTokens} { unexpected $tokenCursor "END" "VALUE" } else { set token [lindex $tokens $tokenCursor] incr tokenCursor set leadingChar [string index $token 0] switch -exact -- $leadingChar { "\{" { return [parseObject $tokens $nrTokens tokenCursor] } "\[" { return [parseArray $tokens $nrTokens tokenCursor] } "\"" { # quoted string return [unquoteUnescapeString $token] } "t" - "f" - "n" { # bare word: true, false or null return $token } default { # number? if {[string is double -strict $token]} { return $token } else { unexpected $tokenCursor $token "VALUE" } } } }XQL Not present: Generic, PostgreSQL, Oracle