VPRJSOND ;SLC/KCM -- Decode JSON
Source file <VPRJSOND.m>
| Name | Comments | DBIA/ICR reference | 
|---|---|---|
| DECODE(VVJSON,VVROOT,VVERR) | ; Set JSON object into closed array ref VVROOT
 | 
|
| DIRECT | ; TAG for use by DECODE^VPRJSON
 | 
|
| NXTKN() | ; Move the pointers to the beginning of the next token
 | 
|
| ADDSTR | ; Add string value to current node, escaping text along the way
 ; Expects VVLINE,VVIDX to reference that starting point of the index ; TODO: add a mechanism to specify names that should not be escaped ; just store as ":")= and ":",n)=  | 
|
| SETSTR | ; Set simple string value from within same line
 ; expects VVJSON, VVLINE, VVINX, VVEND  | 
|
| UESEXT | ; unescape from VVLINE,VVIDX to VVTLINE,VVEND & extend (\) if necessary
 ; expects VVLINE,VVIDX,VVTLINE,VVEND  | 
|
| ADDBUF(VVX) | ; add buffer of characters to destination
 ; expects VVBUF,VVMAX,VVNODE,VVMORE to be defined ; used directly by ADDSTR  | 
|
| SAVEBUF | ; write out buffer to destination
 ; expects VVBUF,VVMAX,VVNODE,VVMORE to be defined ; used directly by ADDSTR,ADDBUF  | 
|
| ISCLOSEQ(VVBLINE) | ; return true if this is a closing, rather than escaped, quote
 ; expects ; VVJSON: lines of the JSON encoded string ; VVIDX: points to 1st character of the segment ; VVLINE: points to the line in which the segment starts ; VVEND: points to 1st character after the " (may be past the end of the line) ; used directly by ADDSTR  | 
|
| NAMPARS() | ; Return parsed name, advancing index past the close quote
 ; -- This assumes no embedded quotes are in the name itself --  | 
|
| NUMPARS(VVDIGIT) | ; Return parsed number, advancing index past the end of the number
 ; VVIDX intially references the second digit  | 
|
| SETBOOL(VVLTR) | ; Return parsed value, advancing index past the end of the value
 | 
|
| OSETBOOL(VVX) | ; set a value and increment VVIDX
 | 
|
| CURNODE() | ; Return a global/local variable name based on VVSTACK
 ; Expects VVSTACK to be defined already  | 
|
| UES(X) | ; Unescape JSON string
 ; copy segments from START to POS-2 (right before \) ; translate target character (which is at $F position)  | 
|
| REALCHAR(C) | ; Return actual character from escaped
 | 
|
| ERRX(ID,VAL) | ; Set the appropriate error message
 |