]> git.saurik.com Git - bison.git/blobdiff - src/lex.c
New file
[bison.git] / src / lex.c
index 987777be5b39f7302beb5bf94251e3164277c3ca..8241fbc8076a5806d431c999e397da2f6ddba43e 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -1,5 +1,5 @@
 /* Token-reader for Bison's input parser,
-   Copyright 1984, 1986, 1989, 1992, 2000 Free Software Foundation, Inc.
+   Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -31,7 +31,7 @@
 
 /* Buffer for storing the current token.  */
 struct obstack token_obstack;
-char *token_buffer = NULL;
+const char *token_buffer = NULL;
 
 bucket *symval;
 int numval;
@@ -234,10 +234,10 @@ literalchar (struct obstack *out, int *pcode, char term)
        }
       else
        {
-         char buf [] = "c";
-         buf[0] = c;
+         char badchar [] = "c";
+         badchar[0] = c;
          complain (_("unknown escape sequence: `\\' followed by `%s'"),
-                   quote (buf));
+                   quote (badchar));
          code = '?';
        }
     }                          /* has \ */
@@ -535,14 +535,14 @@ struct percent_table_struct percent_table[] =
   { "nonassoc",                NULL,                   tok_nonassoc },
   { "binary",          NULL,                   tok_nonassoc },
   { "prec",            NULL,                   tok_prec },
-  { "locations",       &locations_flag,        tok_noop },             /* -l */
-  { "no_lines",                &no_lines_flag,         tok_noop },             /* -l */
-  { "raw",             &raw_flag,              tok_noop },             /* -r */
-  { "token_table",     &token_table_flag,      tok_noop },             /* -k */
-  { "yacc",            &yacc_flag,             tok_noop },             /* -y */
-  { "fixed_output_files",&yacc_flag,           tok_noop },             /* -y */
-  { "defines",         &defines_flag,          tok_noop },             /* -d */
-  { "no_parser",       &no_parser_flag,        tok_noop },             /* -n */
+  { "locations",       &locations_flag,        tok_noop },     /* -l */
+  { "no_lines",                &no_lines_flag,         tok_noop },     /* -l */
+  { "raw",             NULL,                   tok_obsolete }, /* -r */
+  { "token_table",     &token_table_flag,      tok_noop },     /* -k */
+  { "yacc",            &yacc_flag,             tok_noop },     /* -y */
+  { "fixed_output_files",&yacc_flag,           tok_noop },     /* -y */
+  { "defines",         &defines_flag,          tok_noop },     /* -d */
+  { "no_parser",       &no_parser_flag,        tok_noop },     /* -n */
 #if 0
   /* For the time being, this is not enabled yet, while it's possible
      though, since we use obstacks.  The only risk is with semantic
@@ -552,12 +552,15 @@ struct percent_table_struct percent_table[] =
   { "file_prefix",     &spec_file_prefix,      tok_setopt },   /* -b */
   { "name_prefix",     &spec_name_prefix,      tok_setopt },   /* -p */
 #endif
-  { "verbose",         &verbose_flag,          tok_noop },             /* -v */
-  { "debug",           &debug_flag,            tok_noop },             /* -t */
+  { "header_extension",        NULL,                   tok_hdrext },
+  { "source_extension",        NULL,                   tok_srcext },
+  { "define",          NULL,                   tok_define },
+  { "verbose",         &verbose_flag,          tok_noop },     /* -v */
+  { "debug",           &debug_flag,            tok_noop },     /* -t */
+  { "skeleton",                NULL,                   tok_skel },     /* -S */
   { "semantic_parser", &semantic_parser,       tok_noop },
   { "pure_parser",     &pure_parser,           tok_noop },
-/*    {"help", <print usage stmt>, tok_noop}, *//* -h */
-/*    {"version", <print version number> ,  tok_noop}, *//* -V */
+
   { NULL, NULL, tok_illegal}
 };
 
@@ -617,15 +620,23 @@ parse_percent_token (void)
     if (strcmp (token_buffer + 1, tx->name) == 0)
       break;
 
-  if (tx->retval == tok_setopt)
+  if (tx->set_flag)
     {
-      *((char **) (tx->set_flag)) = optarg;
+      *((int *) (tx->set_flag)) = 1;
       return tok_noop;
     }
-  if (tx->set_flag)
+
+  switch (tx->retval)
     {
-      *((int *) (tx->set_flag)) = 1;
+    case tok_setopt:
+      *((char **) (tx->set_flag)) = optarg;
       return tok_noop;
+      break;
+
+    case tok_obsolete:
+      fatal (_("`%s' is no longer supported"), token_buffer);
+      break;
     }
+
   return tx->retval;
 }