HMPJSOND ;SLC/KCM,ASMR/RRB - Decode JSON;9/25/2015 10:16
Source file <HMPJSOND.m>
Name | Comments | DBIA/ICR reference |
---|---|---|
DECODE(VVJSON,VVROOT,VVERR) | ; Set JSON object into closed array ref VVROOT
|
|
DIRECT | ; TAG for use by DECODE^HMPJSON
|
|
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 -- |
|
SETNUM(VVDIGIT) | ; Set numeric along with any necessary modifier
|
|
NUMPARS(VVDIGIT) | ; Return parsed number, advancing index past end of number
; VVIDX initially references the second digit |
|
SETBOOL(VVLTR) | ; Parse and set boolean value, advancing index past end of 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
|