97#define JParserIntf_constructor(o,serviceMA) (o)->service=serviceMA
105#define JParserIntf_serviceCB(o, v, recLev) (o)->service(o,v,recLev)
227#define JErr_constructor(o) (o)->err=JErrT_NoErr
231#define JErr_reset(o) (o)->err=JErrT_NoErr, (o)->msg=0
235#define JErr_isError(o) ((o)->err!=JErrT_NoErr)
239#define JErr_noError(o) ((o)->err==JErrT_NoErr)
243#define JErr_getErrT(o) (o)->err
247#define JErr_getExpT(o) (o)->expType
251#define JErr_getRecT(o) (o)->recType
314 JLexerT_NeedMoreData,
322 JLexerSt_StartComment,
325 JLexerSt_EatCppComment,
326 JLexerSt_TrueFalseNull,
328 JLexerSt_StringEscape,
329 JLexerSt_StringUnicode,
330 JLexerSt_StringSurrogateEscape,
331 JLexerSt_StringSurrogateU,
334 JLexerSt_GetNextToken
353 const U8* typeChkPtr;
462 JParserSt_BeginArray,
463 JParserSt_MemberName,
471#define JPARSER_STACK_LEN 8
572#define JParser_getStatus(o) ((JParsStat)(o)->status)
int serviceCB(JParserVal *v, int recLevel)
Calling the JParserIntf service function is typically performed in a design using a chained parser ca...
Definition: JParser.h:109
int(* JParserIntf_Service)(struct JParserIntf *o, struct JParserVal *v, int recLevel)
Receive one parsed value or container boundary synchronously.
Definition: JParser.h:64
struct JParserIntf JParserIntf
The JParserIntf interface class is the interface between the parser and an object that implements the...
#define JParserIntf_serviceCB(o, v, recLev)
Invoke the callback synchronously.
Definition: JParser.h:105
BA_API int JErr_setTooFewParams(JErr *o)
Record JErrT_InvalidMethodParams with a static message if no error exists.
BA_API void JParser_constructor(JParser *o, JParserIntf *intf, char *nameBuf, int namebufSize, AllocatorIntf *alloc, int extraStackLen)
Create a JSON parser object.
BA_API int JErr_setError(JErr *o, JErrT err, const char *msg)
Record an error only when no earlier error exists.
struct JParserVal JParserVal
The parser sets a JParserVal before calling the parser callback JParserIntf.
struct JErr JErr
The JSON error container object.
BA_API void JParser_destructor(JParser *o)
Free internal assembly storage.
JParser(JParserIntf *intf, char *nameBuf, int namebufSize, AllocatorIntf *alloc, int extraStackLen=0)
Create a JSON parser object.
Definition: JParser.h:575
JParsStat getStatus()
Inspect the last parser result without changing state.
Definition: JParser.h:584
JParsStat
JSON Parser Status.
Definition: JParser.h:427
#define JErr_getExpT(o)
Definition: JParser.h:247
JVType getRecT()
Definition: JParser.h:278
#define JErr_isError(o)
Definition: JParser.h:235
JErrT
JSON error codes.
Definition: JParser.h:150
~JParser()
Free internal assembly storage.
Definition: JParser.h:582
#define JErr_getRecT(o)
Definition: JParser.h:251
void reset()
Clear the error code and message pointer so the object can be reused.
Definition: JParser.h:268
bool noError()
Definition: JParser.h:272
JErrT getErrT()
Definition: JParser.h:274
int parse(const U8 *buf, U32 size)
Feed or resume parsing a top-level JSON object or array.
Definition: JParser.h:580
int setTypeErr(JVType expT, JVType recT)
Record JErrT_WrongType only when no earlier error exists.
Definition: JParser.h:282
JVType
The JSON types.
Definition: JParser.h:121
#define JErr_getErrT(o)
Definition: JParser.h:243
int setError(JErrT err, const char *msg)
Record an error only when no earlier error exists.
Definition: JParser.h:284
BA_API int JErr_setTypeErr(JErr *o, JVType expT, JVType recT)
Record JErrT_WrongType only when no earlier error exists.
#define JErr_reset(o)
Clear the error code and message pointer so the object can be reused.
Definition: JParser.h:231
JParserT
Type 't' in JParserVal.
Definition: JParser.h:371
#define JParser_getStatus(o)
Inspect the last parser result without changing state.
Definition: JParser.h:572
JVType getExpT()
Definition: JParser.h:276
U8 JParserStackNode
The stack used internally by JParser.
Definition: JParser.h:474
JErr()
Initialize only the error code to JErrT_NoErr.
Definition: JParser.h:266
bool isError()
Definition: JParser.h:270
#define JErr_constructor(o)
Initialize only the error code to JErrT_NoErr.
Definition: JParser.h:227
int setTooFewParams()
Record JErrT_InvalidMethodParams with a static message if no error exists.
Definition: JParser.h:280
BA_API int JParser_parse(JParser *o, const U8 *buf, U32 size)
Feed or resume parsing a top-level JSON object or array.
#define JErr_noError(o)
Definition: JParser.h:239
@ JParsStat_ParseErr
JSON Parse error.
Definition: JParser.h:445
@ JParsStat_IntfErr
The JParserIntf interface reported a problem.
Definition: JParser.h:449
@ JParsStat_DoneEOS
The parser completed parsing a new JSON object.
Definition: JParser.h:431
@ JParsStat_NeedMoreData
The parser needs more data to complete.
Definition: JParser.h:441
@ JParsStat_StackOverflow
Object nested too deep.
Definition: JParser.h:456
@ JParsStat_Done
The parser completed parsing a new JSON object, but found the unread bytes in the provided buffer.
Definition: JParser.h:437
@ JParsStat_MemErr
Memory allocation error.
Definition: JParser.h:453
@ JErrT_InvalidMethodParams
Invalid RPC method parameters.
Definition: JParser.h:160
@ JErrT_NoErr
No error.
Definition: JParser.h:152
@ JErrT_MemErr
Memory allocation error.
Definition: JParser.h:165
@ JErrT_FmtValErr
A format error in JEncoder or JVal::get.
Definition: JParser.h:163
@ JErrT_WrongType
Unexpected JSON type when parsing.
Definition: JParser.h:158
@ JErrT_JsonErr
Generic error.
Definition: JParser.h:154
@ JErrT_IOErr
I/O error.
Definition: JParser.h:167
@ JVType_Null
JSON NULL value.
Definition: JParser.h:140
@ JVType_Int
JSON Number encoded as an integer.
Definition: JParser.h:133
@ JVType_Double
JSON Number encoded as a float.
Definition: JParser.h:130
@ JVType_Object
The JVAL is of type JSON object.
Definition: JParser.h:142
@ JVType_String
JSON string.
Definition: JParser.h:127
@ JVType_Long
JSON Number encoded as a long integer.
Definition: JParser.h:136
@ JVType_Array
The JVAL is of type JSON array.
Definition: JParser.h:144
@ JVType_Boolean
JSON boolean.
Definition: JParser.h:138
@ JVType_InvalidType
Invalid JSON type.
Definition: JParser.h:124
@ JParserT_BeginObject
BeginObject.
Definition: JParser.h:379
@ JParserT_Long
64-bit (long long)
Definition: JParser.h:377
@ JParserT_String
String.
Definition: JParser.h:374
@ JParserT_EndArray
EndArray.
Definition: JParser.h:382
@ JParserT_EndObject
EndObject.
Definition: JParser.h:381
@ JParserT_Boolean
Boolean.
Definition: JParser.h:378
@ JParserT_InvalidType
InvalidType.
Definition: JParser.h:372
@ JParserT_BeginArray
BeginArray.
Definition: JParser.h:380
@ JParserT_Null
Null.
Definition: JParser.h:373
@ JParserT_Double
Double.
Definition: JParser.h:375
@ JParserT_Int
Int.
Definition: JParser.h:376
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:91
uint64_t U64
Unsigned 64-bit integer.
Definition: GenPrimT.h:95
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:85
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:83
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
The JSON error container object.
Definition: JParser.h:173
const char * msg
Borrowed message for the recorded error; constructor alone does not initialize it.
Definition: JParser.h:216
The JParserIntf interface class is the interface between the parser and an object that implements the...
Definition: JParser.h:72
JParserIntf(JParserIntf_Service s)
Create the callback interface object.
Definition: JParser.h:77
The parser sets a JParserVal before calling the parser callback JParserIntf.
Definition: JParser.h:389
size_t memberNameLen
Object member-name length.
Definition: JParser.h:419
JParserT t
The type controlling 'v'.
Definition: JParser.h:421
union JParserVal::@3 v
A union controlled by the type 't'.
S32 d
If integer.
Definition: JParser.h:398
BaBool memberNameSet
TRUE when this event carries an object member name, including an empty name.
Definition: JParser.h:420
char * memberName
object member name is set for objects.
Definition: JParser.h:417
size_t stringLen
String length when t is JParserT_String.
Definition: JParser.h:418
U64 l
Long integer bit pattern; signed JSON long values are interpreted as S64 by consumers.
Definition: JParser.h:399
double f
If number of type double.
Definition: JParser.h:396
char * s
Borrowed UTF-8 bytes for String; use stringLen to preserve embedded NUL.
Definition: JParser.h:394
The JSON parser parses a JSON stream and calls the JParserIntf callback interface for each parsed obj...
Definition: JParser.h:482