![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "yajl_lex.h"
#include "yajl_buf.h"
Go to the source code of this file.
Classes | |
struct | yajl_lexer_t |
Macros | |
#define | readChar(lxr, txt, off) |
#define | unreadChar(lxr, off) ((*(off) > 0) ? (*(off))-- : ((lxr)->bufOff--)) |
#define | VEC 0x01 |
#define | IJC 0x02 |
#define | VHC 0x04 |
#define | NFP 0x08 |
#define | NUC 0x10 |
#define | UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } |
#define | STR_CHECK_EOF |
#define | RETURN_IF_EOF if (*offset >= jsonTextLen) return yajl_tok_eof; |
Functions | |
yajl_lexer | yajl_lex_alloc (yajl_alloc_funcs *alloc, unsigned int allowComments, unsigned int validateUTF8) |
void | yajl_lex_free (yajl_lexer lxr) |
yajl_tok | yajl_lex_lex (yajl_lexer lexer, const unsigned char *jsonText, size_t jsonTextLen, size_t *offset, const unsigned char **outBuf, size_t *outLen) |
const char * | yajl_lex_error_to_string (yajl_lex_error error) |
yajl_lex_error | yajl_lex_get_error (yajl_lexer lexer) |
size_t | yajl_lex_current_line (yajl_lexer lexer) |
size_t | yajl_lex_current_char (yajl_lexer lexer) |
yajl_tok | yajl_lex_peek (yajl_lexer lexer, const unsigned char *jsonText, size_t jsonTextLen, size_t offset) |
#define IJC 0x02 |
Definition at line 137 of file yajl_lex.c.
#define NFP 0x08 |
Definition at line 139 of file yajl_lex.c.
#define NUC 0x10 |
Definition at line 140 of file yajl_lex.c.
#define readChar | ( | lxr, | |
txt, | |||
off | |||
) |
Definition at line 96 of file yajl_lex.c.
#define RETURN_IF_EOF if (*offset >= jsonTextLen) return yajl_tok_eof; |
Definition at line 372 of file yajl_lex.c.
#define STR_CHECK_EOF |
Definition at line 248 of file yajl_lex.c.
#define unreadChar | ( | lxr, | |
off | |||
) | ((*(off) > 0) ? (*(off))-- : ((lxr)->bufOff--)) |
Definition at line 101 of file yajl_lex.c.
#define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } |
process a variable length utf8 encoded codepoint.
returns: yajl_tok_string - if valid utf8 char was parsed and offset was advanced yajl_tok_eof - if end of input was hit before validation could complete yajl_tok_error - if invalid utf8 was encountered
NOTE: on error the offset will point to the first char of the invalid utf8
Definition at line 196 of file yajl_lex.c.
#define VEC 0x01 |
Definition at line 136 of file yajl_lex.c.
#define VHC 0x04 |
Definition at line 138 of file yajl_lex.c.
yajl_lexer yajl_lex_alloc | ( | yajl_alloc_funcs * | alloc, |
unsigned int | allowComments, | ||
unsigned int | validateUTF8 | ||
) |
Definition at line 104 of file yajl_lex.c.
size_t yajl_lex_current_char | ( | yajl_lexer | lexer | ) |
get the number of chars lexed by this lexer instance since the last
or
Definition at line 744 of file yajl_lex.c.
size_t yajl_lex_current_line | ( | yajl_lexer | lexer | ) |
get the number of lines lexed by this lexer instance
Definition at line 739 of file yajl_lex.c.
const char* yajl_lex_error_to_string | ( | yajl_lex_error | error | ) |
Definition at line 695 of file yajl_lex.c.
void yajl_lex_free | ( | yajl_lexer | lxr | ) |
Definition at line 121 of file yajl_lex.c.
yajl_lex_error yajl_lex_get_error | ( | yajl_lexer | lexer | ) |
allows access to more specific information about the lexical error when yajl_lex_lex returns yajl_tok_error.
Definition at line 733 of file yajl_lex.c.
yajl_tok yajl_lex_lex | ( | yajl_lexer | lexer, |
const unsigned char * | jsonText, | ||
size_t | jsonTextLen, | ||
size_t * | offset, | ||
const unsigned char ** | outBuf, | ||
size_t * | outLen | ||
) |
run/continue a lex. "offset" is an input/output parameter. It should be initialized to zero for a new chunk of target text, and upon subsetquent calls with the same target text should passed with the value of the previous invocation.
the client may be interested in the value of offset when an error is returned from the lexer. This allows the client to render useful n * error messages.
When you pass the next chunk of data, context should be reinitialized to zero.
Finally, the output buffer is usually just a pointer into the jsonText, however in cases where the entity being lexed spans multiple chunks, the lexer will buffer the entity and the data returned will be a pointer into that buffer.
This behavior is abstracted from client code except for the performance implications which require that the client choose a reasonable chunk size to get adequate performance.
Definition at line 503 of file yajl_lex.c.
yajl_tok yajl_lex_peek | ( | yajl_lexer | lexer, |
const unsigned char * | jsonText, | ||
size_t | jsonTextLen, | ||
size_t | offset | ||
) |
have a peek at the next token, but don't move the lexer forward
Definition at line 749 of file yajl_lex.c.