bison-patches
[Top][All Lists]
Advanced

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

19-fyi-initialize.patch


From: Akim Demaille
Subject: 19-fyi-initialize.patch
Date: Sun, 07 Apr 2002 17:24:21 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/gram.c (nitems, nrules, nsyms, ntokens, nvars, nritems)
        (start_symbol, max_user_token_number, semantic_parser)
        (error_token_number): Initialize.
        * src/reader.c (grammar, start_flag, startval, typed, lastprec):
        Initialize.
        (reader): Don't.
        (errtoken, eoftoken, undeftoken, axiom): Extern.

Index: src/gram.c
--- src/gram.c Sat, 06 Apr 2002 00:08:37 +0200 akim
+++ src/gram.c Sat, 06 Apr 2002 21:45:45 +0200 akim
@@ -27,29 +27,29 @@

 /* comments for these variables are in gram.h  */

-int nitems;
-int nrules;
-int nsyms;
-int ntokens;
-int nvars;
+int nitems = 0;
+int nrules = 0;
+int nsyms = 0;
+int ntokens = 0;
+int nvars = 0;

 short *ritem = NULL;
-int nritems;
+int nritems = 0;

 rule_t *rules = NULL;

 struct bucket **symbols = NULL;
 short *token_translations = NULL;

-int start_symbol;
+int start_symbol = 0;

-int max_user_token_number;
+int max_user_token_number = 256;

-int semantic_parser;
+int semantic_parser = 0;

-int pure_parser;
+int pure_parser = 0;

-int error_token_number;
+int error_token_number = 0;


 /*--------------------------------------.
Index: src/reader.c
--- src/reader.c Thu, 04 Apr 2002 19:41:33 +0200 akim
+++ src/reader.c Sat, 06 Apr 2002 21:45:35 +0200 akim
@@ -52,24 +52,24 @@
 } symbol_list;

 int lineno;
-static symbol_list *grammar;
-static int start_flag;
-static bucket *startval;
+static symbol_list *grammar = NULL;
+static int start_flag = 0;
+static bucket *startval = NULL;

 /* Nonzero if components of semantic values are used, implying
    they must be unions.  */
 static int value_components_used;

 /* Nonzero if %union has been seen.  */
-static int typed;
+static int typed = 0;

 /* Incremented for each %left, %right or %nonassoc seen */
-static int lastprec;
+static int lastprec = 0;

-static bucket *errtoken = NULL;
-static bucket *undeftoken = NULL;
-static bucket *eoftoken = NULL;
-static bucket *axiom = NULL;
+bucket *errtoken = NULL;
+bucket *undeftoken = NULL;
+bucket *eoftoken = NULL;
+bucket *axiom = NULL;

 static symbol_list *
 symbol_list_new (bucket *sym)
@@ -1748,22 +1748,6 @@
 void
 reader (void)
 {
-  start_flag = 0;
-  startval = NULL;             /* start symbol not specified yet. */
-
-  nsyms = 0;
-  nvars = 0;
-  nrules = 0;
-  nitems = 0;
-
-  typed = 0;
-  lastprec = 0;
-
-  semantic_parser = 0;
-  pure_parser = 0;
-
-  grammar = NULL;
-
   lex_init ();
   lineno = 1;

Index: src/reader.h
--- src/reader.h Sun, 03 Mar 2002 11:27:12 +0100 akim
+++ src/reader.h Sat, 06 Apr 2002 21:43:14 +0200 akim
@@ -21,6 +21,8 @@
 #ifndef READER_H_
 # define READER_H_

+#include "symtab.h"
+
 /* Read in the grammar specification and record it in the format
    described in gram.h.  All guards are copied into the FGUARD file
    and all actions into FACTION, in each case forming the body of a C
@@ -33,5 +35,10 @@
 void grammar_free PARAMS ((void));

 extern int lineno;
+
+extern bucket *errtoken;
+extern bucket *undeftoken;
+extern bucket *eoftoken;
+extern bucket *axiom;

 #endif /* !READER_H_ */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]