]> git.saurik.com Git - bison.git/commitdiff
doc: use only @example, not @smallexample.
authorAkim Demaille <akim@lrde.epita.fr>
Thu, 15 Mar 2012 14:40:04 +0000 (15:40 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 19 Mar 2012 10:04:50 +0000 (11:04 +0100)
* doc/bison.texinfo: Convert all @smallexamples into @examples.
Adjust layout where needed.
(cherry picked from commit c93f22fcf703f6e9613c3b1b5129879bc1e79618)

Conflicts:

doc/bison.texinfo

doc/bison.texinfo

index aa82db97e915c853a652779458db67abe4656bff..0f4dec26353f8c80ba2aea4afd1ac59df5970256 100644 (file)
@@ -2272,7 +2272,8 @@ Note that multiple assignment and nested function calls are permitted.
 
 Here are the C and Bison declarations for the multi-function calculator.
 
 
 Here are the C and Bison declarations for the multi-function calculator.
 
-@smallexample
+@comment file: mfcalc.y
+@example
 @group
 %@{
   #include <math.h>  /* For math functions, cos(), sin(), etc.  */
 @group
 %@{
   #include <math.h>  /* For math functions, cos(), sin(), etc.  */
@@ -2299,7 +2300,7 @@ Here are the C and Bison declarations for the multi-function calculator.
 %right '^'    /* exponentiation */
 @end group
 %% /* The grammar follows.  */
 %right '^'    /* exponentiation */
 @end group
 %% /* The grammar follows.  */
-@end smallexample
+@end example
 
 The above grammar introduces only two new features of the Bison language.
 These features allow semantic values to have various data types
 
 The above grammar introduces only two new features of the Bison language.
 These features allow semantic values to have various data types
@@ -2330,7 +2331,8 @@ Here are the grammar rules for the multi-function calculator.
 Most of them are copied directly from @code{calc}; three rules,
 those which mention @code{VAR} or @code{FNCT}, are new.
 
 Most of them are copied directly from @code{calc}; three rules,
 those which mention @code{VAR} or @code{FNCT}, are new.
 
-@smallexample
+@comment file: mfcalc.y
+@example
 @group
 input:   /* empty */
         | input line
 @group
 input:   /* empty */
         | input line
@@ -2361,7 +2363,7 @@ exp:      NUM                @{ $$ = $1;                         @}
 @end group
 /* End of grammar.  */
 %%
 @end group
 /* End of grammar.  */
 %%
-@end smallexample
+@end example
 
 @node Mfcalc Symbol Table
 @subsection The @code{mfcalc} Symbol Table
 
 @node Mfcalc Symbol Table
 @subsection The @code{mfcalc} Symbol Table
@@ -2376,7 +2378,8 @@ The symbol table itself consists of a linked list of records.  Its
 definition, which is kept in the header @file{calc.h}, is as follows.  It
 provides for either functions or variables to be placed in the table.
 
 definition, which is kept in the header @file{calc.h}, is as follows.  It
 provides for either functions or variables to be placed in the table.
 
-@smallexample
+@comment file: calc.h
+@example
 @group
 /* Function type.  */
 typedef double (*func_t) (double);
 @group
 /* Function type.  */
 typedef double (*func_t) (double);
@@ -2406,13 +2409,13 @@ extern symrec *sym_table;
 symrec *putsym (char const *, int);
 symrec *getsym (char const *);
 @end group
 symrec *putsym (char const *, int);
 symrec *getsym (char const *);
 @end group
-@end smallexample
+@end example
 
 The new version of @code{main} includes a call to @code{init_table}, a
 function that initializes the symbol table.  Here it is, and
 @code{init_table} as well:
 
 
 The new version of @code{main} includes a call to @code{init_table}, a
 function that initializes the symbol table.  Here it is, and
 @code{init_table} as well:
 
-@smallexample
+@example
 #include <stdio.h>
 
 @group
 #include <stdio.h>
 
 @group
@@ -2472,7 +2475,7 @@ main (void)
   return yyparse ();
 @}
 @end group
   return yyparse ();
 @}
 @end group
-@end smallexample
+@end example
 
 By simply editing the initialization list and adding the necessary include
 files, you can add additional functions to the calculator.
 
 By simply editing the initialization list and adding the necessary include
 files, you can add additional functions to the calculator.
@@ -2484,7 +2487,8 @@ linked to the front of the list, and a pointer to the object is returned.
 The function @code{getsym} is passed the name of the symbol to look up.  If
 found, a pointer to that symbol is returned; otherwise zero is returned.
 
 The function @code{getsym} is passed the name of the symbol to look up.  If
 found, a pointer to that symbol is returned; otherwise zero is returned.
 
-@smallexample
+@comment file: mfcalc.y
+@example
 #include <stdlib.h> /* malloc. */
 #include <string.h> /* strlen. */
 
 #include <stdlib.h> /* malloc. */
 #include <string.h> /* strlen. */
 
@@ -2515,7 +2519,7 @@ getsym (char const *sym_name)
   return 0;
 @}
 @end group
   return 0;
 @}
 @end group
