|
|
|
@ -142,6 +142,13 @@ ansi_parser(char newchar) |
|
|
|
|
history[HISTORY_LEN-1] = newchar; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// THose should work always, even inside a string
|
|
|
|
|
if (newchar == CAN || newchar == SUB) { |
|
|
|
|
// Cancel the active sequence
|
|
|
|
|
cs = ansi_start; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Handle simple characters immediately (bypass parser)
|
|
|
|
|
if (newchar < ' ' && !inside_string) { |
|
|
|
|
switch (newchar) { |
|
|
|
@ -183,12 +190,6 @@ ansi_parser(char newchar) |
|
|
|
|
apars_handle_enq(); |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
// Cancel the active sequence
|
|
|
|
|
case CAN: |
|
|
|
|
case SUB: |
|
|
|
|
cs = ansi_start; |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
// Discard all other control codes
|
|
|
|
|
return; |
|
|
|
@ -208,7 +209,7 @@ ansi_parser(char newchar) |
|
|
|
|
|
|
|
|
|
// The parser
|
|
|
|
|
|
|
|
|
|
/* #line 212 "user/ansi_parser.c" */ |
|
|
|
|
/* #line 213 "user/ansi_parser.c" */ |
|
|
|
|
{ |
|
|
|
|
const char *_acts; |
|
|
|
|
unsigned int _nacts; |
|
|
|
@ -398,7 +399,7 @@ execFuncs: |
|
|
|
|
while ( _nacts-- > 0 ) { |
|
|
|
|
switch ( *_acts++ ) { |
|
|
|
|
case 0: |
|
|
|
|
/* #line 188 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 189 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
ansi_warn("Parser error."); |
|
|
|
|
apars_show_context(); |
|
|
|
@ -407,7 +408,7 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
/* #line 197 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 198 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
if ((*p) != 0) { |
|
|
|
|
apars_handle_plainchar((*p)); |
|
|
|
@ -415,7 +416,7 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
/* #line 205 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 206 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
// Reset the CSI builder
|
|
|
|
|
leadchar = NUL; |
|
|
|
@ -432,13 +433,13 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
/* #line 220 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 221 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
leadchar = (*p); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
/* #line 224 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 225 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
if (arg_cnt == 0) arg_cnt = 1; |
|
|
|
|
// x10 + digit
|
|
|
|
@ -448,7 +449,7 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
/* #line 232 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 233 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
if (arg_cnt == 0) arg_cnt = 1; // handle case when first arg is empty
|
|
|
|
|
arg_cnt++; |
|
|
|
@ -456,20 +457,20 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
/* #line 238 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 239 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
interchar = (*p); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 7: |
|
|
|
|
/* #line 242 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 243 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
apars_handle_csi(leadchar, arg, arg_cnt, interchar, (*p)); |
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 8: |
|
|
|
|
/* #line 254 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 255 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
leadchar = (*p); |
|
|
|
|
str_ni = 0; |
|
|
|
@ -479,13 +480,13 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 9: |
|
|
|
|
/* #line 262 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 263 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
string_buffer[str_ni++] = (*p); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 10: |
|
|
|
|
/* #line 266 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 267 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
inside_string = false; |
|
|
|
|
string_buffer[str_ni++] = '\0'; |
|
|
|
@ -494,41 +495,41 @@ execFuncs: |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 11: |
|
|
|
|
/* #line 279 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 280 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
apars_handle_hash_cmd((*p)); |
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 12: |
|
|
|
|
/* #line 284 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 285 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
apars_handle_short_cmd((*p)); |
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 13: |
|
|
|
|
/* #line 289 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 290 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
apars_handle_space_cmd((*p)); |
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 14: |
|
|
|
|
/* #line 296 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 297 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
leadchar = (*p); |
|
|
|
|
{cs = 10;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 15: |
|
|
|
|
/* #line 301 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 302 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
apars_handle_chs_designate(leadchar, (*p)); |
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
/* #line 532 "user/ansi_parser.c" */ |
|
|
|
|
/* #line 533 "user/ansi_parser.c" */ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
goto _again; |
|
|
|
@ -546,7 +547,7 @@ _again: |
|
|
|
|
while ( __nacts-- > 0 ) { |
|
|
|
|
switch ( *__acts++ ) { |
|
|
|
|
case 0: |
|
|
|
|
/* #line 188 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 189 "user/ansi_parser.rl" */ |
|
|
|
|
{ |
|
|
|
|
ansi_warn("Parser error."); |
|
|
|
|
apars_show_context(); |
|
|
|
@ -556,7 +557,7 @@ _again: |
|
|
|
|
goto _again;} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
/* #line 560 "user/ansi_parser.c" */ |
|
|
|
|
/* #line 561 "user/ansi_parser.c" */ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -564,6 +565,6 @@ goto _again;} |
|
|
|
|
_out: {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* #line 324 "user/ansi_parser.rl" */ |
|
|
|
|
/* #line 325 "user/ansi_parser.rl" */ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|