Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Info |  Source |  Entry Points
Print Page as PDF
Routine: XLFJSOND

Package: Kernel

Routine: XLFJSOND


Information

XLFJSOND ;SLC/KCM/TJB - Decode JSON ;26 Oct 2016

Source Information

Source file <XLFJSOND.m>

Entry Points

Name Comments DBIA/ICR reference
DECODE(XUJSON,XUROOT,XUERR) ; Set JSON object into closed array ref XUROOT
DIRECT ; TAG for use by DECODE^XLFJSON
NXTKN() ; Move the pointers to the beginning of the next token
ADDSTR ; Add string value to current node, escaping text along the way
; Expects XULINE,XUIDX 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 XUJSON, XULINE, XUINX, XUEND
UESEXT ; unescape from XULINE,XUIDX to XUTLINE,XUEND & extend (\) if necessary
; expects XULINE,XUIDX,XUTLINE,XUEND
ADDBUF(XUX) ; add buffer of characters to destination
; expects XUBUF,XUMAX,XUNODE,XUMORE to be defined
; used directly by ADDSTR
SAVEBUF ; write out buffer to destination
; expects XUBUF,XUMAX,XUNODE,XUMORE to be defined
; used directly by ADDSTR,ADDBUF
ISCLOSEQ(XUBLINE) ; return true if this is a closing, rather than escaped, quote
; expects
; XUJSON: lines of the JSON encoded string
; XUIDX: points to 1st character of the segment
; XULINE: points to the line in which the segment starts
; XUEND: 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(XUDIGIT) ; Set numeric along with any necessary modifier
NUMPARS(XUDIGIT) ; Return parsed number, advancing index past end of number
; XUIDX intially references the second digit
SETBOOL(XULTR) ; Parse and set boolean value, advancing index past end of value
OSETBOOL(XUX) ; set a value and increment XUIDX
CURNODE() ; Return a global/local variable name based on XUSTACK
; Expects XUSTACK 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
Info |  Source |  Entry Points