-@end smallexample
+@end example
 
 The function @code{yylex} must now recognize variables, numeric values, and
 the single-character arithmetic operators.  Strings of alphanumeric
 
 The function @code{yylex} must now recognize variables, numeric values, and
 the single-character arithmetic operators.  Strings of alphanumeric
@@ -2532,7 +2536,8 @@ returned to @code{yyparse}.
 No change is needed in the handling of numeric values and arithmetic
 operators in @code{yylex}.
 
 No change is needed in the handling of numeric values and arithmetic
 operators in @code{yylex}.
 
-@smallexample
+@comment file: mfcalc.y
+@example
 @group
 #include <ctype.h>
 @end group
 @group
 #include <ctype.h>
 @end group
@@ -2573,7 +2578,6 @@ yylex (void)
       int i;
 @end group
 
       int i;
 @end group
 
-@group
       if (!symbuf)
         symbuf = (char *) malloc (length + 1);
 
       if (!symbuf)
         symbuf = (char *) malloc (length + 1);
 
@@ -2612,7 +2616,7 @@ yylex (void)
   return c;
 @}
 @end group
   return c;
 @}
 @end group
-@end smallexample
+@end example
 
 This program is both powerful and flexible.  You may easily add new
 functions, and it is a simple job to modify this code to install
 
 This program is both powerful and flexible.  You may easily add new
 functions, and it is a simple job to modify this code to install
@@ -2715,7 +2719,7 @@ prototype functions that take arguments of type @code{YYSTYPE}.  This
 can be done with two @var{Prologue} blocks, one before and one after the
 @code{%union} declaration.
 
 can be done with two @var{Prologue} blocks, one before and one after the
 @code{%union} declaration.
 
-@smallexample
+@example
 %@{
   #define _GNU_SOURCE
   #include <stdio.h>
 %@{
   #define _GNU_SOURCE
   #include <stdio.h>
@@ -2733,7 +2737,7 @@ can be done with two @var{Prologue} blocks, one before and one after the
 %@}
 
 @dots{}
 %@}
 
 @dots{}
-@end smallexample
+@end example
 
 When in doubt, it is usually safer to put prologue code before all
 Bison declarations, rather than after.  For example, any definitions
 
 When in doubt, it is usually safer to put prologue code before all
 Bison declarations, rather than after.  For example, any definitions
@@ -2761,7 +2765,7 @@ location, or it can be one of @code{requires}, @code{provides},
 
 Look again at the example of the previous section:
 
 
 Look again at the example of the previous section:
 
-@smallexample
+@example
 %@{
   #define _GNU_SOURCE
   #include <stdio.h>
 %@{
   #define _GNU_SOURCE
   #include <stdio.h>
@@ -2779,7 +2783,7 @@ Look again at the example of the previous section:
 %@}
 
 @dots{}
 %@}
 
 @dots{}
-@end smallexample
+@end example
 
 @noindent
 Notice that there are two @var{Prologue} sections here, but there's a
 
 @noindent
 Notice that there are two @var{Prologue} sections here, but there's a
