/** * @PROJECT AerScript Interpreter * @COPYRIGHT See COPYING in the top level directory * @FILE modules/json/json.h * @DESCRIPTION Typed JSON DOM module for AerScript Interpreter * @DEVELOPERS Symisc Systems * Rafal Kupiec */ #ifndef __JSON_H__ #define __JSON_H__ #include "ph7.h" #include "ph7int.h" #define MODULE_DESC "JSON Module" #define MODULE_VER 1.0 /* JsonNodeType constants. NULL is a language keyword, so the null node kind * is published as NULL_NODE (the contract's documented fallback). */ #define JSON_NODE_OBJECT 1 #define JSON_NODE_ARRAY 2 #define JSON_NODE_STRING 3 #define JSON_NODE_NUMBER 4 #define JSON_NODE_BOOLEAN 5 #define JSON_NODE_NULL_NODE 6 /* JsonException error codes. */ #define JSON_ERROR_NONE 0 #define JSON_ERROR_DEPTH 1 #define JSON_ERROR_STATE_MISMATCH 2 #define JSON_ERROR_CTRL_CHAR 3 #define JSON_ERROR_SYNTAX 4 #define JSON_ERROR_UTF8 5 #define JSON_ERROR_TYPE_MISMATCH 6 #define JSON_ERROR_KEY_NOT_FOUND 7 #define JSON_ERROR_INDEX_OUT_OF_RANGE 8 #define JSON_ERROR_DUPLICATE_KEY 9 #define JSON_ERROR_INVALID_OPERATION 10 #define JSON_ERROR_INVALID_OPTION 11 #define JSON_ERROR_READONLY_OPTION 12 /* JsonOptions duplicate-key policies. */ #define JSON_DUP_KEEP_LAST 0 #define JSON_DUP_KEEP_FIRST 1 #define JSON_DUP_REJECT 2 /* Possible tokens from the JSON tokenization process. */ #define JSON_TK_TRUE 0x001 /* Boolean true */ #define JSON_TK_FALSE 0x002 /* Boolean false */ #define JSON_TK_STR 0x004 /* String enclosed in double quotes */ #define JSON_TK_NULL 0x008 /* null */ #define JSON_TK_NUM 0x010 /* Numeric */ #define JSON_TK_OCB 0x020 /* Open curly braces '{' */ #define JSON_TK_CCB 0x040 /* Closing curly braces '}' */ #define JSON_TK_OSB 0x080 /* Open square bracket '[' */ #define JSON_TK_CSB 0x100 /* Closing square bracket ']' */ #define JSON_TK_COLON 0x200 /* Single colon ':' */ #define JSON_TK_COMMA 0x400 /* Single comma ',' */ #define JSON_TK_INVALID 0x800 /* Unexpected token */ PH7_PRIVATE sxi32 initializeModule(ph7_vm *pVm, ph7_real *ver, SyString *desc); #endif