* m10300-opc.c (mn10300_opcodes): Fix opcode for 4 operand "mul" and
[deliverable/binutils-gdb.git] / binutils / rclex.l
index b92d9f358d1610ea88c288cbb8edefc8b120f6eb..06a66077f287aba5c74ce3f43a7b803473cca438 100644 (file)
@@ -1,5 +1,5 @@
 %{ /* 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.
@@ -58,7 +58,9 @@ static char *get_string PARAMS ((int));
 %%
 
 "BEGIN"                        { return BEG; }
+"{"                    { return BEG; }
 "END"                  { return END; }
+"}"                    { return END; }
 "ACCELERATORS"         { return ACCELERATORS; }
 "VIRTKEY"              { return VIRTKEY; }
 "ASCII"                        { return ASCII; }
@@ -99,7 +101,7 @@ static char *get_string PARAMS ((int));
 "ICON"                 { return ICON; }
 "LANGUAGE"             { return LANGUAGE; }
 "CHARACTERISTICS"      { return CHARACTERISTICS; }
-"VERSION"              { return VERSION; }
+"VERSION"              { return VERSIONK; }
 "MENU"                 { return MENU; }
 "MENUEX"               { return MENUEX; }
 "MENUITEM"             { return MENUITEM; }
@@ -195,9 +197,15 @@ static char *get_string PARAMS ((int));
                            }
                        }
 
-[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;
@@ -227,18 +235,18 @@ cpp_line (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 != '"')
@@ -291,6 +299,41 @@ handle_quotes (input, len)
              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;
@@ -329,6 +372,12 @@ handle_quotes (input, len)
                }
              *s++ = ch;
              break;
+
+           default:
+             rcparse_warning ("unrecognized escape sequence");
+             *s++ = '\\';
+             *s++ = *t++;
+             break;
            }
        }
       else if (*t != '"')
@@ -343,8 +392,8 @@ handle_quotes (input, len)
       else
        {
          ++t;
-         assert (isspace (*t));
-         while (isspace (*t))
+         assert (isspace ((unsigned char) *t));
+         while (isspace ((unsigned char) *t))
            ++t;
          if (*t == '\0')
            break;
This page took 0.024706 seconds and 4 git commands to generate.