4coder/test/4cpp_lexer_fsms.h

110 lines
1.5 KiB
C
Raw Normal View History

2016-03-24 01:05:28 +00:00
/*
* FSMs for 4c++ lexer
*
* 23.03.2016 (dd.mm.yyyy)
*/
// TOP
2016-03-31 04:05:47 +00:00
struct String_And_Flag{
char *str;
unsigned int flags;
};
2016-03-24 01:05:28 +00:00
enum Lex_State{
LS_default,
LS_identifier,
LS_pound,
LS_pp,
LS_char,
2016-03-24 14:01:53 +00:00
LS_char_multiline,
2016-03-24 01:05:28 +00:00
LS_char_slashed,
LS_string,
2016-03-24 14:01:53 +00:00
LS_string_multiline,
2016-03-24 01:05:28 +00:00
LS_string_slashed,
LS_number,
LS_number0,
LS_float,
LS_crazy_float0,
LS_crazy_float1,
LS_hex,
LS_comment_pre,
LS_comment,
LS_comment_slashed,
LS_comment_block,
LS_comment_block_ending,
LS_dot,
LS_ellipsis,
LS_less,
LS_less_less,
LS_more,
LS_more_more,
LS_minus,
LS_arrow,
LS_and,
LS_or,
LS_plus,
LS_colon,
LS_star,
LS_modulo,
LS_caret,
LS_eq,
LS_bang,
LS_error_message,
//
LS_count
};
enum Lex_Int_State{
LSINT_default,
LSINT_u,
LSINT_l,
LSINT_L,
LSINT_ul,
LSINT_uL,
LSINT_ll,
2016-03-26 08:06:41 +00:00
LSINT_extra,
//
LSINT_count
2016-03-24 01:05:28 +00:00
};
enum Lex_INC_State{
LSINC_default,
LSINC_quotes,
LSINC_pointy,
LSINC_junk,
};
enum Lex_PP_State{
LSPP_default,
LSPP_include,
LSPP_macro_identifier,
LSPP_identifier,
LSPP_body_if,
LSPP_body,
LSPP_number,
LSPP_error,
LSPP_junk,
//
LSPP_count
};
struct Whitespace_FSM{
unsigned char pp_state;
unsigned char white_done;
};
struct Lex_FSM{
unsigned char state;
2016-03-31 04:05:47 +00:00
union{
unsigned char int_state;
unsigned char directive_state;
};
2016-03-24 01:05:28 +00:00
unsigned char emit_token;
unsigned char multi_line;
};
// BOTTOM