Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/wsconsctl - remove obsolete = { syntac
details: https://anonhg.NetBSD.org/src/rev/b5f237688cdb
branches: trunk
changeset: 782243:b5f237688cdb
user: christos <christos%NetBSD.org@localhost>
date: Tue Oct 23 01:59:18 2012 +0000
description:
- remove obsolete = { syntac
- print context for yyerror()
- add a production to clarify a syntax error
diffstat:
sbin/wsconsctl/map_parse.y | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diffs (104 lines):
diff -r 9475f2780a16 -r b5f237688cdb sbin/wsconsctl/map_parse.y
--- a/sbin/wsconsctl/map_parse.y Mon Oct 22 22:59:33 2012 +0000
+++ b/sbin/wsconsctl/map_parse.y Tue Oct 23 01:59:18 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: map_parse.y,v 1.10 2011/08/27 19:01:34 joerg Exp $ */
+/* $NetBSD: map_parse.y,v 1.11 2012/10/23 01:59:18 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
%%
-program : = {
+program : {
int i;
struct wscons_keymap *mp;
@@ -123,7 +123,7 @@
| keycode_expr
;
-keysym_expr : T_KEYSYM keysym_var "=" keysym_var = {
+keysym_expr : T_KEYSYM keysym_var "=" keysym_var {
size_t src, dst;
dst = ksym_lookup($2);
@@ -134,7 +134,7 @@
}
;
-keycode_expr : T_KEYCODE T_NUMBER "=" = {
+keycode_expr : T_KEYCODE T_NUMBER "=" {
if ($2 >= KS_NUMKEYCODES)
errx(EXIT_FAILURE, "%d: keycode too large", $2);
if ((unsigned int)$2 >= newkbmap.maplen)
@@ -144,35 +144,38 @@
;
keysym_cmd : /* empty */
- | T_KEYSYM_CMD_VAR = {
+ | T_KEYSYM_CMD_VAR {
cur_mp->command = $1;
}
- | T_CMD T_KEYSYM_CMD_VAR = {
+ | T_CMD T_KEYSYM_CMD_VAR {
cur_mp->command = KS_Cmd;
cur_mp->group1[0] = $2;
+ }
+ | T_CMD T_KEYSYM_VAR {
+ yyerror("Not a command keysym");
}
;
keysym_list : /* empty */
- | keysym_var = {
+ | keysym_var {
cur_mp->group1[0] = $1;
cur_mp->group1[1] = ksym_upcase(cur_mp->group1[0]);
cur_mp->group2[0] = cur_mp->group1[0];
cur_mp->group2[1] = cur_mp->group1[1];
}
- | keysym_var keysym_var = {
+ | keysym_var keysym_var {
cur_mp->group1[0] = $1;
cur_mp->group1[1] = $2;
cur_mp->group2[0] = cur_mp->group1[0];
cur_mp->group2[1] = cur_mp->group1[1];
}
- | keysym_var keysym_var keysym_var = {
+ | keysym_var keysym_var keysym_var {
cur_mp->group1[0] = $1;
cur_mp->group1[1] = $2;
cur_mp->group2[0] = $3;
cur_mp->group2[1] = ksym_upcase(cur_mp->group2[0]);
}
- | keysym_var keysym_var keysym_var keysym_var = {
+ | keysym_var keysym_var keysym_var keysym_var {
cur_mp->group1[0] = $1;
cur_mp->group1[1] = $2;
cur_mp->group2[0] = $3;
@@ -180,10 +183,10 @@
}
;
-keysym_var : T_KEYSYM_VAR = {
+keysym_var : T_KEYSYM_VAR {
$$ = $1;
}
- | T_NUMBER = {
+ | T_NUMBER {
char name[2];
int res;
@@ -201,6 +204,8 @@
__dead static void
yyerror(const char *msg)
{
+ extern char *yytext;
+ extern int yyleng;
- errx(EXIT_FAILURE, "parse: %s", msg);
+ errx(EXIT_FAILURE, "parse: %s [%.*s]", msg, yyleng, yytext);
}
Home |
Main Index |
Thread Index |
Old Index