bison-patches
[Top][All Lists]
Advanced

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

FYI: s/start/begin/


From: Akim Demaille
Subject: FYI: s/start/begin/
Date: Tue, 26 Aug 2003 09:09:56 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Another change we mentioned in s/boundary/position/, since that's what
lalr1.cc already names it.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/location.h (struct location): Rename the "start" member as
        "begin", since here, "begin" and "end" have the same "meaning" as
        C++ iterators.
        * src/location.c, src/muscle_tab.c, src/output.c, src/parse-gram.c,
        * src/parse-gram.y, src/reader.c, src/scan-gram.l: Adjust.
        * src/scan-gram.l (code_start, token_start): Rename as...
        (code_begin, token_begin): these.

Index: src/location.c
===================================================================
RCS file: /cvsroot/bison/bison/src/location.c,v
retrieving revision 1.4
diff -u -u -r1.4 location.c
--- src/location.c      11 Dec 2002 06:35:10 -0000      1.4
+++ src/location.c      26 Aug 2003 05:29:23 -0000
@@ -1,5 +1,5 @@
 /* Locations for Bison
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -32,15 +32,15 @@
 location_print (FILE *out, location loc)
 {
   fprintf (out, "%s:%d.%d",
-          quotearg_n_style (3, escape_quoting_style, loc.start.file),
-          loc.start.line, loc.start.column);
+          quotearg_n_style (3, escape_quoting_style, loc.begin.file),
+          loc.begin.line, loc.begin.column);
 
-  if (loc.start.file != loc.end.file)
+  if (loc.begin.file != loc.end.file)
     fprintf (out, "-%s:%d.%d",
             quotearg_n_style (3, escape_quoting_style, loc.end.file),
             loc.end.line, loc.end.column - 1);
-  else if (loc.start.line < loc.end.line)
+  else if (loc.begin.line < loc.end.line)
     fprintf (out, "-%d.%d", loc.end.line, loc.end.column - 1);
-  else if (loc.start.column < loc.end.column - 1)
+  else if (loc.begin.column < loc.end.column - 1)
     fprintf (out, "-%d", loc.end.column - 1);
 }
Index: src/location.h
===================================================================
RCS file: /cvsroot/bison/bison/src/location.h,v
retrieving revision 1.8
diff -u -u -r1.8 location.h
--- src/location.h      11 Dec 2002 06:35:35 -0000      1.8
+++ src/location.h      26 Aug 2003 05:29:23 -0000
@@ -49,7 +49,7 @@
 typedef struct
 {
   /* Boundary just before the location starts.  */
-  boundary start;
+  boundary begin;
 
   /* Boundary just after the location ends.  */
   boundary end;
Index: src/muscle_tab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.c,v
retrieving revision 1.31
diff -u -u -r1.31 muscle_tab.c
--- src/muscle_tab.c    25 Aug 2003 15:16:24 -0000      1.31
+++ src/muscle_tab.c    26 Aug 2003 05:29:23 -0000
@@ -1,6 +1,6 @@
 /* Muscle table manager for Bison.
 
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -163,9 +163,9 @@
 muscle_code_grow (const char *key, const char *val, location loc)
 {
   char *extension = NULL;
-  obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.start.line);
+  obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.begin.line);
   MUSCLE_OBSTACK_SGROW (&muscle_obstack,
-                       quotearg_style (c_quoting_style, loc.start.file));
+                       quotearg_style (c_quoting_style, loc.begin.file));
   obstack_sgrow (&muscle_obstack, "]])[\n");
   obstack_sgrow (&muscle_obstack, val);
   obstack_1grow (&muscle_obstack, 0);
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.223
diff -u -u -r1.223 output.c
--- src/output.c        4 Aug 2003 19:08:38 -0000       1.223
+++ src/output.c        26 Aug 2003 05:29:23 -0000
@@ -235,7 +235,7 @@
       /* Separator in RHS. */
       rhs[i++] = -1;
       /* Line where rule was defined. */
-      rline[r] = rules[r].location.start.line;
+      rline[r] = rules[r].location.begin.line;
       /* Dynamic precedence (GLR).  */
       dprec[r] = rules[r].dprec;
       /* Merger-function index (GLR).  */
@@ -302,8 +302,8 @@
        fprintf (out, "  case %d:\n", r + 1);
 
        fprintf (out, "]b4_syncline([[%d]], ",
-                rules[r].action_location.start.line);
-       escaped_file_name_output (out, rules[r].action_location.start.file);
+                rules[r].action_location.begin.line);
+       escaped_file_name_output (out, rules[r].action_location.begin.file);
        fprintf (out, ")[\n");
        fprintf (out, "    %s\n    break;\n\n",
                 rules[r].action);
