%{ /* rclex.l -- lexer for Windows rc files parser */
-/* Copyright 1997 Free Software Foundation, Inc.
+/* Copyright 1997, 1998 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
%%
"BEGIN" { return BEG; }
+"{" { return BEG; }
"END" { return END; }
+"}" { return END; }
"ACCELERATORS" { return ACCELERATORS; }
"VIRTKEY" { return VIRTKEY; }
"ASCII" { return ASCII; }
"ICON" { return ICON; }
"LANGUAGE" { return LANGUAGE; }
"CHARACTERISTICS" { return CHARACTERISTICS; }
-"VERSION" { return VERSION; }
+"VERSION" { return VERSIONK; }
"MENU" { return MENU; }
"MENUEX" { return MENUEX; }
"MENUITEM" { return MENUITEM; }
}
}
-[A-Za-z][^ \t\r\n]* {
+[A-Za-z][^ ,\t\r\n]* {
char *s;
+ /* I rejected comma in a string in order to
+ handle VIRTKEY, CONTROL in an accelerator
+ resource. This means that an unquoted
+ file name can not contain a comma. I
+ don't know what rc permits. */
+
s = get_string (strlen (yytext) + 1);
strcpy (s, yytext);
yylval.s = s;
char *send, *fn;
++s;
- while (isspace (*s))
+ while (isspace ((unsigned char) *s))
++s;
line = strtol (s, &send, 0);
- if (*send != '\0' && ! isspace (*send))
+ if (*send != '\0' && ! isspace ((unsigned char) *send))
return;
/* Subtract 1 because we are about to count the newline. */
rc_lineno = line - 1;
s = send;
- while (isspace (*s))
+ while (isspace ((unsigned char) *s))
++s;
if (*s != '"')
rcparse_warning ("use \"\" to put \" in a string");
break;
+ case 'a':
+ *s++ = ESCAPE_A;
+ ++t;
+ break;
+
+ case 'b':
+ *s++ = ESCAPE_B;
+ ++t;
+ break;
+
+ case 'f':
+ *s++ = ESCAPE_F;
+ ++t;
+ break;
+
+ case 'n':
+ *s++ = ESCAPE_N;
+ ++t;
+ break;
+
+ case 'r':
+ *s++ = ESCAPE_R;
+ ++t;
+ break;
+
+ case 't':
+ *s++ = ESCAPE_T;
+ ++t;
+ break;
+
+ case 'v':
+ *s++ = ESCAPE_V;
+ ++t;
+ break;
+
case '\\':
*s++ = *t++;
break;
}
*s++ = ch;
break;
+
+ default:
+ rcparse_warning ("unrecognized escape sequence");
+ *s++ = '\\';
+ *s++ = *t++;
+ break;
}
}
else if (*t != '"')
else
{
++t;
- assert (isspace (*t));
- while (isspace (*t))
+ assert (isspace ((unsigned char) *t));
+ while (isspace ((unsigned char) *t))
++t;
if (*t == '\0')
break;