Lines Matching refs:lexer
267 void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func) in json_lexer_init() argument
269 lexer->emit = func; in json_lexer_init()
270 lexer->state = IN_START; in json_lexer_init()
271 lexer->token = qstring_new(); in json_lexer_init()
272 lexer->x = lexer->y = 0; in json_lexer_init()
275 static int json_lexer_feed_char(JSONLexer *lexer, char ch) in json_lexer_feed_char() argument
279 lexer->x++; in json_lexer_feed_char()
281 lexer->x = 0; in json_lexer_feed_char()
282 lexer->y++; in json_lexer_feed_char()
286 new_state = json_lexer[lexer->state][(uint8_t)ch]; in json_lexer_feed_char()
287 char_consumed = !TERMINAL_NEEDED_LOOKAHEAD(lexer->state, new_state); in json_lexer_feed_char()
289 qstring_append_chr(lexer->token, ch); in json_lexer_feed_char()
299 lexer->emit(lexer, lexer->token, new_state, lexer->x, lexer->y); in json_lexer_feed_char()
301 QDECREF(lexer->token); in json_lexer_feed_char()
302 lexer->token = qstring_new(); in json_lexer_feed_char()
310 lexer->state = new_state; in json_lexer_feed_char()
315 int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size) in json_lexer_feed() argument
322 err = json_lexer_feed_char(lexer, buffer[i]); in json_lexer_feed()
331 int json_lexer_flush(JSONLexer *lexer) in json_lexer_flush() argument
333 return lexer->state == IN_START ? 0 : json_lexer_feed_char(lexer, 0); in json_lexer_flush()
336 void json_lexer_destroy(JSONLexer *lexer) in json_lexer_destroy() argument
338 QDECREF(lexer->token); in json_lexer_destroy()