fix a few issues with string termination in the new lexer, switch over to single line strings
parent
2076676156
commit
090e23d31e
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
|
||||
A series of stress tests to more quickly verify that 4coder isn't totally
|
||||
broken before I release in the future... "unit tests" perhaps, although
|
||||
I guess I don't know what the "units" are... probably more like "tests".
|
||||
|
||||
Allen Webster
|
||||
18.07.2016
|
||||
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#include "test_this.cpp"
|
||||
|
||||
|
||||
|
||||
// BOTTOM
|
||||
|
|
@ -2,6 +2,29 @@
|
|||
* FSMs for 4c++ lexer
|
||||
*
|
||||
* 23.03.2016 (dd.mm.yyyy)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
|
|
@ -36,7 +36,7 @@ const int num_main_fsm_eq_classes = 29;
|
|||
unsigned char main_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -74,7 +74,7 @@ const int num_pp_include_fsm_eq_classes = 6;
|
|||
unsigned char pp_include_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
3, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
3, 1, 2,42, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
3,42,42,42, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
1,40, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
3, 1,41, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
|
||||
|
@ -89,7 +89,7 @@ const int num_pp_macro_fsm_eq_classes = 29;
|
|||
unsigned char pp_macro_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -127,7 +127,7 @@ const int num_pp_identifier_fsm_eq_classes = 29;
|
|||
unsigned char pp_identifier_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -165,7 +165,7 @@ const int num_pp_body_if_fsm_eq_classes = 29;
|
|||
unsigned char pp_body_if_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -203,7 +203,7 @@ const int num_pp_body_fsm_eq_classes = 29;
|
|||
unsigned char pp_body_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -241,7 +241,7 @@ const int num_pp_number_fsm_eq_classes = 29;
|
|||
unsigned char pp_number_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
@ -291,7 +291,7 @@ const int num_pp_junk_fsm_eq_classes = 29;
|
|||
unsigned char pp_junk_fsm_table[] = {
|
||||
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,
|
||||
0,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 5, 7, 8, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3,43,44, 5,46,47, 8,49,50,51,52,53,54,55,56,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
0,40,41, 3, 4, 5, 6, 7, 8, 9,49,50,51,52,53,54,55,17,18,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
37,40,41, 3, 4, 5, 4, 7, 8, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
7,40,41, 3, 4, 5, 4,46,47, 7,49,50,51,52,53,54,55,17,17,19,19,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,38,
|
||||
|
|
|
@ -640,23 +640,35 @@ cpp_lex_nonalloc(Lex_Data *S_ptr,
|
|||
|
||||
case LS_char:
|
||||
case LS_char_slashed:
|
||||
S.token.type = CPP_TOKEN_CHARACTER_CONSTANT;
|
||||
S.token.type = CPP_TOKEN_JUNK;
|
||||
if (c == '\''){
|
||||
S.token.type = CPP_TOKEN_CHARACTER_CONSTANT;
|
||||
}
|
||||
S.token.flags = 0;
|
||||
break;
|
||||
|
||||
case LS_char_multiline:
|
||||
S.token.type = CPP_TOKEN_CHARACTER_CONSTANT;
|
||||
S.token.type = CPP_TOKEN_JUNK;
|
||||
if (c == '\''){
|
||||
S.token.type = CPP_TOKEN_CHARACTER_CONSTANT;
|
||||
}
|
||||
S.token.flags = CPP_TFLAG_MULTILINE;
|
||||
break;
|
||||
|
||||
case LS_string:
|
||||
case LS_string_slashed:
|
||||
S.token.type = CPP_TOKEN_STRING_CONSTANT;
|
||||
S.token.type = CPP_TOKEN_JUNK;
|
||||
if (c == '"'){
|
||||
S.token.type = CPP_TOKEN_STRING_CONSTANT;
|
||||
}
|
||||
S.token.flags = 0;
|
||||
break;
|
||||
|
||||
case LS_string_multiline:
|
||||
S.token.type = CPP_TOKEN_STRING_CONSTANT;
|
||||
S.token.type = CPP_TOKEN_JUNK;
|
||||
if (c == '"'){
|
||||
S.token.type = CPP_TOKEN_STRING_CONSTANT;
|
||||
}
|
||||
S.token.flags = CPP_TFLAG_MULTILINE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ int_fsm(Lex_FSM fsm, char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_u:
|
||||
switch (c){
|
||||
case 'l': fsm.int_state = LSINT_ul; break;
|
||||
|
@ -606,7 +606,7 @@ int_fsm(Lex_FSM fsm, char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_l:
|
||||
switch (c){
|
||||
case 'l': fsm.int_state = LSINT_ll; break;
|
||||
|
@ -614,7 +614,7 @@ int_fsm(Lex_FSM fsm, char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_L:
|
||||
switch (c){
|
||||
case 'L': fsm.int_state = LSINT_ll; break;
|
||||
|
@ -622,28 +622,28 @@ int_fsm(Lex_FSM fsm, char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_ul:
|
||||
switch (c){
|
||||
case 'l': fsm.int_state = LSINT_extra; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_uL:
|
||||
switch (c){
|
||||
case 'L': fsm.int_state = LSINT_extra; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_ll:
|
||||
switch (c){
|
||||
case 'u': case 'U': fsm.int_state = LSINT_extra; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINT_extra:
|
||||
fsm.emit_token = 1;
|
||||
break;
|
||||
|
@ -660,7 +660,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
fsm.state = LS_error_message;
|
||||
if (c == '\n') fsm.emit_token = 1;
|
||||
break;
|
||||
|
||||
|
||||
case LSPP_include:
|
||||
switch (fsm.state){
|
||||
case LSINC_default:
|
||||
|
@ -670,21 +670,29 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.state = LSINC_junk; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINC_quotes:
|
||||
if (c == '"') fsm.emit_token = 1;
|
||||
else if (c == '\n'){
|
||||
fsm.emit_token = 1;
|
||||
fsm.state = LSINC_junk;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINC_pointy:
|
||||
if (c == '>') fsm.emit_token = 1;
|
||||
else if (c == '\n'){
|
||||
fsm.emit_token = 1;
|
||||
fsm.state = LSINC_junk;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LSINC_junk:
|
||||
if (c == '\n') fsm.emit_token = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
switch (fsm.state){
|
||||
case LS_default:
|
||||
|
@ -700,31 +708,31 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
else switch (c){
|
||||
case '\'': fsm.state = LS_char; break;
|
||||
case '"': fsm.state = LS_string; break;
|
||||
|
||||
|
||||
case '/': fsm.state = LS_comment_pre; break;
|
||||
|
||||
|
||||
case '.': fsm.state = LS_dot; break;
|
||||
|
||||
|
||||
case '<': fsm.state = LS_less; break;
|
||||
case '>': fsm.state = LS_more; break;
|
||||
|
||||
|
||||
case '-': fsm.state = LS_minus; break;
|
||||
|
||||
|
||||
case '&': fsm.state = LS_and; break;
|
||||
case '|': fsm.state = LS_or; break;
|
||||
|
||||
|
||||
case '+': fsm.state = LS_plus; break;
|
||||
|
||||
|
||||
case ':': fsm.state = LS_colon; break;
|
||||
|
||||
|
||||
case '*': fsm.state = LS_star; break;
|
||||
|
||||
|
||||
case '%': fsm.state = LS_modulo; break;
|
||||
case '^': fsm.state = LS_caret; break;
|
||||
|
||||
|
||||
case '=': fsm.state = LS_eq; break;
|
||||
case '!': fsm.state = LS_bang; break;
|
||||
|
||||
|
||||
case '#':
|
||||
if (pp_state == LSPP_default){
|
||||
fsm.state = LS_pp;
|
||||
|
@ -734,52 +742,52 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
fsm.state = LS_pound;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
#define OperCase(op,type) case op: fsm.emit_token = 1; break;
|
||||
OperCase('{', CPP_TOKEN_BRACE_OPEN);
|
||||
OperCase('}', CPP_TOKEN_BRACE_CLOSE);
|
||||
|
||||
|
||||
OperCase('[', CPP_TOKEN_BRACKET_OPEN);
|
||||
OperCase(']', CPP_TOKEN_BRACKET_CLOSE);
|
||||
|
||||
|
||||
OperCase('(', CPP_TOKEN_PARENTHESE_OPEN);
|
||||
OperCase(')', CPP_TOKEN_PARENTHESE_CLOSE);
|
||||
|
||||
|
||||
OperCase('~', CPP_TOKEN_TILDE);
|
||||
OperCase(',', CPP_TOKEN_COMMA);
|
||||
OperCase(';', CPP_TOKEN_SEMICOLON);
|
||||
OperCase('?', CPP_TOKEN_TERNARY_QMARK);
|
||||
|
||||
|
||||
OperCase('@', CPP_TOKEN_JUNK);
|
||||
OperCase('$', CPP_TOKEN_JUNK);
|
||||
OperCase('\\', CPP_TOKEN_JUNK);
|
||||
#undef OperCase
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_identifier:
|
||||
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_')){
|
||||
fsm.emit_token = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_pound:
|
||||
switch (c){
|
||||
case '#': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_pp:break;
|
||||
|
||||
|
||||
case LS_char:
|
||||
case LS_char_multiline:
|
||||
switch(c){
|
||||
case '\'': fsm.emit_token = 1; break;
|
||||
case '\n': case '\'': fsm.emit_token = 1; break;
|
||||
case '\\': fsm.state = LS_char_slashed; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_char_slashed:
|
||||
switch (c){
|
||||
case '\r': case '\f': case '\v': break;
|
||||
|
@ -787,15 +795,15 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.state = LS_char; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_string:
|
||||
case LS_string_multiline:
|
||||
switch(c){
|
||||
case '\"': fsm.emit_token = 1; break;
|
||||
case '\n': case '\"': fsm.emit_token = 1; break;
|
||||
case '\\': fsm.state = LS_string_slashed; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_string_slashed:
|
||||
switch (c){
|
||||
case '\r': case '\f': case '\v': break;
|
||||
|
@ -803,7 +811,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.state = LS_string; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_number:
|
||||
if (c >= '0' && c <= '9'){
|
||||
fsm.state = LS_number;
|
||||
|
@ -815,7 +823,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_number0:
|
||||
if (c >= '0' && c <= '9'){
|
||||
fsm.state = LS_number;
|
||||
|
@ -830,7 +838,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
fsm.emit_token = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_float:
|
||||
if (!(c >= '0' && c <= '9')){
|
||||
switch (c){
|
||||
|
@ -839,7 +847,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_crazy_float0:
|
||||
{
|
||||
if ((c >= '0' && c <= '9') || c == '-'){
|
||||
|
@ -850,7 +858,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_crazy_float1:
|
||||
{
|
||||
if (!(c >= '0' && c <= '9')){
|
||||
|
@ -858,13 +866,13 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_hex:
|
||||
if (!(c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F')){
|
||||
fsm.emit_token = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_dot:
|
||||
if (c >= '0' && c <= '9'){
|
||||
fsm.state = LS_float;
|
||||
|
@ -876,9 +884,9 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_ellipsis: fsm.emit_token = 1; break;
|
||||
|
||||
|
||||
case LS_less:
|
||||
switch (c){
|
||||
case '<': fsm.state = LS_less_less; break;
|
||||
|
@ -886,14 +894,14 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_less_less:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_more:
|
||||
switch (c){
|
||||
case '>': fsm.state = LS_more_more; break;
|
||||
|
@ -901,14 +909,14 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_more_more:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_comment_pre:
|
||||
switch (c){
|
||||
case '/': fsm.state = LS_comment; break;
|
||||
|
@ -917,27 +925,27 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_comment:
|
||||
switch (c){
|
||||
case '\\': fsm.state = LS_comment_slashed; break;
|
||||
case '\n': fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_comment_slashed:
|
||||
switch (c){
|
||||
case '\r': case '\f': case '\v': break;
|
||||
default: fsm.state = LS_comment; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_comment_block:
|
||||
switch (c){
|
||||
case '*': fsm.state = LS_comment_block_ending; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_comment_block_ending:
|
||||
switch (c){
|
||||
case '*': fsm.state = LS_comment_block_ending; break;
|
||||
|
@ -945,7 +953,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.state = LS_comment_block; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_minus:
|
||||
switch (c){
|
||||
case '>': fsm.state = LS_arrow; break;
|
||||
|
@ -954,14 +962,14 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_arrow:
|
||||
switch (c){
|
||||
case '*': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_and:
|
||||
switch (c){
|
||||
case '&': fsm.emit_token = 1; break;
|
||||
|
@ -969,7 +977,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_or:
|
||||
switch (c){
|
||||
case '|': fsm.emit_token = 1; break;
|
||||
|
@ -977,7 +985,7 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_plus:
|
||||
switch (c){
|
||||
case '+': fsm.emit_token = 1; break;
|
||||
|
@ -985,42 +993,42 @@ main_fsm(Lex_FSM fsm, unsigned char pp_state, unsigned char c){
|
|||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_colon:
|
||||
switch (c){
|
||||
case ':': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_star:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_modulo:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_caret:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_eq:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
default: fsm.emit_token = 1; break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LS_bang:
|
||||
switch (c){
|
||||
case '=': fsm.emit_token = 1; break;
|
||||
|
|
Loading…
Reference in New Issue