]> git.saurik.com Git - bison.git/blobdiff - data/bison.simple
* src/reader.c (parse_braces): Merge into...
[bison.git] / data / bison.simple
index 6b0dc0acf73d012ff0cb14a2ef227b38ea1f5a70..f7127a0cbc4fbc083c5ff8605409b69764608f0b 100644 (file)
@@ -20,6 +20,36 @@ m4_define([b4_uint_type],
        [m4_fatal([no unsigned int type for $1])])])
 
 
+# b4_lhs_value([TYPE])
+# --------------------
+# Expansion of $<TYPE>$.
+m4_define([b4_lhs_value],
+[yyval[]m4_ifval([$1], [.$1])])
+
+
+# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
+# --------------------------------------
+# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
+# symbols on RHS.
+m4_define([b4_rhs_value],
+[yyvsp@<:@m4_eval([$2 - $1])@:>@m4_ifval([$3], [.$3])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[yyloc])
+
+
+# b4_rhs_location(RULE-LENGTH, NUM)
+# ---------------------------------
+# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[yylsp@<:@m4_eval([$2 - $1])@:>@])
+
+
 m4_define_default([b4_input_suffix], [.y])
 
 m4_define_default([b4_output_parser_suffix],
@@ -86,8 +116,8 @@ m4_divert(0)dnl
 
 /* This is the parser code that is written into each bison parser when
    the %semantic_parser declaration is not specified in the grammar.
-   It was written by Richard Stallman by simplifying the hairy parser
-   used when %semantic_parser is specified.  */
+   It was written by Richard Stallman by simplifying the original so
+   called ``semantic'' parser.  */
 
 /* All symbols defined below should begin with yy or YY, to avoid
    infringing on user name space.  This should be done even for local
@@ -142,6 +172,7 @@ m4_ifdef([b4_stype_line],
 ])dnl
 typedef b4_stype yystype;
 # define YYSTYPE yystype
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 #ifndef YYLTYPE
@@ -153,6 +184,7 @@ typedef struct yyltype
   int last_column;
 } yyltype;
 # define YYLTYPE b4_ltype
+# define YYLTYPE_IS_TRIVIAL 1
 #endif
 
 /* Copy the second part of user declarations.  */
@@ -234,7 +266,7 @@ union yyalloc
        {                                       \
          register YYSIZE_T yyi;                \
          for (yyi = 0; yyi < (Count); yyi++)   \
-           (To)[yyi] = (From)[yyi];            \
+           (To)[[yyi]] = (From)[[yyi]];        \
        }                                       \
       while (0)
 #  endif