@@ -405,9 +405,9 @@
           destructor, typename. */
        fprintf (out, "%s[", sep);
        sep = ",\n";
-       escaped_file_name_output (out, sym->destructor_location.start.file);
+       escaped_file_name_output (out, sym->destructor_location.begin.file);
        fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
-                sym->destructor_location.start.line,
+                sym->destructor_location.begin.line,
                 sym->tag,
                 sym->number,
                 sym->destructor,
@@ -438,9 +438,9 @@
           printer, typename. */
        fprintf (out, "%s[", sep);
        sep = ",\n";
-       escaped_file_name_output (out, sym->printer_location.start.file);
+       escaped_file_name_output (out, sym->printer_location.begin.file);
        fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
-                sym->printer_location.start.line,
+                sym->printer_location.begin.line,
                 sym->tag,
                 sym->number,
                 sym->printer,
Index: src/parse-gram.c
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.c,v
retrieving revision 1.48
diff -u -u -r1.48 parse-gram.c
--- src/parse-gram.c    25 Aug 2003 15:16:24 -0000      1.48
+++ src/parse-gram.c    26 Aug 2003 05:29:23 -0000
@@ -1080,9 +1080,9 @@
 {
   /* Bison's grammar can initial empty locations, hence a default
      location is needed. */
-  (*yylsp).start.file   = (*yylsp).end.file   = current_file;
-  (*yylsp).start.line   = (*yylsp).end.line   = 1;
-  (*yylsp).start.column = (*yylsp).end.column = 0;
+  (*yylsp).begin.file   = (*yylsp).end.file   = current_file;
+  (*yylsp).begin.line   = (*yylsp).end.line   = 1;
+  (*yylsp).begin.column = (*yylsp).end.column = 0;
 }
 /* Line 818 of yacc.c.  */
 #line 1089 "parse-gram.c"
@@ -1393,7 +1393,7 @@
 #line 224 "parse-gram.y"
     {
       typed = true;
-      MUSCLE_INSERT_INT ("stype_line", yylsp[0].start.line);
+      MUSCLE_INSERT_INT ("stype_line", yylsp[0].begin.line);
       muscle_insert ("stype", yyvsp[0].chars);
     }
     break;
@@ -1893,15 +1893,15 @@
 {
   int i;
   YYLTYPE loc;
-  loc.start = loc.end = rhs[n].end;
+  loc.begin = loc.end = rhs[n].end;
 
   /* Ignore empty nonterminals the start of the the right-hand side.
      Do not bother to ignore them at the end of the right-hand side,
      since empty nonterminals have the same end as their predecessors.  */
   for (i = 1; i <= n; i++)
-    if (! equal_boundaries (rhs[i].start, rhs[i].end))
+    if (! equal_boundaries (rhs[i].begin, rhs[i].end))
       {
-       loc.start = rhs[i].start;
+       loc.begin = rhs[i].begin;
        break;
       }
 
Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.43
diff -u -u -r1.43 parse-gram.y
--- src/parse-gram.y    25 Aug 2003 15:16:24 -0000      1.43
+++ src/parse-gram.y    26 Aug 2003 05:29:23 -0000
@@ -70,9 +70,9 @@
 {
   /* Bison's grammar can initial empty locations, hence a default
      location is needed. */
-  @$.start.file   = @$.end.file   = current_file;
-  @$.start.line   = @$.end.line   = 1;
-  @$.start.column = @$.end.column = 0;
+  @$.begin.file   = @$.end.file   = current_file;
+  @$.begin.line   = @$.end.line   = 1;
+  @$.begin.column = @$.end.column = 0;
 }
 
 /* Only NUMBERS have a value.  */
@@ -223,7 +223,7 @@
 | "%union {...}"
     {
       typed = true;
-      MUSCLE_INSERT_INT ("stype_line", @1.start.line);
+      MUSCLE_INSERT_INT ("stype_line", @1.begin.line);
       muscle_insert ("stype", $1);
     }
 | "%destructor {...}" symbols.1
@@ -433,15 +433,15 @@
 {
   int i;
   YYLTYPE loc;
-  loc.start = loc.end = rhs[n].end;
+  loc.begin = loc.end = rhs[n].end;
 
   /* Ignore empty nonterminals the start of the the right-hand side.
      Do not bother to ignore them at the end of the right-hand side,
      since empty nonterminals have the same end as their predecessors.  */
   for (i = 1; i <= n; i++)
-    if (! equal_boundaries (rhs[i].start, rhs[i].end))
+    if (! equal_boundaries (rhs[i].begin, rhs[i].end))
       {
-       loc.start = rhs[i].start;
+       loc.begin = rhs[i].begin;
        break;
       }
 
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.233
diff -u -u -r1.233 reader.c
--- src/reader.c        25 Aug 2003 15:16:25 -0000      1.233
+++ src/reader.c        26 Aug 2003 05:29:23 -0000
@@ -71,9 +71,9 @@
   struct obstack *oout =
     !typed ? &pre_prologue_obstack : &post_prologue_obstack;
 
-  obstack_fgrow1 (oout, "]b4_syncline([[%d]], [[", loc.start.line);
+  obstack_fgrow1 (oout, "]b4_syncline([[%d]], [[", loc.begin.line);
   MUSCLE_OBSTACK_SGROW (oout,
-                       quotearg_style (c_quoting_style, loc.start.file));
+                       quotearg_style (c_quoting_style, loc.begin.file));
   obstack_sgrow (oout, "]])[\n");
   obstack_sgrow (oout, prologue);
 }
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.63
diff -u -u -r1.63 scan-gram.l
--- src/scan-gram.l     25 Aug 2003 15:16:25 -0000      1.63
+++ src/scan-gram.l     26 Aug 2003 05:29:23 -0000
@@ -43,7 +43,7 @@
       scanner_cursor.file = current_file;              \
       scanner_cursor.line = 1;                         \
       scanner_cursor.column = 1;                       \