@@ -2808,7 +2812,7 @@ To avoid this subtle @code{%union} dependency, rewrite the example using a
 Let's go ahead and add the new @code{YYLTYPE} definition and the
 @code{trace_token} prototype at the same time:
 
 Let's go ahead and add the new @code{YYLTYPE} definition and the
 @code{trace_token} prototype at the same time:
 
-@smallexample
+@example
 %code top @{
   #define _GNU_SOURCE
   #include <stdio.h>
 %code top @{
   #define _GNU_SOURCE
   #include <stdio.h>
@@ -2840,7 +2844,7 @@ Let's go ahead and add the new @code{YYLTYPE} definition and the
 @}
 
 @dots{}
 @}
 
 @dots{}
-@end smallexample
+@end example
 
 @noindent
 In this way, @code{%code top} and the unqualified @code{%code} achieve the same
 
 @noindent
 In this way, @code{%code top} and the unqualified @code{%code} achieve the same
@@ -2864,7 +2868,7 @@ lines are dependency code required by the @code{YYSTYPE} and @code{YYLTYPE}
 definitions.
 Thus, they belong in one or more @code{%code requires}:
 
 definitions.
 Thus, they belong in one or more @code{%code requires}:
 
-@smallexample
+@example
 @group
 %code top @{
   #define _GNU_SOURCE
 @group
 %code top @{
   #define _GNU_SOURCE
@@ -2907,7 +2911,7 @@ Thus, they belong in one or more @code{%code requires}:
 @end group
 
 @dots{}
 @end group
 
 @dots{}
-@end smallexample
+@end example
 
 @noindent
 Now Bison will insert @code{#include "ptypes.h"} and the new
 
 @noindent
 Now Bison will insert @code{#include "ptypes.h"} and the new
@@ -2941,7 +2945,7 @@ this function is not a dependency required by @code{YYSTYPE} or
 sufficient.  Instead, move its prototype from the unqualified
 @code{%code} to a @code{%code provides}:
 
 sufficient.  Instead, move its prototype from the unqualified
 @code{%code} to a @code{%code provides}:
 
-@smallexample
+@example
 @group
 %code top @{
   #define _GNU_SOURCE
 @group
 %code top @{
   #define _GNU_SOURCE
@@ -2989,7 +2993,7 @@ sufficient.  Instead, move its prototype from the unqualified
 @end group
 
 @dots{}
 @end group
 
 @dots{}
-@end smallexample
+@end example
 
 @noindent
 Bison will insert the @code{trace_token} prototype into both the
 
 @noindent
 Bison will insert the @code{trace_token} prototype into both the
@@ -3015,7 +3019,7 @@ organize your grammar file.
 For example, you may organize semantic-type-related directives by semantic
 type:
 
 For example, you may organize semantic-type-related directives by semantic
 type:
 
-@smallexample
+@example
 @group
 %code requires @{ #include "type1.h" @}
 %union @{ type1 field1; @}
 @group
 %code requires @{ #include "type1.h" @}
 %union @{ type1 field1; @}
@@ -3029,7 +3033,7 @@ type:
 %destructor @{ type2_free ($$); @} <field2>
 %printer @{ type2_print ($$); @} <field2>
 @end group
 %destructor @{ type2_free ($$); @} <field2>
 %printer @{ type2_print ($$); @} <field2>
 @end group
-@end smallexample
+@end example
 
 @noindent
 You could even place each of the above directive groups in the rules section of
 
 @noindent
 You could even place each of the above directive groups in the rules section of
@@ -4019,27 +4023,27 @@ parameter is the number of discarded symbols.
 
 By default, @code{YYLLOC_DEFAULT} is defined this way:
 
 
 By default, @code{YYLLOC_DEFAULT} is defined this way:
 
-@smallexample
+@example
 @group
 @group
-# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
-    do                                                                  \
-      if (N)                                                            \
-        @{                                                               \
-          (Current).first_line   = YYRHSLOC(Rhs, 1).first_line;         \
-          (Current).first_column = YYRHSLOC(Rhs, 1).first_column;       \
-          (Current).last_line    = YYRHSLOC(Rhs, N).last_line;          \
-          (Current).last_column  = YYRHSLOC(Rhs, N).last_column;        \
-        @}                                                               \
-      else                                                              \
-        @{                                                               \
-          (Current).first_line   = (Current).last_line   =              \
-            YYRHSLOC(Rhs, 0).last_line;                                 \
-          (Current).first_column = (Current).last_column =              \
-            YYRHSLOC(Rhs, 0).last_column;                               \
-        @}                                                               \
-    while (0)
+# define YYLLOC_DEFAULT(Cur, Rhs, N)                      \
+do                                                        \
+  if (N)                                                  \
+    @{                                                     \
+      (Cur).first_line   = YYRHSLOC(Rhs, 1).first_line;   \
+      (Cur).first_column = YYRHSLOC(Rhs, 1).first_column; \
+      (Cur).last_line    = YYRHSLOC(Rhs, N).last_line;    \
+      (Cur).last_column  = YYRHSLOC(Rhs, N).last_column;  \
+    @}                                                     \
+  else                                                    \
+    @{                                                     \
+      (Cur).first_line   = (Cur).last_line   =            \
+        YYRHSLOC(Rhs, 0).last_line;                       \
+      (Cur).first_column = (Cur).last_column =            \
+        YYRHSLOC(Rhs, 0).last_column;                     \
+    @}                                                     \
+while (0)
 @end group
 @end group
-@end smallexample
+@end example
 
 @noindent
 where @code{YYRHSLOC (rhs, k)} is the location of the @var{k}th symbol
 
 @noindent
 where @code{YYRHSLOC (rhs, k)} is the location of the @var{k}th symbol
@@ -4551,7 +4555,7 @@ symbol that has no declared semantic type tag.
 @noindent
 For example:
 
 @noindent
 For example:
 
-@smallexample
+@example
 %union @{ char *string; @}
 %token <string> STRING1
 %token <string> STRING2
 %union @{ char *string; @}
 %token <string> STRING1
 %token <string> STRING2
@@ -4566,7 +4570,7 @@ For example:
 %destructor @{ free ($$); @} <*>
 %destructor @{ free ($$); printf ("%d", @@$.first_line); @} STRING1 string1
 %destructor @{ printf ("Discarding tagless symbol.\n"); @} <>
 %destructor @{ free ($$); @} <*>
 %destructor @{ free ($$); printf ("%d", @@$.first_line); @} STRING1 string1
 %destructor @{ printf ("Discarding tagless symbol.\n"); @} <>
-@end smallexample
+@end example
 
 @noindent
 guarantees that, when the parser discards any user-defined symbol that has a
 
 @noindent
 guarantees that, when the parser discards any user-defined symbol that has a
@@ -4591,9 +4595,9 @@ reference it in your grammar.
 However, it may invoke one of them for the end token (token 0) if you
 redefine it from @code{$end} to, for example, @code{END}:
 
 However, it may invoke one of them for the end token (token 0) if you
 redefine it from @code{$end} to, for example, @code{END}:
 
-@smallexample
+@example
 %token END 0
 %token END 0
-@end smallexample
+@end example
 
 @cindex actions in mid-rule
 @cindex mid-rule actions
 
 @cindex actions in mid-rule
 @cindex mid-rule actions
@@ -5180,6 +5184,7 @@ Unaccepted @var{variable}s produce an error.
 Some of the accepted @var{variable}s are:
 
 @itemize @bullet
 Some of the accepted @var{variable}s are:
 
 @itemize @bullet
+@c ================================================== api.pure
 @item api.pure
 @findex %define api.pure
 
 @item api.pure
 @findex %define api.pure
 
@@ -5414,12 +5419,12 @@ should usually be more appropriate than @code{%code top}.  However,
 occasionally it is necessary to insert code much nearer the top of the
 parser implementation file.  For example:
 
 occasionally it is necessary to insert code much nearer the top of the
 parser implementation file.  For example:
 
-@smallexample
+@example
 %code top @{
   #define _GNU_SOURCE
   #include <stdio.h>
 @}
 %code top @{
   #define _GNU_SOURCE
   #include <stdio.h>
 @}
-@end smallexample
+@end example
 
 @item Location(s): Near the top of the parser implementation file.
 @end itemize
 
 @item Location(s): Near the top of the parser implementation file.
 @end itemize
@@ -5742,7 +5747,7 @@ assuming that the characters of the token are stored in
 @code{token_buffer}, and assuming that the token does not contain any
 characters like @samp{"} that require escaping.
 
 @code{token_buffer}, and assuming that the token does not contain any
 characters like @samp{"} that require escaping.
 
-@smallexample
+@example
 for (i = 0; i < YYNTOKENS; i++)
   @{
     if (yytname[i] != 0
 for (i = 0; i < YYNTOKENS; i++)
   @{
     if (yytname[i] != 0
@@ -5753,7 +5758,7 @@ for (i = 0; i < YYNTOKENS; i++)
         && yytname[i][strlen (token_buffer) + 2] == 0)
       break;
   @}
         && yytname[i][strlen (token_buffer) + 2] == 0)
       break;
   @}
-@end smallexample
+@end example
 
 The @code{yytname} table is generated only if you use the
 @code{%token-table} declaration.  @xref{Decl Summary}.
 
 The @code{yytname} table is generated only if you use the
 @code{%token-table} declaration.  @xref{Decl Summary}.
@@ -8359,10 +8364,11 @@ value (from @code{yylval}).
 Here is an example of @code{YYPRINT} suitable for the multi-function
 calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}):
 
 Here is an example of @code{YYPRINT} suitable for the multi-function
 calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}):
 
-@smallexample
+@example
 %@{
   static void print_token_value (FILE *, int, YYSTYPE);
 %@{
   static void print_token_value (FILE *, int, YYSTYPE);
-  #define YYPRINT(file, type, value) print_token_value (file, type, value)
+  #define YYPRINT(file, type, value)            \
+    print_token_value (file, type, value)
 %@}
 
 @dots{} %% @dots{} %% @dots{}
 %@}
 
 @dots{} %% @dots{} %% @dots{}
@@ -8375,7 +8381,7 @@ print_token_value (FILE *file, int type, YYSTYPE value)
   else if (type == NUM)
     fprintf (file, "%d", value.val);
 @}
   else if (type == NUM)
     fprintf (file, "%d", value.val);
 @}
-@end smallexample
+@end example
 
 @c ================================================= Invoking Bison
 
 
 @c ================================================= Invoking Bison
 
@@ -9168,7 +9174,7 @@ the grammar for.
 
 @comment file: calc++-parser.yy
 @example
 
 @comment file: calc++-parser.yy
 @example
-%skeleton "lalr1.cc"                          /*  -*- C++ -*- */
+%skeleton "lalr1.cc" /* -*- C++ -*- */
 %require "@value{VERSION}"
 %defines
 %define parser_class_name "calcxx_parser"
 %require "@value{VERSION}"
 %defines
 %define parser_class_name "calcxx_parser"
@@ -9336,7 +9342,7 @@ parser's to get the set of defined tokens.
 
 @comment file: calc++-scanner.ll
 @example
 
 @comment file: calc++-scanner.ll
 @example
-%@{                                            /* -*- C++ -*- */
+%@{ /* -*- C++ -*- */
 # include <cstdlib>
 # include <cerrno>
 # include <climits>
 # include <cstdlib>
 # include <cerrno>
 # include <climits>
@@ -11242,7 +11248,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
 @c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit nonfree
 @c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok rr
 @c LocalWords: longjmp fprintf stderr yylloc YYLTYPE cos ln Stallman Destructor
 @c LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar isdigit nonfree
 @c LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec yyerrok rr
 @c LocalWords: longjmp fprintf stderr yylloc YYLTYPE cos ln Stallman Destructor
-@c LocalWords: smallexample symrec val tptr FNCT fnctptr func struct sym enum
+@c LocalWords: symrec val tptr FNCT fnctptr func struct sym enum
 @c LocalWords: fnct putsym getsym fname arith fncts atan ptr malloc sizeof Lex
 @c LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc isalnum DOTDOT
 @c LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex dtype Unary
 @c LocalWords: fnct putsym getsym fname arith fncts atan ptr malloc sizeof Lex
 @c LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc isalnum DOTDOT
 @c LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex dtype Unary