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