summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-17 18:50:23 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-17 18:50:23 -0400
commitcb6ee624f72d75b228f5c6c4395b00a709829465 (patch)
treecc4eb490f39211476fb16f95a99fb21d30043ade
parent801e922ddd37ec15ccb8dd16cca9c587b7c1d6fb (diff)
downloadlibvt100-cb6ee624f72d75b228f5c6c4395b00a709829465.tar.gz
libvt100-cb6ee624f72d75b228f5c6c4395b00a709829465.zip
explicitly ignore some escapes
just to prevent warning about them, since we don't intend to support them
-rw-r--r--src/parser.c63
-rw-r--r--src/parser.h2
-rw-r--r--src/parser.l49
3 files changed, 96 insertions, 18 deletions
diff --git a/src/parser.c b/src/parser.c
index faf16d2..d843dfc 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1253,48 +1253,64 @@ case 53:
YY_RULE_SETUP
#line 200 "src/parser.l"
{
- yytext[yyleng - 1] = '\0';
- fprintf(stderr,
- "unhandled OSC sequence: \\033%s\\007\n",
- yytext + 1);
+ if (!strncmp(yytext, "\e]50;", 5)) { // osx terminal.app private stuff
+ // not interested in non-portable extensions
+ }
+ else if (!strncmp(yytext, "\e]499;", 5)) { // termcast private metadata
+ // this isn't intended to be interpreted
+ }
+ else {
+ yytext[yyleng - 1] = '\0';
+ fprintf(stderr,
+ "unhandled OSC sequence: \\033%s\\007\n",
+ yytext + 1);
+ }
}
YY_BREAK
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
-#line 207 "src/parser.l"
+#line 215 "src/parser.l"
{
fprintf(stderr, "unhandled escape sequence: \\%hho\n", yytext[1]);
}
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 211 "src/parser.l"
+#line 219 "src/parser.l"
{
- fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1);
+ switch (yytext[1]) {
+ case '(': // character sets
+ // not interested in implementing character sets, unicode should be
+ // sufficient
+ break;
+ default:
+ fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1);
+ break;
+ }
}
YY_BREAK
case 56:
/* rule 56 can match eol */
YY_RULE_SETUP
-#line 215 "src/parser.l"
+#line 231 "src/parser.l"
{
fprintf(stderr, "unhandled control character: \\%hho\n", yytext[0]);
}
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 219 "src/parser.l"
+#line 235 "src/parser.l"
{
fprintf(stderr, "invalid utf8 byte: \\%hho\n", yytext[0]);
}
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 223 "src/parser.l"
+#line 239 "src/parser.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1298 "src/parser.c"
+#line 1314 "src/parser.c"
case YY_END_OF_BUFFER:
{
@@ -2386,7 +2402,7 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 223 "src/parser.l"
+#line 239 "src/parser.l"
@@ -2694,6 +2710,16 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len)
case 2004:
vt100_screen_set_bracketed_paste(vt);
break;
+ case 12: // blinking cursor
+ // not interested in blinking cursors
+ case 1005: // UTF-8 mouse tracking mode
+ // will just default this to always on. might break some
+ // programs, but the programs that will break will already be
+ // broken for terms with width greater than 223.
+ case 1034: // interpret Meta key
+ // not actually sure if ignoring this is correct - need to see
+ // what exactly it does. don't think it's important though.
+ break;
default:
fprintf(stderr,
"unknown SM parameter: %c%d\n", modes[i], params[i]);
@@ -2753,6 +2779,16 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len)
case 2004:
vt100_screen_reset_bracketed_paste(vt);
break;
+ case 12: // blinking cursor
+ // not interested in blinking cursors
+ case 1005: // UTF-8 mouse tracking mode
+ // will just default this to always on. might break some
+ // programs, but the programs that will break will already be
+ // broken for terms with width greater than 223.
+ case 1034: // interpret Meta key
+ // not actually sure if ignoring this is correct - need to see
+ // what exactly it does. don't think it's important though.
+ break;
default:
fprintf(stderr,
"unknown RM parameter: %c%d\n", modes[i], params[i]);
@@ -2906,6 +2942,9 @@ static void vt100_parser_handle_sgr(VT100Screen *vt, char *buf, size_t len)
case 104: case 105: case 106: case 107:
vt100_screen_set_bg_color(vt, params[i] - 92);
break;
+ case 5: // blink mode
+ // blinking terminals are awful
+ break;
default:
fprintf(stderr, "unknown SGR parameter: %d\n", params[i]);
break;
diff --git a/src/parser.h b/src/parser.h
index f75c1ed..0fed85e 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -330,7 +330,7 @@ extern int vt100_parser_yylex (yyscan_t yyscanner);
#undef YY_DECL
#endif
-#line 223 "src/parser.l"
+#line 239 "src/parser.l"
#line 337 "src/parser.h"
diff --git a/src/parser.l b/src/parser.l
index 7471074..c11d87f 100644
--- a/src/parser.l
+++ b/src/parser.l
@@ -198,10 +198,18 @@ static void vt100_parser_handle_text(VT100Screen *vt, char *text, size_t len);
}
{OSC}{CHAR}*{ST} {
- yytext[yyleng - 1] = '\0';
- fprintf(stderr,
- "unhandled OSC sequence: \\033%s\\007\n",
- yytext + 1);
+ if (!strncmp(yytext, "\e]50;", 5)) { // osx terminal.app private stuff
+ // not interested in non-portable extensions
+ }
+ else if (!strncmp(yytext, "\e]499;", 5)) { // termcast private metadata
+ // this isn't intended to be interpreted
+ }
+ else {
+ yytext[yyleng - 1] = '\0';
+ fprintf(stderr,
+ "unhandled OSC sequence: \\033%s\\007\n",
+ yytext + 1);
+ }
}
{ESC}{CTRL} {
@@ -209,7 +217,15 @@ static void vt100_parser_handle_text(VT100Screen *vt, char *text, size_t len);
}
{ESC}{CHAR} {
- fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1);
+ switch (yytext[1]) {
+ case '(': // character sets
+ // not interested in implementing character sets, unicode should be
+ // sufficient
+ break;
+ default:
+ fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1);
+ break;
+ }
}
{CTRL} {
@@ -526,6 +542,16 @@ static void vt100_parser_handle_sm(VT100Screen *vt, char *buf, size_t len)
case 2004:
vt100_screen_set_bracketed_paste(vt);
break;
+ case 12: // blinking cursor
+ // not interested in blinking cursors
+ case 1005: // UTF-8 mouse tracking mode
+ // will just default this to always on. might break some
+ // programs, but the programs that will break will already be
+ // broken for terms with width greater than 223.
+ case 1034: // interpret Meta key
+ // not actually sure if ignoring this is correct - need to see
+ // what exactly it does. don't think it's important though.
+ break;
default:
fprintf(stderr,
"unknown SM parameter: %c%d\n", modes[i], params[i]);
@@ -585,6 +611,16 @@ static void vt100_parser_handle_rm(VT100Screen *vt, char *buf, size_t len)
case 2004:
vt100_screen_reset_bracketed_paste(vt);
break;
+ case 12: // blinking cursor
+ // not interested in blinking cursors
+ case 1005: // UTF-8 mouse tracking mode
+ // will just default this to always on. might break some
+ // programs, but the programs that will break will already be
+ // broken for terms with width greater than 223.
+ case 1034: // interpret Meta key
+ // not actually sure if ignoring this is correct - need to see
+ // what exactly it does. don't think it's important though.
+ break;
default:
fprintf(stderr,
"unknown RM parameter: %c%d\n", modes[i], params[i]);
@@ -738,6 +774,9 @@ static void vt100_parser_handle_sgr(VT100Screen *vt, char *buf, size_t len)
case 104: case 105: case 106: case 107:
vt100_screen_set_bg_color(vt, params[i] - 92);
break;
+ case 5: // blink mode
+ // blinking terminals are awful
+ break;
default:
fprintf(stderr, "unknown SGR parameter: %d\n", params[i]);
break;