|
|
@ -22,18 +22,18 @@ static const char _ansi_eof_actions[] = { |
|
|
|
0, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
0, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
13, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
13, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
13, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
13, 13, 13, 13, 13, 13, 13, 13,
|
|
|
|
13, 13, 13, 13, 13, 13, 0, 0,
|
|
|
|
13, 13, 13, 13, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0 |
|
|
|
0, 0, 0, 0 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static const int ansi_start = 1; |
|
|
|
static const int ansi_start = 1; |
|
|
|
static const int ansi_first_final = 30; |
|
|
|
static const int ansi_first_final = 28; |
|
|
|
static const int ansi_error = 0; |
|
|
|
static const int ansi_error = 0; |
|
|
|
|
|
|
|
|
|
|
|
static const int ansi_en_CSI_body = 5; |
|
|
|
static const int ansi_en_CSI_body = 5; |
|
|
|
static const int ansi_en_OSC_body = 7; |
|
|
|
static const int ansi_en_OSC_body = 7; |
|
|
|
static const int ansi_en_TITLE_body = 27; |
|
|
|
static const int ansi_en_TITLE_body = 25; |
|
|
|
static const int ansi_en_charsetcmd_body = 29; |
|
|
|
static const int ansi_en_charsetcmd_body = 27; |
|
|
|
static const int ansi_en_main = 1; |
|
|
|
static const int ansi_en_main = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ ansi_parser_reset(void) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define HISTORY_LEN 16 |
|
|
|
#define HISTORY_LEN 10 |
|
|
|
|
|
|
|
|
|
|
|
#if DEBUG_ANSI |
|
|
|
#if DEBUG_ANSI |
|
|
|
static char history[HISTORY_LEN + 1]; |
|
|
|
static char history[HISTORY_LEN + 1]; |
|
|
@ -164,8 +164,12 @@ ansi_parser(char newchar) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
case BEL: |
|
|
|
case BEL: |
|
|
|
|
|
|
|
// bel is also used to terminate OSC
|
|
|
|
|
|
|
|
if (!inside_osc) { |
|
|
|
apars_handle_bel(); |
|
|
|
apars_handle_bel(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case ENQ: // respond with space (like xterm)
|
|
|
|
case ENQ: // respond with space (like xterm)
|
|
|
|
UART_WriteChar(UART0, SP, UART_TIMEOUT_US); |
|
|
|
UART_WriteChar(UART0, SP, UART_TIMEOUT_US); |
|
|
@ -198,7 +202,7 @@ ansi_parser(char newchar) |
|
|
|
|
|
|
|
|
|
|
|
// The parser
|
|
|
|
// The parser
|
|
|
|
|
|
|
|
|
|
|
|
/* #line 202 "user/ansi_parser.c" */ |
|
|
|
/* #line 206 "user/ansi_parser.c" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *_acts; |
|
|
|
const char *_acts; |
|
|
|
unsigned int _nacts; |
|
|
|
unsigned int _nacts; |
|
|
@ -242,7 +246,7 @@ case 3: |
|
|
|
if ( 70 <= (*p) && (*p) <= 71 ) |
|
|
|
if ( 70 <= (*p) && (*p) <= 71 ) |
|
|
|
goto tr10; |
|
|
|
goto tr10; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 30: |
|
|
|
case 28: |
|
|
|
if ( (*p) == 27 ) |
|
|
|
if ( (*p) == 27 ) |
|
|
|
goto tr1; |
|
|
|
goto tr1; |
|
|
|
goto tr0; |
|
|
|
goto tr0; |
|
|
@ -282,9 +286,9 @@ case 6: |
|
|
|
} else |
|
|
|
} else |
|
|
|
goto tr16; |
|
|
|
goto tr16; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 31: |
|
|
|
case 29: |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 32: |
|
|
|
case 30: |
|
|
|
if ( (*p) == 59 ) |
|
|
|
if ( (*p) == 59 ) |
|
|
|
goto tr14; |
|
|
|
goto tr14; |
|
|
|
if ( (*p) < 64 ) { |
|
|
|
if ( (*p) < 64 ) { |
|
|
@ -308,123 +312,107 @@ case 8: |
|
|
|
if ( (*p) == 59 ) |
|
|
|
if ( (*p) == 59 ) |
|
|
|
goto tr21; |
|
|
|
goto tr21; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 9: |
|
|
|
case 31: |
|
|
|
switch( (*p) ) { |
|
|
|
|
|
|
|
case 7: goto tr23; |
|
|
|
|
|
|
|
case 27: goto tr24; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
goto tr22; |
|
|
|
|
|
|
|
case 33: |
|
|
|
|
|
|
|
switch( (*p) ) { |
|
|
|
|
|
|
|
case 7: goto tr23; |
|
|
|
|
|
|
|
case 27: goto tr24; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
goto tr22; |
|
|
|
|
|
|
|
case 10: |
|
|
|
|
|
|
|
if ( (*p) == 92 ) |
|
|
|
|
|
|
|
goto tr25; |
|
|
|
|
|
|
|
goto tr2; |
|
|
|
|
|
|
|
case 34: |
|
|
|
|
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 11: |
|
|
|
case 9: |
|
|
|
if ( (*p) == 84 ) |
|
|
|
if ( (*p) == 84 ) |
|
|
|
goto tr26; |
|
|
|
goto tr22; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 12: |
|
|
|
case 10: |
|
|
|
if ( (*p) == 78 ) |
|
|
|
if ( (*p) == 78 ) |
|
|
|
goto tr27; |
|
|
|
goto tr23; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 13: |
|
|
|
case 11: |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
goto tr28; |
|
|
|
goto tr24; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 14: |
|
|
|
case 12: |
|
|
|
if ( (*p) == 61 ) |
|
|
|
if ( (*p) == 61 ) |
|
|
|
goto tr29; |
|
|
|
goto tr25; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 15: |
|
|
|
case 13: |
|
|
|
switch( (*p) ) { |
|
|
|
switch( (*p) ) { |
|
|
|
case 7: goto tr31; |
|
|
|
case 7: goto tr27; |
|
|
|
case 27: goto tr32; |
|
|
|
case 27: goto tr28; |
|
|
|
} |
|
|
|
} |
|
|
|
goto tr30; |
|
|
|
goto tr26; |
|
|
|
case 35: |
|
|
|
case 32: |
|
|
|
switch( (*p) ) { |
|
|
|
switch( (*p) ) { |
|
|
|
case 7: goto tr31; |
|
|
|
case 7: goto tr27; |
|
|
|
case 27: goto tr32; |
|
|
|
case 27: goto tr28; |
|
|
|
} |
|
|
|
} |
|
|
|
goto tr30; |
|
|
|
goto tr26; |
|
|
|
case 16: |
|
|
|
case 14: |
|
|
|
if ( (*p) == 92 ) |
|
|
|
if ( (*p) == 92 ) |
|
|
|
goto tr33; |
|
|
|
goto tr29; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 17: |
|
|
|
case 15: |
|
|
|
if ( (*p) == 73 ) |
|
|
|
if ( (*p) == 73 ) |
|
|
|
goto tr34; |
|
|
|
goto tr30; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 18: |
|
|
|
case 16: |
|
|
|
if ( (*p) == 84 ) |
|
|
|
if ( (*p) == 84 ) |
|
|
|
goto tr35; |
|
|
|
goto tr31; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 19: |
|
|
|
case 17: |
|
|
|
if ( (*p) == 76 ) |
|
|
|
if ( (*p) == 76 ) |
|
|
|
goto tr36; |
|
|
|
goto tr32; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 20: |
|
|
|
case 18: |
|
|
|
if ( (*p) == 69 ) |
|
|
|
if ( (*p) == 69 ) |
|
|
|
goto tr37; |
|
|
|
goto tr33; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 21: |
|
|
|
case 19: |
|
|
|
if ( (*p) == 61 ) |
|
|
|
if ( (*p) == 61 ) |
|
|
|
goto tr38; |
|
|
|
goto tr21; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 22: |
|
|
|
case 20: |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
goto tr39; |
|
|
|
goto tr34; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 23: |
|
|
|
case 21: |
|
|
|
if ( (*p) == 59 ) |
|
|
|
if ( (*p) == 59 ) |
|
|
|
goto tr40; |
|
|
|
goto tr35; |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
goto tr39; |
|
|
|
goto tr34; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 24: |
|
|
|
case 22: |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
goto tr41; |
|
|
|
goto tr36; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 25: |
|
|
|
case 23: |
|
|
|
switch( (*p) ) { |
|
|
|
switch( (*p) ) { |
|
|
|
case 7: goto tr42; |
|
|
|
case 7: goto tr37; |
|
|
|
case 27: goto tr43; |
|
|
|
case 27: goto tr38; |
|
|
|
} |
|
|
|
} |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
if ( 48 <= (*p) && (*p) <= 57 ) |
|
|
|
goto tr41; |
|
|
|
goto tr36; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 26: |
|
|
|
case 24: |
|
|
|
if ( (*p) == 92 ) |
|
|
|
if ( (*p) == 92 ) |
|
|
|
goto tr42; |
|
|
|
goto tr37; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 27: |
|
|
|
case 25: |
|
|
|
switch( (*p) ) { |
|
|
|
switch( (*p) ) { |
|
|
|
case 7: goto tr45; |
|
|
|
case 7: goto tr40; |
|
|
|
case 27: goto tr46; |
|
|
|
case 27: goto tr41; |
|
|
|
} |
|
|
|
} |
|
|
|
goto tr44; |
|
|
|
goto tr39; |
|
|
|
case 36: |
|
|
|
case 33: |
|
|
|
switch( (*p) ) { |
|
|
|
switch( (*p) ) { |
|
|
|
case 7: goto tr45; |
|
|
|
case 7: goto tr40; |
|
|
|
case 27: goto tr46; |
|
|
|
case 27: goto tr41; |
|
|
|
} |
|
|
|
} |
|
|
|
goto tr44; |
|
|
|
goto tr39; |
|
|
|
case 28: |
|
|
|
case 26: |
|
|
|
if ( (*p) == 92 ) |
|
|
|
if ( (*p) == 92 ) |
|
|
|
goto tr47; |
|
|
|
goto tr42; |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 37: |
|
|
|
case 34: |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
case 29: |
|
|
|
case 27: |
|
|
|
goto tr48; |
|
|
|
goto tr43; |
|
|
|
case 38: |
|
|
|
case 35: |
|
|
|
goto tr2; |
|
|
|
goto tr2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -437,46 +425,41 @@ case 38: |
|
|
|
tr13: cs = 6; goto f10; |
|
|
|
tr13: cs = 6; goto f10; |
|
|
|
tr14: cs = 6; goto f11; |
|
|
|
tr14: cs = 6; goto f11; |
|
|
|
tr17: cs = 8; goto _again; |
|
|
|
tr17: cs = 8; goto _again; |
|
|
|
tr21: cs = 9; goto _again; |
|
|
|
tr18: cs = 9; goto _again; |
|
|
|
tr22: cs = 9; goto f14; |
|
|
|
tr22: cs = 10; goto _again; |
|
|
|
tr24: cs = 10; goto _again; |
|
|
|
tr23: cs = 11; goto _again; |
|
|
|
tr18: cs = 11; goto _again; |
|
|
|
tr24: cs = 12; goto f10; |
|
|
|
tr26: cs = 12; goto _again; |
|
|
|
tr25: cs = 13; goto _again; |
|
|
|
tr27: cs = 13; goto _again; |
|
|
|
tr26: cs = 13; goto f14; |
|
|
|
tr28: cs = 14; goto f10; |
|
|
|
tr28: cs = 14; goto _again; |
|
|
|
tr29: cs = 15; goto _again; |
|
|
|
tr19: cs = 15; goto _again; |
|
|
|
tr30: cs = 15; goto f14; |
|
|
|
tr30: cs = 16; goto _again; |
|
|
|
tr32: cs = 16; goto _again; |
|
|
|
tr31: cs = 17; goto _again; |
|
|
|
tr19: cs = 17; goto _again; |
|
|
|
tr32: cs = 18; goto _again; |
|
|
|
tr34: cs = 18; goto _again; |
|
|
|
tr33: cs = 19; goto _again; |
|
|
|
tr35: cs = 19; goto _again; |
|
|
|
tr20: cs = 20; goto _again; |
|
|
|
tr36: cs = 20; goto _again; |
|
|
|
tr34: cs = 21; goto f10; |
|
|
|
tr37: cs = 21; goto _again; |
|
|
|
tr35: cs = 22; goto f11; |
|
|
|
tr20: cs = 22; goto _again; |
|
|
|
tr36: cs = 23; goto f10; |
|
|
|
tr39: cs = 23; goto f10; |
|
|
|
tr38: cs = 24; goto _again; |
|
|
|
tr40: cs = 24; goto f11; |
|
|
|
tr39: cs = 25; goto f14; |
|
|
|
tr41: cs = 25; goto f10; |
|
|
|
tr41: cs = 26; goto _again; |
|
|
|
tr43: cs = 26; goto _again; |
|
|
|
tr5: cs = 28; goto f2; |
|
|
|
tr44: cs = 27; goto f14; |
|
|
|
tr6: cs = 28; goto f3; |
|
|
|
tr46: cs = 28; goto _again; |
|
|
|
tr7: cs = 28; goto f4; |
|
|
|
tr5: cs = 30; goto f2; |
|
|
|
tr8: cs = 28; goto f5; |
|
|
|
tr6: cs = 30; goto f3; |
|
|
|
tr9: cs = 28; goto f6; |
|
|
|
tr7: cs = 30; goto f4; |
|
|
|
tr10: cs = 28; goto f7; |
|
|
|
tr8: cs = 30; goto f5; |
|
|
|
tr11: cs = 28; goto f8; |
|
|
|
tr9: cs = 30; goto f6; |
|
|
|
tr16: cs = 29; goto f13; |
|
|
|
tr10: cs = 30; goto f7; |
|
|
|
tr15: cs = 30; goto f12; |
|
|
|
tr11: cs = 30; goto f8; |
|
|
|
tr21: cs = 31; goto f6; |
|
|
|
tr16: cs = 31; goto f13; |
|
|
|
tr29: cs = 31; goto f16; |
|
|
|
tr15: cs = 32; goto f12; |
|
|
|
tr37: cs = 31; goto f17; |
|
|
|
tr23: cs = 33; goto f15; |
|
|
|
tr27: cs = 32; goto f15; |
|
|
|
tr38: cs = 34; goto f6; |
|
|
|
tr40: cs = 33; goto f18; |
|
|
|
tr25: cs = 34; goto f16; |
|
|
|
|
|
|
|
tr33: cs = 34; goto f18; |
|
|
|
|
|
|
|
tr42: cs = 34; goto f19; |
|
|
|
tr42: cs = 34; goto f19; |
|
|
|
tr31: cs = 35; goto f17; |
|
|
|
tr43: cs = 35; goto f20; |
|
|
|
tr45: cs = 36; goto f15; |
|
|
|
|
|
|
|
tr47: cs = 37; goto f16; |
|
|
|
|
|
|
|
tr48: cs = 38; goto f20; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f1: _acts = _ansi_actions + 1; goto execFuncs; |
|
|
|
f1: _acts = _ansi_actions + 1; goto execFuncs; |
|
|
|
f4: _acts = _ansi_actions + 3; goto execFuncs; |
|
|
|
f4: _acts = _ansi_actions + 3; goto execFuncs; |
|
|
@ -487,25 +470,25 @@ case 38: |
|
|
|
f0: _acts = _ansi_actions + 13; goto execFuncs; |
|
|
|
f0: _acts = _ansi_actions + 13; goto execFuncs; |
|
|
|
f5: _acts = _ansi_actions + 15; goto execFuncs; |
|
|
|
f5: _acts = _ansi_actions + 15; goto execFuncs; |
|
|
|
f6: _acts = _ansi_actions + 17; goto execFuncs; |
|
|
|
f6: _acts = _ansi_actions + 17; goto execFuncs; |
|
|
|
f19: _acts = _ansi_actions + 19; goto execFuncs; |
|
|
|
f17: _acts = _ansi_actions + 19; goto execFuncs; |
|
|
|
f14: _acts = _ansi_actions + 21; goto execFuncs; |
|
|
|
f14: _acts = _ansi_actions + 21; goto execFuncs; |
|
|
|
f16: _acts = _ansi_actions + 23; goto execFuncs; |
|
|
|
f19: _acts = _ansi_actions + 23; goto execFuncs; |
|
|
|
f18: _acts = _ansi_actions + 25; goto execFuncs; |
|
|
|
f16: _acts = _ansi_actions + 25; goto execFuncs; |
|
|
|
f8: _acts = _ansi_actions + 27; goto execFuncs; |
|
|
|
f8: _acts = _ansi_actions + 27; goto execFuncs; |
|
|
|
f3: _acts = _ansi_actions + 29; goto execFuncs; |
|
|
|
f3: _acts = _ansi_actions + 29; goto execFuncs; |
|
|
|
f7: _acts = _ansi_actions + 31; goto execFuncs; |
|
|
|
f7: _acts = _ansi_actions + 31; goto execFuncs; |
|
|
|
f2: _acts = _ansi_actions + 33; goto execFuncs; |
|
|
|
f2: _acts = _ansi_actions + 33; goto execFuncs; |
|
|
|
f20: _acts = _ansi_actions + 35; goto execFuncs; |
|
|
|
f20: _acts = _ansi_actions + 35; goto execFuncs; |
|
|
|
f12: _acts = _ansi_actions + 37; goto execFuncs; |
|
|
|
f12: _acts = _ansi_actions + 37; goto execFuncs; |
|
|
|
f15: _acts = _ansi_actions + 40; goto execFuncs; |
|
|
|
f18: _acts = _ansi_actions + 40; goto execFuncs; |
|
|
|
f17: _acts = _ansi_actions + 43; goto execFuncs; |
|
|
|
f15: _acts = _ansi_actions + 43; goto execFuncs; |
|
|
|
|
|
|
|
|
|
|
|
execFuncs: |
|
|
|
execFuncs: |
|
|
|
_nacts = *_acts++; |
|
|
|
_nacts = *_acts++; |
|
|
|
while ( _nacts-- > 0 ) { |
|
|
|
while ( _nacts-- > 0 ) { |
|
|
|
switch ( *_acts++ ) { |
|
|
|
switch ( *_acts++ ) { |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
/* #line 173 "user/ansi_parser.rl" */ |
|
|
|
/* #line 177 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((*p) != 0) { |
|
|
|
if ((*p) != 0) { |
|
|
|
apars_handle_plainchar((*p)); |
|
|
|
apars_handle_plainchar((*p)); |
|
|
@ -513,7 +496,7 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
/* #line 182 "user/ansi_parser.rl" */ |
|
|
|
/* #line 186 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Reset the CSI builder
|
|
|
|
// Reset the CSI builder
|
|
|
|
csi_leading = csi_char = 0; |
|
|
|
csi_leading = csi_char = 0; |
|
|
@ -529,13 +512,13 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
/* #line 196 "user/ansi_parser.rl" */ |
|
|
|
/* #line 200 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
csi_leading = (*p); |
|
|
|
csi_leading = (*p); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
/* #line 200 "user/ansi_parser.rl" */ |
|
|
|
/* #line 204 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (csi_cnt == 0) csi_cnt = 1; |
|
|
|
if (csi_cnt == 0) csi_cnt = 1; |
|
|
|
// x10 + digit
|
|
|
|
// x10 + digit
|
|
|
@ -545,7 +528,7 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
/* #line 208 "user/ansi_parser.rl" */ |
|
|
|
/* #line 212 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (csi_cnt == 0) csi_cnt = 1; // handle case when first arg is empty
|
|
|
|
if (csi_cnt == 0) csi_cnt = 1; // handle case when first arg is empty
|
|
|
|
csi_cnt++; |
|
|
|
csi_cnt++; |
|
|
@ -553,7 +536,7 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
case 5: |
|
|
|
/* #line 214 "user/ansi_parser.rl" */ |
|
|
|
/* #line 218 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
csi_char = (*p); |
|
|
|
csi_char = (*p); |
|
|
|
apars_handle_CSI(csi_leading, csi_n, csi_cnt, csi_char); |
|
|
|
apars_handle_CSI(csi_leading, csi_n, csi_cnt, csi_char); |
|
|
@ -561,15 +544,15 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
case 6: |
|
|
|
/* #line 220 "user/ansi_parser.rl" */ |
|
|
|
/* #line 224 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
ansi_warn("Invalid escape sequence discarded."); |
|
|
|
ansi_warn("Parser error."); |
|
|
|
apars_handle_badseq(); |
|
|
|
apars_handle_badseq(); |
|
|
|
{cs = 1;goto _again;} |
|
|
|
{cs = 1;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 7: |
|
|
|
case 7: |
|
|
|
/* #line 238 "user/ansi_parser.rl" */ |
|
|
|
/* #line 242 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
csi_ni = 0; |
|
|
|
csi_ni = 0; |
|
|
|
|
|
|
|
|
|
|
@ -587,16 +570,16 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
case 8: |
|
|
|
/* #line 255 "user/ansi_parser.rl" */ |
|
|
|
/* #line 259 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
osc_bi = 0; |
|
|
|
osc_bi = 0; |
|
|
|
osc_buffer[0] = '\0'; |
|
|
|
osc_buffer[0] = '\0'; |
|
|
|
inside_osc = true; |
|
|
|
inside_osc = true; |
|
|
|
{cs = 27;goto _again;} |
|
|
|
{cs = 25;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
case 9: |
|
|
|
/* #line 262 "user/ansi_parser.rl" */ |
|
|
|
/* #line 266 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
apars_handle_OSC_SetScreenSize(csi_n[0], csi_n[1]); |
|
|
|
apars_handle_OSC_SetScreenSize(csi_n[0], csi_n[1]); |
|
|
|
inside_osc = false; |
|
|
|
inside_osc = false; |
|
|
@ -604,13 +587,13 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 10: |
|
|
|
case 10: |
|
|
|
/* #line 268 "user/ansi_parser.rl" */ |
|
|
|
/* #line 272 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
osc_buffer[osc_bi++] = (*p); |
|
|
|
osc_buffer[osc_bi++] = (*p); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 11: |
|
|
|
case 11: |
|
|
|
/* #line 272 "user/ansi_parser.rl" */ |
|
|
|
/* #line 276 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
osc_buffer[osc_bi++] = '\0'; |
|
|
|
osc_buffer[osc_bi++] = '\0'; |
|
|
|
apars_handle_OSC_SetTitle(osc_buffer); |
|
|
|
apars_handle_OSC_SetTitle(osc_buffer); |
|
|
@ -619,7 +602,7 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 12: |
|
|
|
case 12: |
|
|
|
/* #line 279 "user/ansi_parser.rl" */ |
|
|
|
/* #line 283 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
osc_buffer[osc_bi++] = '\0'; |
|
|
|
osc_buffer[osc_bi++] = '\0'; |
|
|
|
apars_handle_OSC_SetButton(csi_n[0], osc_buffer); |
|
|
|
apars_handle_OSC_SetButton(csi_n[0], osc_buffer); |
|
|
@ -628,42 +611,42 @@ execFuncs: |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 13: |
|
|
|
case 13: |
|
|
|
/* #line 312 "user/ansi_parser.rl" */ |
|
|
|
/* #line 316 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
apars_handle_hashCode((*p)); |
|
|
|
apars_handle_hashCode((*p)); |
|
|
|
{cs = 1;goto _again;} |
|
|
|
{cs = 1;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 14: |
|
|
|
case 14: |
|
|
|
/* #line 317 "user/ansi_parser.rl" */ |
|
|
|
/* #line 321 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
apars_handle_shortCode((*p)); |
|
|
|
apars_handle_shortCode((*p)); |
|
|
|
{cs = 1;goto _again;} |
|
|
|
{cs = 1;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 15: |
|
|
|
case 15: |
|
|
|
/* #line 322 "user/ansi_parser.rl" */ |
|
|
|
/* #line 326 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
apars_handle_setXCtrls((*p)); // weird control settings like 7 bit / 8 bit mode
|
|
|
|
apars_handle_setXCtrls((*p)); // weird control settings like 7 bit / 8 bit mode
|
|
|
|
{cs = 1;goto _again;} |
|
|
|
{cs = 1;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 16: |
|
|
|
case 16: |
|
|
|
/* #line 327 "user/ansi_parser.rl" */ |
|
|
|
/* #line 331 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
// abuse the buffer for storing the leading char
|
|
|
|
// abuse the buffer for storing the leading char
|
|
|
|
osc_buffer[0] = (*p); |
|
|
|
osc_buffer[0] = (*p); |
|
|
|
{cs = 29;goto _again;} |
|
|
|
{cs = 27;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 17: |
|
|
|
case 17: |
|
|
|
/* #line 333 "user/ansi_parser.rl" */ |
|
|
|
/* #line 337 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
apars_handle_characterSet(osc_buffer[0], (*p)); |
|
|
|
apars_handle_characterSet(osc_buffer[0], (*p)); |
|
|
|
{cs = 1;goto _again;} |
|
|
|
{cs = 1;goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
/* #line 667 "user/ansi_parser.c" */ |
|
|
|
/* #line 650 "user/ansi_parser.c" */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
goto _again; |
|
|
|
goto _again; |
|
|
@ -681,16 +664,16 @@ _again: |
|
|
|
while ( __nacts-- > 0 ) { |
|
|
|
while ( __nacts-- > 0 ) { |
|
|
|
switch ( *__acts++ ) { |
|
|
|
switch ( *__acts++ ) { |
|
|
|
case 6: |
|
|
|
case 6: |
|
|
|
/* #line 220 "user/ansi_parser.rl" */ |
|
|
|
/* #line 224 "user/ansi_parser.rl" */ |
|
|
|
{ |
|
|
|
{ |
|
|
|
ansi_warn("Invalid escape sequence discarded."); |
|
|
|
ansi_warn("Parser error."); |
|
|
|
apars_handle_badseq(); |
|
|
|
apars_handle_badseq(); |
|
|
|
{cs = 1; if ( p == pe ) |
|
|
|
{cs = 1; if ( p == pe ) |
|
|
|
goto _test_eof; |
|
|
|
goto _test_eof; |
|
|
|
goto _again;} |
|
|
|
goto _again;} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
/* #line 694 "user/ansi_parser.c" */ |
|
|
|
/* #line 677 "user/ansi_parser.c" */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -698,7 +681,7 @@ goto _again;} |
|
|
|
_out: {} |
|
|
|
_out: {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* #line 357 "user/ansi_parser.rl" */ |
|
|
|
/* #line 361 "user/ansi_parser.rl" */ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|