-      code_start = scanner_cursor;                     \
+      code_begin = scanner_cursor;                     \
     }                                                  \
   while (0)
 
@@ -142,11 +142,11 @@
   /* Where containing code started, when applicable.  Its initial
      value is relevant only when yylex is invoked in the SC_EPILOGUE
      start condition.  */
-  boundary code_start = scanner_cursor;
+  boundary code_begin = scanner_cursor;
 
   /* Where containing comment or string or character literal started,
      when applicable.  */
-  boundary token_start IF_LINT (= scanner_cursor);
+  boundary token_begin IF_LINT (= scanner_cursor);
 %}
 
 
@@ -162,7 +162,7 @@
   /* Comments. */
   "//".*       ;
   "/*" {
-    token_start = loc->start;
+    token_begin = loc->begin;
     context_state = YY_START;
     BEGIN SC_YACC_COMMENT;
   }
@@ -246,20 +246,20 @@
   }
 
   /* Characters.  We don't check there is only one.  */
-  "'"        STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER;
+  "'"        STRING_GROW; token_begin = loc->begin; BEGIN SC_ESCAPED_CHARACTER;
 
   /* Strings. */
-  "\""       STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_STRING;
+  "\""       STRING_GROW; token_begin = loc->begin; BEGIN SC_ESCAPED_STRING;
 
   /* Prologue. */
-  "%{"        code_start = loc->start; BEGIN SC_PROLOGUE;
+  "%{"        code_begin = loc->begin; BEGIN SC_PROLOGUE;
 
   /* Code in between braces.  */
   "{" {
     STRING_GROW;
     token_type = BRACED_CODE;
     braces_level = 0;
-    code_start = loc->start;
+    code_begin = loc->begin;
     BEGIN SC_BRACED_CODE;
   }
 
@@ -284,7 +284,7 @@
   }
 
   <<EOF>> {
-    loc->start = loc->end = scanner_cursor;
+    loc->begin = loc->end = scanner_cursor;
     yyterminate ();
   }
 }
@@ -325,7 +325,7 @@
 {
   "*/"     BEGIN context_state;
   .|\n    ;
-  <<EOF>>  unexpected_eof (token_start, "*/"); BEGIN context_state;
+  <<EOF>>  unexpected_eof (token_begin, "*/"); BEGIN context_state;
 }
 
 
@@ -336,7 +336,7 @@
 <SC_COMMENT>
 {
   "*"{splice}"/"  STRING_GROW; BEGIN context_state;
-  <<EOF>>        unexpected_eof (token_start, "*/"); BEGIN context_state;
+  <<EOF>>        unexpected_eof (token_begin, "*/"); BEGIN context_state;
 }
 
 
@@ -362,7 +362,7 @@
   "\"" {
     STRING_GROW;
     STRING_FINISH;
-    loc->start = token_start;
+    loc->begin = token_begin;
     val->chars = last_string;
     rule_length++;
     BEGIN INITIAL;
@@ -370,7 +370,7 @@
   }
 
   .|\n     STRING_GROW;
