60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
#ifndef RJP_LEX_H
|
|
#define RJP_LEX_H
|
|
|
|
#include "rjp.h"
|
|
|
|
#define rjp_lex_accept 1
|
|
typedef enum RJP_lex_category{
|
|
rjp_lex_start = 0,
|
|
rjp_lex_obracket = 3,
|
|
rjp_lex_obrace = 5,
|
|
rjp_lex_cbracket = 7,
|
|
rjp_lex_cbrace = 9,
|
|
rjp_lex_spaces = 11,
|
|
rjp_lex_quote = 12,
|
|
rjp_lex_t = 14,
|
|
rjp_lex_tr = 16,
|
|
rjp_lex_tru = 18,
|
|
rjp_lex_true = 19,
|
|
rjp_lex_f = 20,
|
|
rjp_lex_fa = 22,
|
|
rjp_lex_fal = 24,
|
|
rjp_lex_fals = 26,
|
|
rjp_lex_false = 27,
|
|
rjp_lex_n = 28,
|
|
rjp_lex_nu = 30,
|
|
rjp_lex_nul = 32,
|
|
rjp_lex_null = 33,
|
|
rjp_lex_escaped = 34,
|
|
rjp_lex_string = 35,
|
|
rjp_lex_comma = 37,
|
|
rjp_lex_colon = 39,
|
|
rjp_lex_number = 41,
|
|
rjp_lex_decimal = 42,
|
|
rjp_lex_fnumber = 43,
|
|
rjp_lex_fnum_e = 44,
|
|
rjp_lex_sci_num = 45,
|
|
rjp_lex_slash = 46,
|
|
rjp_lex_line_comment = 47,
|
|
rjp_lex_signed_number = 49,
|
|
rjp_lex_sci_num_signed = 51,
|
|
rjp_lex_newlines = 53,
|
|
rjp_lex_block_comment_start = 54,
|
|
rjp_lex_block_comment_end1 = 56,
|
|
rjp_lex_block_comment = 57,
|
|
rjp_lex_invalid = 1000,
|
|
rjp_lex_unrecognized_word = 1002,
|
|
rjp_lex_end = 1004,
|
|
}RJP_lex_category;
|
|
|
|
typedef struct RJP_lex_state{
|
|
const char* str;
|
|
RJP_lex_category node;
|
|
RJP_index length;
|
|
RJP_index offset;
|
|
}RJP_lex_state;
|
|
|
|
RJP_lex_category irjp_lex(RJP_lex_state* state);
|
|
|
|
#endif
|