forked from Krowemoh/TCL-Utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSON.PARSE
45 lines (45 loc) · 1.79 KB
/
JSON.PARSE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
SUBROUTINE JSON.PARSE(RAW.TEXT,JSON)
*
GIT.FILENAME = 'JSON.PARSE'
GIT.REPO = 'https://github.com/Krowemoh/TCL-Utilities.git'
*
* VERSION
*
VERSION = '1'
*
@USER1 = 'JSON.PARSE'
@USER2 = 'JSON.PARSE'
*
GOSUB SETUP
*
IF RAW.TEXT[1,1] # '{' THEN
PRINT 'Error - Text is not JSON.'
RETURN
END
*
CONVERT HIGH TO '?' IN RAW.TEXT
CONVERT LOW TO '?' IN RAW.TEXT
*
IF RAW.TEXT[1,1] = '{' AND RAW.TEXT[LEN(RAW.TEXT),1] = '}' THEN
RAW.TEXT = RAW.TEXT[2,LEN(RAW.TEXT)-2]
END
*
CALL JSON.PARSE.RECURSE(RAW.TEXT,JSON)
*
RETURN
*
********************* S U B R O U T I N E *********************
*
SETUP:NULL
*
HIGH = CHAR(254):CHAR(253):CHAR(252):CHAR(251):CHAR(250):CHAR(249):CHAR(248):CHAR(247):CHAR(246):CHAR(245):CHAR(244):CHAR(243):CHAR(242):CHAR(241):CHAR(240):CHAR(239):CHAR(238):CHAR(237):CHAR(236):CHAR(235):CHAR(234):CHAR(233):CHAR(232):CHAR(231):CHAR(230):CHAR(229):CHAR(228):CHAR(227):CHAR(226):CHAR(225):CHAR(224):CHAR(223):CHAR(222):CHAR(221):CHAR(220):CHAR(219):CHAR(218):CHAR(217):CHAR(216):CHAR(215):CHAR(214):CHAR(213):CHAR(212):CHAR(211):CHAR(210):CHAR(209):CHAR(208):CHAR(207):CHAR(206):CHAR(205):CHAR(204):CHAR(203):CHAR(202):CHAR(201)
*
LOW = CHAR(253):CHAR(252):CHAR(251):CHAR(250):CHAR(249):CHAR(248):CHAR(247):CHAR(246):CHAR(245):CHAR(244):CHAR(243):CHAR(242):CHAR(241):CHAR(240):CHAR(239):CHAR(238):CHAR(237):CHAR(236):CHAR(235):CHAR(234):CHAR(233):CHAR(232):CHAR(231):CHAR(230):CHAR(229):CHAR(228):CHAR(227):CHAR(226):CHAR(225):CHAR(224):CHAR(223):CHAR(222):CHAR(221):CHAR(220):CHAR(219):CHAR(218):CHAR(217):CHAR(216):CHAR(215):CHAR(214):CHAR(213):CHAR(212):CHAR(211):CHAR(210):CHAR(209):CHAR(208):CHAR(207):CHAR(206):CHAR(205):CHAR(204):CHAR(203):CHAR(202):CHAR(201):CHAR(200)
*
RETURN
*
*
* END OF PROGRAM
*
END
*