-  <<EOF>>   unexpected_eof (token_start, "\""); BEGIN INITIAL;
+  <<EOF>>   unexpected_eof (token_begin, "\""); BEGIN INITIAL;
 }
 
   /*---------------------------------------------------------------.
@@ -384,7 +384,7 @@
     unsigned char last_string_1;
     STRING_GROW;
     STRING_FINISH;
-    loc->start = token_start;
+    loc->begin = token_begin;
     val->symbol = symbol_get (last_string, *loc);
     symbol_class_set (val->symbol, token_sym, *loc);
     last_string_1 = last_string[1];
@@ -396,7 +396,7 @@
   }
 
   .|\n     STRING_GROW;
-  <<EOF>>   unexpected_eof (token_start, "'"); BEGIN INITIAL;
+  <<EOF>>   unexpected_eof (token_begin, "'"); BEGIN INITIAL;
 }
 
 
@@ -458,7 +458,7 @@
 {
   "'"                  STRING_GROW; BEGIN context_state;
   address@hidden       STRING_GROW;
-  <<EOF>>              unexpected_eof (token_start, "'"); BEGIN context_state;
+  <<EOF>>              unexpected_eof (token_begin, "'"); BEGIN context_state;
 }
 
 
@@ -472,7 +472,7 @@
   "\""                 STRING_GROW; BEGIN context_state;
   address@hidden       STRING_GROW;
   <<EOF>> {
-    unexpected_eof (token_start, "\"");
+    unexpected_eof (token_begin, "\"");
     BEGIN context_state;
   }
 }
@@ -487,19 +487,19 @@
   "'" {
     STRING_GROW;
     context_state = YY_START;
-    token_start = loc->start;
+    token_begin = loc->begin;
     BEGIN SC_CHARACTER;
   }
   "\"" {
     STRING_GROW;
     context_state = YY_START;
-    token_start = loc->start;
+    token_begin = loc->begin;
     BEGIN SC_STRING;
   }
   "/"{splice}"*" {
     STRING_GROW;
     context_state = YY_START;
-    token_start = loc->start;
+    token_begin = loc->begin;
     BEGIN SC_COMMENT;
   }
   "/"{splice}"/" {
@@ -526,7 +526,7 @@
     if (valid)
       {
        braces_level = -1;
-       code_start = loc->start;
+       code_begin = loc->begin;
        BEGIN SC_BRACED_CODE;
       }
     else
@@ -580,7 +580,7 @@
       {
        STRING_FINISH;
        rule_length++;
-       loc->start = code_start;
+       loc->begin = code_begin;
        val->chars = last_string;
        BEGIN INITIAL;
        return token_type;
@@ -594,7 +594,7 @@
   "$"("<"{tag}">")?(-?[0-9]+|"$")  handle_dollar (token_type, yytext, *loc);
   "@"(-?[0-9]+|"$")               handle_at (token_type, yytext, *loc);
 
-  <<EOF>>  unexpected_eof (code_start, "}"); BEGIN INITIAL;
+  <<EOF>>  unexpected_eof (code_begin, "}"); BEGIN INITIAL;
 }
 
 
@@ -606,13 +606,13 @@
 {
   "%}" {
     STRING_FINISH;
-    loc->start = code_start;
+    loc->begin = code_begin;
     val->chars = last_string;
     BEGIN INITIAL;
     return PROLOGUE;
   }
 
-  <<EOF>>  unexpected_eof (code_start, "%}"); BEGIN INITIAL;
+  <<EOF>>  unexpected_eof (code_begin, "%}"); BEGIN INITIAL;
 }
 
 
@@ -625,7 +625,7 @@
 {
   <<EOF>> {
     STRING_FINISH;
-    loc->start = code_start;
+    loc->begin = code_begin;
     val->chars = last_string;
     BEGIN INITIAL;
     return EPILOGUE;
@@ -667,7 +667,7 @@
   char const *p = token;
   char const *lim = token + size;
 
-  loc->start = scanner_cursor;
+  loc->begin = scanner_cursor;
 
   for (p = token; p < lim; p++)
     switch (*p)
@@ -983,15 +983,15 @@
 
 
 /*------------------------------------------------------------------------.
-| Report an unexpected EOF in a token or comment starting at START.       |
+| Report an unexpected EOF in a token or comment starting at BEGIN.       |
 | An end of file was encountered and the expected TOKEN_END was missing.  |
 `------------------------------------------------------------------------*/
 
 static void
-unexpected_eof (boundary start, char const *token_end)
+unexpected_eof (boundary begin, char const *token_end)
 {
   location loc;
-  loc.start = start;
+  loc.begin = begin;
   loc.end = scanner_cursor;
   complain_at (loc, _("missing `%s' at end of file"), token_end);
 }




reply via email to

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