Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/byacc Implement some more bison features (incom...



details:   https://anonhg.NetBSD.org/src/rev/b5e274a7e9c1
branches:  trunk
changeset: 335345:b5e274a7e9c1
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 04 01:34:20 2015 +0000

description:
Implement some more bison features (incomplete!!!)
This handles the mesa/gallium parser but the %error-verbose part needs a
little more work.

diffstat:

 external/bsd/byacc/dist/btyaccpar.c |    6 +-
 external/bsd/byacc/dist/defs.h      |   31 +++-
 external/bsd/byacc/dist/error.c     |   46 +++---
 external/bsd/byacc/dist/main.c      |    6 +-
 external/bsd/byacc/dist/mstring.c   |   18 +-
 external/bsd/byacc/dist/output.c    |   17 ++-
 external/bsd/byacc/dist/reader.c    |  230 +++++++++++++++++++++--------------
 external/bsd/byacc/dist/yaccpar.c   |    7 +-
 external/bsd/byacc/include/config.h |   11 +-
 9 files changed, 229 insertions(+), 143 deletions(-)

diffs (truncated from 1087 to 300 lines):

diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/btyaccpar.c
--- a/external/bsd/byacc/dist/btyaccpar.c       Sun Jan 04 01:26:31 2015 +0000
+++ b/external/bsd/byacc/dist/btyaccpar.c       Sun Jan 04 01:34:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btyaccpar.c,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $       */
+/*     $NetBSD: btyaccpar.c,v 1.2 2015/01/04 01:34:20 christos Exp $   */
 
 /* This file generated automatically using
  * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @
@@ -451,6 +451,10 @@
     "        fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);",
     "#endif",
     "",
+    0
+};
+
+const char *const body_3[] = {
 #if defined(YYBTYACC)
     "#if YYBTYACC",
     "    yyps = yyNewState(0); if (yyps == 0) goto yyenomem;",
diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/defs.h
--- a/external/bsd/byacc/dist/defs.h    Sun Jan 04 01:26:31 2015 +0000
+++ b/external/bsd/byacc/dist/defs.h    Sun Jan 04 01:34:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.8 2015/01/03 23:22:52 christos Exp $        */
+/*     $NetBSD: defs.h,v 1.9 2015/01/04 01:34:20 christos Exp $        */
 
 #if HAVE_NBTOOL_CONFIG_H
 #include "nbtool_config.h"
@@ -123,10 +123,13 @@
 #define LEX_PARAM 14
 #define POSIX_YACC 15
 #define TOKEN_TABLE 16
+#define ERROR_VERBOSE 17
+#define XXXDEBUG 18
 
 #if defined(YYBTYACC)
-#define LOCATIONS 17
-#define DESTRUCTOR 18
+#define LOCATIONS 19
+#define DESTRUCTOR 20
+#define INITIAL_ACTION 21
 #endif
 
 /*  symbol classes  */
@@ -292,10 +295,12 @@
 extern int exit_code;
 extern int pure_parser;
 extern int token_table;
+extern int error_verbose;
 #if defined(YYBTYACC)
 extern int locations;
 extern int backtrack;
 extern int destructor;
+extern char *initial_action;
 #endif
 
 extern const char *const banner[];
@@ -308,6 +313,7 @@
 extern const char *const body_1[];
 extern const char *const body_vars[];
 extern const char *const body_2[];
+extern const char *const body_3[];
 extern const char *const trailer[];
 
 extern char *code_file_name;
@@ -432,7 +438,12 @@
 extern void at_warning(int a_lineno, int i);
 extern void bad_formals(void) GCC_NORETURN;
 extern void default_action_warning(void);
-extern void destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr);
+struct ainfo {
+       int a_lineno;
+       char *a_line;
+       char *a_cptr;
+};
+extern void destructor_redeclared_warning(const struct ainfo *);
 extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
 extern void dollar_warning(int a_lineno, int i);
 extern void fatal(const char *msg) GCC_NORETURN;
@@ -459,16 +470,16 @@
 extern void unknown_arg_warning(int d_lineno, const char *dlr_opt, const char *d_arg, const char *d_line, const char *d_cptr);
 extern void unknown_rhs(int i) GCC_NORETURN;
 extern void unsupported_flag_warning(const char *flag, const char *details);
-extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
-extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) GCC_NORETURN;
-extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr) GCC_NORETURN;
-extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN;
-extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr) GCC_NORETURN;
+extern void unterminated_action(const struct ainfo *);
+extern void unterminated_comment(const struct ainfo *) GCC_NORETURN;
+extern void unterminated_string(const struct ainfo *) GCC_NORETURN;
+extern void unterminated_text(const struct ainfo *) GCC_NORETURN;
+extern void unterminated_union(const struct ainfo *) GCC_NORETURN;
 extern void untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name);
 extern void untyped_lhs(void) GCC_NORETURN;
 extern void untyped_rhs(int i, char *s) GCC_NORETURN;
 extern void used_reserved(char *s) GCC_NORETURN;
-extern void unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN;
+extern void unterminated_arglist(const struct ainfo *) GCC_NORETURN;
 extern void wrong_number_args_warning(const char *which, const char *a_name);
 extern void wrong_type_for_arg_warning(int i, char *a_name);
 
diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/error.c
--- a/external/bsd/byacc/dist/error.c   Sun Jan 04 01:26:31 2015 +0000
+++ b/external/bsd/byacc/dist/error.c   Sun Jan 04 01:34:20 2015 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: error.c,v 1.9 2015/01/03 23:22:52 christos Exp $       */
+/*     $NetBSD: error.c,v 1.10 2015/01/04 01:34:20 christos Exp $      */
 
 #include "defs.h"
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: error.c,v 1.9 2015/01/03 23:22:52 christos Exp $");
+__RCSID("$NetBSD: error.c,v 1.10 2015/01/04 01:34:20 christos Exp $");
 /* Id: error.c,v 1.11 2014/04/07 22:22:49 tom Exp  */
 
 /* routines for printing error messages  */
@@ -81,38 +81,38 @@
 }
 
 __dead void
-unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
+unterminated_comment(const struct ainfo *a)
 {
     fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
-           myname, c_lineno, input_file_name);
-    print_pos(c_line, c_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
 __dead void
-unterminated_string(int s_lineno, char *s_line, char *s_cptr)
+unterminated_string(const struct ainfo *a)
 {
     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
-           myname, s_lineno, input_file_name);
-    print_pos(s_line, s_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
 __dead void
-unterminated_text(int t_lineno, char *t_line, char *t_cptr)
+unterminated_text(const struct ainfo *a)
 {
     fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
-           myname, t_lineno, input_file_name);
-    print_pos(t_line, t_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
 __dead void
-unterminated_union(int u_lineno, char *u_line, char *u_cptr)
+unterminated_union(const struct ainfo *a)
 {
     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \
-declaration\n", myname, u_lineno, input_file_name);
-    print_pos(u_line, u_cptr);
+declaration\n", myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
@@ -222,11 +222,11 @@
 }
 
 void
-unterminated_action(int a_lineno, char *a_line, char *a_cptr)
+unterminated_action(const struct ainfo *a)
 {
     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
-           myname, a_lineno, input_file_name);
-    print_pos(a_line, a_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
@@ -319,12 +319,12 @@
 }
 
 void
-unterminated_arglist(int a_lineno, char *a_line, char *a_cptr)
+unterminated_arglist(const struct ainfo *a)
 {
     fprintf(stderr,
            "%s: e - line %d of \"%s\", unterminated argument list\n",
-           myname, a_lineno, input_file_name);
-    print_pos(a_line, a_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
     done(1);
 }
 
@@ -397,10 +397,10 @@
 }
 
 void
-destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr)
+destructor_redeclared_warning(const struct ainfo *a)
 {
     fprintf(stderr, "%s: w - line %d of \"%s\", destructor redeclared\n",
-           myname, a_lineno, input_file_name);
-    print_pos(a_line, a_cptr);
+           myname, a->a_lineno, input_file_name);
+    print_pos(a->a_line, a->a_cptr);
 }
 #endif
diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/main.c
--- a/external/bsd/byacc/dist/main.c    Sun Jan 04 01:26:31 2015 +0000
+++ b/external/bsd/byacc/dist/main.c    Sun Jan 04 01:34:20 2015 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: main.c,v 1.10 2015/01/03 23:22:52 christos Exp $       */
+/*     $NetBSD: main.c,v 1.11 2015/01/04 01:34:20 christos Exp $       */
 
 #include "defs.h"
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.10 2015/01/03 23:22:52 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2015/01/04 01:34:20 christos Exp $");
 /* Id: main.c,v 1.54 2014/10/06 22:40:07 tom Exp  */
 
 #include <signal.h>
@@ -98,6 +98,7 @@
 
 int pure_parser;
 int token_table;
+int error_verbose;
 
 #if defined(YYBTYACC)
 Value_t *symbol_pval;
@@ -105,6 +106,7 @@
 char **symbol_type_tag;
 int locations = 0;     /* default to no position processing */
 int backtrack = 0;     /* default is no backtracking */
+char *initial_action = NULL;
 #endif
 
 int exit_code;
diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/mstring.c
--- a/external/bsd/byacc/dist/mstring.c Sun Jan 04 01:26:31 2015 +0000
+++ b/external/bsd/byacc/dist/mstring.c Sun Jan 04 01:34:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mstring.c,v 1.2 2015/01/03 23:22:52 christos Exp $     */
+/*     $NetBSD: mstring.c,v 1.3 2015/01/04 01:34:20 christos Exp $     */
 
 /* Id: mstring.c,v 1.6 2014/04/22 23:36:31 tom Exp  */
 #if HAVE_NBTOOL_CONFIG_H
@@ -6,7 +6,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mstring.c,v 1.2 2015/01/03 23:22:52 christos Exp $");
+__RCSID("$NetBSD: mstring.c,v 1.3 2015/01/04 01:34:20 christos Exp $");
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -165,20 +165,20 @@
 {
     while (1)
     {
-       while (isspace(*a))
+       while (isspace((unsigned char)*a))
            a++;
-       while (isspace(*b))
+       while (isspace((unsigned char)*b))
            b++;
        while (*a && *a == *b)
            a++, b++;
-       if (isspace(*a))
+       if (isspace((unsigned char)*a))
        {
-           if (isalnum(a[-1]) && isalnum(*b))
+           if (isalnum((unsigned char)a[-1]) && isalnum((unsigned char)*b))
                break;
        }
-       else if (isspace(*b))
+       else if (isspace((unsigned char)*b))
        {
-           if (isalnum(b[-1]) && isalnum(*a))
+           if (isalnum((unsigned char)b[-1]) && isalnum((unsigned char)*a))
                break;
        }
        else
@@ -194,7 +194,7 @@
 
     while (*s)
     {
-       if (!isspace(*s))
+       if (!isspace((unsigned char)*s))
            h = (h << 5) - h + (unsigned char)*s;
        s++;
     }
diff -r 436b39e66338 -r b5e274a7e9c1 external/bsd/byacc/dist/output.c



Home | Main Index | Thread Index | Old Index