2016-03-24 01:05:28 +00:00
|
|
|
/*
|
2016-08-29 01:03:26 +00:00
|
|
|
* FSMs for 4cpp lexer
|
2016-03-24 01:05:28 +00:00
|
|
|
*
|
|
|
|
* 23.03.2016 (dd.mm.yyyy)
|
2016-08-29 01:03:26 +00:00
|
|
|
*
|
2016-03-24 01:05:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2016-08-29 01:03:26 +00:00
|
|
|
#if !defined(FCPP_LEXER_FSMS_H)
|
|
|
|
#define FCPP_LEXER_FSMS_H
|
2016-03-31 04:05:47 +00:00
|
|
|
|
2016-03-24 01:05:28 +00:00
|
|
|
enum Lex_State{
|
|
|
|
LS_default,
|
|
|
|
LS_identifier,
|
|
|
|
LS_pound,
|
|
|
|
LS_pp,
|
2016-08-30 19:30:41 +00:00
|
|
|
LS_ppdef,
|
2016-03-24 01:05:28 +00:00
|
|
|
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_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 Lex_FSM{
|
2016-08-29 01:03:26 +00:00
|
|
|
uint8_t state;
|
2016-09-05 15:44:19 +00:00
|
|
|
uint8_t int_state;
|
2016-08-29 01:03:26 +00:00
|
|
|
uint8_t emit_token;
|
|
|
|
uint8_t multi_line;
|
2016-03-24 01:05:28 +00:00
|
|
|
};
|
2016-09-05 15:44:19 +00:00
|
|
|
static Lex_FSM null_lex_fsm = {0};
|
2016-03-24 01:05:28 +00:00
|
|
|
|
2016-08-29 01:03:26 +00:00
|
|
|
#endif
|
|
|
|
|
2016-03-24 01:05:28 +00:00
|
|
|
// BOTTOM
|
|
|
|
|
|
|
|
|