Browse Source

Merge pull request #1255 from marauder2k9-torque/torquescript-generateCompiler

TorqueScript Generate compiler
Brian Roberts 1 năm trước cách đây
mục cha
commit
4e88c4c050
69 tập tin đã thay đổi với 30282 bổ sung11036 xóa
  1. 220 0
      Engine/bin/bison-flex/FlexLexer.h
  2. 34 0
      Engine/bin/bison-flex/README.md
  3. 0 0
      Engine/bin/bison-flex/bison.hairy
  4. 0 0
      Engine/bin/bison-flex/bison.simple
  5. 166 0
      Engine/bin/bison-flex/changelog.md
  6. 173 0
      Engine/bin/bison-flex/custom_build_rules/README.md
  7. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/1.png
  8. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/2.png
  9. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/3.png
  10. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/4.png
  11. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/5.png
  12. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/6.png
  13. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/BisonProperties.png
  14. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/FlexProperties.png
  15. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/Flex_debuging.png
  16. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/Properties.png
  17. BIN
      Engine/bin/bison-flex/custom_build_rules/docs/Verbosity.png
  18. 23 0
      Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.props
  19. 91 0
      Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.targets
  20. 281 0
      Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.xml
  21. 43 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.props
  22. 178 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.targets
  23. 521 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.xml
  24. 23 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.props
  25. 94 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.targets
  26. 243 0
      Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.xml
  27. 227 0
      Engine/bin/bison-flex/data/README.md
  28. 61 0
      Engine/bin/bison-flex/data/bison-default.css
  29. 58 0
      Engine/bin/bison-flex/data/local.mk
  30. 362 0
      Engine/bin/bison-flex/data/m4sugar/foreach.m4
  31. 3329 0
      Engine/bin/bison-flex/data/m4sugar/m4sugar.m4
  32. 1241 0
      Engine/bin/bison-flex/data/skeletons/bison.m4
  33. 27 0
      Engine/bin/bison-flex/data/skeletons/c++-skel.m4
  34. 778 0
      Engine/bin/bison-flex/data/skeletons/c++.m4
  35. 72 0
      Engine/bin/bison-flex/data/skeletons/c-like.m4
  36. 27 0
      Engine/bin/bison-flex/data/skeletons/c-skel.m4
  37. 1125 0
      Engine/bin/bison-flex/data/skeletons/c.m4
  38. 26 0
      Engine/bin/bison-flex/data/skeletons/d-skel.m4
  39. 628 0
      Engine/bin/bison-flex/data/skeletons/d.m4
  40. 2763 0
      Engine/bin/bison-flex/data/skeletons/glr.c
  41. 397 0
      Engine/bin/bison-flex/data/skeletons/glr.cc
  42. 3533 0
      Engine/bin/bison-flex/data/skeletons/glr2.cc
  43. 27 0
      Engine/bin/bison-flex/data/skeletons/java-skel.m4
  44. 502 0
      Engine/bin/bison-flex/data/skeletons/java.m4
  45. 1633 0
      Engine/bin/bison-flex/data/skeletons/lalr1.cc
  46. 1326 0
      Engine/bin/bison-flex/data/skeletons/lalr1.d
  47. 1303 0
      Engine/bin/bison-flex/data/skeletons/lalr1.java
  48. 380 0
      Engine/bin/bison-flex/data/skeletons/location.cc
  49. 157 0
      Engine/bin/bison-flex/data/skeletons/stack.hh
  50. 2 0
      Engine/bin/bison-flex/data/skeletons/traceon.m4
  51. 525 0
      Engine/bin/bison-flex/data/skeletons/variant.hh
  52. 2209 0
      Engine/bin/bison-flex/data/skeletons/yacc.c
  53. 105 0
      Engine/bin/bison-flex/data/xslt/bison.xsl
  54. 401 0
      Engine/bin/bison-flex/data/xslt/xml2dot.xsl
  55. 572 0
      Engine/bin/bison-flex/data/xslt/xml2text.xsl
  56. 765 0
      Engine/bin/bison-flex/data/xslt/xml2xhtml.xsl
  57. BIN
      Engine/bin/bison/bison.exe
  58. 0 4501
      Engine/bin/bison/bison.html
  59. BIN
      Engine/bin/flex/flex.exe
  60. 0 4079
      Engine/bin/flex/flex_1.html
  61. 170 0
      Engine/source/console/torquescript/CMDgram.h
  62. 2 2
      Engine/source/console/torquescript/CMDgram.y
  63. 539 181
      Engine/source/console/torquescript/CMDscan.cpp
  64. 2 2
      Engine/source/console/torquescript/CMDscan.l
  65. 1 1
      Engine/source/console/torquescript/astNodes.cpp
  66. 1 1
      Engine/source/console/torquescript/bison.bat
  67. 2913 2172
      Engine/source/console/torquescript/cmdgram.cpp
  68. 0 97
      Engine/source/console/torquescript/cmdgram.h
  69. 3 0
      Engine/source/console/torquescript/generateCompiler.bat

+ 220 - 0
Engine/bin/bison-flex/FlexLexer.h

@@ -0,0 +1,220 @@
+// -*-C++-*-
+// FlexLexer.h -- define interfaces for lexical analyzer classes generated
+// by flex
+
+// Copyright (c) 1993 The Regents of the University of California.
+// All rights reserved.
+//
+// This code is derived from software contributed to Berkeley by
+// Kent Williams and Tom Epperly.
+//
+//  Redistribution and use in source and binary forms, with or without
+//  modification, are permitted provided that the following conditions
+//  are met:
+
+//  1. Redistributions of source code must retain the above copyright
+//  notice, this list of conditions and the following disclaimer.
+//  2. Redistributions in binary form must reproduce the above copyright
+//  notice, this list of conditions and the following disclaimer in the
+//  documentation and/or other materials provided with the distribution.
+
+//  Neither the name of the University nor the names of its contributors
+//  may be used to endorse or promote products derived from this software
+//  without specific prior written permission.
+
+//  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+//  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+//  PURPOSE.
+
+// This file defines FlexLexer, an abstract class which specifies the
+// external interface provided to flex C++ lexer objects, and yyFlexLexer,
+// which defines a particular lexer class.
+//
+// If you want to create multiple lexer classes, you use the -P flag
+// to rename each yyFlexLexer to some other xxFlexLexer.  You then
+// include <FlexLexer.h> in your other sources once per lexer class:
+//
+//      #undef yyFlexLexer
+//      #define yyFlexLexer xxFlexLexer
+//      #include <FlexLexer.h>
+//
+//      #undef yyFlexLexer
+//      #define yyFlexLexer zzFlexLexer
+//      #include <FlexLexer.h>
+//      ...
+
+#ifndef __FLEX_LEXER_H
+// Never included before - need to define base class.
+#define __FLEX_LEXER_H
+
+#include <iostream>
+
+extern "C++" {
+
+struct yy_buffer_state;
+typedef int yy_state_type;
+
+class FlexLexer
+{
+public:
+  virtual ~FlexLexer()        { }
+
+  const char* YYText() const  { return yytext; }
+  int YYLeng()        const   { return yyleng; }
+
+  virtual void
+  yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
+  virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
+  virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
+  virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
+  virtual void yyrestart( std::istream* s ) = 0;
+  virtual void yyrestart( std::istream& s ) = 0;
+
+  virtual int yylex() = 0;
+
+  // Call yylex with new input/output sources.
+  int yylex( std::istream& new_in, std::ostream& new_out )
+  {
+    switch_streams( new_in, new_out );
+    return yylex();
+  }
+
+  int yylex( std::istream* new_in, std::ostream* new_out = 0)
+  {
+    switch_streams( new_in, new_out );
+    return yylex();
+  }
+
+  // Switch to new input/output streams.  A nil stream pointer
+  // indicates "keep the current one".
+  virtual void switch_streams( std::istream* new_in,
+                               std::ostream* new_out ) = 0;
+  virtual void switch_streams( std::istream& new_in,
+                               std::ostream& new_out ) = 0;
+
+  int lineno() const          { return yylineno; }
+
+  int debug() const           { return yy_flex_debug; }
+  void set_debug( int flag )  { yy_flex_debug = flag; }
+
+protected:
+  char* yytext;
+  int yyleng;
+  int yylineno;       // only maintained if you use %option yylineno
+  int yy_flex_debug;  // only has effect with -d or "%option debug"
+};
+
+}
+#endif // FLEXLEXER_H
+
+#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
+// Either this is the first time through (yyFlexLexerOnce not defined),
+// or this is a repeated include to define a different flavor of
+// yyFlexLexer, as discussed in the flex manual.
+# define yyFlexLexerOnce
+
+extern "C++" {
+
+class yyFlexLexer : public FlexLexer {
+public:
+  // arg_yyin and arg_yyout default to the cin and cout, but we
+  // only make that assignment when initializing in yylex().
+  yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
+  yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
+private:
+  void ctor_common();
+
+public:
+
+  virtual ~yyFlexLexer();
+
+  void yy_switch_to_buffer( yy_buffer_state* new_buffer );
+  yy_buffer_state* yy_create_buffer( std::istream* s, int size );
+  yy_buffer_state* yy_create_buffer( std::istream& s, int size );
+  void yy_delete_buffer( yy_buffer_state* b );
+  void yyrestart( std::istream* s );
+  void yyrestart( std::istream& s );
+
+  void yypush_buffer_state( yy_buffer_state* new_buffer );
+  void yypop_buffer_state();
+
+  virtual int yylex();
+  virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
+  virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
+  virtual int yywrap();
+
+protected:
+  virtual int LexerInput( char* buf, int max_size );
+  virtual void LexerOutput( const char* buf, int size );
+  virtual void LexerError( const char* msg );
+
+  void yyunput( int c, char* buf_ptr );
+  int yyinput();
+
+  void yy_load_buffer_state();
+  void yy_init_buffer( yy_buffer_state* b, std::istream& s );
+  void yy_flush_buffer( yy_buffer_state* b );
+
+  int yy_start_stack_ptr;
+  int yy_start_stack_depth;
+  int* yy_start_stack;
+
+  void yy_push_state( int new_state );
+  void yy_pop_state();
+  int yy_top_state();
+
+  yy_state_type yy_get_previous_state();
+  yy_state_type yy_try_NUL_trans( yy_state_type current_state );
+  int yy_get_next_buffer();
+
+  std::istream yyin;  // input source for default LexerInput
+  std::ostream yyout; // output sink for default LexerOutput
+
+  // yy_hold_char holds the character lost when yytext is formed.
+  char yy_hold_char;
+
+  // Number of characters read into yy_ch_buf.
+  int yy_n_chars;
+
+  // Points to current character in buffer.
+  char* yy_c_buf_p;
+
+  int yy_init;                // whether we need to initialize
+  int yy_start;               // start state number
+
+  // Flag which is used to allow yywrap()'s to do buffer switches
+  // instead of setting up a fresh yyin.  A bit of a hack ...
+  int yy_did_buffer_switch_on_eof;
+
+
+  size_t yy_buffer_stack_top; /**< index of top of stack. */
+  size_t yy_buffer_stack_max; /**< capacity of stack. */
+  yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+  void yyensure_buffer_stack(void);
+
+  // The following are not always needed, but may be depending
+  // on use of certain flex features (like REJECT or yymore()).
+
+  yy_state_type yy_last_accepting_state;
+  char* yy_last_accepting_cpos;
+
+  yy_state_type* yy_state_buf;
+  yy_state_type* yy_state_ptr;
+
+  char* yy_full_match;
+  int* yy_full_state;
+  int yy_full_lp;
+
+  int yy_lp;
+  int yy_looking_for_trail_begin;
+
+  int yy_more_flag;
+  int yy_more_len;
+  int yy_more_offset;
+  int yy_prev_more_offset;
+};
+
+}
+
+#endif // yyFlexLexer || ! yyFlexLexerOnce

+ 34 - 0
Engine/bin/bison-flex/README.md

@@ -0,0 +1,34 @@
+# WinFlexBison - Flex and Bison for Microsoft Windows
+
+WinFlexBison is a Windows port of [Flex (the fast lexical analyser)](https://github.com/westes/flex/) and [GNU Bison (parser generator)](https://www.gnu.org/software/bison/).
+Both win_flex and win_bison are based on upstream sources but depend on system libraries only.
+
+**NOTE**:
+* 2.4.x versions include GNU Bison version 2.7
+* 2.5.x versions include GNU Bison version 3.x.x
+
+## License
+Flex uses a [BSD license](flex/src/COPYING), GNU Bison is [licensed under the GNU General Public License (GPLv3+)](bison/src/COPYING).  
+All build scripts in WinFlexBison are distributed under GPLv3+. See [COPYING](COPYING) for details.
+
+All documentation, especially those under custom_build_rules/doc, is distributed under the GNU Free Documentation License (FDL 1.3+).
+
+## Build status
+Bison 3.x (master) [![Build status](https://ci.appveyor.com/api/projects/status/58lcjnr0mb9uc8c8/branch/master?svg=true)](https://ci.appveyor.com/project/lexxmark/winflexbison/branch/master) and, for compatibility reasons, Bison 2.7 (bison2.7) [![Build status](https://ci.appveyor.com/api/projects/status/58lcjnr0mb9uc8c8/branch/bison2.7?svg=true)](https://ci.appveyor.com/project/lexxmark/winflexbison/branch/bison2.7)
+
+## Downloads
+https://github.com/lexxmark/winflexbison/releases provides stable versions.
+To test non-released development versions see the artifacts provided by CI under "Build status".
+
+## Changelog
+The release page includes the full Changelog but you may also see the [changelog.md](changelog.md) file.
+
+## Build requirements
+* Visual Studio 2017 or newer
+* optional: CMake (when building with CMake)
+
+## HowTo
+You may use win_flex and win_bison directly on the command line or [use them via CustomBuildRules in VisualStudio](custom_build_rules/README.md).
+
+## Example flex/bison files
+See https://github.com/meyerd/flex-bison-example

+ 0 - 0
Engine/bin/bison/bison.hairy → Engine/bin/bison-flex/bison.hairy


+ 0 - 0
Engine/bin/bison/bison.simple → Engine/bin/bison-flex/bison.simple


+ 166 - 0
Engine/bin/bison-flex/changelog.md

@@ -0,0 +1,166 @@
+## Changelog
+
+**NOTE**:
+  * 2.4.x versions include bison version 2.7
+  * 2.5.x versions include bison version 3.x
+  
+### version 2.5.25
+  * upgrade win_bison to version 3.8.2
+  * upgrade m4 to version 1.4.19
+
+### version 2.5.24
+  * upgrade win_bison to version 3.7.4
+  * upgrade m4 to version 1.4.18
+  * upgrade gnulib
+  * removed VS2015 support
+  * fixed win_bison --update option (renaming opened file)
+
+### version 2.5.23
+  * upgrade win_bison to version 3.7.1
+
+### version 2.5.22
+  * upgrade win_bison to version 3.5.0
+
+### version 2.5.21
+  * avoid _m4eof lines in generated bison code while printing warnings
+
+### version 2.5.20
+  * recovered invoking win_bison from different folders
+
+### version 2.5.19
+  * upgrade win_bison to version 3.4.1
+  
+### version 2.5.18
+  * upgrade win_bison to version 3.3.2
+
+### version 2.5.17
+  * upgrade win_bison to version 3.3.1
+
+### version 2.5.16
+  * upgrade win_bison to version 3.1
+  * write output flex/bison files in binary mode "wb" that means use '\n' EOL not '\r\n'
+  * documentation about how to use the custom build-rules is now included
+
+### versions 2.4.12/2.5.15
+  * upgrade win_bison to version 3.0.5
+
+### versions 2.4.12/2.5.14
+  * revert to Visual Studio 2015 due to false positive virus alarms for win_flex.exe
+
+### versions 2.4.11/2.5.13
+  * fixed VS 2017 compilation errors in location.cc
+
+### versions 2.4.11/2.5.12
+  * migrate to Visual Studio 2017
+
+### versions 2.4.10/2.5.11
+  * upgrade win_flex to version 2.6.4
+  * fixed compilation warnings
+
+### versions 2.4.9/2.5.10
+  * data folder was up to dated for bison 3.0.4
+
+### versions 2.4.9/2.5.9
+  * recovered --header-file win_flex option
+
+### versions 2.4.8/2.5.8
+  * fixed outdated FlexLexer.h file
+
+### versions 2.4.7/2.5.7
+  * upgrade win_flex to version 2.6.3
+  * fixed compilation warnings
+
+### versions 2.4.6/2.5.6
+  * upgrade win_bison to version 3.0.4
+  * win_bison v2.7 is unchanged
+  * add separate custom build rules
+    * for win_bison `custom_build_rules\win_bison_only`
+    * and win_flex `custom_build_rules\win_flex_only`
+
+### versions 2.4.5/2.5.5
+  * fix missing Additional Options in custom build rules
+  * fix incorrect "----header-file" option in flex custom build rules
+  * add some extra flex options to Visual Studio property pages:
+     1. Prefix (--prefix="...")
+     2. C++ Class Name (--yyclass="...")
+
+###versions 2.4.4/2.5.4
+  * fix silent errors in custom build rules
+  * add some flex/bison options to Visual Studio property pages:
+  * Bison:
+     1. Output File Name (--output="...")
+     2. Defines File Name (--defines="...")
+     3. Debug (--debug)
+     4. Verbose (--verbose)
+     5. No lines (--no-lines)
+     6. File Prefix (--file-prefix="...")
+     7. Graph File (--graph="...")
+     8. Warnings (--warnings="...")
+     9. Report (--report="...")
+     10. Report File Name (--report-file="...")
+
+  * Flex:
+     1. Output File Name (--outfile="...")
+     2. Header File Name (--header-file="...")
+     3. Windows compatibility mode (--wincompat)
+     4. Case-insensitive mode (--case-insensitive)
+     5. Lex-compatibility mode (--lex-compat)
+     6. Start Condition Stacks (--stack)
+     7. Bison Bridge Mode (--bison-bridge)
+     8. No #line Directives (--noline)
+     9. Generate Reentrant Scanner (--reentrant)
+     10. Generate C++ Scanner (--c++)
+     11. Debug Mode (--debug)
+
+### versions 2.4.3/2.5.3
+  * fix incorrect #line directives in win_flex.exe
+see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542482
+
+### versions 2.4.2/2.5.2
+  * backport parallel invocations of win_bison version 2.7
+  * win_bison of version 3.0 is unchanged
+
+### versions 2.4.1/2.5.1
+  * remove XSI extention syntax for fprintf function (not implemented in windows)
+  * this fixes Graphviz files generation for bison
+
+**NOTE**:
+  * 2.4.x versions will include bison version 2.7
+  * 2.5.x versions will include bison version 3.0
+
+### version 2.5
+  * upgrade win_bison to version 3.0 and make temporary win_bison's files process unique (so parallel invocations of win_bison are possible)
+
+**NOTE**: Several deprecated features were removed in bison 3.0 so this version can break your projects.
+Please see http://savannah.gnu.org/forum/forum.php?forum_id=7663
+For the reason of compatibility I don't change win_flex_bison-latest.zip to refer to win_flex_bison-2.5.zip file.
+It still refer to win_flex_bison-2.4.zip
+
+### version 2.4
+  * fix problem with "m4_syscmd is not implemented" message.
+  * Now win_bison should output correct diagnostic and error messages.
+
+### version 2.3
+  * hide __attribute__ construction for non GCC compilers
+
+### version 2.2
+  * added --wincompat option to win_flex (this option changes `<unistd.h>` unix include with `<io.h>` windows analog
+  also `isatty/fileno` functions changed to `_isatty/_fileno`)
+fixed two "'<' : signed/unsigned mismatch" warnings in win_flex generated file
+
+### version 2.1
+  * fixed crash when execute win_bison.exe under WindowsXP (argv[0] don't have full application path)
+  * added win_flex_bison-latest.zip package to freeze download link
+
+### version 2.0
+  * upgrade win_bison to version 2.7 and win_flex to version 2.5.37
+
+### version 1.2
+  * fixed win_flex.exe #line directives (some #line directives in output file were with unescaped backslashes)
+
+### version 1.1
+  * fixed win_flex.exe parallel invocations (now all temporary files are process specific)
+  * added FLEX_TMP_DIR environment variable support to redirect temporary files folder
+  * added '.exe' to program name in win_flex.exe --version output (CMake support)
+  * fixed win_bison.exe to use "/data" subfolder related to executable path rather than current working directory
+  * added BISON_PKGDATADIR environment variable to redirect "/data" subfolder to a different place

+ 173 - 0
Engine/bin/bison-flex/custom_build_rules/README.md

@@ -0,0 +1,173 @@
+
+How to setup custom build rules for Visual Studio 2010 and up.
+---------------
+
+First of all you should have the necessary files.
+Custom Build rules are separated into a file triplet of `.xml`, `.targets` and `.props`.
+
+You find the custom build rules for win_flex_bison in the **custom_build_rules** directory of the win_flex_bison archive.
+
+You may choose to install one of the following rule set
+
+* the combined rules - [alternative download][1]:
+    * [win_flex_bison_custom_build.props  ](win_flex_bison/win_flex_bison_custom_build.props)
+    * [win_flex_bison_custom_build.targets](win_flex_bison/win_flex_bison_custom_build.targets)
+    * [win_flex_bison_custom_build.xml    ](win_flex_bison/win_flex_bison_custom_build.xml)
+
+* flex only rules   - [alternative download][2]:
+    * [win_flex_custom_build.props        ](win_flex_only/win_flex_custom_build.props)
+    * [win_flex_custom_build.targets      ](win_flex_only/win_flex_custom_build.targets)
+    * [win_flex_custom_build.xml          ](win_flex_only/win_flex_custom_build.xml)
+
+* bison only rules  - [alternative download][3]:
+    * [win_bison_custom_build.props  ](win_bison_only/win_bison_custom_build.props)
+    * [win_bison_custom_build.targets](win_bison_only/win_bison_custom_build.targets)
+    * [win_bison_custom_build.xml    ](win_bison_only/win_bison_custom_build.xml)
+
+This documentation uses the combined rule-set but can be used for all rule-sets.
+
+[1]: https://sourceforge.net/projects/winflexbison/files/win_flex_bison_custom_build_rules.zip/download "Combined build rules for Bison and Flex"
+[2]: https://sourceforge.net/projects/winflexbison/files/win_flex_custom_build_rules.zip/download "Build rules for Flex only"
+[3]: https://sourceforge.net/projects/winflexbison/files/win_bison_custom_build_rules.zip/download "Build rules for Bison only"
+
+----
+
+Launch Visual Studio and open an VC/VC++ project.
+Open context menu for project item in Solution Explorer panel and select "**Build Customizations...**" menu item.
+(Note: newer VS versions have this below sub-menu "**Build Dependencies...**".)
+
+![Build Customizations in Solution Explorer](docs/1.png)
+
+----
+
+In popup dialog "Visual C++ Build Customization Files" press "**Find Existing...**" button.
+
+![Customization Files](docs/2.png)
+
+----
+
+In Open File dialog select "**win_flex_bison_custom_build.targets**" file and press "Open".
+(Note: you may have to switch the file filter to "(*.*) all files".)
+
+----
+
+You will see "Add Search Path?" message box, press "Yes".
+
+![Adding Search Path](docs/3.png)
+
+----
+
+In "Visual C++ Build Customization Files" dialog check just added item **win_flex_bison_custom_build** and press "OK".
+
+![activate custom build rule](docs/4.png)
+
+----
+
+Now you can add flex and bison files to the project...
+
+![project with flex and bison files added](docs/5.png)
+
+... and build.
+In build output you should see something like this:
+
+~~~~
+
+1>------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
+1>  Process sample bison file
+1>  Process sample flex file
+1>  stdafx.cpp
+1>  ConsoleApplication1.cpp
+1>  Generating Code...
+1>  ConsoleApplication1.vcxproj -> C:\Users\ConsoleApplication1\Debug\ConsoleApplication1.exe
+========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
+
+~~~~
+
+-----
+
+For **sample.y** bison file there are two output files: **sample.tab.h** and **sample.tab.cpp**.
+For **sample.l** flex file you'll got **sample.flex.cpp**.
+
+Now you can add them to the project and build. (*Don't forget to exclude cpp files from using precompiled headers*)
+
+![Include generated files into Solution](docs/6.png)
+
+~~~~
+
+1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
+1>  Process sample bison file
+1>  Process sample flex file
+1>  sample.tab.cpp
+1>  sample.flex.cpp
+1>  Generating Code...
+1>  ConsoleApplication1.vcxproj -> C:\Users\ConsoleApplication1\Debug\ConsoleApplication1.exe
+========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
+
+~~~~
+
+----
+
+If your flex/bison file is incorrect and you've got an error. But you don't see actual error message, something like this:
+
+~~~~
+
+1>------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
+1>  Process "grammar.y" bison file
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: The command "
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: start /B /WAIT /D "C:...\ConsoleApplication2\ConsoleApplication2\" win_bison.exe --output="grammar.tab.cpp" --defines="grammar.tab.h" --graph="1.dot" "grammar.y"
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: exit /b %errorlevel%" exited with code 1.
+========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
+
+~~~~
+
+You can change Build Output Verbosity from "Minimal" to "Normal" in "Options" dialog
+
+![Verbosity](docs/Verbosity.png)
+
+Then you will see more detailed output:
+
+~~~~
+
+1>BisonTarget:
+1>  Process "grammar.y" bison file
+1>  grammar.y:51.1-4: error: invalid directive: '%sdw'
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: The command "
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: start /B /WAIT /D "C:...\ConsoleApplication2\" win_bison.exe --output="grammar.tab.cpp" --defines="grammar.tab.h" --graph="1.dot" "grammar.y"
+1>C:...\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: exit /b %errorlevel%" exited with code 1.
+1>
+1>Build FAILED.
+1>
+1>Time Elapsed 00:00:01.21
+========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
+
+~~~~
+
+----
+
+Also you can tune some flex/bison options in files properties dialog:
+
+![Opening File Properties](docs/Properties.png)
+![Property Page for Flex sources](docs/FlexProperties.png)
+![Property Page for Bison sources](docs/BisonProperties.png)
+
+----
+
+
+To debug your scanner or parser you can set break points right into **sample.y** or **sample.l** code.
+
+![Debugging Flex source files](docs/Flex_debuging.png)
+
+----
+
+
+To use the Visual C++ Code editor for Flex/Bison files instead of the text editor adjust your editor settings as follows:
+
+* click **Options** on the **Tools** menu, expand the **Text Editor** node and select **File Extension**
+* type extension **`l`** in the **Extension** field and choose **Microsoft Visual C++** in the **Editor** drop-down field, click **Add**
+* do the same for the extension **`y`**
+
+You now have syntax highlighting, code-completion and show definition options in your Flex/Bison source.
+
+----
+
+Enjoy!

BIN
Engine/bin/bison-flex/custom_build_rules/docs/1.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/2.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/3.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/4.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/5.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/6.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/BisonProperties.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/FlexProperties.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/Flex_debuging.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/Properties.png


BIN
Engine/bin/bison-flex/custom_build_rules/docs/Verbosity.png


+ 23 - 0
Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.props

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup
+    Condition="'$(BisonBeforeTargets)' == '' and '$(BisonAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
+    <BisonBeforeTargets>Midl</BisonBeforeTargets>
+    <BisonAfterTargets>CustomBuild</BisonAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup>
+    <BisonDependsOn
+      Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(BisonDependsOn)</BisonDependsOn>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <Bison>
+      <OutputFile>%(Filename).tab.cpp</OutputFile>
+      <DefinesFile>%(Filename).tab.h</DefinesFile>
+      <CommandLineTemplate>
+start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
+exit /b %errorlevel%</CommandLineTemplate>
+      <Outputs>%(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile);</Outputs>
+      <ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
+    </Bison>
+  </ItemDefinitionGroup>
+</Project>

+ 91 - 0
Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.targets

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <PropertyPageSchema
+      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
+    <AvailableItemName
+      Include="Bison">
+      <Targets>BisonTarget</Targets>
+    </AvailableItemName>
+  </ItemGroup>
+  <UsingTask
+    TaskName="Bison"
+    TaskFactory="XamlTaskFactory"
+    AssemblyName="Microsoft.Build.Tasks.v4.0">
+    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
+  </UsingTask>
+  <Target
+    Name="BisonTarget"
+    BeforeTargets="$(BisonBeforeTargets)"
+    AfterTargets="$(BisonAfterTargets)"
+    Condition="'@(Bison)' != ''"
+    DependsOnTargets="$(BisonDependsOn);ComputeBisonOutput"
+    Outputs="%(Bison.Outputs)"
+    Inputs="%(Bison.Identity);%(Bison.AdditionalDependencies);$(MSBuildProjectFile)">
+    <ItemGroup
+      Condition="'@(SelectedFiles)' != ''">
+      <Bison
+        Remove="@(Bison)"
+        Condition="'%(Identity)' != '@(SelectedFiles)'" />
+    </ItemGroup>
+    <ItemGroup>
+      <Bison_tlog
+        Include="%(Bison.Outputs)"
+        Condition="'%(Bison.Outputs)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'">
+        <Source>@(Bison, '|')</Source>
+      </Bison_tlog>
+    </ItemGroup>
+    <Message
+      Importance="High"
+      Text="%(Bison.ExecutionDescription)" />
+    <WriteLinesToFile
+      Condition="'@(Bison_tlog)' != '' and '%(Bison_tlog.ExcludedFromBuild)' != 'true'"
+      File="$(IntDir)$(ProjectName).write.1.tlog"
+      Lines="^%(Bison_tlog.Source);@(Bison_tlog-&gt;'%(Fullpath)')" />
+    <Bison
+      Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
+      CommandLineTemplate="%(Bison.CommandLineTemplate)"
+      OutputFile="%(Bison.OutputFile)"
+      DefinesFile="%(Bison.DefinesFile)"
+      Debug="%(Bison.Debug)"
+      Verbose="%(Bison.Verbose)"
+      NoLines="%(Bison.NoLines)"
+      FilePrefix="%(Bison.FilePrefix)"
+      GraphFile="%(Bison.GraphFile)"
+      Warnings="%(Bison.Warnings)"
+      Report="%(Bison.Report)"
+      ReportFile="%(Bison.ReportFile)"
+      AdditionalOptions="%(Bison.AdditionalOptions)"
+      Inputs="%(Bison.Identity)" />
+  </Target>
+  <PropertyGroup>
+    <ComputeLinkInputsTargets>
+            $(ComputeLinkInputsTargets);
+            ComputeBisonOutput;
+          </ComputeLinkInputsTargets>
+    <ComputeLibInputsTargets>
+            $(ComputeLibInputsTargets);
+            ComputeBisonOutput;
+          </ComputeLibInputsTargets>
+  </PropertyGroup>
+  <Target
+    Name="ComputeBisonOutput"
+    Condition="'@(Bison)' != ''">
+    <ItemGroup>
+      <BisonDirsToMake
+        Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
+        Include="%(Bison.Outputs)" />
+      <Link
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <Lib
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <ImpLib
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+    </ItemGroup>
+    <MakeDir
+      Directories="@(BisonDirsToMake-&gt;'%(RootDir)%(Directory)')" />
+  </Target>
+</Project>

+ 281 - 0
Engine/bin/bison-flex/custom_build_rules/win_bison_only/win_bison_custom_build.xml

@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
+  <Rule
+    Name="Bison"
+    PageTemplate="tool"
+    DisplayName="Bison files"
+    SwitchPrefix="--"
+    Order="200">
+    <Rule.DataSource>
+      <DataSource
+        Persistence="ProjectFile"
+        ItemType="Bison" />
+    </Rule.DataSource>
+    <Rule.Categories>
+      <Category
+        Name="General">
+        <Category.DisplayName>
+          <sys:String>General</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Bison Options">
+        <Category.DisplayName>
+          <sys:String>Bison Options</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Command Line"
+        Subtype="CommandLine">
+        <Category.DisplayName>
+          <sys:String>Command Line</sys:String>
+        </Category.DisplayName>
+      </Category>
+    </Rule.Categories>
+
+    <StringListProperty
+      Name="OutputFile"
+      Category="Bison Options"
+      IsRequired="true"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Output File Name"
+      Description="Specify the file for the parser implementation file. --output=value"
+      Switch="output=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="DefinesFile"
+      Category="Bison Options"
+      Subtype="file"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Defines File Name"
+      Description="Pretend that %defines was specified, i.e., write an extra output file containing macro definitions for the token type names defined in the grammar, as well as a few other declarations. --defines=value"
+      Switch="defines=&quot;[value]&quot;"
+      />
+    
+    <BoolProperty
+      Name="Debug"
+      Category="Bison Options"
+      DisplayName="Debug"
+      Description="In the parser implementation file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled. (--debug)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html#Enabling-Traces"
+      Switch="debug" />
+    
+    <BoolProperty
+      Name="Verbose"
+      Category="Bison Options"
+      DisplayName="Verbose"
+      Description="Write an extra output file containing verbose descriptions of the parser states and what is done for each type of lookahead token in that state. (--verbose)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Understanding.html#Understanding"
+      Switch="verbose" />
+
+    <BoolProperty
+      Name="NoLines"
+      Category="Bison Options"
+      DisplayName="No lines"
+      Description="Don’t put any #line preprocessor commands in the parser implementation file. (--no-lines)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      Switch="no-lines" />
+
+    <StringListProperty
+      Name="FilePrefix"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="File Prefix"
+      Description="Pretend that %file-prefix was specified, i.e., specify prefix to use for all Bison output file names. --file-prefix=prefix"
+      Switch="file-prefix=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="GraphFile"
+      Category="Bison Options"
+      Subtype="file"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Graph File"
+      Description="Output a graphical representation of the parser’s automaton computed by Bison, in Graphviz DOT format. --graph=file"
+      Switch="graph=&quot;[value]&quot;"
+      />
+
+    <EnumProperty
+      Name="Warnings"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Warnings"
+      Description="Output warnings falling in category. (--warnings=category)">
+
+      <EnumValue
+        Name="midrule-values"
+        DisplayName="midrule-values"
+        Switch="warnings=midrule-values"/>
+      <EnumValue
+        Name="yacc"
+        DisplayName="yacc"
+        Switch="warnings=yacc"/>
+      <EnumValue
+        Name="conflicts-sr"
+        DisplayName="conflicts-sr"
+        Switch="warnings=conflicts-sr"/>
+      <EnumValue
+        Name="conflicts-rr"
+        DisplayName="conflicts-rr"
+        Switch="warnings=conflicts-rr"/>
+      <EnumValue
+        Name="other"
+        DisplayName="other"
+        Switch="warnings=other"/>
+      <EnumValue
+        Name="all"
+        DisplayName="all"
+        Switch="warnings=all"/>
+      <EnumValue
+        Name="none"
+        DisplayName="none"
+        Switch="warnings=none"/>
+      <EnumValue
+        Name="error"
+        DisplayName="error"
+        Switch="warnings=error"/>
+    </EnumProperty>
+
+    <EnumProperty
+      Name="Report"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Report"
+      Description="Write an extra output file containing verbose description of the comma separated list of things. (--report=things)">
+      
+      <EnumValue
+        Name="state"
+        DisplayName="state"
+        Switch="report=state"/>
+      <EnumValue
+        Name="itemset"
+        DisplayName="itemset"
+        Switch="report=itemset"/>
+      <EnumValue
+        Name="lookahead"
+        DisplayName="lookahead"
+        Switch="report=lookahead"/>
+      <EnumValue
+        Name="solved"
+        DisplayName="solved"
+        Switch="report=solved"/>
+      <EnumValue
+        Name="all"
+        DisplayName="all"
+        Switch="report=all"/>
+      <EnumValue
+        Name="none"
+        DisplayName="none"
+        Switch="report=none"/>
+    </EnumProperty>
+
+    <StringListProperty
+      Name="ReportFile"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Report File Name"
+      Description="Specify the file for the verbose description. --report-file=value"
+      Switch="report-file=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="Inputs"
+      Category="Command Line"
+      IsRequired="true"
+      Switch=" ">
+      <StringListProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType="Bison"
+          SourceType="Item" />
+      </StringListProperty.DataSource>
+    </StringListProperty>
+    <StringProperty
+      Name="CommandLineTemplate"
+      DisplayName="Command Line"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <DynamicEnumProperty
+      Name="BisonBeforeTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute Before</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^BisonBeforeTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <DynamicEnumProperty
+      Name="BisonAfterTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute After</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^BisonAfterTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType=""
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <StringListProperty
+      Name="Outputs"
+      DisplayName="Outputs"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringProperty
+      Name="ExecutionDescription"
+      DisplayName="Execution Description"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringListProperty
+      Name="AdditionalDependencies"
+      DisplayName="Additional Dependencies"
+      IncludeInCommandLine="False"
+      Visible="false" />
+    <StringProperty
+      Subtype="AdditionalOptions"
+      Name="AdditionalOptions"
+      Category="Command Line">
+      <StringProperty.DisplayName>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.DisplayName>
+      <StringProperty.Description>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.Description>
+    </StringProperty>
+  </Rule>
+  <ItemType
+    Name="Bison"
+    DisplayName="Bison files" />
+  <FileExtension
+    Name="*.y"
+    ContentType="Bison" />
+  <ContentType
+    Name="Bison"
+    DisplayName="Bison files"
+    ItemType="Bison" />
+  </ProjectSchemaDefinitions>

+ 43 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.props

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup
+    Condition="'$(BisonBeforeTargets)' == '' and '$(BisonAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
+    <BisonBeforeTargets>Midl</BisonBeforeTargets>
+    <BisonAfterTargets>CustomBuild</BisonAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup>
+    <BisonDependsOn
+      Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(BisonDependsOn)</BisonDependsOn>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <Bison>
+      <OutputFile>%(Filename).tab.cpp</OutputFile>
+      <DefinesFile>%(Filename).tab.h</DefinesFile>
+      <CommandLineTemplate>
+start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
+exit /b %errorlevel%</CommandLineTemplate>
+      <Outputs>%(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile);</Outputs>
+      <ExecutionDescription>Process "%(Filename)%(Extension)" bison file</ExecutionDescription>
+    </Bison>
+  </ItemDefinitionGroup>
+  <PropertyGroup
+    Condition="'$(FlexBeforeTargets)' == '' and '$(FlexAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
+    <FlexBeforeTargets>Midl</FlexBeforeTargets>
+    <FlexAfterTargets>CustomBuild</FlexAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup>
+    <FlexDependsOn
+      Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(FlexDependsOn)</FlexDependsOn>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <Flex>
+      <OutputFile>%(Filename).flex.cpp</OutputFile>
+      <Wincompat>true</Wincompat>
+      <CommandLineTemplate>
+start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
+exit /b %errorlevel%</CommandLineTemplate>
+      <Outputs>%(RootDir)%(Directory)%(OutputFile);</Outputs>
+      <ExecutionDescription>Process "%(Filename)%(Extension)" flex file</ExecutionDescription>
+    </Flex>
+  </ItemDefinitionGroup>
+</Project>

+ 178 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.targets

@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <PropertyPageSchema
+      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
+    <AvailableItemName
+      Include="Bison">
+      <Targets>BisonTarget</Targets>
+    </AvailableItemName>
+    <AvailableItemName
+      Include="Flex">
+      <Targets>FlexTarget</Targets>
+    </AvailableItemName>
+  </ItemGroup>
+  <UsingTask
+    TaskName="Bison"
+    TaskFactory="XamlTaskFactory"
+    AssemblyName="Microsoft.Build.Tasks.v4.0">
+    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
+  </UsingTask>
+  <UsingTask
+    TaskName="Flex"
+    TaskFactory="XamlTaskFactory"
+    AssemblyName="Microsoft.Build.Tasks.v4.0">
+    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
+  </UsingTask>
+  <Target
+    Name="BisonTarget"
+    BeforeTargets="$(BisonBeforeTargets)"
+    AfterTargets="$(BisonAfterTargets)"
+    Condition="'@(Bison)' != ''"
+    DependsOnTargets="$(BisonDependsOn);ComputeBisonOutput"
+    Outputs="%(Bison.Outputs)"
+    Inputs="%(Bison.Identity);%(Bison.AdditionalDependencies);$(MSBuildProjectFile)">
+    <ItemGroup
+      Condition="'@(SelectedFiles)' != ''">
+      <Bison
+        Remove="@(Bison)"
+        Condition="'%(Identity)' != '@(SelectedFiles)'" />
+    </ItemGroup>
+    <ItemGroup>
+      <Bison_tlog
+        Include="%(Bison.Outputs)"
+        Condition="'%(Bison.Outputs)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'">
+        <Source>@(Bison, '|')</Source>
+      </Bison_tlog>
+    </ItemGroup>
+    <Message
+      Importance="High"
+      Text="%(Bison.ExecutionDescription)" />
+    <WriteLinesToFile
+      Condition="'@(Bison_tlog)' != '' and '%(Bison_tlog.ExcludedFromBuild)' != 'true'"
+      File="$(IntDir)$(ProjectName).write.1.tlog"
+      Lines="^%(Bison_tlog.Source);@(Bison_tlog-&gt;'%(Fullpath)')" />
+    <Bison
+      Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
+      CommandLineTemplate="%(Bison.CommandLineTemplate)"
+      OutputFile="%(Bison.OutputFile)"
+      DefinesFile="%(Bison.DefinesFile)"
+      Debug="%(Bison.Debug)"
+      Verbose="%(Bison.Verbose)"
+      NoLines="%(Bison.NoLines)"
+      FilePrefix="%(Bison.FilePrefix)"
+      GraphFile="%(Bison.GraphFile)"
+      Warnings="%(Bison.Warnings)"
+      Report="%(Bison.Report)"
+      ReportFile="%(Bison.ReportFile)"
+      AdditionalOptions="%(Bison.AdditionalOptions)"
+      Inputs="%(Bison.Identity)" />
+  </Target>
+  <PropertyGroup>
+    <ComputeLinkInputsTargets>
+            $(ComputeLinkInputsTargets);
+            ComputeBisonOutput;
+          </ComputeLinkInputsTargets>
+    <ComputeLibInputsTargets>
+            $(ComputeLibInputsTargets);
+            ComputeBisonOutput;
+          </ComputeLibInputsTargets>
+  </PropertyGroup>
+  <Target
+    Name="ComputeBisonOutput"
+    Condition="'@(Bison)' != ''">
+    <ItemGroup>
+      <BisonDirsToMake
+        Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
+        Include="%(Bison.Outputs)" />
+      <Link
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <Lib
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <ImpLib
+        Include="%(BisonDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+    </ItemGroup>
+    <MakeDir
+      Directories="@(BisonDirsToMake-&gt;'%(RootDir)%(Directory)')" />
+  </Target>
+  <Target
+    Name="FlexTarget"
+    BeforeTargets="$(FlexBeforeTargets)"
+    AfterTargets="$(FlexAfterTargets)"
+    Condition="'@(Flex)' != ''"
+    DependsOnTargets="$(FlexDependsOn);ComputeFlexOutput"
+    Outputs="%(Flex.Outputs)"
+    Inputs="%(Flex.Identity);%(Flex.AdditionalDependencies);$(MSBuildProjectFile)">
+    <ItemGroup
+      Condition="'@(SelectedFiles)' != ''">
+      <Flex
+        Remove="@(Flex)"
+        Condition="'%(Identity)' != '@(SelectedFiles)'" />
+    </ItemGroup>
+    <ItemGroup>
+      <Flex_tlog
+        Include="%(Flex.Outputs)"
+        Condition="'%(Flex.Outputs)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'">
+        <Source>@(Flex, '|')</Source>
+      </Flex_tlog>
+    </ItemGroup>
+    <Message
+      Importance="High"
+      Text="%(Flex.ExecutionDescription)" />
+    <WriteLinesToFile
+      Condition="'@(Flex_tlog)' != '' and '%(Flex_tlog.ExcludedFromBuild)' != 'true'"
+      File="$(IntDir)$(ProjectName).write.1.tlog"
+      Lines="^%(Flex_tlog.Source);@(Flex_tlog-&gt;'%(Fullpath)')" />
+    <Flex
+      Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
+      CommandLineTemplate="%(Flex.CommandLineTemplate)"
+      OutputFile="%(Flex.OutputFile)"
+      HeaderFile="%(Flex.HeaderFile)"
+      Prefix="%(Flex.Prefix)"
+      Wincompat="%(Flex.Wincompat)"
+      CaseInsensitive="%(Flex.CaseInsensitive)"
+      LexCompat="%(Flex.LexCompat)"
+      Stack="%(Flex.Stack)"
+      BisonBridge="%(Flex.BisonBridge)"
+      Noline="%(Flex.Noline)"
+      Reentrant="%(Flex.Reentrant)"
+      Cpp="%(Flex.Cpp)"
+      CppClassName="%(Flex.CppClassName)"
+      Debug="%(Flex.Debug)"
+      AdditionalOptions="%(Flex.AdditionalOptions)"
+      Inputs="%(Flex.Identity)" />
+  </Target>
+  <PropertyGroup>
+    <ComputeLinkInputsTargets>
+            $(ComputeLinkInputsTargets);
+            ComputeFlexOutput;
+          </ComputeLinkInputsTargets>
+    <ComputeLibInputsTargets>
+            $(ComputeLibInputsTargets);
+            ComputeFlexOutput;
+          </ComputeLibInputsTargets>
+  </PropertyGroup>
+  <Target
+    Name="ComputeFlexOutput"
+    Condition="'@(Flex)' != ''">
+    <ItemGroup>
+      <FlexDirsToMake
+        Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
+        Include="%(Flex.Outputs)" />
+      <Link
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <Lib
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <ImpLib
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+    </ItemGroup>
+    <MakeDir
+      Directories="@(FlexDirsToMake-&gt;'%(RootDir)%(Directory)')" />
+  </Target>
+</Project>

+ 521 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.xml

@@ -0,0 +1,521 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
+  <Rule
+    Name="Bison"
+    PageTemplate="tool"
+    DisplayName="Bison files"
+    SwitchPrefix="--"
+    Order="200">
+    <Rule.DataSource>
+      <DataSource
+        Persistence="ProjectFile"
+        ItemType="Bison" />
+    </Rule.DataSource>
+    <Rule.Categories>
+      <Category
+        Name="General">
+        <Category.DisplayName>
+          <sys:String>General</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Bison Options">
+        <Category.DisplayName>
+          <sys:String>Bison Options</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Command Line"
+        Subtype="CommandLine">
+        <Category.DisplayName>
+          <sys:String>Command Line</sys:String>
+        </Category.DisplayName>
+      </Category>
+    </Rule.Categories>
+
+    <StringListProperty
+      Name="OutputFile"
+      Category="Bison Options"
+      IsRequired="true"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Output File Name"
+      Description="Specify the file for the parser implementation file. --output=value"
+      Switch="output=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="DefinesFile"
+      Category="Bison Options"
+      Subtype="file"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Defines File Name"
+      Description="Pretend that %defines was specified, i.e., write an extra output file containing macro definitions for the token type names defined in the grammar, as well as a few other declarations. --defines=value"
+      Switch="defines=&quot;[value]&quot;"
+      />
+    
+    <BoolProperty
+      Name="Debug"
+      Category="Bison Options"
+      DisplayName="Debug"
+      Description="In the parser implementation file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled. (--debug)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html#Enabling-Traces"
+      Switch="debug" />
+    
+    <BoolProperty
+      Name="Verbose"
+      Category="Bison Options"
+      DisplayName="Verbose"
+      Description="Write an extra output file containing verbose descriptions of the parser states and what is done for each type of lookahead token in that state. (--verbose)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Understanding.html#Understanding"
+      Switch="verbose" />
+
+    <BoolProperty
+      Name="NoLines"
+      Category="Bison Options"
+      DisplayName="No lines"
+      Description="Don’t put any #line preprocessor commands in the parser implementation file. (--no-lines)"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      Switch="no-lines" />
+
+    <StringListProperty
+      Name="FilePrefix"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="File Prefix"
+      Description="Pretend that %file-prefix was specified, i.e., specify prefix to use for all Bison output file names. --file-prefix=prefix"
+      Switch="file-prefix=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="GraphFile"
+      Category="Bison Options"
+      Subtype="file"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Graph File"
+      Description="Output a graphical representation of the parser’s automaton computed by Bison, in Graphviz DOT format. --graph=file"
+      Switch="graph=&quot;[value]&quot;"
+      />
+
+    <EnumProperty
+      Name="Warnings"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Warnings"
+      Description="Output warnings falling in category. (--warnings=category)">
+
+      <EnumValue
+        Name="midrule-values"
+        DisplayName="midrule-values"
+        Switch="warnings=midrule-values"/>
+      <EnumValue
+        Name="yacc"
+        DisplayName="yacc"
+        Switch="warnings=yacc"/>
+      <EnumValue
+        Name="conflicts-sr"
+        DisplayName="conflicts-sr"
+        Switch="warnings=conflicts-sr"/>
+      <EnumValue
+        Name="conflicts-rr"
+        DisplayName="conflicts-rr"
+        Switch="warnings=conflicts-rr"/>
+      <EnumValue
+        Name="other"
+        DisplayName="other"
+        Switch="warnings=other"/>
+      <EnumValue
+        Name="all"
+        DisplayName="all"
+        Switch="warnings=all"/>
+      <EnumValue
+        Name="none"
+        DisplayName="none"
+        Switch="warnings=none"/>
+      <EnumValue
+        Name="error"
+        DisplayName="error"
+        Switch="warnings=error"/>
+    </EnumProperty>
+
+    <EnumProperty
+      Name="Report"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Report"
+      Description="Write an extra output file containing verbose description of the comma separated list of things. (--report=things)">
+      
+      <EnumValue
+        Name="state"
+        DisplayName="state"
+        Switch="report=state"/>
+      <EnumValue
+        Name="itemset"
+        DisplayName="itemset"
+        Switch="report=itemset"/>
+      <EnumValue
+        Name="lookahead"
+        DisplayName="lookahead"
+        Switch="report=lookahead"/>
+      <EnumValue
+        Name="solved"
+        DisplayName="solved"
+        Switch="report=solved"/>
+      <EnumValue
+        Name="all"
+        DisplayName="all"
+        Switch="report=all"/>
+      <EnumValue
+        Name="none"
+        DisplayName="none"
+        Switch="report=none"/>
+    </EnumProperty>
+
+    <StringListProperty
+      Name="ReportFile"
+      Category="Bison Options"
+      HelpUrl="https://www.gnu.org/software/bison/manual/html_node/Bison-Options.html#Bison-Options"
+      DisplayName="Report File Name"
+      Description="Specify the file for the verbose description. --report-file=value"
+      Switch="report-file=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="Inputs"
+      Category="Command Line"
+      IsRequired="true"
+      Switch=" ">
+      <StringListProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType="Bison"
+          SourceType="Item" />
+      </StringListProperty.DataSource>
+    </StringListProperty>
+    <StringProperty
+      Name="CommandLineTemplate"
+      DisplayName="Command Line"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <DynamicEnumProperty
+      Name="BisonBeforeTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute Before</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^BisonBeforeTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <DynamicEnumProperty
+      Name="BisonAfterTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute After</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^BisonAfterTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType=""
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <StringListProperty
+      Name="Outputs"
+      DisplayName="Outputs"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringProperty
+      Name="ExecutionDescription"
+      DisplayName="Execution Description"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringListProperty
+      Name="AdditionalDependencies"
+      DisplayName="Additional Dependencies"
+      IncludeInCommandLine="False"
+      Visible="false" />
+    <StringProperty
+      Subtype="AdditionalOptions"
+      Name="AdditionalOptions"
+      Category="Command Line">
+      <StringProperty.DisplayName>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.DisplayName>
+      <StringProperty.Description>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.Description>
+    </StringProperty>
+  </Rule>
+  <ItemType
+    Name="Bison"
+    DisplayName="Bison files" />
+  <FileExtension
+    Name="*.y"
+    ContentType="Bison" />
+  <ContentType
+    Name="Bison"
+    DisplayName="Bison files"
+    ItemType="Bison" />
+  <Rule
+    Name="Flex"
+    PageTemplate="tool"
+    DisplayName="Flex files"
+    SwitchPrefix="--"
+    Order="200">
+    <Rule.DataSource>
+      <DataSource
+        Persistence="ProjectFile"
+        ItemType="Flex" />
+    </Rule.DataSource>
+    <Rule.Categories>
+      <Category
+        Name="General">
+        <Category.DisplayName>
+          <sys:String>General</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Flex Options">
+        <Category.DisplayName>
+          <sys:String>Flex Options</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Command Line"
+        Subtype="CommandLine">
+        <Category.DisplayName>
+          <sys:String>Command Line</sys:String>
+        </Category.DisplayName>
+      </Category>
+    </Rule.Categories>
+
+    <StringListProperty
+      Name="OutputFile"
+      Category="Flex Options"
+      IsRequired="true"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Output File Name"
+      Description="Directs flex to write the scanner to the file ‘FILE’ instead of ‘lex.yy.c’. --outfile=value"
+      Switch="outfile=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="HeaderFile"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Header File Name"
+      Description="Instructs flex to write a C header to ‘FILE’. This file contains function prototypes, extern variables, and types used by the scanner. Only the external API is exported by the header file.         (--header-file=value)"
+      Switch="header-file=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="Prefix"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Prefix"
+      Description="Changes the default ‘yy’ prefix used by flex for all globally-visible variable and function names to instead be ‘PREFIX’. For example, ‘--prefix=foo’ changes the name of yytext to footext. It also changes the name of the default output file from lex.yy.c to lex.foo.c.         (--prefix=value)"
+      Switch="prefix=&quot;[value]&quot;"
+      />
+
+	  <BoolProperty
+      Name="Wincompat"
+      Category="Flex Options"
+      DisplayName="Windows compatibility mode"
+      Description="This option changes 'unistd.h' unix header with windows analog 'io.h' and replaces isatty/fileno functions to safe windows analogs _isatty/_fileno.            (--wincompat)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="wincompat" />
+
+  <BoolProperty
+      Name="CaseInsensitive"
+      Category="Flex Options"
+      DisplayName="Case-insensitive mode"
+      Description="Instructs flex to generate a case-insensitive scanner. The case of letters given in the flex input patterns will be ignored, and tokens in the input will be matched regardless of case. The matched text given in yytext will have the preserved case (i.e., it will not be folded).            (--case-insensitive)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="case-insensitive" />
+
+    <BoolProperty
+      Name="LexCompat"
+      Category="Flex Options"
+      DisplayName="Lex-compatibility mode"
+      Description="Turns on maximum compatibility with the original AT&amp;T lex implementation. Note that this does not mean full compatibility. Use of this option costs a considerable amount of performance, and it cannot be used with the ‘--c++’, ‘--full’, ‘--fast’, ‘-Cf’, or ‘-CF’ options.            (--lex-compat)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="lex-compat" />
+
+    <BoolProperty
+      Name="Stack"
+      Category="Flex Options"
+      DisplayName="Start Condition Stacks"
+      Description="Enables the use of start condition stacks.            (--stack)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="stack" />
+
+    <BoolProperty
+      Name="BisonBridge"
+      Category="Flex Options"
+      DisplayName="Bison Bridge Mode"
+      Description="Instructs flex to generate a C scanner that is meant to be called by a GNU bison parser. The scanner has minor API changes for bison compatibility. In particular, the declaration of yylex is modified to take an additional parameter, yylval.            (--bison-bridge)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="bison-bridge" />
+
+    <BoolProperty
+      Name="Noline"
+      Category="Flex Options"
+      DisplayName="No #line Directives"
+      Description="Instructs flex not to generate #line directives.            (--noline)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="noline" />
+
+    <BoolProperty
+       Name="Reentrant"
+       Category="Flex Options"
+       DisplayName="Generate Reentrant Scanner"
+       Description="Instructs flex to generate a reentrant C scanner. The generated scanner may safely be used in a multi-threaded environment. The API for a reentrant scanner is different than for a non-reentrant scanner.            (--reentrant)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="reentrant" />
+
+    <BoolProperty
+       Name="Cpp"
+       Category="Flex Options"
+       DisplayName="Generate C++ Scanner"
+       Description="Specifies that you want flex to generate a C++ scanner class.           (--c++)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="c++" />
+
+    <StringListProperty
+      Name="CppClassName"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="C++ Class Name"
+      Description="Only applies when generating a C++ scanner (the ‘--c++’ option). It informs flex that you have derived NAME as a subclass of yyFlexLexer, so flex will place your actions in the member function foo::yylex() instead of yyFlexLexer::yylex(). It also generates a yyFlexLexer::yylex() member function that emits a run-time error (by invoking yyFlexLexer::LexerError()) if called.         (--yyclass=value)"
+      Switch="yyclass=&quot;[value]&quot;" />
+
+	   <BoolProperty
+       Name="Debug"
+       Category="Flex Options"
+       DisplayName="Debug Mode"
+       Description="Makes the generated scanner run in debug mode. Whenever a pattern is recognized and the global variable yy_flex_debug is non-zero (which is the default), the scanner will write to ‘stderr’ a line of the form: -accepting rule at line 53 ('the matched text').           (--debug)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="debug" />
+
+    <StringListProperty
+      Name="Inputs"
+      Category="Command Line"
+      IsRequired="true"
+      Switch=" ">
+      <StringListProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType="Flex"
+          SourceType="Item" />
+      </StringListProperty.DataSource>
+    </StringListProperty>
+    <StringProperty
+      Name="CommandLineTemplate"
+      DisplayName="Command Line"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <DynamicEnumProperty
+      Name="FlexBeforeTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute Before</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^FlexBeforeTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <DynamicEnumProperty
+      Name="FlexAfterTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute After</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^FlexAfterTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType=""
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <StringListProperty
+      Name="Outputs"
+      DisplayName="Outputs"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringProperty
+      Name="ExecutionDescription"
+      DisplayName="Execution Description"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringListProperty
+      Name="AdditionalDependencies"
+      DisplayName="Additional Dependencies"
+      IncludeInCommandLine="False"
+      Visible="false" />
+    <StringProperty
+      Subtype="AdditionalOptions"
+      Name="AdditionalOptions"
+      Category="Command Line">
+      <StringProperty.DisplayName>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.DisplayName>
+      <StringProperty.Description>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.Description>
+    </StringProperty>
+  </Rule>
+  <ItemType
+    Name="Flex"
+    DisplayName="Flex files" />
+  <FileExtension
+    Name="*.l"
+    ContentType="Flex" />
+  <ContentType
+    Name="Flex"
+    DisplayName="Flex files"
+    ItemType="Flex" />
+  </ProjectSchemaDefinitions>

+ 23 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.props

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup
+    Condition="'$(FlexBeforeTargets)' == '' and '$(FlexAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
+    <FlexBeforeTargets>Midl</FlexBeforeTargets>
+    <FlexAfterTargets>CustomBuild</FlexAfterTargets>
+  </PropertyGroup>
+  <PropertyGroup>
+    <FlexDependsOn
+      Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(FlexDependsOn)</FlexDependsOn>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <Flex>
+      <OutputFile>%(Filename).flex.cpp</OutputFile>
+      <Wincompat>true</Wincompat>
+      <CommandLineTemplate>
+start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
+exit /b %errorlevel%</CommandLineTemplate>
+      <Outputs>%(RootDir)%(Directory)%(OutputFile);</Outputs>
+      <ExecutionDescription>Process "%(Filename)%(Extension)" flex file</ExecutionDescription>
+    </Flex>
+  </ItemDefinitionGroup>
+</Project>

+ 94 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.targets

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <PropertyPageSchema
+      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
+    <AvailableItemName
+      Include="Flex">
+      <Targets>FlexTarget</Targets>
+    </AvailableItemName>
+  </ItemGroup>
+  <UsingTask
+    TaskName="Flex"
+    TaskFactory="XamlTaskFactory"
+    AssemblyName="Microsoft.Build.Tasks.v4.0">
+    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
+  </UsingTask>
+  <Target
+    Name="FlexTarget"
+    BeforeTargets="$(FlexBeforeTargets)"
+    AfterTargets="$(FlexAfterTargets)"
+    Condition="'@(Flex)' != ''"
+    DependsOnTargets="$(FlexDependsOn);ComputeFlexOutput"
+    Outputs="%(Flex.Outputs)"
+    Inputs="%(Flex.Identity);%(Flex.AdditionalDependencies);$(MSBuildProjectFile)">
+    <ItemGroup
+      Condition="'@(SelectedFiles)' != ''">
+      <Flex
+        Remove="@(Flex)"
+        Condition="'%(Identity)' != '@(SelectedFiles)'" />
+    </ItemGroup>
+    <ItemGroup>
+      <Flex_tlog
+        Include="%(Flex.Outputs)"
+        Condition="'%(Flex.Outputs)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'">
+        <Source>@(Flex, '|')</Source>
+      </Flex_tlog>
+    </ItemGroup>
+    <Message
+      Importance="High"
+      Text="%(Flex.ExecutionDescription)" />
+    <WriteLinesToFile
+      Condition="'@(Flex_tlog)' != '' and '%(Flex_tlog.ExcludedFromBuild)' != 'true'"
+      File="$(IntDir)$(ProjectName).write.1.tlog"
+      Lines="^%(Flex_tlog.Source);@(Flex_tlog-&gt;'%(Fullpath)')" />
+    <Flex
+      Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
+      CommandLineTemplate="%(Flex.CommandLineTemplate)"
+      OutputFile="%(Flex.OutputFile)"
+      HeaderFile="%(Flex.HeaderFile)"
+      Prefix="%(Flex.Prefix)"
+      Wincompat="%(Flex.Wincompat)"
+      CaseInsensitive="%(Flex.CaseInsensitive)"
+      LexCompat="%(Flex.LexCompat)"
+      Stack="%(Flex.Stack)"
+      BisonBridge="%(Flex.BisonBridge)"
+      Noline="%(Flex.Noline)"
+      Reentrant="%(Flex.Reentrant)"
+      Cpp="%(Flex.Cpp)"
+      CppClassName="%(Flex.CppClassName)"
+      Debug="%(Flex.Debug)"
+      AdditionalOptions="%(Flex.AdditionalOptions)"
+      Inputs="%(Flex.Identity)" />
+  </Target>
+  <PropertyGroup>
+    <ComputeLinkInputsTargets>
+            $(ComputeLinkInputsTargets);
+            ComputeFlexOutput;
+          </ComputeLinkInputsTargets>
+    <ComputeLibInputsTargets>
+            $(ComputeLibInputsTargets);
+            ComputeFlexOutput;
+          </ComputeLibInputsTargets>
+  </PropertyGroup>
+  <Target
+    Name="ComputeFlexOutput"
+    Condition="'@(Flex)' != ''">
+    <ItemGroup>
+      <FlexDirsToMake
+        Condition="'@(Flex)' != '' and '%(Flex.ExcludedFromBuild)' != 'true'"
+        Include="%(Flex.Outputs)" />
+      <Link
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <Lib
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+      <ImpLib
+        Include="%(FlexDirsToMake.Identity)"
+        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
+    </ItemGroup>
+    <MakeDir
+      Directories="@(FlexDirsToMake-&gt;'%(RootDir)%(Directory)')" />
+  </Target>
+</Project>

+ 243 - 0
Engine/bin/bison-flex/custom_build_rules/win_flex_only/win_flex_custom_build.xml

@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
+  <Rule
+    Name="Flex"
+    PageTemplate="tool"
+    DisplayName="Flex files"
+    SwitchPrefix="--"
+    Order="200">
+    <Rule.DataSource>
+      <DataSource
+        Persistence="ProjectFile"
+        ItemType="Flex" />
+    </Rule.DataSource>
+    <Rule.Categories>
+      <Category
+        Name="General">
+        <Category.DisplayName>
+          <sys:String>General</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Flex Options">
+        <Category.DisplayName>
+          <sys:String>Flex Options</sys:String>
+        </Category.DisplayName>
+      </Category>
+      <Category
+        Name="Command Line"
+        Subtype="CommandLine">
+        <Category.DisplayName>
+          <sys:String>Command Line</sys:String>
+        </Category.DisplayName>
+      </Category>
+    </Rule.Categories>
+
+    <StringListProperty
+      Name="OutputFile"
+      Category="Flex Options"
+      IsRequired="true"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Output File Name"
+      Description="Directs flex to write the scanner to the file ‘FILE’ instead of ‘lex.yy.c’. --outfile=value"
+      Switch="outfile=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="HeaderFile"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Header File Name"
+      Description="Instructs flex to write a C header to ‘FILE’. This file contains function prototypes, extern variables, and types used by the scanner. Only the external API is exported by the header file.         (--header-file=value)"
+      Switch="header-file=&quot;[value]&quot;"
+      />
+
+    <StringListProperty
+      Name="Prefix"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="Prefix"
+      Description="Changes the default ‘yy’ prefix used by flex for all globally-visible variable and function names to instead be ‘PREFIX’. For example, ‘--prefix=foo’ changes the name of yytext to footext. It also changes the name of the default output file from lex.yy.c to lex.foo.c.         (--prefix=value)"
+      Switch="prefix=&quot;[value]&quot;"
+      />
+
+	  <BoolProperty
+      Name="Wincompat"
+      Category="Flex Options"
+      DisplayName="Windows compatibility mode"
+      Description="This option changes 'unistd.h' unix header with windows analog 'io.h' and replaces isatty/fileno functions to safe windows analogs _isatty/_fileno.            (--wincompat)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="wincompat" />
+
+  <BoolProperty
+      Name="CaseInsensitive"
+      Category="Flex Options"
+      DisplayName="Case-insensitive mode"
+      Description="Instructs flex to generate a case-insensitive scanner. The case of letters given in the flex input patterns will be ignored, and tokens in the input will be matched regardless of case. The matched text given in yytext will have the preserved case (i.e., it will not be folded).            (--case-insensitive)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="case-insensitive" />
+
+    <BoolProperty
+      Name="LexCompat"
+      Category="Flex Options"
+      DisplayName="Lex-compatibility mode"
+      Description="Turns on maximum compatibility with the original AT&amp;T lex implementation. Note that this does not mean full compatibility. Use of this option costs a considerable amount of performance, and it cannot be used with the ‘--c++’, ‘--full’, ‘--fast’, ‘-Cf’, or ‘-CF’ options.            (--lex-compat)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="lex-compat" />
+
+    <BoolProperty
+      Name="Stack"
+      Category="Flex Options"
+      DisplayName="Start Condition Stacks"
+      Description="Enables the use of start condition stacks.            (--stack)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="stack" />
+
+    <BoolProperty
+      Name="BisonBridge"
+      Category="Flex Options"
+      DisplayName="Bison Bridge Mode"
+      Description="Instructs flex to generate a C scanner that is meant to be called by a GNU bison parser. The scanner has minor API changes for bison compatibility. In particular, the declaration of yylex is modified to take an additional parameter, yylval.            (--bison-bridge)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="bison-bridge" />
+
+    <BoolProperty
+      Name="Noline"
+      Category="Flex Options"
+      DisplayName="No #line Directives"
+      Description="Instructs flex not to generate #line directives.            (--noline)"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      Switch="noline" />
+
+    <BoolProperty
+       Name="Reentrant"
+       Category="Flex Options"
+       DisplayName="Generate Reentrant Scanner"
+       Description="Instructs flex to generate a reentrant C scanner. The generated scanner may safely be used in a multi-threaded environment. The API for a reentrant scanner is different than for a non-reentrant scanner.            (--reentrant)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="reentrant" />
+
+    <BoolProperty
+       Name="Cpp"
+       Category="Flex Options"
+       DisplayName="Generate C++ Scanner"
+       Description="Specifies that you want flex to generate a C++ scanner class.           (--c++)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="c++" />
+
+    <StringListProperty
+      Name="CppClassName"
+      Category="Flex Options"
+      HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+      DisplayName="C++ Class Name"
+      Description="Only applies when generating a C++ scanner (the ‘--c++’ option). It informs flex that you have derived NAME as a subclass of yyFlexLexer, so flex will place your actions in the member function foo::yylex() instead of yyFlexLexer::yylex(). It also generates a yyFlexLexer::yylex() member function that emits a run-time error (by invoking yyFlexLexer::LexerError()) if called.         (--yyclass=value)"
+      Switch="yyclass=&quot;[value]&quot;" />
+
+	   <BoolProperty
+       Name="Debug"
+       Category="Flex Options"
+       DisplayName="Debug Mode"
+       Description="Makes the generated scanner run in debug mode. Whenever a pattern is recognized and the global variable yy_flex_debug is non-zero (which is the default), the scanner will write to ‘stderr’ a line of the form: -accepting rule at line 53 ('the matched text').           (--debug)"
+       HelpUrl="https://westes.github.io/flex/manual/Scanner-Options.html#Scanner-Options"
+       Switch="debug" />
+
+    <StringListProperty
+      Name="Inputs"
+      Category="Command Line"
+      IsRequired="true"
+      Switch=" ">
+      <StringListProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType="Flex"
+          SourceType="Item" />
+      </StringListProperty.DataSource>
+    </StringListProperty>
+    <StringProperty
+      Name="CommandLineTemplate"
+      DisplayName="Command Line"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <DynamicEnumProperty
+      Name="FlexBeforeTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute Before</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^FlexBeforeTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <DynamicEnumProperty
+      Name="FlexAfterTargets"
+      Category="General"
+      EnumProvider="Targets"
+      IncludeInCommandLine="False">
+      <DynamicEnumProperty.DisplayName>
+        <sys:String>Execute After</sys:String>
+      </DynamicEnumProperty.DisplayName>
+      <DynamicEnumProperty.Description>
+        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
+      </DynamicEnumProperty.Description>
+      <DynamicEnumProperty.ProviderSettings>
+        <NameValuePair
+          Name="Exclude"
+          Value="^FlexAfterTargets|^Compute" />
+      </DynamicEnumProperty.ProviderSettings>
+      <DynamicEnumProperty.DataSource>
+        <DataSource
+          Persistence="ProjectFile"
+          ItemType=""
+          HasConfigurationCondition="true" />
+      </DynamicEnumProperty.DataSource>
+    </DynamicEnumProperty>
+    <StringListProperty
+      Name="Outputs"
+      DisplayName="Outputs"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringProperty
+      Name="ExecutionDescription"
+      DisplayName="Execution Description"
+      Visible="False"
+      IncludeInCommandLine="False" />
+    <StringListProperty
+      Name="AdditionalDependencies"
+      DisplayName="Additional Dependencies"
+      IncludeInCommandLine="False"
+      Visible="false" />
+    <StringProperty
+      Subtype="AdditionalOptions"
+      Name="AdditionalOptions"
+      Category="Command Line">
+      <StringProperty.DisplayName>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.DisplayName>
+      <StringProperty.Description>
+        <sys:String>Additional Options</sys:String>
+      </StringProperty.Description>
+    </StringProperty>
+  </Rule>
+  <ItemType
+    Name="Flex"
+    DisplayName="Flex files" />
+  <FileExtension
+    Name="*.l"
+    ContentType="Flex" />
+  <ContentType
+    Name="Flex"
+    DisplayName="Flex files"
+    ItemType="Flex" />
+  </ProjectSchemaDefinitions>

+ 227 - 0
Engine/bin/bison-flex/data/README.md

@@ -0,0 +1,227 @@
+This directory contains data needed by Bison.
+
+# Directory Content
+## Skeletons
+Bison skeletons: the general shapes of the different parser kinds, that are
+specialized for specific grammars by the bison program.
+
+Currently, the supported skeletons are:
+
+- yacc.c
+  It used to be named bison.simple: it corresponds to C Yacc
+  compatible LALR(1) parsers.
+
+- lalr1.cc
+  Produces a C++ parser class.
+
+- lalr1.java
+  Produces a Java parser class.
+
+- glr.c
+  A Generalized LR C parser based on Bison's LALR(1) tables.
+
+- glr.cc
+  A Generalized LR C++ parser.  Actually a C++ wrapper around glr.c.
+
+These skeletons are the only ones supported by the Bison team.  Because the
+interface between skeletons and the bison program is not finished, *we are
+not bound to it*.  In particular, Bison is not mature enough for us to
+consider that "foreign skeletons" are supported.
+
+## m4sugar
+This directory contains M4sugar, sort of an extended library for M4, which
+is used by Bison to instantiate the skeletons.
+
+## xslt
+This directory contains XSLT programs that transform Bison's XML output into
+various formats.
+
+- bison.xsl
+  A library of routines used by the other XSLT programs.
+
+- xml2dot.xsl
+  Conversion into GraphViz's dot format.
+
+- xml2text.xsl
+  Conversion into text.
+
+- xml2xhtml.xsl
+  Conversion into XHTML.
+
+# Implementation Notes About the Skeletons
+
+"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
+executable with LR tables, facts about the symbols, etc. and they generate
+the output (say parser.cc, parser.hh, location.hh, etc.).  They are only in
+charge of generating the parser and its auxiliary files, they do not
+generate the XML output, the parser.output reports, nor the graphical
+rendering.
+
+The bits of information passing from bison to the backend is named
+"muscles".  Muscles are passed to M4 via its standard input: it's a set of
+m4 definitions.  To see them, use `--trace=muscles`.
+
+Except for muscles, whose names are generated by bison, the skeletons have
+no constraint at all on the macro names: there is no technical/theoretical
+limitation, as long as you generate the output, you can do what you want.
+However, of course, that would be a bad idea if, say, the C and C++
+skeletons used different approaches and had completely different
+implementations.  That would be a maintenance nightmare.
+
+Below, we document some of the macros that we use in several of the
+skeletons.  If you are to write a new skeleton, please, implement them for
+your language.  Overall, be sure to follow the same patterns as the existing
+skeletons.
+
+## Vocabulary
+
+We use "formal arguments", or "formals" for short, to denote the declared
+parameters of a function (e.g., `int argc, const char **argv`).  Yes, this
+is somewhat contradictory with `param` in the `%param` directives.
+
+We use "effective arguments", or "args" for short, to denote the values
+passed in function calls (e.g., `argc, argv`).
+
+## Symbols
+
+### `b4_symbol(NUM, FIELD)`
+In order to unify the handling of the various aspects of symbols (tag, type
+name, whether terminal, etc.), bison.exe defines one macro per (token,
+field), where field can `has_id`, `id`, etc.: see
+`prepare_symbol_definitions()` in `src/output.c`.
+
+NUM can be:
+- `empty` to denote the "empty" pseudo-symbol when it exists,
+- `eof`, `error`, or `undef`
+- a symbol number.
+
+FIELD can be:
+
+- `has_id`: 0 or 1
+  Whether the symbol has an `id`.
+
+- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
+  If `has_id`, the name of the token kind (prefixed by api.token.prefix if
+  defined), otherwise empty.  Guaranteed to be usable as a C identifier.
+  This is used to define the token kind (i.e., the enum used by the return
+  value of yylex).  Should be named `token_kind`.
+
+- `tag`: string
+  A human readable representation of the symbol.  Can be `'foo'`,
+  `'foo.id'`, `'"foo"'` etc.
+
+- `code`: integer
+  The token code associated to the token kind `id`.
+  The external number as used by yylex.  Can be ASCII code when a character,
+  some number chosen by bison, or some user number in the case of `%token
+  FOO <NUM>`.  Corresponds to `yychar` in `yacc.c`.
+
+- `is_token`: 0 or 1
+  Whether this is a terminal symbol.
+
+- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
+  The base of the symbol kind, i.e., the enumerator of this symbol (token or
+  nonterminal) which is mapped to its `number`.
+
+- `kind`: string
+  Same as `kind_base`, but possibly with a prefix in some languages.  E.g.,
+  EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
+  `S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
+
+- `number`: integer
+  The code associated to the `kind`.
+  The internal number (computed from the external number by yytranslate).
+  Corresponds to yytoken in yacc.c.  This is the same number that serves as
+  key in b4_symbol(NUM, FIELD).
+
+  In bison, symbols are first assigned increasing numbers in order of
+  appearance (but tokens first, then nterms).  After grammar reduction,
+  unused nterms are then renumbered to appear last (i.e., first tokens, then
+  used nterms and finally unused nterms).  This final number NUM is the one
+  contained in this field, and it is the one used as key in `b4_symbol(NUM,
+  FIELD)`.
+
+  The code of the rule actions, however, is emitted before we know what
+  symbols are unused, so they use the original numbers.  To avoid confusion,
+  they actually use "orig NUM" instead of just "NUM".  bison also emits
+  definitions for `b4_symbol(orig NUM, number)` that map from original
+  numbers to the new ones.  `b4_symbol` actually resolves `orig NUM` in the
+  other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the
+  symbols whose original number was 42.
+
+- `has_type`: 0, 1
+  Whether has a semantic value.
+
+- `type_tag`: string
+  When api.value.type=union, the generated name for the union member.
+  yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
+
+- `type`: string
+  If it has a semantic value, its type tag, or, if variant are used,
+  its type.
+  In the case of api.value.type=union, type is the real type (e.g. int).
+
+- `slot`: string
+  If it has a semantic value, the name of the union member (i.e., bounces to
+  either `type_tag` or `type`).  It would be better to fix our mess and
+  always use `type` for the true type of the member, and `type_tag` for the
+  name of the union member.
+
+- `has_printer`: 0, 1
+- `printer`: string
+- `printer_file`: string
+- `printer_line`: integer
+- `printer_loc`: location
+  If the symbol has a printer, everything about it.
+
+- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`, `destructor_loc`
+  Likewise.
+
+### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])`
+Expansion of $$, $1, $<TYPE-TAG>3, etc.
+
+The semantic value from a given VAL.
+- `VAL`: some semantic value storage (typically a union).  e.g., `yylval`
+- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
+- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
+
+The result can be used safely, it is put in parens to avoid nasty precedence
+issues.
+
+### `b4_lhs_value(SYMBOL-NUM, [TYPE])`
+Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
+
+### `b4_rhs_data(RULE-LENGTH, POS)`
+The data corresponding to the symbol `#POS`, where the current rule has
+`RULE-LENGTH` symbols on RHS.
+
+### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])`
+Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
+on RHS.
+
+<!--
+
+Local Variables:
+mode: markdown
+fill-column: 76
+ispell-dictionary: "american"
+End:
+
+Copyright (C) 2002, 2008-2015, 2018-2021 Free Software Foundation, Inc.
+
+This file is part of GNU Bison.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+-->

+ 61 - 0
Engine/bin/bison-flex/data/bison-default.css

@@ -0,0 +1,61 @@
+/* Default styling rules for Bison when doing terminal output.
+   Copyright (C) 2019-2021 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* This is an experimental feature.  The class names may change in the
+   future.  */
+
+/* Diagnostics.  */
+.warning   { color: purple; }
+.error     { color: red; }
+.note      { color: cyan; }
+
+.fixit-insert { color: green; }
+
+/* Semantic values in Bison's own parser traces.  */
+.value     { color: green; }
+
+/* "Sections" in traces (--trace).  */
+.trace0    { color: green; }
+
+/* Syntax error messages.  */
+.expected   { color: green; }
+.unexpected { color: red; }
+
+
+/* Counterexamples.  */
+
+/* Cex: point in rule.  */
+.cex-dot { color: red; }
+
+/* Cex: coloring various rules.  */
+.cex-0   { color: yellow; }
+.cex-1   { color: green; }
+.cex-2   { color: blue; }
+.cex-3   { color: purple; }
+.cex-4   { color: violet; }
+.cex-5   { color: orange; }
+.cex-6   { color: brown; }
+.cex-7   { color: mauve; }
+.cex-8   { color: #013220; } /* Dark green. */
+.cex-9   { color: #e75480; } /* Dark pink. */
+.cex-10  { color: cyan; }
+.cex-11  { color: orange; }
+
+/* Cex: derivation rewriting steps.  */
+.cex-step { font-style: italic; }
+
+/* Cex: leaves of a derivation.  */
+.cex-leaf { font-weight: 600; }

+ 58 - 0
Engine/bin/bison-flex/data/local.mk

@@ -0,0 +1,58 @@
+## Copyright (C) 2002, 2005-2015, 2018-2021 Free Software Foundation,
+## Inc.
+
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+dist_pkgdata_DATA =                             \
+  data/README.md                                \
+  data/bison-default.css
+
+skeletonsdir = $(pkgdatadir)/skeletons
+dist_skeletons_DATA =                           \
+  data/skeletons/bison.m4                       \
+  data/skeletons/c++-skel.m4                    \
+  data/skeletons/c++.m4                         \
+  data/skeletons/c-like.m4                      \
+  data/skeletons/c-skel.m4                      \
+  data/skeletons/c.m4                           \
+  data/skeletons/glr.c                          \
+  data/skeletons/glr.cc                         \
+  data/skeletons/glr2.cc                        \
+  data/skeletons/java-skel.m4                   \
+  data/skeletons/java.m4                        \
+  data/skeletons/lalr1.cc                       \
+  data/skeletons/lalr1.java                     \
+  data/skeletons/location.cc                    \
+  data/skeletons/stack.hh                       \
+  data/skeletons/traceon.m4                     \
+  data/skeletons/variant.hh                     \
+  data/skeletons/yacc.c
+
+# Experimental support for the D language.
+dist_skeletons_DATA +=                          \
+  data/skeletons/d-skel.m4                      \
+  data/skeletons/d.m4                           \
+  data/skeletons/lalr1.d
+
+m4sugardir = $(pkgdatadir)/m4sugar
+dist_m4sugar_DATA =                             \
+  data/m4sugar/foreach.m4                       \
+  data/m4sugar/m4sugar.m4
+
+xsltdir = $(pkgdatadir)/xslt
+dist_xslt_DATA =                                \
+  data/xslt/bison.xsl                           \
+  data/xslt/xml2dot.xsl                         \
+  data/xslt/xml2text.xsl                        \
+  data/xslt/xml2xhtml.xsl

+ 362 - 0
Engine/bin/bison-flex/data/m4sugar/foreach.m4

@@ -0,0 +1,362 @@
+#                                                  -*- Autoconf -*-
+# This file is part of Autoconf.
+# foreach-based replacements for recursive functions.
+# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
+# GNU M4 1.6 by requiring more memory and macro expansions.
+#
+# Copyright (C) 2008-2017, 2020 Free Software Foundation, Inc.
+
+# This file is part of Autoconf.  This program is free
+# software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the Autoconf Configure Script Exception,
+# version 3.0, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License
+# and a copy of the Autoconf Configure Script Exception along with
+# this program; see the files COPYINGv3 and COPYING.EXCEPTION
+# respectively.  If not, see <https://www.gnu.org/licenses/>.
+
+# Written by Eric Blake.
+
+# In M4 1.4.x, every byte of $@ is rescanned.  This means that an
+# algorithm on n arguments that recurses with one less argument each
+# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time.  In
+# M4 1.6, this was fixed so that $@ is only scanned once, then
+# back-references are made to information stored about the scan.
+# Thus, n iterations need only scan n arguments, for O(n) time.
+# Additionally, in M4 1.4.x, recursive algorithms did not clean up
+# memory very well, requiring O(n^2) memory rather than O(n) for n
+# iterations.
+#
+# This file is designed to overcome the quadratic nature of $@
+# recursion by writing a variant of m4_foreach that uses m4_for rather
+# than $@ recursion to operate on the list.  This involves more macro
+# expansions, but avoids the need to rescan a quadratic number of
+# arguments, making these replacements very attractive for M4 1.4.x.
+# On the other hand, in any version of M4, expanding additional macros
+# costs additional time; therefore, in M4 1.6, where $@ recursion uses
+# fewer macros, these replacements actually pessimize performance.
+# Additionally, the use of $10 to mean the tenth argument violates
+# POSIX; although all versions of m4 1.4.x support this meaning, a
+# future m4 version may switch to take it as the first argument
+# concatenated with a literal 0, so the implementations in this file
+# are not future-proof.  Thus, this file is conditionally included as
+# part of m4_init(), only when it is detected that M4 probably has
+# quadratic behavior (ie. it lacks the macro __m4_version__).
+#
+# Please keep this file in sync with m4sugar.m4.
+
+# _m4_foreach(PRE, POST, IGNORED, ARG...)
+# ---------------------------------------
+# Form the common basis of the m4_foreach and m4_map macros.  For each
+# ARG, expand PRE[ARG]POST[].  The IGNORED argument makes recursion
+# easier, and must be supplied rather than implicit.
+#
+# This version minimizes the number of times that $@ is evaluated by
+# using m4_for to generate a boilerplate into _m4_f then passing $@ to
+# that temporary macro.  Thus, the recursion is done in m4_for without
+# reparsing any user input, and is not quadratic.  For an idea of how
+# this works, note that m4_foreach(i,[1,2],[i]) calls
+#   _m4_foreach([m4_define([i],],[)i],[],[1],[2])
+# which defines _m4_f:
+#   $1[$4]$2[]$1[$5]$2[]_m4_popdef([_m4_f])
+# then calls _m4_f([m4_define([i],],[)i],[],[1],[2]) for a net result:
+#   m4_define([i],[1])i[]m4_define([i],[2])i[]_m4_popdef([_m4_f]).
+m4_define([_m4_foreach],
+[m4_if([$#], [3], [],
+       [m4_pushdef([_m4_f], _m4_for([4], [$#], [1],
+   [$0_([1], [2],], [)])[_m4_popdef([_m4_f])])_m4_f($@)])])
+
+m4_define([_m4_foreach_],
+[[$$1[$$3]$$2[]]])
+
+# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
+# -----------------------------------------------------------
+# Find the first VAL that SWITCH matches, and expand the corresponding
+# IF-VAL.  If there are no matches, expand DEFAULT.
+#
+# Use m4_for to create a temporary macro in terms of a boilerplate
+# m4_if with final cleanup.  If $# is even, we have DEFAULT; if it is
+# odd, then rounding the last $# up in the temporary macro is
+# harmless.  For example, both m4_case(1,2,3,4,5) and
+# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
+#   m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
+m4_define([m4_case],
+[m4_if(m4_eval([$# <= 2]), [1], [$2],
+[m4_pushdef([_$0], [m4_if(]_m4_for([2], m4_eval([($# - 1) / 2 * 2]), [2],
+     [_$0_(], [)])[_m4_popdef(
+	 [_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
+
+m4_define([_m4_case_],
+[$0_([1], [$1], m4_incr([$1]))])
+
+m4_define([_m4_case__],
+[[[$$1],[$$2],[$$3],]])
+
+# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
+# -----------------------------------------------------
+# m4 equivalent of
+#
+# if (SWITCH =~ RE1)
+#   VAL1;
+# elif (SWITCH =~ RE2)
+#   VAL2;
+# elif ...
+#   ...
+# else
+#   DEFAULT
+#
+# We build the temporary macro _m4_b:
+#   m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
+#   _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
+# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
+m4_define([m4_bmatch],
+[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+       [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
+       [$#], 2, [$2],
+       [m4_pushdef([_m4_b], [m4_define([_m4_b],
+  _m4_defn([_$0]))]_m4_for([3], m4_eval([($# + 1) / 2 * 2 - 1]),
+  [2], [_$0_(], [)])[_m4_b([], [],]m4_dquote([$]m4_eval(
+  [($# + 1) / 2 * 2]))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
+
+m4_define([_m4_bmatch],
+[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
+
+m4_define([_m4_bmatch_],
+[$0_([1], m4_decr([$1]), [$1])])
+
+m4_define([_m4_bmatch__],
+[[_m4_b([$$1], [$$2], [$$3])]])
+
+
+# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
+# -------------------------------------------------------------------
+# Similar to m4_if, except that each TEST is expanded when encountered.
+# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
+# The result is DEFAULT if no tests passed.  This macro allows
+# short-circuiting of expensive tests, where it pays to arrange quick
+# filter tests to run first.
+#
+# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
+# We only have to speed up _m4_cond, by building the temporary _m4_c:
+#   m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
+#   [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
+#   [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
+#   [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
+# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
+m4_define([_m4_cond],
+[m4_pushdef([_m4_c], [m4_define([_m4_c],
+  _m4_defn([m4_unquote]))]_m4_for([2], m4_eval([$# / 3 * 3 - 1]), [3],
+  [$0_(], [)])[_m4_c(]m4_dquote(m4_dquote(
+  [$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
+
+m4_define([_m4_cond_],
+[$0_(m4_decr([$1]), [$1], m4_incr([$1]))])
+
+m4_define([_m4_cond__],
+[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
+
+# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
+# ----------------------------------------------------
+# m4 equivalent of
+#
+#   $_ = STRING;
+#   s/RE1/SUBST1/g;
+#   s/RE2/SUBST2/g;
+#   ...
+#
+# m4_bpatsubsts already validated an odd number of arguments; we only
+# need to speed up _m4_bpatsubsts.  To avoid nesting, we build the
+# temporary _m4_p:
+#   m4_define([_m4_p], [$1])m4_define([_m4_p],
+#   m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
+#   m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
+#   m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
+#   _m4_defn([_m4_p])_m4_popdef([_m4_p]))
+m4_define([_m4_bpatsubsts],
+[m4_pushdef([_m4_p], [m4_define([_m4_p],
+  ]m4_dquote([$]1)[)]_m4_for([3], [$#], [2], [$0_(],
+  [)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
+
+m4_define([_m4_bpatsubsts_],
+[$0_(m4_decr([$1]), [$1])])
+
+m4_define([_m4_bpatsubsts__],
+[[m4_define([_m4_p],
+m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
+
+# m4_shiftn(N, ...)
+# -----------------
+# Returns ... shifted N times.  Useful for recursive "varargs" constructs.
+#
+# m4_shiftn already validated arguments; we only need to speed up
+# _m4_shiftn.  If N is 3, then we build the temporary _m4_s, defined as
+#   ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
+# before calling m4_shift(_m4_s($@)).
+m4_define([_m4_shiftn],
+[m4_if(m4_incr([$1]), [$#], [], [m4_pushdef([_m4_s],
+  _m4_for(m4_eval([$1 + 2]), [$#], [1],
+  [[,]m4_dquote($], [)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
+
+# m4_do(STRING, ...)
+# ------------------
+# This macro invokes all its arguments (in sequence, of course).  It is
+# useful for making your macros more structured and readable by dropping
+# unnecessary dnl's and have the macros indented properly.
+#
+# Here, we use the temporary macro _m4_do, defined as
+#   $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
+m4_define([m4_do],
+[m4_if([$#], [0], [],
+       [m4_pushdef([_$0], _m4_for([1], [$#], [1],
+		   [$], [[[]]])[_m4_popdef([_$0])])_$0($@)])])
+
+# m4_dquote_elt(ARGS)
+# -------------------
+# Return ARGS as an unquoted list of double-quoted arguments.
+#
+# _m4_foreach to the rescue.
+m4_define([m4_dquote_elt],
+[m4_if([$#], [0], [], [[[$1]]_m4_foreach([,m4_dquote(], [)], $@)])])
+
+# m4_reverse(ARGS)
+# ----------------
+# Output ARGS in reverse order.
+#
+# Invoke _m4_r($@) with the temporary _m4_r built as
+#   [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
+m4_define([m4_reverse],
+[m4_if([$#], [0], [], [$#], [1], [[$1]],
+[m4_pushdef([_m4_r], [[$$#]]_m4_for(m4_decr([$#]), [1], [-1],
+    [[, ]m4_dquote($], [)])[_m4_popdef([_m4_r])])_m4_r($@)])])
+
+
+# m4_map_args_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
+# -------------------------------------------------------------
+# Perform a pairwise grouping of consecutive ARGs, by expanding
+# EXPRESSION([ARG1], [ARG2]).  If there are an odd number of ARGs, the
+# final argument is expanded with END-EXPR([ARGn]).
+#
+# Build the temporary macro _m4_map_args_pair, with the $2([$m+1])
+# only output if $# is odd:
+#   $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
+#   [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_map_args_pair])
+m4_define([m4_map_args_pair],
+[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
+       [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
+       [$#], [2], [],
+       [$#], [3], [m4_default([$2], [$1])([$3])[]],
+       [m4_pushdef([_$0], _m4_for([3],
+   m4_eval([$# / 2 * 2 - 1]), [2], [_$0_(], [)])_$0_end(
+   [1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
+
+m4_define([_m4_map_args_pair_],
+[$0_([1], [$1], m4_incr([$1]))])
+
+m4_define([_m4_map_args_pair__],
+[[$$1([$$2], [$$3])[]]])
+
+m4_define([_m4_map_args_pair_end],
+[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
+
+# m4_join(SEP, ARG1, ARG2...)
+# ---------------------------
+# Produce ARG1SEPARG2...SEPARGn.  Avoid back-to-back SEP when a given ARG
+# is the empty string.  No expansion is performed on SEP or ARGs.
+#
+# Use a self-modifying separator, since we don't know how many
+# arguments might be skipped before a separator is first printed, but
+# be careful if the separator contains $.  _m4_foreach to the rescue.
+m4_define([m4_join],
+[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
+[_m4_foreach([_$0([$1],], [)], $@)_m4_popdef([_m4_sep])])
+
+m4_define([_m4_join],
+[m4_if([$2], [], [], [_m4_sep([$1])[$2]])])
+
+# m4_joinall(SEP, ARG1, ARG2...)
+# ------------------------------
+# Produce ARG1SEPARG2...SEPARGn.  An empty ARG results in back-to-back SEP.
+# No expansion is performed on SEP or ARGs.
+#
+# A bit easier than m4_join.  _m4_foreach to the rescue.
+m4_define([m4_joinall],
+[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
+	   [_m4_foreach([$1], [], m4_shift($@))])])
+
+# m4_list_cmp(A, B)
+# -----------------
+# Compare the two lists of integer expressions A and B.
+#
+# m4_list_cmp takes care of any side effects; we only override
+# _m4_list_cmp_raw, where we can safely expand lists multiple times.
+# First, insert padding so that both lists are the same length; the
+# trailing +0 is necessary to handle a missing list.  Next, create a
+# temporary macro to perform pairwise comparisons until an inequality
+# is found.  For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
+#   m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
+#         m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
+#         [0]_m4_popdef([_m4_cmp]))
+# then calls _m4_cmp([1+0], [0*2], [1], [2+0])
+m4_define([_m4_list_cmp_raw],
+[m4_if([$1], [$2], 0,
+       [_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
+		     $2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
+
+m4_define([_m4_list_pad],
+[m4_if(m4_eval($1 < $2), [1],
+       [_m4_for(m4_incr([$1]), [$2], [1], [,0*])])])
+
+m4_define([_m4_list_cmp],
+[m4_pushdef([_m4_cmp], [m4_if(]_m4_for(
+   [1], m4_eval([$# >> 1]), [1], [$0_(], [,]m4_eval([$# >> 1])[)])[
+      [0]_m4_popdef([_m4_cmp]))])_m4_cmp($@)])
+
+m4_define([_m4_list_cmp_],
+[$0_([$1], m4_eval([$1 + $2]))])
+
+m4_define([_m4_list_cmp__],
+[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
+]])
+
+# m4_max(EXPR, ...)
+# m4_min(EXPR, ...)
+# -----------------
+# Return the decimal value of the maximum (or minimum) in a series of
+# integer expressions.
+#
+# _m4_foreach to the rescue; we only need to replace _m4_minmax.  Here,
+# we need a temporary macro to track the best answer so far, so that
+# the foreach expression is tractable.
+m4_define([_m4_minmax],
+[m4_pushdef([_m4_best], m4_eval([$2]))_m4_foreach(
+  [m4_define([_m4_best], $1(_m4_best,], [))], m4_shift($@))]dnl
+[_m4_best[]_m4_popdef([_m4_best])])
+
+# m4_set_add_all(SET, VALUE...)
+# -----------------------------
+# Add each VALUE into SET.  This is O(n) in the number of VALUEs, and
+# can be faster than calling m4_set_add for each VALUE.
+#
+# _m4_foreach to the rescue.  If no deletions have occurred, then
+# avoid the speed penalty of m4_set_add.
+m4_define([m4_set_add_all],
+[m4_if([$#], [0], [], [$#], [1], [],
+       [m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
+	  + m4_len(_m4_foreach(m4_ifdef([_m4_set_cleanup($1)],
+  [[m4_set_add]], [[_$0]])[([$1],], [)], $@))))])])
+
+m4_define([_m4_set_add_all],
+[m4_ifdef([_m4_set([$1],$2)], [],
+	  [m4_define([_m4_set([$1],$2)],
+		     [1])m4_pushdef([_m4_set([$1])], [$2])-])])

+ 3329 - 0
Engine/bin/bison-flex/data/m4sugar/m4sugar.m4

@@ -0,0 +1,3329 @@
+divert(-1)#                                                  -*- Autoconf -*-
+# This file is part of Autoconf.
+# Base M4 layer.
+# Requires GNU M4.
+#
+# Copyright (C) 1999-2017, 2020 Free Software Foundation, Inc.
+
+# This file is part of Autoconf.  This program is free
+# software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# Under Section 7 of GPL version 3, you are granted additional
+# permissions described in the Autoconf Configure Script Exception,
+# version 3.0, as published by the Free Software Foundation.
+#
+# You should have received a copy of the GNU General Public License
+# and a copy of the Autoconf Configure Script Exception along with
+# this program; see the files COPYINGv3 and COPYING.EXCEPTION
+# respectively.  If not, see <https://www.gnu.org/licenses/>.
+
+# Written by Akim Demaille.
+
+# Set the quotes, whatever the current quoting system.
+changequote()
+changequote([, ])
+
+# Some old m4's don't support m4exit.  But they provide
+# equivalent functionality by core dumping because of the
+# long macros we define.
+ifdef([__gnu__], ,
+[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or
+set the M4 environment variable to its absolute file name.)
+m4exit(2)])
+
+
+## ------------------------------- ##
+## 1. Simulate --prefix-builtins.  ##
+## ------------------------------- ##
+
+# m4_define
+# m4_defn
+# m4_undefine
+define([m4_define],   defn([define]))
+define([m4_defn],     defn([defn]))
+define([m4_undefine], defn([undefine]))
+
+m4_undefine([define])
+m4_undefine([defn])
+m4_undefine([undefine])
+
+
+# m4_copy(SRC, DST)
+# -----------------
+# Define DST as the definition of SRC.
+# What's the difference between:
+# 1. m4_copy([from], [to])
+# 2. m4_define([to], [from($@)])
+# Well, obviously 1 is more expensive in space.  Maybe 2 is more expensive
+# in time, but because of the space cost of 1, it's not that obvious.
+# Nevertheless, one huge difference is the handling of `$0'.  If `from'
+# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
+# The user would certainly prefer to see `to'.
+#
+# This definition is in effect during m4sugar initialization, when
+# there are no pushdef stacks; later on, we redefine it to something
+# more powerful for all other clients to use.
+m4_define([m4_copy],
+[m4_define([$2], m4_defn([$1]))])
+
+
+# m4_rename(SRC, DST)
+# -------------------
+# Rename the macro SRC to DST.
+m4_define([m4_rename],
+[m4_copy([$1], [$2])m4_undefine([$1])])
+
+
+# m4_rename_m4(MACRO-NAME)
+# ------------------------
+# Rename MACRO-NAME to m4_MACRO-NAME.
+m4_define([m4_rename_m4],
+[m4_rename([$1], [m4_$1])])
+
+
+# m4_copy_unm4(m4_MACRO-NAME)
+# ---------------------------
+# Copy m4_MACRO-NAME to MACRO-NAME.
+m4_define([m4_copy_unm4],
+[m4_copy([$1], m4_bpatsubst([$1], [^m4_\(.*\)], [[\1]]))])
+
+
+# Some m4 internals have names colliding with tokens we might use.
+# Rename them a` la `m4 --prefix-builtins'.  Conditionals first, since
+# some subsequent renames are conditional.
+m4_rename_m4([ifdef])
+m4_rename([ifelse], [m4_if])
+
+m4_rename_m4([builtin])
+m4_rename_m4([changecom])
+m4_rename_m4([changequote])
+m4_ifdef([changeword],dnl conditionally available in 1.4.x
+[m4_undefine([changeword])])
+m4_rename_m4([debugfile])
+m4_rename_m4([debugmode])
+m4_rename_m4([decr])
+m4_rename_m4([divnum])
+m4_rename_m4([dumpdef])
+m4_rename_m4([errprint])
+m4_rename_m4([esyscmd])
+m4_rename_m4([eval])
+m4_rename_m4([format])
+m4_undefine([include])
+m4_rename_m4([incr])
+m4_rename_m4([index])
+m4_rename_m4([indir])
+m4_rename_m4([len])
+m4_rename([m4exit], [m4_exit])
+m4_undefine([m4wrap])
+m4_ifdef([mkstemp],dnl added in M4 1.4.8
+[m4_rename_m4([mkstemp])
+m4_copy([m4_mkstemp], [m4_maketemp])
+m4_undefine([maketemp])],
+[m4_rename_m4([maketemp])
+m4_copy([m4_maketemp], [m4_mkstemp])])
+m4_rename([patsubst], [m4_bpatsubst])
+m4_rename_m4([popdef])
+m4_rename_m4([pushdef])
+m4_rename([regexp], [m4_bregexp])
+m4_rename_m4([shift])
+m4_undefine([sinclude])
+m4_rename_m4([substr])
+m4_ifdef([symbols],dnl present only in alpha-quality 1.4o
+[m4_rename_m4([symbols])])
+m4_rename_m4([syscmd])
+m4_rename_m4([sysval])
+m4_rename_m4([traceoff])
+m4_rename_m4([traceon])
+m4_rename_m4([translit])
+
+# _m4_defn(ARG)
+# -------------
+# _m4_defn is for internal use only - it bypasses the wrapper, so it
+# must only be used on one argument at a time, and only on macros
+# known to be defined.  Make sure this still works if the user renames
+# m4_defn but not _m4_defn.
+m4_copy([m4_defn], [_m4_defn])
+
+# _m4_divert_raw(NUM)
+# -------------------
+# _m4_divert_raw is for internal use only.  Use this instead of
+# m4_builtin([divert], NUM), so that tracing diversion flow is easier.
+m4_rename([divert], [_m4_divert_raw])
+
+# _m4_popdef(ARG...)
+# ------------------
+# _m4_popdef is for internal use only - it bypasses the wrapper, so it
+# must only be used on macros known to be defined.  Make sure this
+# still works if the user renames m4_popdef but not _m4_popdef.
+m4_copy([m4_popdef], [_m4_popdef])
+
+# _m4_undefine(ARG...)
+# --------------------
+# _m4_undefine is for internal use only - it bypasses the wrapper, so
+# it must only be used on macros known to be defined.  Make sure this
+# still works if the user renames m4_undefine but not _m4_undefine.
+m4_copy([m4_undefine], [_m4_undefine])
+
+# _m4_undivert(NUM...)
+# --------------------
+# _m4_undivert is for internal use only, and should always be given
+# arguments.  Use this instead of m4_builtin([undivert], NUM...), so
+# that tracing diversion flow is easier.
+m4_rename([undivert], [_m4_undivert])
+
+
+## ------------------- ##
+## 2. Error messages.  ##
+## ------------------- ##
+
+
+# m4_location
+# -----------
+# Output the current file, colon, and the current line number.
+m4_define([m4_location],
+[__file__:__line__])
+
+
+# m4_errprintn(MSG)
+# -----------------
+# Same as `errprint', but with the missing end of line.
+m4_define([m4_errprintn],
+[m4_errprint([$1
+])])
+
+
+# m4_warning(MSG)
+# ---------------
+# Warn the user.
+m4_define([m4_warning],
+[m4_errprintn(m4_location[: warning: $1])])
+
+
+# m4_fatal(MSG, [EXIT-STATUS])
+# ----------------------------
+# Fatal the user.                                                      :)
+m4_define([m4_fatal],
+[m4_errprintn(m4_location[: error: $1]
+m4_expansion_stack)m4_exit(m4_if([$2],, 1, [$2]))])
+
+
+# m4_assert(EXPRESSION, [EXIT-STATUS = 1])
+# ----------------------------------------
+# This macro ensures that EXPRESSION evaluates to true, and exits if
+# EXPRESSION evaluates to false.
+m4_define([m4_assert],
+[m4_if(m4_eval([$1]), 0,
+       [m4_fatal([assert failed: $1], [$2])])])
+
+
+
+## ------------- ##
+## 3. Warnings.  ##
+## ------------- ##
+
+
+# _m4_warn(CATEGORY, MESSAGE, [STACK-TRACE])
+# ------------------------------------------
+# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
+# This is for traces only.
+# If present, STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE",
+# where the last line (and no other) ends with "the top level".
+#
+# Within m4, the macro is a no-op.  This macro really matters
+# when autom4te post-processes the trace output.
+m4_define([_m4_warn], [])
+
+
+# m4_warn(CATEGORY, MESSAGE)
+# --------------------------
+# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
+m4_define([m4_warn],
+[_m4_warn([$1], [$2],
+m4_ifdef([_m4_expansion_stack], [m4_expansion_stack]))])
+
+
+
+## ------------------- ##
+## 4. File inclusion.  ##
+## ------------------- ##
+
+
+# We also want to neutralize include (and sinclude for symmetry),
+# but we want to extend them slightly: warn when a file is included
+# several times.  This is, in general, a dangerous operation, because
+# too many people forget to quote the first argument of m4_define.
+#
+# For instance in the following case:
+#   m4_define(foo, [bar])
+# then a second reading will turn into
+#   m4_define(bar, [bar])
+# which is certainly not what was meant.
+
+# m4_include_unique(FILE)
+# -----------------------
+# Declare that the FILE was loading; and warn if it has already
+# been included.
+m4_define([m4_include_unique],
+[m4_ifdef([m4_include($1)],
+	  [m4_warn([syntax], [file `$1' included several times])])dnl
+m4_define([m4_include($1)])])
+
+
+# m4_include(FILE)
+# ----------------
+# Like the builtin include, but warns against multiple inclusions.
+m4_define([m4_include],
+[m4_include_unique([$1])dnl
+m4_builtin([include], [$1])])
+
+
+# m4_sinclude(FILE)
+# -----------------
+# Like the builtin sinclude, but warns against multiple inclusions.
+m4_define([m4_sinclude],
+[m4_include_unique([$1])dnl
+m4_builtin([sinclude], [$1])])
+
+
+
+## ------------------------------------ ##
+## 5. Additional branching constructs.  ##
+## ------------------------------------ ##
+
+# Both `m4_ifval' and `m4_ifset' tests against the empty string.  The
+# difference is that `m4_ifset' is specialized on macros.
+#
+# In case of arguments of macros, eg. $1, it makes little difference.
+# In the case of a macro `FOO', you don't want to check `m4_ifval(FOO,
+# TRUE)', because if `FOO' expands with commas, there is a shifting of
+# the arguments.  So you want to run `m4_ifval([FOO])', but then you just
+# compare the *string* `FOO' against `', which, of course fails.
+#
+# So you want the variation `m4_ifset' that expects a macro name as $1.
+# If this macro is both defined and defined to a non empty value, then
+# it runs TRUE, etc.
+
+
+# m4_ifblank(COND, [IF-BLANK], [IF-TEXT])
+# m4_ifnblank(COND, [IF-TEXT], [IF-BLANK])
+# ----------------------------------------
+# If COND is empty, or consists only of blanks (space, tab, newline),
+# then expand IF-BLANK, otherwise expand IF-TEXT.  This differs from
+# m4_ifval only if COND has just whitespace, but it helps optimize in
+# spite of users who mistakenly leave trailing space after what they
+# thought was an empty argument:
+#   macro(
+#         []
+#        )
+#
+# Writing one macro in terms of the other causes extra overhead, so
+# we inline both definitions.
+m4_define([m4_ifblank],
+[m4_if(m4_translit([[$1]],  [ ][	][
+]), [], [$2], [$3])])
+
+m4_define([m4_ifnblank],
+[m4_if(m4_translit([[$1]],  [ ][	][
+]), [], [$3], [$2])])
+
+
+# m4_ifval(COND, [IF-TRUE], [IF-FALSE])
+# -------------------------------------
+# If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE.
+# Comparable to m4_ifdef.
+m4_define([m4_ifval],
+[m4_if([$1], [], [$3], [$2])])
+
+
+# m4_n(TEXT)
+# ----------
+# If TEXT is not empty, return TEXT and a new line, otherwise nothing.
+m4_define([m4_n],
+[m4_if([$1],
+       [], [],
+	   [$1
+])])
+
+
+# m4_ifvaln(COND, [IF-TRUE], [IF-FALSE])
+# --------------------------------------
+# Same as `m4_ifval', but add an extra newline to IF-TRUE or IF-FALSE
+# unless that argument is empty.
+m4_define([m4_ifvaln],
+[m4_if([$1],
+       [],   [m4_n([$3])],
+	     [m4_n([$2])])])
+
+
+# m4_ifset(MACRO, [IF-TRUE], [IF-FALSE])
+# --------------------------------------
+# If MACRO has no definition, or of its definition is the empty string,
+# expand IF-FALSE, otherwise IF-TRUE.
+m4_define([m4_ifset],
+[m4_ifdef([$1],
+	  [m4_ifval(_m4_defn([$1]), [$2], [$3])],
+	  [$3])])
+
+
+# m4_ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED])
+# -----------------------------------------------
+m4_define([m4_ifndef],
+[m4_ifdef([$1], [$3], [$2])])
+
+
+# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
+# -----------------------------------------------------------
+# m4 equivalent of
+# switch (SWITCH)
+# {
+#   case VAL1:
+#     IF-VAL1;
+#     break;
+#   case VAL2:
+#     IF-VAL2;
+#     break;
+#   ...
+#   default:
+#     DEFAULT;
+#     break;
+# }.
+# All the values are optional, and the macro is robust to active
+# symbols properly quoted.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_case],
+[m4_if([$#], 0, [],
+       [$#], 1, [],
+       [$#], 2, [$2],
+       [$1], [$2], [$3],
+       [$0([$1], m4_shift3($@))])])
+
+
+# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
+# -----------------------------------------------------
+# m4 equivalent of
+#
+# if (SWITCH =~ RE1)
+#   VAL1;
+# elif (SWITCH =~ RE2)
+#   VAL2;
+# elif ...
+#   ...
+# else
+#   DEFAULT
+#
+# All the values are optional, and the macro is robust to active symbols
+# properly quoted.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_bmatch],
+[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+       [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
+       [$#], 2, [$2],
+       [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shift3($@))],
+	      [$3])])])
+
+# m4_argn(N, ARGS...)
+# -------------------
+# Extract argument N (greater than 0) from ARGS.  Example:
+#   m4_define([b], [B])
+#   m4_argn([2], [a], [b], [c]) => b
+#
+# Rather than using m4_car(m4_shiftn([$1], $@)), we exploit the fact that
+# GNU m4 can directly reference any argument, through an indirect macro.
+m4_define([m4_argn],
+[m4_assert([0 < $1])]dnl
+[m4_pushdef([_$0], [_m4_popdef([_$0])]m4_dquote([$]m4_incr([$1])))_$0($@)])
+
+
+# m4_car(ARGS...)
+# m4_cdr(ARGS...)
+# ---------------
+# Manipulate m4 lists.  m4_car returns the first argument.  m4_cdr
+# bundles all but the first argument into a quoted list.  These two
+# macros are generally used with list arguments, with quoting removed
+# to break the list into multiple m4 ARGS.
+m4_define([m4_car], [[$1]])
+m4_define([m4_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+
+# _m4_cdr(ARGS...)
+# ----------------
+# Like m4_cdr, except include a leading comma unless only one argument
+# remains.  Why?  Because comparing a large list against [] is more
+# expensive in expansion time than comparing the number of arguments; so
+# _m4_cdr can be used to reduce the number of arguments when it is time
+# to end recursion.
+m4_define([_m4_cdr],
+[m4_if([$#], 1, [],
+       [, m4_dquote(m4_shift($@))])])
+
+
+
+# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
+# -------------------------------------------------------------------
+# Similar to m4_if, except that each TEST is expanded when encountered.
+# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
+# The result is DEFAULT if no tests passed.  This macro allows
+# short-circuiting of expensive tests, where it pays to arrange quick
+# filter tests to run first.
+#
+# For an example, consider a previous implementation of _AS_QUOTE_IFELSE:
+#
+#    m4_if(m4_index([$1], [\]), [-1], [$2],
+#          m4_eval(m4_index([$1], [\\]) >= 0), [1], [$2],
+#          m4_eval(m4_index([$1], [\$]) >= 0), [1], [$2],
+#          m4_eval(m4_index([$1], [\`]) >= 0), [1], [$3],
+#          m4_eval(m4_index([$1], [\"]) >= 0), [1], [$3],
+#          [$2])
+#
+# Here, m4_index is computed 5 times, and m4_eval 4, even if $1 contains
+# no backslash.  It is more efficient to do:
+#
+#    m4_cond([m4_index([$1], [\])], [-1], [$2],
+#            [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
+#            [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
+#            [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
+#            [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
+#            [$2])
+#
+# In the common case of $1 with no backslash, only one m4_index expansion
+# occurs, and m4_eval is avoided altogether.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_cond],
+[m4_if([$#], [0], [m4_fatal([$0: cannot be called without arguments])],
+       [$#], [1], [$1],
+       m4_eval([$# % 3]), [2], [m4_fatal([$0: missing an argument])],
+       [_$0($@)])])
+
+m4_define([_m4_cond],
+[m4_if(($1), [($2)], [$3],
+       [$#], [3], [],
+       [$#], [4], [$4],
+       [$0(m4_shift3($@))])])
+
+
+## ---------------------------------------- ##
+## 6. Enhanced version of some primitives.  ##
+## ---------------------------------------- ##
+
+# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
+# ----------------------------------------------------
+# m4 equivalent of
+#
+#   $_ = STRING;
+#   s/RE1/SUBST1/g;
+#   s/RE2/SUBST2/g;
+#   ...
+#
+# All the values are optional, and the macro is robust to active symbols
+# properly quoted.
+#
+# I would have liked to name this macro `m4_bpatsubst', unfortunately,
+# due to quotation problems, I need to double quote $1 below, therefore
+# the anchors are broken :(  I can't let users be trapped by that.
+#
+# Recall that m4_shift3 always results in an argument.  Hence, we need
+# to distinguish between a final deletion vs. ending recursion.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_bpatsubsts],
+[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+       [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
+       [$#], 2, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2]))],
+       [$#], 3, [m4_unquote(m4_builtin([patsubst], [[$1]], [$2], [$3]))],
+       [_$0($@m4_if(m4_eval($# & 1), 0, [,]))])])
+m4_define([_m4_bpatsubsts],
+[m4_if([$#], 2, [$1],
+       [$0(m4_builtin([patsubst], [[$1]], [$2], [$3]),
+	   m4_shift3($@))])])
+
+
+# m4_copy(SRC, DST)
+# -----------------
+# Define the pushdef stack DST as a copy of the pushdef stack SRC;
+# give an error if DST is already defined.  This is particularly nice
+# for copying self-modifying pushdef stacks, where the top definition
+# includes one-shot initialization that is later popped to the normal
+# definition.  This version intentionally does nothing if SRC is
+# undefined.
+#
+# Some macros simply can't be renamed with this method: namely, anything
+# involved in the implementation of m4_stack_foreach_sep.
+m4_define([m4_copy],
+[m4_ifdef([$2], [m4_fatal([$0: won't overwrite defined macro: $2])],
+	  [m4_stack_foreach_sep([$1], [m4_pushdef([$2],], [)])])]dnl
+[m4_ifdef([m4_location($1)], [m4_define([m4_location($2)], m4_location)])])
+
+
+# m4_copy_force(SRC, DST)
+# m4_rename_force(SRC, DST)
+# -------------------------
+# Like m4_copy/m4_rename, except blindly overwrite any existing DST.
+# Note that m4_copy_force tolerates undefined SRC, while m4_rename_force
+# does not.
+m4_define([m4_copy_force],
+[m4_ifdef([$2], [_m4_undefine([$2])])m4_copy($@)])
+
+m4_define([m4_rename_force],
+[m4_ifdef([$2], [_m4_undefine([$2])])m4_rename($@)])
+
+
+# m4_define_default(MACRO, VALUE)
+# -------------------------------
+# If MACRO is undefined, set it to VALUE.
+m4_define([m4_define_default],
+[m4_ifndef([$1], [m4_define($@)])])
+
+
+# m4_default(EXP1, EXP2)
+# m4_default_nblank(EXP1, EXP2)
+# -----------------------------
+# Returns EXP1 if not empty/blank, otherwise EXP2.  Expand the result.
+#
+# m4_default is called on hot paths, so inline the contents of m4_ifval,
+# for one less round of expansion.
+m4_define([m4_default],
+[m4_if([$1], [], [$2], [$1])])
+
+m4_define([m4_default_nblank],
+[m4_ifblank([$1], [$2], [$1])])
+
+
+# m4_default_quoted(EXP1, EXP2)
+# m4_default_nblank_quoted(EXP1, EXP2)
+# ------------------------------------
+# Returns EXP1 if non empty/blank, otherwise EXP2.  Leave the result quoted.
+#
+# For comparison:
+#   m4_define([active], [ACTIVE])
+#   m4_default([active], [default]) => ACTIVE
+#   m4_default([], [active]) => ACTIVE
+#   -m4_default([ ], [active])- => - -
+#   -m4_default_nblank([ ], [active])- => -ACTIVE-
+#   m4_default_quoted([active], [default]) => active
+#   m4_default_quoted([], [active]) => active
+#   -m4_default_quoted([ ], [active])- => - -
+#   -m4_default_nblank_quoted([ ], [active])- => -active-
+#
+# m4_default macro is called on hot paths, so inline the contents of m4_ifval,
+# for one less round of expansion.
+m4_define([m4_default_quoted],
+[m4_if([$1], [], [[$2]], [[$1]])])
+
+m4_define([m4_default_nblank_quoted],
+[m4_ifblank([$1], [[$2]], [[$1]])])
+
+
+# m4_defn(NAME)
+# -------------
+# Like the original, except guarantee a warning when using something which is
+# undefined (unlike M4 1.4.x).  This replacement is not a full-featured
+# replacement: if any of the defined macros contain unbalanced quoting, but
+# when pasted together result in a well-quoted string, then only native m4
+# support is able to get it correct.  But that's where quadrigraphs come in
+# handy, if you really need unbalanced quotes inside your macros.
+#
+# This macro is called frequently, so minimize the amount of additional
+# expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
+m4_define([m4_defn],
+[m4_if([$#], [0], [[$0]],
+       [$#], [1], [m4_ifdef([$1], [_m4_defn([$1])],
+			    [m4_fatal([$0: undefined macro: $1])])],
+       [m4_map_args([$0], $@)])])
+
+
+# m4_dumpdef(NAME...)
+# -------------------
+# In m4 1.4.x, dumpdef writes to the current debugfile, rather than
+# stderr.  This in turn royally confuses autom4te; so we follow the
+# lead of newer m4 and always dump to stderr.  Unlike the original,
+# this version requires an argument, since there is no convenient way
+# in m4 1.4.x to grab the names of all defined macros.  Newer m4
+# always dumps to stderr, regardless of the current debugfile; it also
+# provides m4symbols as a way to grab all current macro names.  But
+# dumpdefs is not frequently called, so we don't need to worry about
+# conditionally using these newer features.  Also, this version
+# doesn't sort multiple arguments.
+#
+# If we detect m4 1.6 or newer, then provide an alternate definition,
+# installed during m4_init, that allows builtins through.
+# Unfortunately, there is no nice way in m4 1.4.x to dump builtins.
+m4_define([m4_dumpdef],
+[m4_if([$#], [0], [m4_fatal([$0: missing argument])],
+       [$#], [1], [m4_ifdef([$1], [m4_errprintn(
+  [$1:	]m4_dquote(_m4_defn([$1])))], [m4_fatal([$0: undefined macro: $1])])],
+       [m4_map_args([$0], $@)])])
+
+m4_define([_m4_dumpdef],
+[m4_if([$#], [0], [m4_fatal([$0: missing argument])],
+       [$#], [1], [m4_builtin([dumpdef], [$1])],
+       [m4_map_args_sep([m4_builtin([dumpdef],], [)], [], $@)])])
+
+
+# m4_dumpdefs(NAME...)
+# --------------------
+# Similar to `m4_dumpdef(NAME)', but if NAME was m4_pushdef'ed, display its
+# value stack (most recent displayed first).  Also, this version silently
+# ignores undefined macros, rather than erroring out.
+#
+# This macro cheats, because it relies on the current definition of NAME
+# while the second argument of m4_stack_foreach_lifo is evaluated (which
+# would be undefined according to the API).
+m4_define([m4_dumpdefs],
+[m4_if([$#], [0], [m4_fatal([$0: missing argument])],
+       [$#], [1], [m4_stack_foreach_lifo([$1], [m4_dumpdef([$1])m4_ignore])],
+       [m4_map_args([$0], $@)])])
+
+# m4_esyscmd_s(COMMAND)
+# ---------------------
+# Like m4_esyscmd, except strip any trailing newlines, thus behaving
+# more like shell command substitution.
+m4_define([m4_esyscmd_s],
+[m4_chomp_all(m4_esyscmd([$1]))])
+
+
+# m4_popdef(NAME)
+# ---------------
+# Like the original, except guarantee a warning when using something which is
+# undefined (unlike M4 1.4.x).
+#
+# This macro is called frequently, so minimize the amount of additional
+# expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
+m4_define([m4_popdef],
+[m4_if([$#], [0], [[$0]],
+       [$#], [1], [m4_ifdef([$1], [_m4_popdef([$1])],
+			    [m4_fatal([$0: undefined macro: $1])])],
+       [m4_map_args([$0], $@)])])
+
+
+# m4_shiftn(N, ...)
+# -----------------
+# Returns ... shifted N times.  Useful for recursive "varargs" constructs.
+#
+# Autoconf does not use this macro, because it is inherently slower than
+# calling the common cases of m4_shift2 or m4_shift3 directly.  But it
+# might as well be fast for other clients, such as Libtool.  One way to
+# do this is to expand $@ only once in _m4_shiftn (otherwise, for long
+# lists, the expansion of m4_if takes twice as much memory as what the
+# list itself occupies, only to throw away the unused branch).  The end
+# result is strictly equivalent to
+#   m4_if([$1], 1, [m4_shift(,m4_shift(m4_shift($@)))],
+#         [_m4_shiftn(m4_decr([$1]), m4_shift(m4_shift($@)))])
+# but with the final `m4_shift(m4_shift($@)))' shared between the two
+# paths.  The first leg uses a no-op m4_shift(,$@) to balance out the ().
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_shiftn],
+[m4_assert(0 < $1 && $1 < $#)_$0($@)])
+
+m4_define([_m4_shiftn],
+[m4_if([$1], 1, [m4_shift(],
+       [$0(m4_decr([$1])]), m4_shift(m4_shift($@)))])
+
+# m4_shift2(...)
+# m4_shift3(...)
+# --------------
+# Returns ... shifted twice, and three times.  Faster than m4_shiftn.
+m4_define([m4_shift2], [m4_shift(m4_shift($@))])
+m4_define([m4_shift3], [m4_shift(m4_shift(m4_shift($@)))])
+
+# _m4_shift2(...)
+# _m4_shift3(...)
+# ---------------
+# Like m4_shift2 or m4_shift3, except include a leading comma unless shifting
+# consumes all arguments.  Why?  Because in recursion, it is nice to
+# distinguish between 1 element left and 0 elements left, based on how many
+# arguments this shift expands to.
+m4_define([_m4_shift2],
+[m4_if([$#], [2], [],
+       [, m4_shift(m4_shift($@))])])
+m4_define([_m4_shift3],
+[m4_if([$#], [3], [],
+       [, m4_shift(m4_shift(m4_shift($@)))])])
+
+
+# m4_undefine(NAME)
+# -----------------
+# Like the original, except guarantee a warning when using something which is
+# undefined (unlike M4 1.4.x).
+#
+# This macro is called frequently, so minimize the amount of additional
+# expansions by skipping m4_ifndef.  Better yet, if __m4_version__ exists,
+# (added in M4 1.6), then let m4 do the job for us (see m4_init).
+m4_define([m4_undefine],
+[m4_if([$#], [0], [[$0]],
+       [$#], [1], [m4_ifdef([$1], [_m4_undefine([$1])],
+			    [m4_fatal([$0: undefined macro: $1])])],
+       [m4_map_args([$0], $@)])])
+
+# _m4_wrap(PRE, POST)
+# -------------------
+# Helper macro for m4_wrap and m4_wrap_lifo.  Allows nested calls to
+# m4_wrap within wrapped text.  Use _m4_defn and _m4_popdef for speed.
+m4_define([_m4_wrap],
+[m4_ifdef([$0_text],
+	  [m4_define([$0_text], [$1]_m4_defn([$0_text])[$2])],
+	  [m4_builtin([m4wrap], [m4_unquote(
+  _m4_defn([$0_text])_m4_popdef([$0_text]))])m4_define([$0_text], [$1$2])])])
+
+# m4_wrap(TEXT)
+# -------------
+# Append TEXT to the list of hooks to be executed at the end of input.
+# Whereas the order of the original may be LIFO in the underlying m4,
+# this version is always FIFO.
+m4_define([m4_wrap],
+[_m4_wrap([], [$1[]])])
+
+# m4_wrap_lifo(TEXT)
+# ------------------
+# Prepend TEXT to the list of hooks to be executed at the end of input.
+# Whereas the order of m4_wrap may be FIFO in the underlying m4, this
+# version is always LIFO.
+m4_define([m4_wrap_lifo],
+[_m4_wrap([$1[]])])
+
+## ------------------------- ##
+## 7. Quoting manipulation.  ##
+## ------------------------- ##
+
+
+# m4_apply(MACRO, LIST)
+# ---------------------
+# Invoke MACRO, with arguments provided from the quoted list of
+# comma-separated quoted arguments.  If LIST is empty, invoke MACRO
+# without arguments.  The expansion will not be concatenated with
+# subsequent text.
+m4_define([m4_apply],
+[m4_if([$2], [], [$1], [$1($2)])[]])
+
+# _m4_apply(MACRO, LIST)
+# ----------------------
+# Like m4_apply, except do nothing if LIST is empty.
+m4_define([_m4_apply],
+[m4_if([$2], [], [], [$1($2)[]])])
+
+
+# m4_count(ARGS)
+# --------------
+# Return a count of how many ARGS are present.
+m4_define([m4_count], [$#])
+
+
+# m4_curry(MACRO, ARG...)
+# -----------------------
+# Perform argument currying.  The expansion of this macro is another
+# macro that takes exactly one argument, appends it to the end of the
+# original ARG list, then invokes MACRO.  For example:
+#   m4_curry([m4_curry], [m4_reverse], [1])([2])([3]) => 3, 2, 1
+# Not quite as practical as m4_incr, but you could also do:
+#   m4_define([add], [m4_eval(([$1]) + ([$2]))])
+#   m4_define([add_one], [m4_curry([add], [1])])
+#   add_one()([2]) => 3
+m4_define([m4_curry], [$1(m4_shift($@,)_$0])
+m4_define([_m4_curry],               [[$1])])
+
+
+# m4_do(STRING, ...)
+# ------------------
+# This macro invokes all its arguments (in sequence, of course).  It is
+# useful for making your macros more structured and readable by dropping
+# unnecessary dnl's and have the macros indented properly.  No concatenation
+# occurs after a STRING; use m4_unquote(m4_join(,STRING)) for that.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_do],
+[m4_if([$#], 0, [],
+       [$#], 1, [$1[]],
+       [$1[]$0(m4_shift($@))])])
+
+
+# m4_dquote(ARGS)
+# ---------------
+# Return ARGS as a quoted list of quoted arguments.
+m4_define([m4_dquote],  [[$@]])
+
+
+# m4_dquote_elt(ARGS)
+# -------------------
+# Return ARGS as an unquoted list of double-quoted arguments.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_dquote_elt],
+[m4_if([$#], [0], [],
+       [$#], [1], [[[$1]]],
+       [[[$1]],$0(m4_shift($@))])])
+
+
+# m4_echo(ARGS)
+# -------------
+# Return the ARGS, with the same level of quoting.  Whitespace after
+# unquoted commas are consumed.
+m4_define([m4_echo], [$@])
+
+
+# m4_expand(ARG)
+# _m4_expand(ARG)
+# ---------------
+# Return the expansion of ARG as a single string.  Unlike
+# m4_quote($1), this preserves whitespace following single-quoted
+# commas that appear within ARG.  It also deals with shell case
+# statements.
+#
+#   m4_define([active], [ACT, IVE])
+#   m4_define([active2], [[ACT, IVE]])
+#   m4_quote(active, active2)
+#   => ACT,IVE,ACT, IVE
+#   m4_expand([active, active2])
+#   => ACT, IVE, ACT, IVE
+#
+# Unfortunately, due to limitations in m4, ARG must expand to
+# something with balanced quotes (use quadrigraphs to get around
+# this), and should not contain the unlikely delimiters -=<{( or
+# )}>=-.  It is possible to have unbalanced quoted `(' or `)', as well
+# as unbalanced unquoted `)'.  m4_expand can handle unterminated
+# comments or dnl on the final line, at the expense of speed; it also
+# aids in detecting attempts to incorrectly change the current
+# diversion inside ARG.  Meanwhile, _m4_expand is faster but must be
+# given a terminated expansion, and has no safety checks for
+# mis-diverted text.
+#
+# Exploit that extra unquoted () will group unquoted commas and the
+# following whitespace.  m4_bpatsubst can't handle newlines inside $1,
+# and m4_substr strips quoting.  So we (ab)use m4_changequote, using
+# temporary quotes to remove the delimiters that conveniently included
+# the unquoted () that were added prior to the changequote.
+#
+# Thanks to shell case statements, too many people are prone to pass
+# underquoted `)', so we try to detect that by passing a marker as a
+# fourth argument; if the marker is not present, then we assume that
+# we encountered an early `)', and re-expand the first argument, but
+# this time with one more `(' in the second argument and in the
+# open-quote delimiter.  We must also ignore the slop from the
+# previous try.  The final macro is thus half line-noise, half art.
+m4_define([m4_expand],
+[m4_pushdef([m4_divert], _m4_defn([_m4_divert_unsafe]))]dnl
+[m4_pushdef([m4_divert_push], _m4_defn([_m4_divert_unsafe]))]dnl
+[m4_chomp(_$0([$1
+]))_m4_popdef([m4_divert], [m4_divert_push])])
+
+m4_define([_m4_expand], [$0_([$1], [(], -=<{($1)}>=-, [}>=-])])
+
+m4_define([_m4_expand_],
+[m4_if([$4], [}>=-],
+       [m4_changequote([-=<{$2], [)}>=-])$3m4_changequote([, ])],
+       [$0([$1], [($2], -=<{($2$1)}>=-, [}>=-])m4_ignore$2])])
+
+
+# m4_ignore(ARGS)
+# ---------------
+# Expands to nothing.  Useful for conditionally ignoring an arbitrary
+# number of arguments (see _m4_list_cmp for an example).
+m4_define([m4_ignore])
+
+
+# m4_make_list(ARGS)
+# ------------------
+# Similar to m4_dquote, this creates a quoted list of quoted ARGS.  This
+# version is less efficient than m4_dquote, but separates each argument
+# with a comma and newline, rather than just comma, for readability.
+# When developing an m4sugar algorithm, you could temporarily use
+#   m4_pushdef([m4_dquote],m4_defn([m4_make_list]))
+# around your code to make debugging easier.
+m4_define([m4_make_list], [m4_join([,
+], m4_dquote_elt($@))])
+
+
+# m4_noquote(STRING)
+# ------------------
+# Return the result of ignoring all quotes in STRING and invoking the
+# macros it contains.  Among other things, this is useful for enabling
+# macro invocations inside strings with [] blocks (for instance regexps
+# and help-strings).  On the other hand, since all quotes are disabled,
+# any macro expanded during this time that relies on nested [] quoting
+# will likely crash and burn.  This macro is seldom useful; consider
+# m4_unquote or m4_expand instead.
+m4_define([m4_noquote],
+[m4_changequote([-=<{(],[)}>=-])$1-=<{()}>=-m4_changequote([,])])
+
+
+# m4_quote(ARGS)
+# --------------
+# Return ARGS as a single argument.  Any whitespace after unquoted commas
+# is stripped.  There is always output, even when there were no arguments.
+#
+# It is important to realize the difference between `m4_quote(exp)' and
+# `[exp]': in the first case you obtain the quoted *result* of the
+# expansion of EXP, while in the latter you just obtain the string
+# `exp'.
+m4_define([m4_quote],  [[$*]])
+
+
+# _m4_quote(ARGS)
+# ---------------
+# Like m4_quote, except that when there are no arguments, there is no
+# output.  For conditional scenarios (such as passing _m4_quote as the
+# macro name in m4_mapall), this feature can be used to distinguish between
+# one argument of the empty string vs. no arguments.  However, in the
+# normal case with arguments present, this is less efficient than m4_quote.
+m4_define([_m4_quote],
+[m4_if([$#], [0], [], [[$*]])])
+
+
+# m4_reverse(ARGS)
+# ----------------
+# Output ARGS in reverse order.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_reverse],
+[m4_if([$#], [0], [], [$#], [1], [[$1]],
+       [$0(m4_shift($@)), [$1]])])
+
+
+# m4_unquote(ARGS)
+# ----------------
+# Remove one layer of quotes from each ARG, performing one level of
+# expansion.  For one argument, m4_unquote([arg]) is more efficient than
+# m4_do([arg]), but for multiple arguments, the difference is that
+# m4_unquote separates arguments with commas while m4_do concatenates.
+# Follow this macro with [] if concatenation with subsequent text is
+# undesired.
+m4_define([m4_unquote], [$*])
+
+
+## -------------------------- ##
+## 8. Implementing m4 loops.  ##
+## -------------------------- ##
+
+
+# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION)
+# --------------------------------------------------------
+# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO with
+# increments of STEP.  Both limits are included, and bounds are
+# checked for consistency.  The algorithm is robust to indirect
+# VARIABLE names.  Changing VARIABLE inside EXPRESSION will not impact
+# the number of iterations.
+#
+# Uses _m4_defn for speed, and avoid dnl in the macro body.  Factor
+# the _m4_for call so that EXPRESSION is only parsed once.
+m4_define([m4_for],
+[m4_pushdef([$1], m4_eval([$2]))]dnl
+[m4_cond([m4_eval(([$3]) > ([$2]))], 1,
+	   [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4],
+	      1)))m4_assert(_m4_step > 0)_$0(_m4_defn([$1]),
+  m4_eval((([$3]) - ([$2])) / _m4_step * _m4_step + ([$2])), _m4_step,],
+	 [m4_eval(([$3]) < ([$2]))], 1,
+	   [m4_pushdef([_m4_step], m4_eval(m4_default_quoted([$4],
+	      -1)))m4_assert(_m4_step < 0)_$0(_m4_defn([$1]),
+  m4_eval((([$2]) - ([$3])) / -(_m4_step) * _m4_step + ([$2])), _m4_step,],
+	 [m4_pushdef([_m4_step])_$0(_m4_defn([$1]), _m4_defn([$1]), 0,])]dnl
+[[m4_define([$1],], [)$5])m4_popdef([_m4_step], [$1])])
+
+# _m4_for(COUNT, LAST, STEP, PRE, POST)
+# -------------------------------------
+# Core of the loop, no consistency checks, all arguments are plain
+# numbers.  Expand PRE[COUNT]POST, then alter COUNT by STEP and
+# iterate if COUNT is not LAST.
+m4_define([_m4_for],
+[$4[$1]$5[]m4_if([$1], [$2], [],
+		 [$0(m4_eval([$1 + $3]), [$2], [$3], [$4], [$5])])])
+
+
+# Implementing `foreach' loops in m4 is much more tricky than it may
+# seem.  For example, the old M4 1.4.4 manual had an incorrect example,
+# which looked like this (when translated to m4sugar):
+#
+# | # foreach(VAR, (LIST), STMT)
+# | m4_define([foreach],
+# |   [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])])
+# | m4_define([_arg1], [$1])
+# | m4_define([_foreach],
+# |   [m4_if([$2], [()], ,
+# |     [m4_define([$1], _arg1$2)$3[]_foreach([$1], (m4_shift$2), [$3])])])
+#
+# But then if you run
+#
+# | m4_define(a, 1)
+# | m4_define(b, 2)
+# | m4_define(c, 3)
+# | foreach([f], [([a], [(b], [c)])], [echo f
+# | ])
+#
+# it gives
+#
+#  => echo 1
+#  => echo (2,3)
+#
+# which is not what is expected.
+#
+# Of course the problem is that many quotes are missing.  So you add
+# plenty of quotes at random places, until you reach the expected
+# result.  Alternatively, if you are a quoting wizard, you directly
+# reach the following implementation (but if you really did, then
+# apply to the maintenance of m4sugar!).
+#
+# | # foreach(VAR, (LIST), STMT)
+# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])])
+# | m4_define([_arg1], [[$1]])
+# | m4_define([_foreach],
+# |  [m4_if($2, [()], ,
+# |    [m4_define([$1], [_arg1$2])$3[]_foreach([$1], [(m4_shift$2)], [$3])])])
+#
+# which this time answers
+#
+#  => echo a
+#  => echo (b
+#  => echo c)
+#
+# Bingo!
+#
+# Well, not quite.
+#
+# With a better look, you realize that the parens are more a pain than
+# a help: since anyway you need to quote properly the list, you end up
+# with always using an outermost pair of parens and an outermost pair
+# of quotes.  Rejecting the parens both eases the implementation, and
+# simplifies the use:
+#
+# | # foreach(VAR, (LIST), STMT)
+# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])])
+# | m4_define([_arg1], [$1])
+# | m4_define([_foreach],
+# |  [m4_if($2, [], ,
+# |    [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], [m4_shift($2)], [$3])])])
+#
+#
+# Now, just replace the `$2' with `m4_quote($2)' in the outer `m4_if'
+# to improve robustness, and you come up with a nice implementation
+# that doesn't require extra parentheses in the user's LIST.
+#
+# But wait -  now the algorithm is quadratic, because every recursion of
+# the algorithm keeps the entire LIST and merely adds another m4_shift to
+# the quoted text.  If the user has a lot of elements in LIST, you can
+# bring the system to its knees with the memory m4 then requires, or trip
+# the m4 --nesting-limit recursion factor.  The only way to avoid
+# quadratic growth is ensure m4_shift is expanded prior to the recursion.
+# Hence the design below.
+#
+# The M4 manual now includes a chapter devoted to this issue, with
+# the lessons learned from m4sugar.  And still, this design is only
+# optimal for M4 1.6; see foreach.m4 for yet more comments on why
+# M4 1.4.x uses yet another implementation.
+
+
+# m4_foreach(VARIABLE, LIST, EXPRESSION)
+# --------------------------------------
+#
+# Expand EXPRESSION assigning each value of the LIST to VARIABLE.
+# LIST should have the form `item_1, item_2, ..., item_n', i.e. the
+# whole list must *quoted*.  Quote members too if you don't want them
+# to be expanded.
+#
+# This macro is robust to active symbols:
+#      | m4_define(active, [ACT, IVE])
+#      | m4_foreach(Var, [active, active], [-Var-])
+#     => -ACT--IVE--ACT--IVE-
+#
+#      | m4_foreach(Var, [[active], [active]], [-Var-])
+#     => -ACT, IVE--ACT, IVE-
+#
+#      | m4_foreach(Var, [[[active]], [[active]]], [-Var-])
+#     => -active--active-
+#
+# This macro is called frequently, so avoid extra expansions such as
+# m4_ifval and dnl.  Also, since $2 might be quite large, try to use it
+# as little as possible in _m4_foreach; each extra use requires that much
+# more memory for expansion.  So, rather than directly compare $2 against
+# [] and use m4_car/m4_cdr for recursion, we instead unbox the list (which
+# requires swapping the argument order in the helper), insert an ignored
+# third argument, and use m4_shift3 to detect when recursion is complete,
+# at which point this looks very much like m4_map_args.
+m4_define([m4_foreach],
+[m4_if([$2], [], [],
+       [m4_pushdef([$1])_$0([m4_define([$1],], [)$3], [],
+  $2)m4_popdef([$1])])])
+
+# _m4_foreach(PRE, POST, IGNORED, ARG...)
+# ---------------------------------------
+# Form the common basis of the m4_foreach and m4_map macros.  For each
+# ARG, expand PRE[ARG]POST[].  The IGNORED argument makes recursion
+# easier, and must be supplied rather than implicit.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([_m4_foreach],
+[m4_if([$#], [3], [],
+       [$1[$4]$2[]$0([$1], [$2], m4_shift3($@))])])
+
+
+# m4_foreach_w(VARIABLE, LIST, EXPRESSION)
+# ----------------------------------------
+# Like m4_foreach, but the list is whitespace separated.  Depending on
+# EXPRESSION, it may be more efficient to use m4_map_args_w.
+#
+# This macro is robust to active symbols:
+#    m4_foreach_w([Var], [ active
+#    b	act\
+#    ive  ], [-Var-])end
+#    => -active--b--active-end
+#
+# This used to use a slower implementation based on m4_foreach:
+#   m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])
+m4_define([m4_foreach_w],
+[m4_pushdef([$1])m4_map_args_w([$2],
+  [m4_define([$1],], [)$3])m4_popdef([$1])])
+
+
+# m4_map(MACRO, LIST)
+# m4_mapall(MACRO, LIST)
+# ----------------------
+# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements of
+# LIST.  $1, $2... must in turn be lists, appropriate for m4_apply.
+# If LIST contains an empty sublist, m4_map skips the expansion of
+# MACRO, while m4_mapall expands MACRO with no arguments.
+#
+# Since LIST may be quite large, we want to minimize how often it
+# appears in the expansion.  Rather than use m4_car/m4_cdr iteration,
+# we unbox the list, and use _m4_foreach for iteration.  For m4_map,
+# an empty list behaves like an empty sublist and gets ignored; for
+# m4_mapall, we must special-case the empty list.
+m4_define([m4_map],
+[_m4_foreach([_m4_apply([$1],], [)], [], $2)])
+
+m4_define([m4_mapall],
+[m4_if([$2], [], [],
+       [_m4_foreach([m4_apply([$1],], [)], [], $2)])])
+
+
+# m4_map_sep(MACRO, [SEPARATOR], LIST)
+# m4_mapall_sep(MACRO, [SEPARATOR], LIST)
+# ---------------------------------------
+# Invoke MACRO($1), SEPARATOR, MACRO($2), ..., MACRO($N) where $1,
+# $2... $N are the elements of LIST, and are in turn lists appropriate
+# for m4_apply.  SEPARATOR is expanded, in order to allow the creation
+# of a list of arguments by using a single-quoted comma as the
+# separator.  For each empty sublist, m4_map_sep skips the expansion
+# of MACRO and SEPARATOR, while m4_mapall_sep expands MACRO with no
+# arguments.
+#
+# For m4_mapall_sep, merely expand the first iteration without the
+# separator, then include separator as part of subsequent recursion;
+# but avoid extra expansion of LIST's side-effects via a helper macro.
+# For m4_map_sep, things are trickier - we don't know if the first
+# list element is an empty sublist, so we must define a self-modifying
+# helper macro and use that as the separator instead.
+m4_define([m4_map_sep],
+[m4_pushdef([m4_Sep], [m4_define([m4_Sep], _m4_defn([m4_unquote]))])]dnl
+[_m4_foreach([_m4_apply([m4_Sep([$2])[]$1],], [)], [], $3)m4_popdef([m4_Sep])])
+
+m4_define([m4_mapall_sep],
+[m4_if([$3], [], [], [_$0([$1], [$2], $3)])])
+
+m4_define([_m4_mapall_sep],
+[m4_apply([$1], [$3])_m4_foreach([m4_apply([$2[]$1],], [)], m4_shift2($@))])
+
+# m4_map_args(EXPRESSION, ARG...)
+# -------------------------------
+# Expand EXPRESSION([ARG]) for each argument.  More efficient than
+#   m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))])
+# Shorthand for m4_map_args_sep([EXPRESSION(], [)], [], ARG...).
+m4_define([m4_map_args],
+[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
+       [$#], [1], [],
+       [$#], [2], [$1([$2])[]],
+       [_m4_foreach([$1(], [)], $@)])])
+
+
+# m4_map_args_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
+# -------------------------------------------------------------
+# Perform a pairwise grouping of consecutive ARGs, by expanding
+# EXPRESSION([ARG1], [ARG2]).  If there are an odd number of ARGs, the
+# final argument is expanded with END-EXPR([ARGn]).
+#
+# For example:
+#   m4_define([show], [($*)m4_newline])dnl
+#   m4_map_args_pair([show], [], [a], [b], [c], [d], [e])dnl
+#   => (a,b)
+#   => (c,d)
+#   => (e)
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_map_args_pair],
+[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
+       [$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
+       [$#], [2], [],
+       [$#], [3], [m4_default([$2], [$1])([$3])[]],
+       [$#], [4], [$1([$3], [$4])[]],
+       [$1([$3], [$4])[]$0([$1], [$2], m4_shift(m4_shift3($@)))])])
+
+
+# m4_map_args_sep([PRE], [POST], [SEP], ARG...)
+# ---------------------------------------------
+# Expand PRE[ARG]POST for each argument, with SEP between arguments.
+m4_define([m4_map_args_sep],
+[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
+       [$#], [1], [],
+       [$#], [2], [],
+       [$#], [3], [],
+       [$#], [4], [$1[$4]$2[]],
+       [$1[$4]$2[]_m4_foreach([$3[]$1], [$2], m4_shift3($@))])])
+
+
+# m4_map_args_w(STRING, [PRE], [POST], [SEP])
+# -------------------------------------------
+# Perform the expansion of PRE[word]POST[] for each word in STRING
+# separated by whitespace.  More efficient than:
+#   m4_foreach_w([var], [STRING], [PRE[]m4_defn([var])POST])
+# Additionally, expand SEP between words.
+#
+# As long as we have to use m4_bpatsubst to split the string, we might
+# as well make it also apply PRE and POST; this avoids iteration
+# altogether.  But we must be careful of any \ in PRE or POST.
+# _m4_strip returns a quoted string, but that's okay, since it also
+# supplies an empty leading and trailing argument due to our
+# intentional whitespace around STRING.  We use m4_substr to strip the
+# empty elements and remove the extra layer of quoting.
+m4_define([m4_map_args_w],
+[_$0(_m4_split([ ]m4_flatten([$1])[ ], [[	 ]+],
+	       m4_if(m4_index([$2$3$4], [\]), [-1], [[$3[]$4[]$2]],
+		     [m4_bpatsubst([[$3[]$4[]$2]], [\\], [\\\\])])),
+     m4_len([[]$3[]$4]), m4_len([$4[]$2[]]))])
+
+m4_define([_m4_map_args_w],
+[m4_substr([$1], [$2], m4_eval(m4_len([$1]) - [$2] - [$3]))])
+
+
+# m4_stack_foreach(MACRO, FUNC)
+# m4_stack_foreach_lifo(MACRO, FUNC)
+# ----------------------------------
+# Pass each stacked definition of MACRO to the one-argument macro FUNC.
+# m4_stack_foreach proceeds in FIFO order, while m4_stack_foreach_lifo
+# processes the topmost definitions first.  In addition, FUNC should
+# not push or pop definitions of MACRO, and should not expect anything about
+# the active definition of MACRO (it will not be the topmost, and may not
+# be the one passed to FUNC either).
+#
+# Some macros simply can't be examined with this method: namely,
+# anything involved in the implementation of _m4_stack_reverse.
+m4_define([m4_stack_foreach],
+[_m4_stack_reverse([$1], [m4_tmp-$1])]dnl
+[_m4_stack_reverse([m4_tmp-$1], [$1], [$2(_m4_defn([m4_tmp-$1]))])])
+
+m4_define([m4_stack_foreach_lifo],
+[_m4_stack_reverse([$1], [m4_tmp-$1], [$2(_m4_defn([m4_tmp-$1]))])]dnl
+[_m4_stack_reverse([m4_tmp-$1], [$1])])
+
+# m4_stack_foreach_sep(MACRO, [PRE], [POST], [SEP])
+# m4_stack_foreach_sep_lifo(MACRO, [PRE], [POST], [SEP])
+# ------------------------------------------------------
+# Similar to m4_stack_foreach and m4_stack_foreach_lifo, in that every
+# definition of a pushdef stack will be visited.  But rather than
+# passing the definition as a single argument to a macro, this variant
+# expands the concatenation of PRE[]definition[]POST, and expands SEP
+# between consecutive expansions.  Note that m4_stack_foreach([a], [b])
+# is equivalent to m4_stack_foreach_sep([a], [b(], [)]).
+m4_define([m4_stack_foreach_sep],
+[_m4_stack_reverse([$1], [m4_tmp-$1])]dnl
+[_m4_stack_reverse([m4_tmp-$1], [$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]])])
+
+m4_define([m4_stack_foreach_sep_lifo],
+[_m4_stack_reverse([$1], [m4_tmp-$1], [$2[]_m4_defn([m4_tmp-$1])$3], [$4[]])]dnl
+[_m4_stack_reverse([m4_tmp-$1], [$1])])
+
+
+# _m4_stack_reverse(OLD, NEW, [ACTION], [SEP])
+# --------------------------------------------
+# A recursive worker for pushdef stack manipulation.  Destructively
+# copy the OLD stack into the NEW, and expanding ACTION for each
+# iteration.  After the first iteration, SEP is promoted to the front
+# of ACTION (note that SEP should include a trailing [] if it is to
+# avoid interfering with ACTION).  The current definition is examined
+# after the NEW has been pushed but before OLD has been popped; this
+# order is important, as ACTION is permitted to operate on either
+# _m4_defn([OLD]) or _m4_defn([NEW]).  Since the operation is
+# destructive, this macro is generally used twice, with a temporary
+# macro name holding the swapped copy.
+m4_define([_m4_stack_reverse],
+[m4_ifdef([$1], [m4_pushdef([$2],
+  _m4_defn([$1]))$3[]_m4_popdef([$1])$0([$1], [$2], [$4$3])])])
+
+
+
+## --------------------------- ##
+## 9. More diversion support.  ##
+## --------------------------- ##
+
+
+# m4_cleardivert(DIVERSION-NAME...)
+# ---------------------------------
+# Discard any text in DIVERSION-NAME.
+#
+# This works even inside m4_expand.
+m4_define([m4_cleardivert],
+[m4_if([$#], [0], [m4_fatal([$0: missing argument])],
+       [_m4_divert_raw([-1])m4_undivert($@)_m4_divert_raw(
+	 _m4_divert(_m4_defn([_m4_divert_diversion]), [-]))])])
+
+
+# _m4_divert(DIVERSION-NAME or NUMBER, [NOWARN])
+# ----------------------------------------------
+# If DIVERSION-NAME is the name of a diversion, return its number,
+# otherwise if it is a NUMBER return it.  Issue a warning about
+# the use of a number instead of a name, unless NOWARN is provided.
+m4_define([_m4_divert],
+[m4_ifdef([_m4_divert($1)],
+	  [m4_indir([_m4_divert($1)])],
+	  [m4_if([$2], [], [m4_warn([syntax],
+	     [prefer named diversions])])$1])])
+
+# KILL is only used to suppress output.
+m4_define([_m4_divert(KILL)],           -1)
+
+# The empty diversion name is a synonym for 0.
+m4_define([_m4_divert()],                0)
+
+
+# m4_divert_stack
+# ---------------
+# Print the diversion stack, if it's nonempty.  The caller is
+# responsible for any leading or trailing newline.
+m4_define([m4_divert_stack],
+[m4_stack_foreach_sep_lifo([_m4_divert_stack], [], [], [
+])])
+
+
+# m4_divert_stack_push(MACRO-NAME, DIVERSION-NAME)
+# ------------------------------------------------
+# Form an entry of the diversion stack from caller MACRO-NAME and
+# entering DIVERSION-NAME and push it.
+m4_define([m4_divert_stack_push],
+[m4_pushdef([_m4_divert_stack], m4_location[: $1: $2])])
+
+
+# m4_divert(DIVERSION-NAME)
+# -------------------------
+# Change the diversion stream to DIVERSION-NAME.
+m4_define([m4_divert],
+[m4_popdef([_m4_divert_stack])]dnl
+[m4_define([_m4_divert_diversion], [$1])]dnl
+[m4_divert_stack_push([$0], [$1])]dnl
+[_m4_divert_raw(_m4_divert([$1]))])
+
+
+# m4_divert_push(DIVERSION-NAME, [NOWARN])
+# ----------------------------------------
+# Change the diversion stream to DIVERSION-NAME, while stacking old values.
+# For internal use only: if NOWARN is not empty, DIVERSION-NAME can be a
+# number instead of a name.
+m4_define([m4_divert_push],
+[m4_divert_stack_push([$0], [$1])]dnl
+[m4_pushdef([_m4_divert_diversion], [$1])]dnl
+[_m4_divert_raw(_m4_divert([$1], [$2]))])
+
+
+# m4_divert_pop([DIVERSION-NAME])
+# -------------------------------
+# Change the diversion stream to its previous value, unstacking it.
+# If specified, verify we left DIVERSION-NAME.
+# When we pop the last value from the stack, we divert to -1.
+m4_define([m4_divert_pop],
+[m4_if([$1], [], [],
+       [$1], _m4_defn([_m4_divert_diversion]), [],
+       [m4_fatal([$0($1): diversion mismatch:
+]m4_divert_stack)])]dnl
+[_m4_popdef([_m4_divert_stack], [_m4_divert_diversion])]dnl
+[m4_ifdef([_m4_divert_diversion], [],
+	   [m4_fatal([too many m4_divert_pop])])]dnl
+[_m4_divert_raw(_m4_divert(_m4_defn([_m4_divert_diversion]), [-]))])
+
+
+# m4_divert_text(DIVERSION-NAME, CONTENT)
+# ---------------------------------------
+# Output CONTENT into DIVERSION-NAME (which may be a number actually).
+# An end of line is appended for free to CONTENT.
+m4_define([m4_divert_text],
+[m4_divert_push([$1])$2
+m4_divert_pop([$1])])
+
+
+# m4_divert_once(DIVERSION-NAME, CONTENT)
+# ---------------------------------------
+# Output CONTENT into DIVERSION-NAME once, if not already there.
+# An end of line is appended for free to CONTENT.
+m4_define([m4_divert_once],
+[m4_expand_once([m4_divert_text([$1], [$2])])])
+
+
+# _m4_divert_unsafe(DIVERSION-NAME)
+# ---------------------------------
+# Issue a warning that the attempt to change the current diversion to
+# DIVERSION-NAME is unsafe, because this macro is being expanded
+# during argument collection of m4_expand.
+m4_define([_m4_divert_unsafe],
+[m4_fatal([$0: cannot change diversion to `$1' inside m4_expand])])
+
+
+# m4_undivert(DIVERSION-NAME...)
+# ------------------------------
+# Undivert DIVERSION-NAME.  Unlike the M4 version, this requires at
+# least one DIVERSION-NAME; also, due to support for named diversions,
+# this should not be used to undivert files.
+m4_define([m4_undivert],
+[m4_if([$#], [0], [m4_fatal([$0: missing argument])],
+       [$#], [1], [_m4_undivert(_m4_divert([$1]))],
+       [m4_map_args([$0], $@)])])
+
+
+## --------------------------------------------- ##
+## 10. Defining macros with bells and whistles.  ##
+## --------------------------------------------- ##
+
+# `m4_defun' is basically `m4_define' but it equips the macro with the
+# needed machinery for `m4_require'.  A macro must be m4_defun'd if
+# either it is m4_require'd, or it m4_require's.
+#
+# Two things deserve attention and are detailed below:
+#  1. Implementation of m4_require
+#  2. Keeping track of the expansion stack
+#
+# 1. Implementation of m4_require
+# ===============================
+#
+# Of course m4_defun calls m4_provide, so that a macro which has
+# been expanded is not expanded again when m4_require'd, but the
+# difficult part is the proper expansion of macros when they are
+# m4_require'd.
+#
+# The implementation is based on three ideas, (i) using diversions to
+# prepare the expansion of the macro and its dependencies (by Franc,ois
+# Pinard), (ii) expand the most recently m4_require'd macros _after_
+# the previous macros (by Axel Thimm), and (iii) track instances of
+# provide before require (by Eric Blake).
+#
+#
+# The first idea: why use diversions?
+# -----------------------------------
+#
+# When a macro requires another, the other macro is expanded in new
+# diversion, GROW.  When the outer macro is fully expanded, we first
+# undivert the most nested diversions (GROW - 1...), and finally
+# undivert GROW.  To understand why we need several diversions,
+# consider the following example:
+#
+# | m4_defun([TEST1], [Test...m4_require([TEST2])1])
+# | m4_defun([TEST2], [Test...m4_require([TEST3])2])
+# | m4_defun([TEST3], [Test...3])
+#
+# Because m4_require is not required to be first in the outer macros, we
+# must keep the expansions of the various levels of m4_require separated.
+# Right before executing the epilogue of TEST1, we have:
+#
+#	   GROW - 2: Test...3
+#	   GROW - 1: Test...2
+#	   GROW:     Test...1
+#	   BODY:
+#
+# Finally the epilogue of TEST1 undiverts GROW - 2, GROW - 1, and
+# GROW into the regular flow, BODY.
+#
+#	   GROW - 2:
+#	   GROW - 1:
+#	   GROW:
+#	   BODY:        Test...3; Test...2; Test...1
+#
+# (The semicolons are here for clarification, but of course are not
+# emitted.)  This is what Autoconf 2.0 (I think) to 2.13 (I'm sure)
+# implement.
+#
+#
+# The second idea: first required first out
+# -----------------------------------------
+#
+# The natural implementation of the idea above is buggy and produces
+# very surprising results in some situations.  Let's consider the
+# following example to explain the bug:
+#
+# | m4_defun([TEST1],  [m4_require([TEST2a])m4_require([TEST2b])])
+# | m4_defun([TEST2a], [])
+# | m4_defun([TEST2b], [m4_require([TEST3])])
+# | m4_defun([TEST3],  [m4_require([TEST2a])])
+# |
+# | AC_INIT
+# | TEST1
+#
+# The dependencies between the macros are:
+#
+#		 3 --- 2b
+#		/        \              is m4_require'd by
+#	       /          \       left -------------------- right
+#	    2a ------------ 1
+#
+# If you strictly apply the rules given in the previous section you get:
+#
+#	   GROW - 2: TEST3
+#	   GROW - 1: TEST2a; TEST2b
+#	   GROW:     TEST1
+#	   BODY:
+#
+# (TEST2a, although required by TEST3 is not expanded in GROW - 3
+# because is has already been expanded before in GROW - 1, so it has
+# been AC_PROVIDE'd, so it is not expanded again) so when you undivert
+# the stack of diversions, you get:
+#
+#	   GROW - 2:
+#	   GROW - 1:
+#	   GROW:
+#	   BODY:        TEST3; TEST2a; TEST2b; TEST1
+#
+# i.e., TEST2a is expanded after TEST3 although the latter required the
+# former.
+#
+# Starting from 2.50, we use an implementation provided by Axel Thimm.
+# The idea is simple: the order in which macros are emitted must be the
+# same as the one in which macros are expanded.  (The bug above can
+# indeed be described as: a macro has been m4_provide'd before its
+# dependent, but it is emitted after: the lack of correlation between
+# emission and expansion order is guilty).
+#
+# How to do that?  You keep the stack of diversions to elaborate the
+# macros, but each time a macro is fully expanded, emit it immediately.
+#
+# In the example above, when TEST2a is expanded, but it's epilogue is
+# not run yet, you have:
+#
+#	   GROW - 2:
+#	   GROW - 1: TEST2a
+#	   GROW:     Elaboration of TEST1
+#	   BODY:
+#
+# The epilogue of TEST2a emits it immediately:
+#
+#	   GROW - 2:
+#	   GROW - 1:
+#	   GROW:     Elaboration of TEST1
+#	   BODY:     TEST2a
+#
+# TEST2b then requires TEST3, so right before the epilogue of TEST3, you
+# have:
+#
+#	   GROW - 2: TEST3
+#	   GROW - 1: Elaboration of TEST2b
+#	   GROW:     Elaboration of TEST1
+#	   BODY:      TEST2a
+#
+# The epilogue of TEST3 emits it:
+#
+#	   GROW - 2:
+#	   GROW - 1: Elaboration of TEST2b
+#	   GROW:     Elaboration of TEST1
+#	   BODY:     TEST2a; TEST3
+#
+# TEST2b is now completely expanded, and emitted:
+#
+#	   GROW - 2:
+#	   GROW - 1:
+#	   GROW:     Elaboration of TEST1
+#	   BODY:     TEST2a; TEST3; TEST2b
+#
+# and finally, TEST1 is finished and emitted:
+#
+#	   GROW - 2:
+#	   GROW - 1:
+#	   GROW:
+#	   BODY:     TEST2a; TEST3; TEST2b: TEST1
+#
+# The idea is simple, but the implementation is a bit involved.  If
+# you are like me, you will want to see the actual functioning of this
+# implementation to be convinced.  The next section gives the full
+# details.
+#
+#
+# The Axel Thimm implementation at work
+# -------------------------------------
+#
+# We consider the macros above, and this configure.ac:
+#
+#	    AC_INIT
+#	    TEST1
+#
+# You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and
+# m4_require at hand to follow the steps.
+#
+# This implementation tries not to assume that the current diversion is
+# BODY, so as soon as a macro (m4_defun'd) is expanded, we first
+# record the current diversion under the name _m4_divert_dump (denoted
+# DUMP below for short).  This introduces an important difference with
+# the previous versions of Autoconf: you cannot use m4_require if you
+# are not inside an m4_defun'd macro, and especially, you cannot
+# m4_require directly from the top level.
+#
+# We have not tried to simulate the old behavior (better yet, we
+# diagnose it), because it is too dangerous: a macro m4_require'd from
+# the top level is expanded before the body of `configure', i.e., before
+# any other test was run.  I let you imagine the result of requiring
+# AC_STDC_HEADERS for instance, before AC_PROG_CC was actually run....
+#
+# After AC_INIT was run, the current diversion is BODY.
+# * AC_INIT was run
+#   DUMP:                undefined
+#   diversion stack:     BODY |-
+#
+# * TEST1 is expanded
+# The prologue of TEST1 sets _m4_divert_dump, which is the diversion
+# where the current elaboration will be dumped, to the current
+# diversion.  It also m4_divert_push to GROW, where the full
+# expansion of TEST1 and its dependencies will be elaborated.
+#   DUMP:        BODY
+#   BODY:        empty
+#   diversions:  GROW, BODY |-
+#
+# * TEST1 requires TEST2a
+# _m4_require_call m4_divert_pushes another temporary diversion,
+# GROW - 1, and expands TEST2a in there.
+#   DUMP:        BODY
+#   BODY:        empty
+#   GROW - 1:    TEST2a
+#   diversions:  GROW - 1, GROW, BODY |-
+# Then the content of the temporary diversion is moved to DUMP and the
+# temporary diversion is popped.
+#   DUMP:        BODY
+#   BODY:        TEST2a
+#   diversions:  GROW, BODY |-
+#
+# * TEST1 requires TEST2b
+# Again, _m4_require_call pushes GROW - 1 and heads to expand TEST2b.
+#   DUMP:        BODY
+#   BODY:        TEST2a
+#   diversions:  GROW - 1, GROW, BODY |-
+#
+# * TEST2b requires TEST3
+# _m4_require_call pushes GROW - 2 and expands TEST3 here.
+# (TEST3 requires TEST2a, but TEST2a has already been m4_provide'd, so
+# nothing happens.)
+#   DUMP:        BODY
+#   BODY:        TEST2a
+#   GROW - 2:    TEST3
+#   diversions:  GROW - 2, GROW - 1, GROW, BODY |-
+# Then the diversion is appended to DUMP, and popped.
+#   DUMP:        BODY
+#   BODY:        TEST2a; TEST3
+#   diversions:  GROW - 1, GROW, BODY |-
+#
+# * TEST1 requires TEST2b (contd.)
+# The content of TEST2b is expanded...
+#   DUMP:        BODY
+#   BODY:        TEST2a; TEST3
+#   GROW - 1:    TEST2b,
+#   diversions:  GROW - 1, GROW, BODY |-
+# ... and moved to DUMP.
+#   DUMP:        BODY
+#   BODY:        TEST2a; TEST3; TEST2b
+#   diversions:  GROW, BODY |-
+#
+# * TEST1 is expanded: epilogue
+# TEST1's own content is in GROW...
+#   DUMP:        BODY
+#   BODY:        TEST2a; TEST3; TEST2b
+#   GROW:        TEST1
+#   diversions:  BODY |-
+# ... and it's epilogue moves it to DUMP and then undefines DUMP.
+#   DUMP:       undefined
+#   BODY:       TEST2a; TEST3; TEST2b; TEST1
+#   diversions: BODY |-
+#
+#
+# The third idea: track macros provided before they were required
+# ---------------------------------------------------------------
+#
+# Using just the first two ideas, Autoconf 2.50 through 2.63 still had
+# a subtle bug for more than seven years.  Let's consider the
+# following example to explain the bug:
+#
+# | m4_defun([TEST1], [1])
+# | m4_defun([TEST2], [2[]m4_require([TEST1])])
+# | m4_defun([TEST3], [3 TEST1 m4_require([TEST2])])
+# | TEST3
+#
+# After the prologue of TEST3, we are collecting text in GROW with the
+# intent of dumping it in BODY during the epilogue.  Next, we
+# encounter the direct invocation of TEST1, which provides the macro
+# in place in GROW.  From there, we encounter a requirement for TEST2,
+# which must be collected in a new diversion.  While expanding TEST2,
+# we encounter a requirement for TEST1, but since it has already been
+# expanded, the Axel Thimm algorithm states that we can treat it as a
+# no-op.  But that would lead to an end result of `2 3 1', meaning
+# that we have once again output a macro (TEST2) prior to its
+# requirements (TEST1).
+#
+# The problem can only occur if a single defun'd macro first provides,
+# then later indirectly requires, the same macro.  Note that directly
+# expanding then requiring a macro is okay: because the dependency was
+# met, the require phase can be a no-op.  For that matter, the outer
+# macro can even require two helpers, where the first helper expands
+# the macro, and the second helper indirectly requires the macro.
+# Out-of-order expansion is only present if the inner macro is
+# required by something that will be hoisted in front of where the
+# direct expansion occurred.  In other words, we must be careful not
+# to warn on:
+#
+# | m4_defun([TEST4], [4])
+# | m4_defun([TEST5], [5 TEST4 m4_require([TEST4])])
+# | TEST5 => 5 4
+#
+# or even the more complex:
+#
+# | m4_defun([TEST6], [6])
+# | m4_defun([TEST7], [7 TEST6])
+# | m4_defun([TEST8], [8 m4_require([TEST6])])
+# | m4_defun([TEST9], [9 m4_require([TEST8])])
+# | m4_defun([TEST10], [10 m4_require([TEST7]) m4_require([TEST9])])
+# | TEST10 => 7 6 8 9 10
+#
+# So, to detect whether a require was direct or indirect, m4_defun and
+# m4_require track the name of the macro that caused a diversion to be
+# created (using the stack _m4_diverting, coupled with an O(1) lookup
+# _m4_diverting([NAME])), and m4_provide stores the name associated
+# with the diversion at which a macro was provided.  A require call is
+# direct if it occurs within the same diversion where the macro was
+# provided, or if the diversion associated with the providing context
+# has been collected.
+#
+# The implementation of the warning involves tracking the set of
+# macros which have been provided since the start of the outermost
+# defun'd macro (the set is named _m4_provide).  When starting an
+# outermost macro, the set is emptied; when a macro is provided, it is
+# added to the set; when require expands the body of a macro, it is
+# removed from the set; and when a macro is indirectly required, the
+# set is checked.  If a macro is in the set, then it has been provided
+# before it was required, and we satisfy dependencies by expanding the
+# macro as if it had never been provided; in the example given above,
+# this means we now output `1 2 3 1'.  Meanwhile, a warning is issued
+# to inform the user that her macros trigger the bug in older autoconf
+# versions, and that her output file now contains redundant contents
+# (and possibly new problems, if the repeated macro was not
+# idempotent).  Meanwhile, macros defined by m4_defun_once instead of
+# m4_defun are idempotent, avoiding any warning or duplicate output.
+#
+#
+# 2. Keeping track of the expansion stack
+# =======================================
+#
+# When M4 expansion goes wrong it is often extremely hard to find the
+# path amongst macros that drove to the failure.  What is needed is
+# the stack of macro `calls'. One could imagine that GNU M4 would
+# maintain a stack of macro expansions, unfortunately it doesn't, so
+# we do it by hand.  This is of course extremely costly, but the help
+# this stack provides is worth it.  Nevertheless to limit the
+# performance penalty this is implemented only for m4_defun'd macros,
+# not for define'd macros.
+#
+# Each time we enter an m4_defun'd macros, we add a definition in
+# _m4_expansion_stack, and when we exit the macro, we remove it (thanks
+# to pushdef/popdef).  m4_stack_foreach is used to print the expansion
+# stack in the rare cases when it's needed.
+#
+# In addition, we want to detect circular m4_require dependencies.
+# Each time we expand a macro FOO we define _m4_expanding(FOO); and
+# m4_require(BAR) simply checks whether _m4_expanding(BAR) is defined.
+
+
+# m4_expansion_stack
+# ------------------
+# Expands to the entire contents of the expansion stack.  The caller
+# must supply a trailing newline.  This macro always prints a
+# location; check whether _m4_expansion_stack is defined to filter out
+# the case when no defun'd macro is in force.
+m4_define([m4_expansion_stack],
+[m4_stack_foreach_sep_lifo([_$0], [_$0_entry(], [)
+])m4_location[: the top level]])
+
+# _m4_expansion_stack_entry(MACRO)
+# --------------------------------
+# Format an entry for MACRO found on the expansion stack.
+m4_define([_m4_expansion_stack_entry],
+[_m4_defn([m4_location($1)])[: $1 is expanded from...]])
+
+# m4_expansion_stack_push(MACRO)
+# ------------------------------
+# Form an entry of the expansion stack on entry to MACRO and push it.
+m4_define([m4_expansion_stack_push],
+[m4_pushdef([_m4_expansion_stack], [$1])])
+
+
+# _m4_divert(GROW)
+# ----------------
+# This diversion is used by the m4_defun/m4_require machinery.  It is
+# important to keep room before GROW because for each nested
+# AC_REQUIRE we use an additional diversion (i.e., two m4_require's
+# will use GROW - 2.  More than 3 levels has never seemed to be
+# needed.)
+#
+# ...
+# - GROW - 2
+#   m4_require'd code, 2 level deep
+# - GROW - 1
+#   m4_require'd code, 1 level deep
+# - GROW
+#   m4_defun'd macros are elaborated here.
+
+m4_define([_m4_divert(GROW)],       10000)
+
+
+# _m4_defun_pro(MACRO-NAME)
+# -------------------------
+# The prologue for Autoconf macros.
+#
+# This is called frequently, so minimize the number of macro invocations
+# by avoiding dnl and m4_defn overhead.
+m4_define([_m4_defun_pro],
+[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_pro_outer([$1])])]dnl
+[m4_expansion_stack_push([$1])m4_pushdef([_m4_expanding($1)])])
+
+m4_define([_m4_defun_pro_outer],
+[m4_set_delete([_m4_provide])]dnl
+[m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])]dnl
+[m4_pushdef([_m4_divert_dump], m4_divnum)m4_divert_push([GROW])])
+
+# _m4_defun_epi(MACRO-NAME)
+# -------------------------
+# The Epilogue for Autoconf macros.  MACRO-NAME only helps tracing
+# the PRO/EPI pairs.
+#
+# This is called frequently, so minimize the number of macro invocations
+# by avoiding dnl and m4_popdef overhead.
+m4_define([_m4_defun_epi],
+[_m4_popdef([_m4_expanding($1)], [_m4_expansion_stack])]dnl
+[m4_ifdef([_m4_expansion_stack], [], [_m4_defun_epi_outer([$1])])]dnl
+[m4_provide([$1])])
+
+m4_define([_m4_defun_epi_outer],
+[_m4_popdef([_m4_divert_dump], [_m4_diverting([$1])], [_m4_diverting])]dnl
+[m4_divert_pop([GROW])m4_undivert([GROW])])
+
+
+# _m4_divert_dump
+# ---------------
+# If blank, we are outside of any defun'd macro.  Otherwise, expands
+# to the diversion number (not name) where require'd macros should be
+# moved once completed.
+m4_define([_m4_divert_dump])
+
+
+# m4_divert_require(DIVERSION, NAME-TO-CHECK, [BODY-TO-EXPAND])
+# -------------------------------------------------------------
+# Same as m4_require, but BODY-TO-EXPAND goes into the named DIVERSION;
+# requirements still go in the current diversion though.
+#
+m4_define([m4_divert_require],
+[m4_ifdef([_m4_expanding($2)],
+  [m4_fatal([$0: circular dependency of $2])])]dnl
+[m4_if(_m4_divert_dump, [],
+  [m4_fatal([$0($2): cannot be used outside of an m4_defun'd macro])])]dnl
+[m4_provide_if([$2], [],
+  [_m4_require_call([$2], [$3], _m4_divert([$1], [-]))])])
+
+
+# m4_defun(NAME, EXPANSION, [MACRO = m4_define])
+# ----------------------------------------------
+# Define a macro NAME which automatically provides itself.  Add
+# machinery so the macro automatically switches expansion to the
+# diversion stack if it is not already using it, prior to EXPANSION.
+# In this case, once finished, it will bring back all the code
+# accumulated in the diversion stack.  This, combined with m4_require,
+# achieves the topological ordering of macros.  We don't use this
+# macro to define some frequently called macros that are not involved
+# in ordering constraints, to save m4 processing.
+#
+# MACRO is an undocumented argument; when set to m4_pushdef, and NAME
+# is already defined, the new definition is added to the pushdef
+# stack, rather than overwriting the current definition.  It can thus
+# be used to write self-modifying macros, which pop themselves to a
+# previously m4_define'd definition so that subsequent use of the
+# macro is faster.
+m4_define([m4_defun],
+[m4_define([m4_location($1)], m4_location)]dnl
+[m4_default([$3], [m4_define])([$1],
+  [_m4_defun_pro(]m4_dquote($[0])[)$2[]_m4_defun_epi(]m4_dquote($[0])[)])])
+
+
+# m4_defun_init(NAME, INIT, COMMON)
+# ---------------------------------
+# Like m4_defun, but split EXPANSION into two portions: INIT which is
+# done only the first time NAME is invoked, and COMMON which is
+# expanded every time.
+#
+# For now, the COMMON definition is always m4_define'd, giving an even
+# lighter-weight definition.  m4_defun allows self-providing, but once
+# a macro is provided, m4_require no longer cares if it is m4_define'd
+# or m4_defun'd.  m4_defun also provides location tracking to identify
+# dependency bugs, but once the INIT has been expanded, we know there
+# are no dependency bugs.  However, if a future use needs COMMON to be
+# m4_defun'd, we can add a parameter, similar to the third parameter
+# to m4_defun.
+m4_define([m4_defun_init],
+[m4_define([$1], [$3[]])m4_defun([$1],
+   [$2[]_m4_popdef(]m4_dquote($[0])[)m4_indir(]m4_dquote($[0])dnl
+[m4_if(]m4_dquote($[#])[, [0], [], ]m4_dquote([,$]@)[))], [m4_pushdef])])
+
+
+# m4_defun_once(NAME, EXPANSION)
+# ------------------------------
+# Like m4_defun, but guarantee that EXPANSION only happens once
+# (thereafter, using NAME is a no-op).
+#
+# If _m4_divert_dump is empty, we are called at the top level;
+# otherwise, we must ensure that we are required in front of the
+# current defun'd macro.  Use a helper macro so that EXPANSION need
+# only occur once in the definition of NAME, since it might be large.
+m4_define([m4_defun_once],
+[m4_define([m4_location($1)], m4_location)]dnl
+[m4_define([$1], [_m4_defun_once([$1], [$2], m4_if(_m4_divert_dump, [],
+  [[_m4_defun_pro([$1])m4_unquote(], [)_m4_defun_epi([$1])]],
+m4_ifdef([_m4_diverting([$1])], [-]), [-], [[m4_unquote(], [)]],
+  [[_m4_require_call([$1],], [, _m4_divert_dump)]]))])])
+
+m4_define([_m4_defun_once],
+[m4_pushdef([$1])$3[$2[]m4_provide([$1])]$4])
+
+
+# m4_pattern_forbid(ERE, [WHY])
+# -----------------------------
+# Declare that no token matching the forbidden perl extended regular
+# expression ERE should be seen in the output unless...
+m4_define([m4_pattern_forbid], [])
+
+
+# m4_pattern_allow(ERE)
+# ---------------------
+# ... that token also matches the allowed extended regular expression ERE.
+# Both used via traces, by autom4te post-processing.
+m4_define([m4_pattern_allow], [])
+
+
+## --------------------------------- ##
+## 11. Dependencies between macros.  ##
+## --------------------------------- ##
+
+
+# m4_before(THIS-MACRO-NAME, CALLED-MACRO-NAME)
+# ---------------------------------------------
+# Issue a warning if CALLED-MACRO-NAME was called before THIS-MACRO-NAME.
+m4_define([m4_before],
+[m4_provide_if([$2],
+	       [m4_warn([syntax], [$2 was called before $1])])])
+
+
+# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
+# -----------------------------------------------------------
+# If NAME-TO-CHECK has never been expanded (actually, if it is not
+# m4_provide'd), expand BODY-TO-EXPAND *before* the current macro
+# expansion; follow the expansion with a newline.  Once expanded, emit
+# it in _m4_divert_dump.  Keep track of the m4_require chain in
+# _m4_expansion_stack.
+#
+# The normal cases are:
+#
+# - NAME-TO-CHECK == BODY-TO-EXPAND
+#   Which you can use for regular macros with or without arguments, e.g.,
+#     m4_require([AC_PROG_CC], [AC_PROG_CC])
+#     m4_require([AC_CHECK_HEADERS(threads.h)], [AC_CHECK_HEADERS(threads.h)])
+#   which is just the same as
+#     m4_require([AC_PROG_CC])
+#     m4_require([AC_CHECK_HEADERS(threads.h)])
+#
+# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK])
+#   In the case of macros with irregular names.  For instance:
+#     m4_require([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])])
+#   which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are
+#   part of the name, it is not an argument) has not been run, then
+#   call it.'
+#   Had you used
+#     m4_require([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
+#   then m4_require would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
+#   call the macro `AC_LANG_COMPILER' with `C' as argument.
+#
+#   You could argue that `AC_LANG_COMPILER', when it receives an argument
+#   such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'.  But this
+#   `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
+#   it passes to `AC_LANG_COMPILER(C)'.
+#
+# This is called frequently, so minimize the number of macro invocations
+# by avoiding dnl and other overhead on the common path.
+m4_define([m4_require],
+[m4_ifdef([_m4_expanding($1)],
+  [m4_fatal([$0: circular dependency of $1])])]dnl
+[m4_if(_m4_divert_dump, [],
+  [m4_fatal([$0($1): cannot be used outside of an ]dnl
+m4_if([$0], [m4_require], [[m4_defun]], [[AC_DEFUN]])['d macro])])]dnl
+[m4_provide_if([$1], [m4_set_contains([_m4_provide], [$1],
+    [_m4_require_check([$1], _m4_defn([m4_provide($1)]), [$0])], [m4_ignore])],
+  [_m4_require_call])([$1], [$2], _m4_divert_dump)])
+
+
+# _m4_require_call(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
+#                  DIVERSION-NUMBER)
+# -----------------------------------------------------------------
+# If m4_require decides to expand the body, it calls this macro.  The
+# expansion is placed in DIVERSION-NUMBER.
+#
+# This is called frequently, so minimize the number of macro invocations
+# by avoiding dnl and other overhead on the common path.
+# The use of a witness macro protecting the warning allows aclocal
+# to silence any warnings when probing for what macros are required
+# and must therefore be located, when using the Autoconf-without-aclocal-m4
+# autom4te language.  For more background, see:
+# https://lists.gnu.org/archive/html/automake-patches/2012-11/msg00035.html
+m4_define([_m4_require_call],
+[m4_pushdef([_m4_divert_grow], m4_decr(_m4_divert_grow))]dnl
+[m4_pushdef([_m4_diverting([$1])])m4_pushdef([_m4_diverting], [$1])]dnl
+[m4_divert_push(_m4_divert_grow, [-])]dnl
+[m4_if([$2], [], [$1], [$2])
+m4_provide_if([$1], [m4_set_remove([_m4_provide], [$1])],
+  [m4_ifndef([m4_require_silent_probe],
+    [m4_warn([syntax], [$1 is m4_require'd but not m4_defun'd])])])]dnl
+[_m4_divert_raw($3)_m4_undivert(_m4_divert_grow)]dnl
+[m4_divert_pop(_m4_divert_grow)_m4_popdef([_m4_divert_grow],
+[_m4_diverting([$1])], [_m4_diverting])])
+
+
+# _m4_require_check(NAME-TO-CHECK, OWNER, CALLER)
+# -----------------------------------------------
+# NAME-TO-CHECK has been identified as previously expanded in the
+# diversion owned by OWNER.  If this is a problem, warn on behalf of
+# CALLER and return _m4_require_call; otherwise return m4_ignore.
+m4_define([_m4_require_check],
+[m4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore],
+       m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax],
+   [$3: `$1' was expanded before it was required
+https://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call],
+       [m4_ignore])])
+
+
+# _m4_divert_grow
+# ---------------
+# The counter for _m4_require_call.
+m4_define([_m4_divert_grow], _m4_divert([GROW]))
+
+
+# m4_expand_once(TEXT, [WITNESS = TEXT])
+# --------------------------------------
+# If TEXT has never been expanded, expand it *here*.  Use WITNESS as
+# as a memory that TEXT has already been expanded.
+m4_define([m4_expand_once],
+[m4_provide_if(m4_default_quoted([$2], [$1]),
+	       [],
+	       [m4_provide(m4_default_quoted([$2], [$1]))[]$1])])
+
+
+# m4_provide(MACRO-NAME)
+# ----------------------
+m4_define([m4_provide],
+[m4_ifdef([m4_provide($1)], [],
+[m4_set_add([_m4_provide], [$1], [m4_define([m4_provide($1)],
+  m4_ifdef([_m4_diverting], [_m4_defn([_m4_diverting])]))])])])
+
+
+# m4_provide_if(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -------------------------------------------------------
+# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
+# The purpose of this macro is to provide the user with a means to
+# check macros which are provided without letting her know how the
+# information is coded.
+m4_define([m4_provide_if],
+[m4_ifdef([m4_provide($1)],
+	  [$2], [$3])])
+
+
+## --------------------- ##
+## 12. Text processing.  ##
+## --------------------- ##
+
+
+# m4_cr_letters
+# m4_cr_LETTERS
+# m4_cr_Letters
+# -------------
+m4_define([m4_cr_letters], [abcdefghijklmnopqrstuvwxyz])
+m4_define([m4_cr_LETTERS], [ABCDEFGHIJKLMNOPQRSTUVWXYZ])
+m4_define([m4_cr_Letters],
+m4_defn([m4_cr_letters])dnl
+m4_defn([m4_cr_LETTERS])dnl
+)
+
+
+# m4_cr_digits
+# ------------
+m4_define([m4_cr_digits], [0123456789])
+
+
+# m4_cr_alnum
+# -----------
+m4_define([m4_cr_alnum],
+m4_defn([m4_cr_Letters])dnl
+m4_defn([m4_cr_digits])dnl
+)
+
+
+# m4_cr_symbols1
+# m4_cr_symbols2
+# --------------
+m4_define([m4_cr_symbols1],
+m4_defn([m4_cr_Letters])dnl
+_)
+
+m4_define([m4_cr_symbols2],
+m4_defn([m4_cr_symbols1])dnl
+m4_defn([m4_cr_digits])dnl
+)
+
+# m4_cr_all
+# ---------
+# The character range representing everything, with `-' as the last
+# character, since it is special to m4_translit.  Use with care, because
+# it contains characters special to M4 (fortunately, both ASCII and EBCDIC
+# have [] in order, so m4_defn([m4_cr_all]) remains a valid string).  It
+# also contains characters special to terminals, so it should never be
+# displayed in an error message.  Also, attempts to map [ and ] to other
+# characters via m4_translit must deal with the fact that m4_translit does
+# not add quotes to the output.
+#
+# In EBCDIC, $ is immediately followed by *, which leads to problems
+# if m4_cr_all is inlined into a macro definition; so swap them.
+#
+# It is mainly useful in generating inverted character range maps, for use
+# in places where m4_translit is faster than an equivalent m4_bpatsubst;
+# the regex `[^a-z]' is equivalent to:
+#  m4_translit(m4_dquote(m4_defn([m4_cr_all])), [a-z])
+m4_define([m4_cr_all],
+m4_translit(m4_dquote(m4_format(m4_dquote(m4_for(
+  ,1,255,,[[%c]]))m4_for([i],1,255,,[,i]))), [$*-], [*$])-)
+
+
+# _m4_define_cr_not(CATEGORY)
+# ---------------------------
+# Define m4_cr_not_CATEGORY as the inverse of m4_cr_CATEGORY.
+m4_define([_m4_define_cr_not],
+[m4_define([m4_cr_not_$1],
+	   m4_translit(m4_dquote(m4_defn([m4_cr_all])),
+		       m4_defn([m4_cr_$1])))])
+
+
+# m4_cr_not_letters
+# m4_cr_not_LETTERS
+# m4_cr_not_Letters
+# m4_cr_not_digits
+# m4_cr_not_alnum
+# m4_cr_not_symbols1
+# m4_cr_not_symbols2
+# ------------------
+# Inverse character sets
+_m4_define_cr_not([letters])
+_m4_define_cr_not([LETTERS])
+_m4_define_cr_not([Letters])
+_m4_define_cr_not([digits])
+_m4_define_cr_not([alnum])
+_m4_define_cr_not([symbols1])
+_m4_define_cr_not([symbols2])
+
+
+# m4_newline([STRING])
+# --------------------
+# Expands to a newline, possibly followed by STRING.  Exists mostly for
+# formatting reasons.
+m4_define([m4_newline], [
+$1])
+
+
+# m4_re_escape(STRING)
+# --------------------
+# Escape RE active characters in STRING.
+m4_define([m4_re_escape],
+[m4_bpatsubst([$1],
+	      [[][*+.?\^$]], [\\\&])])
+
+
+# m4_re_string
+# ------------
+# Regexp for `[a-zA-Z_0-9]*'
+# m4_dquote provides literal [] for the character class.
+m4_define([m4_re_string],
+m4_dquote(m4_defn([m4_cr_symbols2]))dnl
+[*]dnl
+)
+
+
+# m4_re_word
+# ----------
+# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*'
+m4_define([m4_re_word],
+m4_dquote(m4_defn([m4_cr_symbols1]))dnl
+m4_defn([m4_re_string])dnl
+)
+
+
+# m4_tolower(STRING)
+# m4_toupper(STRING)
+# ------------------
+# These macros convert STRING to lowercase or uppercase.
+#
+# Rather than expand the m4_defn each time, we inline them up front.
+m4_define([m4_tolower],
+[m4_translit([[$1]], ]m4_dquote(m4_defn([m4_cr_LETTERS]))[,
+		     ]m4_dquote(m4_defn([m4_cr_letters]))[)])
+m4_define([m4_toupper],
+[m4_translit([[$1]], ]m4_dquote(m4_defn([m4_cr_letters]))[,
+		     ]m4_dquote(m4_defn([m4_cr_LETTERS]))[)])
+
+
+# m4_split(STRING, [REGEXP])
+# --------------------------
+# Split STRING into an m4 list of quoted elements.  The elements are
+# quoted with [ and ].  Beginning spaces and end spaces *are kept*.
+# Use m4_strip to remove them.
+#
+# REGEXP specifies where to split.  Default is [\t ]+.
+#
+# If STRING is empty, the result is an empty list.
+#
+# Pay attention to the m4_changequotes.  When m4 reads the definition of
+# m4_split, it still has quotes set to [ and ].  Luckily, these are matched
+# in the macro body, so the definition is stored correctly.  Use the same
+# alternate quotes as m4_noquote; it must be unlikely to appear in $1.
+#
+# Also, notice that $1 is quoted twice, since we want the result to
+# be quoted.  Then you should understand that the argument of
+# patsubst is -=<{(STRING)}>=- (i.e., with additional -=<{( and )}>=-).
+#
+# This macro is safe on active symbols, i.e.:
+#   m4_define(active, ACTIVE)
+#   m4_split([active active ])end
+#   => [active], [active], []end
+#
+# Optimize on regex of ` ' (space), since m4_foreach_w already guarantees
+# that the list contains single space separators, and a common case is
+# splitting a single-element list.  This macro is called frequently,
+# so avoid unnecessary dnl inside the definition.
+m4_define([m4_split],
+[m4_if([$1], [], [],
+       [$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]],
+			 [_$0([$1], [$2], [, ])])],
+       [$2], [], [_$0([$1], [[	 ]+], [, ])],
+       [_$0([$1], [$2], [, ])])])
+
+m4_define([_m4_split],
+[m4_changequote([-=<{(],[)}>=-])]dnl
+[[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-,
+	       -=<{(]$3[)}>=-)]m4_changequote([, ])])
+
+
+# m4_chomp(STRING)
+# m4_chomp_all(STRING)
+# --------------------
+# Return STRING quoted, but without a trailing newline.  m4_chomp
+# removes at most one newline, while m4_chomp_all removes all
+# consecutive trailing newlines.  Embedded newlines are not touched,
+# and a trailing backslash-newline leaves just a trailing backslash.
+#
+# m4_bregexp is slower than m4_index, and we don't always want to
+# remove all newlines; hence the two variants.  We massage characters
+# to give a nicer pattern to match, particularly since m4_bregexp is
+# line-oriented.  Both versions must guarantee a match, to avoid bugs
+# with precision -1 in m4_format in older m4.
+m4_define([m4_chomp],
+[m4_format([[%.*s]], m4_index(m4_translit([[$1]], [
+/.], [/  ])[./.], [/.]), [$1])])
+
+m4_define([m4_chomp_all],
+[m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [
+/], [/ ]), [/*$]), [$1])])
+
+
+# m4_flatten(STRING)
+# ------------------
+# If STRING contains end of lines, replace them with spaces.  If there
+# are backslashed end of lines, remove them.  This macro is safe with
+# active symbols.
+#    m4_define(active, ACTIVE)
+#    m4_flatten([active
+#    act\
+#    ive])end
+#    => active activeend
+#
+# In m4, m4_bpatsubst is expensive, so first check for a newline.
+m4_define([m4_flatten],
+[m4_if(m4_index([$1], [
+]), [-1], [[$1]],
+       [m4_translit(m4_bpatsubst([[[$1]]], [\\
+]), [
+], [ ])])])
+
+
+# m4_strip(STRING)
+# ----------------
+# Expands into STRING with tabs and spaces singled out into a single
+# space, and removing leading and trailing spaces.
+#
+# This macro is robust to active symbols.
+#    m4_define(active, ACTIVE)
+#    m4_strip([  active <tab> <tab>active ])end
+#    => active activeend
+#
+# First, notice that we guarantee trailing space.  Why?  Because regular
+# expressions are greedy, and `.* ?' would always group the space into the
+# .* portion.  The algorithm is simpler by avoiding `?' at the end.  The
+# algorithm correctly strips everything if STRING is just ` '.
+#
+# Then notice the second pattern: it is in charge of removing the
+# leading/trailing spaces.  Why not just `[^ ]'?  Because they are
+# applied to over-quoted strings, i.e. more or less [STRING], due
+# to the limitations of m4_bpatsubsts.  So the leading space in STRING
+# is the *second* character; equally for the trailing space.
+m4_define([m4_strip],
+[m4_bpatsubsts([$1 ],
+	       [[	 ]+], [ ],
+	       [^. ?\(.*\) .$], [[[\1]]])])
+
+
+# m4_normalize(STRING)
+# --------------------
+# Apply m4_flatten and m4_strip to STRING.
+#
+# The argument is quoted, so that the macro is robust to active symbols:
+#
+#    m4_define(active, ACTIVE)
+#    m4_normalize([  act\
+#    ive
+#    active ])end
+#    => active activeend
+
+m4_define([m4_normalize],
+[m4_strip(m4_flatten([$1]))])
+
+
+# m4_validate_w(STRING)
+# ---------------------
+# Expands into m4_normalize(m4_expand([STRING])), but if that is not
+# the same as just m4_normalize([STRING]), issue a warning.
+#
+# This is used in several Autoconf macros that take a
+# whitespace-separated list of symbols as an argument.  Ideally that
+# list would not be expanded before use, but several packages used
+# `dnl' to put comments inside those lists, so they must be expanded
+# for compatibility's sake.
+m4_define([m4_validate_w],
+[_m4_validate_w(m4_normalize([$1]), m4_normalize(m4_expand([$1])))])
+
+m4_define([_m4_validate_w],
+[m4_if([$1], [$2], [],
+  [m4_warn([obsolete], [whitespace-separated list contains macros;
+in a future version of Autoconf they will not be expanded]dnl
+m4_if(m4_bregexp([$1], [\bdn[l]\b]), -1, [], [
+note: `dn@&t@l' is a macro]))])dnl
+[$2]])
+
+
+# m4_join(SEP, ARG1, ARG2...)
+# ---------------------------
+# Produce ARG1SEPARG2...SEPARGn.  Avoid back-to-back SEP when a given ARG
+# is the empty string.  No expansion is performed on SEP or ARGs.
+#
+# Since the number of arguments to join can be arbitrarily long, we
+# want to avoid having more than one $@ in the macro definition;
+# otherwise, the expansion would require twice the memory of the already
+# long list.  Hence, m4_join merely looks for the first non-empty element,
+# and outputs just that element; while _m4_join looks for all non-empty
+# elements, and outputs them following a separator.  The final trick to
+# note is that we decide between recursing with $0 or _$0 based on the
+# nested m4_if ending with `_'.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift2($@))])])
+m4_define([_m4_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift2($@))])])
+
+# m4_joinall(SEP, ARG1, ARG2...)
+# ------------------------------
+# Produce ARG1SEPARG2...SEPARGn.  An empty ARG results in back-to-back SEP.
+# No expansion is performed on SEP or ARGs.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_joinall], [[$2]_$0([$1], m4_shift($@))])
+m4_define([_m4_joinall],
+[m4_if([$#], [2], [], [[$1$3]$0([$1], m4_shift2($@))])])
+
+# m4_combine([SEPARATOR], PREFIX-LIST, [INFIX], SUFFIX...)
+# --------------------------------------------------------
+# Produce the pairwise combination of every element in the quoted,
+# comma-separated PREFIX-LIST with every element from the SUFFIX arguments.
+# Each pair is joined with INFIX, and pairs are separated by SEPARATOR.
+# No expansion occurs on SEPARATOR, INFIX, or elements of either list.
+#
+# For example:
+#   m4_combine([, ], [[a], [b], [c]], [-], [1], [2], [3])
+#   => a-1, a-2, a-3, b-1, b-2, b-3, c-1, c-2, c-3
+#
+# This definition is a bit hairy; the thing to realize is that we want
+# to construct m4_map_args_sep([[prefix$3]], [], [[$1]], m4_shift3($@))
+# as the inner loop, using each prefix generated by the outer loop,
+# and without recalculating m4_shift3 every outer iteration.
+m4_define([m4_combine],
+[m4_if([$2], [], [], m4_eval([$# > 3]), [1],
+[m4_map_args_sep([m4_map_args_sep(m4_dquote(], [)[[$3]], [], [[$1]],]]]dnl
+[m4_dquote(m4_dquote(m4_shift3($@)))[[)], [[$1]], $2)])])
+
+
+# m4_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR`'STRING'
+# at the end.  It is valid to use this macro with MACRO-NAME undefined,
+# in which case no SEPARATOR is added.  Be aware that the criterion is
+# `not being defined', and not `not being empty'.
+#
+# Note that neither STRING nor SEPARATOR are expanded here; rather, when
+# you expand MACRO-NAME, they will be expanded at that point in time.
+#
+# This macro is robust to active symbols.  It can be used to grow
+# strings.
+#
+#    | m4_define(active, ACTIVE)dnl
+#    | m4_append([sentence], [This is an])dnl
+#    | m4_append([sentence], [ active ])dnl
+#    | m4_append([sentence], [symbol.])dnl
+#    | sentence
+#    | m4_undefine([active])dnl
+#    | sentence
+#    => This is an ACTIVE symbol.
+#    => This is an active symbol.
+#
+# It can be used to define hooks.
+#
+#    | m4_define(active, ACTIVE)dnl
+#    | m4_append([hooks], [m4_define([act1], [act2])])dnl
+#    | m4_append([hooks], [m4_define([act2], [active])])dnl
+#    | m4_undefine([active])dnl
+#    | act1
+#    | hooks
+#    | act1
+#    => act1
+#    =>
+#    => active
+#
+# It can also be used to create lists, although this particular usage was
+# broken prior to autoconf 2.62.
+#    | m4_append([list], [one], [, ])dnl
+#    | m4_append([list], [two], [, ])dnl
+#    | m4_append([list], [three], [, ])dnl
+#    | list
+#    | m4_dquote(list)
+#    => one, two, three
+#    => [one],[two],[three]
+#
+# Note that m4_append can benefit from amortized O(n) m4 behavior, if
+# the underlying m4 implementation is smart enough to avoid copying existing
+# contents when enlarging a macro's definition into any pre-allocated storage
+# (m4 1.4.x unfortunately does not implement this optimization).  We do
+# not implement m4_prepend, since it is inherently O(n^2) (pre-allocated
+# storage only occurs at the end of a macro, so the existing contents must
+# always be moved).
+#
+# Use _m4_defn for speed.
+m4_define([m4_append],
+[m4_define([$1], m4_ifdef([$1], [_m4_defn([$1])[$3]])[$2])])
+
+
+# m4_append_uniq(MACRO-NAME, STRING, [SEPARATOR], [IF-UNIQ], [IF-DUP])
+# --------------------------------------------------------------------
+# Like `m4_append', but append only if not yet present.  Additionally,
+# expand IF-UNIQ if STRING was appended, or IF-DUP if STRING was already
+# present.  Also, warn if SEPARATOR is not empty and occurs within STRING,
+# as the algorithm no longer guarantees uniqueness.
+#
+# Note that while m4_append can be O(n) (depending on the quality of the
+# underlying M4 implementation), m4_append_uniq is inherently O(n^2)
+# because each append operation searches the entire string.
+m4_define([m4_append_uniq],
+[m4_ifval([$3], [m4_if(m4_index([$2], [$3]), [-1], [],
+		       [m4_warn([syntax],
+				[$0: `$2' contains `$3'])])])_$0($@)])
+m4_define([_m4_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]_m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [m4_append([$1], [$2], [$3])$4], [$5])],
+	  [m4_define([$1], [$2])$4])])
+
+# m4_append_uniq_w(MACRO-NAME, STRINGS)
+# -------------------------------------
+# For each of the words in the whitespace separated list STRINGS, append
+# only the unique strings to the definition of MACRO-NAME.
+#
+# Use _m4_defn for speed.
+m4_define([m4_append_uniq_w],
+[m4_map_args_w([$2], [_m4_append_uniq([$1],], [, [ ])])])
+
+
+# m4_escape(STRING)
+# -----------------
+# Output quoted STRING, but with embedded #, $, [ and ] turned into
+# quadrigraphs.
+#
+# It is faster to check if STRING is already good using m4_translit
+# than to blindly perform four m4_bpatsubst.
+#
+# Because the translit is stripping quotes, it must also neutralize
+# anything that might be in a macro name, as well as comments, commas,
+# and parentheses.  All the problem characters are unified so that a
+# single m4_index can scan the result.
+#
+# Rather than expand m4_defn every time m4_escape is expanded, we
+# inline its expansion up front.
+m4_define([m4_escape],
+[m4_if(m4_index(m4_translit([$1],
+   [[]#,()]]m4_dquote(m4_defn([m4_cr_symbols2]))[, [$$$]), [$]),
+  [-1], [m4_echo], [_$0])([$1])])
+
+m4_define([_m4_escape],
+[m4_changequote([-=<{(],[)}>=-])]dnl
+[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(m4_bpatsubst(
+	  -=<{(-=<{(-=<{(-=<{(-=<{($1)}>=-)}>=-)}>=-)}>=-)}>=-,
+	-=<{(#)}>=-, -=<{(@%:@)}>=-),
+      -=<{(\[)}>=-, -=<{(@<:@)}>=-),
+    -=<{(\])}>=-, -=<{(@:>@)}>=-),
+  -=<{(\$)}>=-, -=<{(@S|@)}>=-)m4_changequote([,])])
+
+
+# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
+# -------------------------------------------------------
+# Expands into STRING wrapped to hold in WIDTH columns (default = 79).
+# If PREFIX is given, each line is prefixed with it.  If FIRST-PREFIX is
+# specified, then the first line is prefixed with it.  As a special case,
+# if the length of FIRST-PREFIX is greater than that of PREFIX, then
+# FIRST-PREFIX will be left alone on the first line.
+#
+# No expansion occurs on the contents STRING, PREFIX, or FIRST-PREFIX,
+# although quadrigraphs are correctly recognized.  More precisely,
+# you may redefine m4_qlen to recognize whatever escape sequences that
+# you will post-process.
+#
+# Typical outputs are:
+#
+# m4_text_wrap([Short string */], [   ], [/* ], 20)
+#  => /* Short string */
+#
+# m4_text_wrap([Much longer string */], [   ], [/* ], 20)
+#  => /* Much longer
+#  =>    string */
+#
+# m4_text_wrap([Short doc.], [          ], [  --short ], 30)
+#  =>   --short Short doc.
+#
+# m4_text_wrap([Short doc.], [          ], [  --too-wide ], 30)
+#  =>   --too-wide
+#  =>           Short doc.
+#
+# m4_text_wrap([Super long documentation.], [          ], [  --too-wide ], 30)
+#  =>   --too-wide
+#  =>      Super long
+#  =>      documentation.
+#
+# FIXME: there is no checking of a longer PREFIX than WIDTH, but do
+# we really want to bother with people trying each single corner
+# of a software?
+#
+# This macro does not leave a trailing space behind the last word of a line,
+# which complicates it a bit.  The algorithm is otherwise stupid and simple:
+# all the words are preceded by m4_Separator which is defined to empty for
+# the first word, and then ` ' (single space) for all the others.
+#
+# The algorithm uses a helper that uses $2 through $4 directly, rather than
+# using local variables, to avoid m4_defn overhead, or expansion swallowing
+# any $.  It also bypasses m4_popdef overhead with _m4_popdef since no user
+# macro expansion occurs in the meantime.  Also, the definition is written
+# with m4_do, to avoid time wasted on dnl during expansion (since this is
+# already a time-consuming macro).
+m4_define([m4_text_wrap],
+[_$0(m4_escape([$1]), [$2], m4_default_quoted([$3], [$2]),
+     m4_default_quoted([$4], [79]))])
+
+m4_define([_m4_text_wrap],
+m4_do(dnl set up local variables, to avoid repeated calculations
+[[m4_pushdef([m4_Indent], m4_qlen([$2]))]],
+[[m4_pushdef([m4_Cursor], m4_qlen([$3]))]],
+[[m4_pushdef([m4_Separator], [m4_define([m4_Separator], [ ])])]],
+dnl expand the first prefix, then check its length vs. regular prefix
+dnl same length: nothing special
+dnl prefix1 longer: output on line by itself, and reset cursor
+dnl prefix1 shorter: pad to length of prefix, and reset cursor
+[[[$3]m4_cond([m4_Cursor], m4_Indent, [],
+	      [m4_eval(m4_Cursor > m4_Indent)], [1], [
+[$2]m4_define([m4_Cursor], m4_Indent)],
+	      [m4_format([%*s], m4_max([0],
+  m4_eval(m4_Indent - m4_Cursor)), [])m4_define([m4_Cursor], m4_Indent)])]],
+dnl now, for each word, compute the cursor after the word is output, then
+dnl check if the cursor would exceed the wrap column
+dnl if so, reset cursor, and insert newline and prefix
+dnl if not, insert the separator (usually a space)
+dnl either way, insert the word
+[[m4_map_args_w([$1], [$0_word(], [, [$2], [$4])])]],
+dnl finally, clean up the local variables
+[[_m4_popdef([m4_Separator], [m4_Cursor], [m4_Indent])]]))
+
+m4_define([_m4_text_wrap_word],
+[m4_define([m4_Cursor], m4_eval(m4_Cursor + m4_qlen([$1]) + 1))]dnl
+[m4_if(m4_eval(m4_Cursor > ([$3])),
+      [1], [m4_define([m4_Cursor], m4_eval(m4_Indent + m4_qlen([$1]) + 1))
+[$2]],
+      [m4_Separator[]])[$1]])
+
+# m4_text_box(MESSAGE, [FRAME-CHARACTER = `-'])
+# ---------------------------------------------
+# Turn MESSAGE into:
+#  ## ------- ##
+#  ## MESSAGE ##
+#  ## ------- ##
+# using FRAME-CHARACTER in the border.
+#
+# Quadrigraphs are correctly recognized.  More precisely, you may
+# redefine m4_qlen to recognize whatever escape sequences that you
+# will post-process.
+m4_define([m4_text_box],
+[m4_pushdef([m4_Border],
+	    m4_translit(m4_format([[[%*s]]], m4_decr(m4_qlen(_m4_expand([$1
+]))), []), [ ], m4_default_quoted([$2], [-])))]dnl
+[[##] _m4_defn([m4_Border]) [##]
+[##] $1 [##]
+[##] _m4_defn([m4_Border]) [##]_m4_popdef([m4_Border])])
+
+
+# m4_qlen(STRING)
+# ---------------
+# Expands to the length of STRING after autom4te converts all quadrigraphs.
+#
+# If you use some other means of post-processing m4 output rather than
+# autom4te, then you may redefine this macro to recognize whatever
+# escape sequences your post-processor will handle.  For that matter,
+# m4_define([m4_qlen], m4_defn([m4_len])) is sufficient if you don't
+# do any post-processing.
+#
+# Avoid bpatsubsts for the common case of no quadrigraphs.  Cache
+# results, as configure scripts tend to ask about lengths of common
+# strings like `/*' and `*/' rather frequently.  Minimize the number
+# of times that $1 occurs in m4_qlen, so there is less text to parse
+# on a cache hit.
+m4_define([m4_qlen],
+[m4_ifdef([$0-$1], [_m4_defn([$0-]], [_$0(])[$1])])
+m4_define([_m4_qlen],
+[m4_define([m4_qlen-$1],
+m4_if(m4_index([$1], [@]), [-1], [m4_len([$1])],
+      [m4_len(m4_bpatsubst([[$1]],
+			   [@\(\(<:\|:>\|S|\|%:\|\{:\|:\}\)\(@\)\|&t@\)],
+			   [\3]))]))_m4_defn([m4_qlen-$1])])
+
+# m4_copyright_condense(TEXT)
+# ---------------------------
+# Condense the copyright notice in TEXT to only display the final
+# year, wrapping the results to fit in 80 columns.
+m4_define([m4_copyright_condense],
+[m4_text_wrap(m4_bpatsubst(m4_flatten([[$1]]),
+[(C)[-	 ,0-9]*\([1-9][0-9][0-9][0-9]\)], [(C) \1]))])
+
+## ----------------------- ##
+## 13. Number processing.  ##
+## ----------------------- ##
+
+# m4_cmp(A, B)
+# ------------
+# Compare two integer expressions.
+# A < B -> -1
+# A = B ->  0
+# A > B ->  1
+m4_define([m4_cmp],
+[m4_eval((([$1]) > ([$2])) - (([$1]) < ([$2])))])
+
+
+# m4_list_cmp(A, B)
+# -----------------
+#
+# Compare the two lists of integer expressions A and B.  For instance:
+#   m4_list_cmp([1, 0],     [1])    ->  0
+#   m4_list_cmp([1, 0],     [1, 0]) ->  0
+#   m4_list_cmp([1, 2],     [1, 0]) ->  1
+#   m4_list_cmp([1, 2, 3],  [1, 2]) ->  1
+#   m4_list_cmp([1, 2, -3], [1, 2]) -> -1
+#   m4_list_cmp([1, 0],     [1, 2]) -> -1
+#   m4_list_cmp([1],        [1, 2]) -> -1
+#   m4_define([xa], [oops])dnl
+#   m4_list_cmp([[0xa]],    [5+5])  -> 0
+#
+# Rather than face the overhead of m4_case, we use a helper function whose
+# expansion includes the name of the macro to invoke on the tail, either
+# m4_ignore or m4_unquote.  This is particularly useful when comparing
+# long lists, since less text is being expanded for deciding when to end
+# recursion.  The recursion is between a pair of macros that alternate
+# which list is trimmed by one element; this is more efficient than
+# calling m4_cdr on both lists from a single macro.  Guarantee exactly
+# one expansion of both lists' side effects.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_list_cmp],
+[_$0_raw(m4_dquote($1), m4_dquote($2))])
+
+m4_define([_m4_list_cmp_raw],
+[m4_if([$1], [$2], [0], [_m4_list_cmp_1([$1], $2)])])
+
+m4_define([_m4_list_cmp],
+[m4_if([$1], [], [0m4_ignore], [$2], [0], [m4_unquote], [$2m4_ignore])])
+
+m4_define([_m4_list_cmp_1],
+[_m4_list_cmp_2([$2], [m4_shift2($@)], $1)])
+
+m4_define([_m4_list_cmp_2],
+[_m4_list_cmp([$1$3], m4_cmp([$3+0], [$1+0]))(
+  [_m4_list_cmp_1(m4_dquote(m4_shift3($@)), $2)])])
+
+# m4_max(EXPR, ...)
+# m4_min(EXPR, ...)
+# -----------------
+# Return the decimal value of the maximum (or minimum) in a series of
+# integer expressions.
+#
+# M4 1.4.x doesn't provide ?:.  Hence this huge m4_eval.  Avoid m4_eval
+# if both arguments are identical, but be aware of m4_max(0xa, 10) (hence
+# the use of <=, not just <, in the second multiply).
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_max],
+[m4_if([$#], [0], [m4_fatal([too few arguments to $0])],
+       [$#], [1], [m4_eval([$1])],
+       [$#$1], [2$2], [m4_eval([$1])],
+       [$#], [2], [_$0($@)],
+       [_m4_minmax([_$0], $@)])])
+
+m4_define([_m4_max],
+[m4_eval((([$1]) > ([$2])) * ([$1]) + (([$1]) <= ([$2])) * ([$2]))])
+
+m4_define([m4_min],
+[m4_if([$#], [0], [m4_fatal([too few arguments to $0])],
+       [$#], [1], [m4_eval([$1])],
+       [$#$1], [2$2], [m4_eval([$1])],
+       [$#], [2], [_$0($@)],
+       [_m4_minmax([_$0], $@)])])
+
+m4_define([_m4_min],
+[m4_eval((([$1]) < ([$2])) * ([$1]) + (([$1]) >= ([$2])) * ([$2]))])
+
+# _m4_minmax(METHOD, ARG1, ARG2...)
+# ---------------------------------
+# Common recursion code for m4_max and m4_min.  METHOD must be _m4_max
+# or _m4_min, and there must be at least two arguments to combine.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([_m4_minmax],
+[m4_if([$#], [3], [$1([$2], [$3])],
+       [$0([$1], $1([$2], [$3]), m4_shift3($@))])])
+
+
+# m4_sign(A)
+# ----------
+# The sign of the integer expression A.
+m4_define([m4_sign],
+[m4_eval((([$1]) > 0) - (([$1]) < 0))])
+
+
+
+## ------------------------ ##
+## 14. Version processing.  ##
+## ------------------------ ##
+
+
+# m4_version_unletter(VERSION)
+# ----------------------------
+# Normalize beta version numbers with letters to numeric expressions, which
+# can then be handed to m4_eval for the purpose of comparison.
+#
+#   Nl -> (N+1).-1.(l#)
+#
+# for example:
+#   [2.14a] -> [0,2,14+1,-1,[0r36:a]] -> 2.15.-1.10
+#   [2.14b] -> [0,2,15+1,-1,[0r36:b]] -> 2.15.-1.11
+#   [2.61aa.b] -> [0,2.61,1,-1,[0r36:aa],+1,-1,[0r36:b]] -> 2.62.-1.370.1.-1.11
+#   [08] -> [0,[0r10:0]8] -> 8
+#
+# This macro expects reasonable version numbers, but can handle double
+# letters and does not expand any macros.  Original version strings can
+# use both `.' and `-' separators.
+#
+# Inline constant expansions, to avoid m4_defn overhead.
+# _m4_version_unletter is the real workhorse used by m4_version_compare,
+# but since [0r36:a] and commas are less readable than 10 and dots, we
+# provide a wrapper for human use.
+m4_define([m4_version_unletter],
+[m4_substr(m4_map_args([.m4_eval], m4_unquote(_$0([$1]))), [3])])
+m4_define([_m4_version_unletter],
+[m4_bpatsubst(m4_bpatsubst(m4_translit([[[[0,$1]]]], [.-], [,,]),]dnl
+m4_dquote(m4_dquote(m4_defn([m4_cr_Letters])))[[+],
+	      [+1,-1,[0r36:\&]]), [,0], [,[0r10:0]])])
+
+
+# m4_version_compare(VERSION-1, VERSION-2)
+# ----------------------------------------
+# Compare the two version numbers and expand into
+#  -1 if VERSION-1 < VERSION-2
+#   0 if           =
+#   1 if           >
+#
+# Since _m4_version_unletter does not output side effects, we can
+# safely bypass the overhead of m4_version_cmp.
+m4_define([m4_version_compare],
+[_m4_list_cmp_raw(_m4_version_unletter([$1]), _m4_version_unletter([$2]))])
+
+
+# m4_PACKAGE_NAME
+# m4_PACKAGE_TARNAME
+# m4_PACKAGE_VERSION
+# m4_PACKAGE_STRING
+# m4_PACKAGE_BUGREPORT
+# --------------------
+# If m4sugar/version.m4 is present, then define version strings.  This
+# file is optional, provided by Autoconf but absent in Bison.
+m4_sinclude([m4sugar/version.m4])
+
+
+# m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
+# ----------------------------------------------------
+# Check this Autoconf version against VERSION.
+m4_define([m4_version_prereq],
+m4_ifdef([m4_PACKAGE_VERSION],
+[[m4_if(m4_version_compare(]m4_dquote(m4_defn([m4_PACKAGE_VERSION]))[, [$1]),
+	[-1],
+	[m4_default([$3],
+		    [m4_fatal([Autoconf version $1 or higher is required],
+			      [63])])],
+	[$2])]],
+[[m4_fatal([m4sugar/version.m4 not found])]]))
+
+
+## ------------------ ##
+## 15. Set handling.  ##
+## ------------------ ##
+
+# Autoconf likes to create arbitrarily large sets; for example, as of
+# this writing, the configure.ac for coreutils tracks a set of more
+# than 400 AC_SUBST.  How do we track all of these set members,
+# without introducing duplicates?  We could use m4_append_uniq, with
+# the set NAME residing in the contents of the macro NAME.
+# Unfortunately, m4_append_uniq is quadratic for set creation, because
+# it costs O(n) to search the string for each of O(n) insertions; not
+# to mention that with m4 1.4.x, even using m4_append is slow, costing
+# O(n) rather than O(1) per insertion.  Other set operations, not used
+# by Autoconf but still possible by manipulation of the definition
+# tracked in macro NAME, include O(n) deletion of one element and O(n)
+# computation of set size.  Because the set is exposed to the user via
+# the definition of a single macro, we cannot cache any data about the
+# set without risking the cache being invalidated by the user
+# redefining NAME.
+#
+# Can we do better?  Yes, because m4 gives us an O(1) search function
+# for free: ifdef.  Additionally, even m4 1.4.x gives us an O(1)
+# insert operation for free: pushdef.  But to use these, we must
+# represent the set via a group of macros; to keep the set consistent,
+# we must hide the set so that the user can only manipulate it through
+# accessor macros.  The contents of the set are maintained through two
+# access points; _m4_set([name]) is a pushdef stack of values in the
+# set, useful for O(n) traversal of the set contents; while the
+# existence of _m4_set([name],value) with no particular value is
+# useful for O(1) querying of set membership.  And since the user
+# cannot externally manipulate the set, we are free to add additional
+# caching macros for other performance improvements.  Deletion can be
+# O(1) per element rather than O(n), by reworking the definition of
+# _m4_set([name],value) to be 0 or 1 based on current membership, and
+# adding _m4_set_cleanup(name) to defer the O(n) cleanup of
+# _m4_set([name]) until we have another reason to do an O(n)
+# traversal.  The existence of _m4_set_cleanup(name) can then be used
+# elsewhere to determine if we must dereference _m4_set([name],value),
+# or assume that definition implies set membership.  Finally, size can
+# be tracked in an O(1) fashion with _m4_set_size(name).
+#
+# The quoting in _m4_set([name],value) is chosen so that there is no
+# ambiguity with a set whose name contains a comma, and so that we can
+# supply the value via _m4_defn([_m4_set([name])]) without needing any
+# quote manipulation.
+
+# m4_set_add(SET, VALUE, [IF-UNIQ], [IF-DUP])
+# -------------------------------------------
+# Add VALUE as an element of SET.  Expand IF-UNIQ on the first
+# addition, and IF-DUP if it is already in the set.  Addition of one
+# element is O(1), such that overall set creation is O(n).
+#
+# We do not want to add a duplicate for a previously deleted but
+# unpruned element, but it is just as easy to check existence directly
+# as it is to query _m4_set_cleanup($1).
+m4_define([m4_set_add],
+[m4_ifdef([_m4_set([$1],$2)],
+	  [m4_if(m4_indir([_m4_set([$1],$2)]), [0],
+		 [m4_define([_m4_set([$1],$2)],
+			    [1])_m4_set_size([$1], [m4_incr])$3], [$4])],
+	  [m4_define([_m4_set([$1],$2)],
+		     [1])m4_pushdef([_m4_set([$1])],
+				    [$2])_m4_set_size([$1], [m4_incr])$3])])
+
+# m4_set_add_all(SET, VALUE...)
+# -----------------------------
+# Add each VALUE into SET.  This is O(n) in the number of VALUEs, and
+# can be faster than calling m4_set_add for each VALUE.
+#
+# Implement two recursion helpers; the check variant is slower but
+# handles the case where an element has previously been removed but
+# not pruned.  The recursion helpers ignore their second argument, so
+# that we can use the faster m4_shift2 and 2 arguments, rather than
+# _m4_shift2 and one argument, as the signal to end recursion.
+#
+# Please keep foreach.m4 in sync with any adjustments made here.
+m4_define([m4_set_add_all],
+[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
+  + m4_len(m4_ifdef([_m4_set_cleanup($1)], [_$0_check], [_$0])([$1], $@))))])
+
+m4_define([_m4_set_add_all],
+[m4_if([$#], [2], [],
+       [m4_ifdef([_m4_set([$1],$3)], [],
+		 [m4_define([_m4_set([$1],$3)], [1])m4_pushdef([_m4_set([$1])],
+	   [$3])-])$0([$1], m4_shift2($@))])])
+
+m4_define([_m4_set_add_all_check],
+[m4_if([$#], [2], [],
+       [m4_set_add([$1], [$3])$0([$1], m4_shift2($@))])])
+
+# m4_set_contains(SET, VALUE, [IF-PRESENT], [IF-ABSENT])
+# ------------------------------------------------------
+# Expand IF-PRESENT if SET contains VALUE, otherwise expand IF-ABSENT.
+# This is always O(1).
+m4_define([m4_set_contains],
+[m4_ifdef([_m4_set_cleanup($1)],
+	  [m4_if(m4_ifdef([_m4_set([$1],$2)],
+		    [m4_indir([_m4_set([$1],$2)])], [0]), [1], [$3], [$4])],
+	  [m4_ifdef([_m4_set([$1],$2)], [$3], [$4])])])
+
+# m4_set_contents(SET, [SEP])
+# ---------------------------
+# Expand to a single string containing all the elements in SET,
+# separated by SEP, without modifying SET.  No provision is made for
+# disambiguating set elements that contain non-empty SEP as a
+# sub-string, or for recognizing a set that contains only the empty
+# string.  Order of the output is not guaranteed.  If any elements
+# have been previously removed from the set, this action will prune
+# the unused memory.  This is O(n) in the size of the set before
+# pruning.
+#
+# Use _m4_popdef for speed.  The existence of _m4_set_cleanup($1)
+# determines which version of _1 helper we use.
+m4_define([m4_set_contents],
+[m4_set_map_sep([$1], [], [], [[$2]])])
+
+# _m4_set_contents_1(SET)
+# _m4_set_contents_1c(SET)
+# _m4_set_contents_2(SET, [PRE], [POST], [SEP])
+# ---------------------------------------------
+# Expand to a list of quoted elements currently in the set, each
+# surrounded by PRE and POST, and moving SEP in front of PRE on
+# recursion.  To avoid nesting limit restrictions, the algorithm must
+# be broken into two parts; _1 destructively copies the stack in
+# reverse into _m4_set_($1), producing no output; then _2
+# destructively copies _m4_set_($1) back into the stack in reverse.
+# If no elements were deleted, then this visits the set in the order
+# that elements were inserted.  Behavior is undefined if PRE/POST/SEP
+# tries to recursively list or modify SET in any way other than
+# calling m4_set_remove on the current element.  Use _1 if all entries
+# in the stack are guaranteed to be in the set, and _1c to prune
+# removed entries.  Uses _m4_defn and _m4_popdef for speed.
+m4_define([_m4_set_contents_1],
+[_m4_stack_reverse([_m4_set([$1])], [_m4_set_($1)])])
+
+m4_define([_m4_set_contents_1c],
+[m4_ifdef([_m4_set([$1])],
+	  [m4_set_contains([$1], _m4_defn([_m4_set([$1])]),
+		   [m4_pushdef([_m4_set_($1)], _m4_defn([_m4_set([$1])]))],
+		   [_m4_popdef([_m4_set([$1],]_m4_defn(
+      [_m4_set([$1])])[)])])_m4_popdef([_m4_set([$1])])$0([$1])],
+	  [_m4_popdef([_m4_set_cleanup($1)])])])
+
+m4_define([_m4_set_contents_2],
+[_m4_stack_reverse([_m4_set_($1)], [_m4_set([$1])],
+  [$2[]_m4_defn([_m4_set_($1)])$3], [$4[]])])
+
+# m4_set_delete(SET)
+# ------------------
+# Delete all elements in SET, and reclaim any memory occupied by the
+# set.  This is O(n) in the set size.
+#
+# Use _m4_defn and _m4_popdef for speed.
+m4_define([m4_set_delete],
+[m4_ifdef([_m4_set([$1])],
+	  [_m4_popdef([_m4_set([$1],]_m4_defn([_m4_set([$1])])[)],
+		      [_m4_set([$1])])$0([$1])],
+	  [m4_ifdef([_m4_set_cleanup($1)],
+		    [_m4_popdef([_m4_set_cleanup($1)])])m4_ifdef(
+		    [_m4_set_size($1)],
+		    [_m4_popdef([_m4_set_size($1)])])])])
+
+# m4_set_difference(SET1, SET2)
+# -----------------------------
+# Produce a LIST of quoted elements that occur in SET1 but not SET2.
+# Output a comma prior to any elements, to distinguish the empty
+# string from no elements.  This can be directly used as a series of
+# arguments, such as for m4_join, or wrapped inside quotes for use in
+# m4_foreach.  Order of the output is not guaranteed.
+#
+# Short-circuit the idempotence relation.
+m4_define([m4_set_difference],
+[m4_if([$1], [$2], [], [m4_set_map_sep([$1], [_$0([$2],], [)])])])
+
+m4_define([_m4_set_difference],
+[m4_set_contains([$1], [$2], [], [,[$2]])])
+
+# m4_set_dump(SET, [SEP])
+# -----------------------
+# Expand to a single string containing all the elements in SET,
+# separated by SEP, then delete SET.  In general, if you only need to
+# list the contents once, this is faster than m4_set_contents.  No
+# provision is made for disambiguating set elements that contain
+# non-empty SEP as a sub-string.  Order of the output is not
+# guaranteed.  This is O(n) in the size of the set before pruning.
+#
+# Use _m4_popdef for speed.  Use existence of _m4_set_cleanup($1) to
+# decide if more expensive recursion is needed.
+m4_define([m4_set_dump],
+[m4_ifdef([_m4_set_size($1)],
+	  [_m4_popdef([_m4_set_size($1)])])m4_ifdef([_m4_set_cleanup($1)],
+    [_$0_check], [_$0])([$1], [], [$2])])
+
+# _m4_set_dump(SET, [SEP], [PREP])
+# _m4_set_dump_check(SET, [SEP], [PREP])
+# --------------------------------------
+# Print SEP and the current element, then delete the element and
+# recurse with empty SEP changed to PREP.  The check variant checks
+# whether the element has been previously removed.  Use _m4_defn and
+# _m4_popdef for speed.
+m4_define([_m4_set_dump],
+[m4_ifdef([_m4_set([$1])],
+	  [[$2]_m4_defn([_m4_set([$1])])_m4_popdef([_m4_set([$1],]_m4_defn(
+		[_m4_set([$1])])[)], [_m4_set([$1])])$0([$1], [$2$3])])])
+
+m4_define([_m4_set_dump_check],
+[m4_ifdef([_m4_set([$1])],
+	  [m4_set_contains([$1], _m4_defn([_m4_set([$1])]),
+			   [[$2]_m4_defn([_m4_set([$1])])])_m4_popdef(
+    [_m4_set([$1],]_m4_defn([_m4_set([$1])])[)],
+    [_m4_set([$1])])$0([$1], [$2$3])],
+	  [_m4_popdef([_m4_set_cleanup($1)])])])
+
+# m4_set_empty(SET, [IF-EMPTY], [IF-ELEMENTS])
+# --------------------------------------------
+# Expand IF-EMPTY if SET has no elements, otherwise IF-ELEMENTS.
+m4_define([m4_set_empty],
+[m4_ifdef([_m4_set_size($1)],
+	  [m4_if(m4_indir([_m4_set_size($1)]), [0], [$2], [$3])], [$2])])
+
+# m4_set_foreach(SET, VAR, ACTION)
+# --------------------------------
+# For each element of SET, define VAR to the element and expand
+# ACTION.  ACTION should not recursively list SET's contents, add
+# elements to SET, nor delete any element from SET except the one
+# currently in VAR.  The order that the elements are visited in is not
+# guaranteed.  This is faster than the corresponding m4_foreach([VAR],
+#   m4_indir([m4_dquote]m4_set_listc([SET])), [ACTION])
+m4_define([m4_set_foreach],
+[m4_pushdef([$2])m4_set_map_sep([$1],
+[m4_define([$2],], [)$3])m4_popdef([$2])])
+
+# m4_set_intersection(SET1, SET2)
+# -------------------------------
+# Produce a LIST of quoted elements that occur in both SET1 or SET2.
+# Output a comma prior to any elements, to distinguish the empty
+# string from no elements.  This can be directly used as a series of
+# arguments, such as for m4_join, or wrapped inside quotes for use in
+# m4_foreach.  Order of the output is not guaranteed.
+#
+# Iterate over the smaller set, and short-circuit the idempotence
+# relation.
+m4_define([m4_set_intersection],
+[m4_if([$1], [$2], [m4_set_listc([$1])],
+       m4_eval(m4_set_size([$2]) < m4_set_size([$1])), [1], [$0([$2], [$1])],
+       [m4_set_map_sep([$1], [_$0([$2],], [)])])])
+
+m4_define([_m4_set_intersection],
+[m4_set_contains([$1], [$2], [,[$2]])])
+
+# m4_set_list(SET)
+# m4_set_listc(SET)
+# -----------------
+# Produce a LIST of quoted elements of SET.  This can be directly used
+# as a series of arguments, such as for m4_join or m4_set_add_all, or
+# wrapped inside quotes for use in m4_foreach or m4_map.  With
+# m4_set_list, there is no way to distinguish an empty set from a set
+# containing only the empty string; with m4_set_listc, a leading comma
+# is output if there are any elements.
+m4_define([m4_set_list],
+[m4_set_map_sep([$1], [], [], [,])])
+
+m4_define([m4_set_listc],
+[m4_set_map_sep([$1], [,])])
+
+# m4_set_map(SET, ACTION)
+# -----------------------
+# For each element of SET, expand ACTION with a single argument of the
+# current element.  ACTION should not recursively list SET's contents,
+# add elements to SET, nor delete any element from SET except the one
+# passed as an argument.  The order that the elements are visited in
+# is not guaranteed.  This is faster than either of the corresponding
+#   m4_map_args([ACTION]m4_set_listc([SET]))
+#   m4_set_foreach([SET], [VAR], [ACTION(m4_defn([VAR]))])
+m4_define([m4_set_map],
+[m4_set_map_sep([$1], [$2(], [)])])
+
+# m4_set_map_sep(SET, [PRE], [POST], [SEP])
+# -----------------------------------------
+# For each element of SET, expand PRE[value]POST[], and expand SEP
+# between elements.
+m4_define([m4_set_map_sep],
+[m4_ifdef([_m4_set_cleanup($1)], [_m4_set_contents_1c],
+	  [_m4_set_contents_1])([$1])_m4_set_contents_2($@)])
+
+# m4_set_remove(SET, VALUE, [IF-PRESENT], [IF-ABSENT])
+# ----------------------------------------------------
+# If VALUE is an element of SET, delete it and expand IF-PRESENT.
+# Otherwise expand IF-ABSENT.  Deleting a single value is O(1),
+# although it leaves memory occupied until the next O(n) traversal of
+# the set which will compact the set.
+#
+# Optimize if the element being removed is the most recently added,
+# since defining _m4_set_cleanup($1) slows down so many other macros.
+# In particular, this plays well with m4_set_foreach and m4_set_map.
+m4_define([m4_set_remove],
+[m4_set_contains([$1], [$2], [_m4_set_size([$1],
+    [m4_decr])m4_if(_m4_defn([_m4_set([$1])]), [$2],
+		    [_m4_popdef([_m4_set([$1],$2)], [_m4_set([$1])])],
+		    [m4_define([_m4_set_cleanup($1)])m4_define(
+		      [_m4_set([$1],$2)], [0])])$3], [$4])])
+
+# m4_set_size(SET)
+# ----------------
+# Expand to the number of elements currently in SET.  This operation
+# is O(1), and thus more efficient than m4_count(m4_set_list([SET])).
+m4_define([m4_set_size],
+[m4_ifdef([_m4_set_size($1)], [m4_indir([_m4_set_size($1)])], [0])])
+
+# _m4_set_size(SET, ACTION)
+# -------------------------
+# ACTION must be either m4_incr or m4_decr, and the size of SET is
+# changed accordingly.  If the set is empty, ACTION must not be
+# m4_decr.
+m4_define([_m4_set_size],
+[m4_define([_m4_set_size($1)],
+	   m4_ifdef([_m4_set_size($1)], [$2(m4_indir([_m4_set_size($1)]))],
+		    [1]))])
+
+# m4_set_union(SET1, SET2)
+# ------------------------
+# Produce a LIST of double quoted elements that occur in either SET1
+# or SET2, without duplicates.  Output a comma prior to any elements,
+# to distinguish the empty string from no elements.  This can be
+# directly used as a series of arguments, such as for m4_join, or
+# wrapped inside quotes for use in m4_foreach.  Order of the output is
+# not guaranteed.
+#
+# We can rely on the fact that m4_set_listc prunes SET1, so we don't
+# need to check _m4_set([$1],element) for 0.  Short-circuit the
+# idempotence relation.
+m4_define([m4_set_union],
+[m4_set_listc([$1])m4_if([$1], [$2], [],
+  [m4_set_map_sep([$2], [_$0([$1],], [)])])])
+
+m4_define([_m4_set_union],
+[m4_ifdef([_m4_set([$1],$2)], [], [,[$2]])])
+
+
+## ------------------- ##
+## 16. File handling.  ##
+## ------------------- ##
+
+
+# It is a real pity that M4 comes with no macros to bind a diversion
+# to a file.  So we have to deal without, which makes us a lot more
+# fragile than we should.
+
+
+# m4_file_append(FILE-NAME, CONTENT)
+# ----------------------------------
+m4_define([m4_file_append],
+[m4_syscmd([cat >>$1 <<_m4eof
+$2
+_m4eof
+])
+m4_if(m4_sysval, [0], [],
+      [m4_fatal([$0: cannot write: $1])])])
+
+
+
+## ------------------------ ##
+## 17. Setting M4sugar up.  ##
+## ------------------------ ##
+
+# _m4_divert_diversion should be defined.
+m4_divert_push([KILL])
+
+# m4_init
+# -------
+# Initialize the m4sugar language.
+m4_define([m4_init],
+[# All the M4sugar macros start with `m4_', except `dnl' kept as is
+# for sake of simplicity.
+m4_pattern_forbid([^_?m4_])
+m4_pattern_forbid([^dnl$])
+
+# If __m4_version__ is defined, we assume that we are being run by M4
+# 1.6 or newer, thus $@ recursion is linear, and debugmode(+do)
+# is available for faster checks of dereferencing undefined macros
+# and forcing dumpdef to print to stderr regardless of debugfile.
+# But if it is missing, we assume we are being run by M4 1.4.x, that
+# $@ recursion is quadratic, and that we need foreach-based
+# replacement macros.  Also, m4 prior to 1.4.8 loses track of location
+# during m4wrap text; __line__ should never be 0.
+#
+# Use the raw builtin to avoid tripping up include tracing.
+# Meanwhile, avoid m4_copy, since it temporarily undefines m4_defn.
+m4_ifdef([__m4_version__],
+[m4_debugmode([+do])
+m4_define([m4_defn], _m4_defn([_m4_defn]))
+m4_define([m4_dumpdef], _m4_defn([_m4_dumpdef]))
+m4_define([m4_popdef], _m4_defn([_m4_popdef]))
+m4_define([m4_undefine], _m4_defn([_m4_undefine]))],
+[m4_builtin([include], [m4sugar/foreach.m4])
+m4_wrap_lifo([m4_if(__line__, [0], [m4_pushdef([m4_location],
+]]m4_dquote(m4_dquote(m4_dquote(__file__:__line__)))[[)])])])
+
+# Rewrite the first entry of the diversion stack.
+m4_divert([KILL])
+
+# Check the divert push/pop perfect balance.
+# Some users are prone to also use m4_wrap to register last-minute
+# m4_divert_text; so after our diversion cleanups, we restore
+# KILL as the bottom of the diversion stack.
+m4_wrap([m4_popdef([_m4_divert_diversion])m4_ifdef(
+  [_m4_divert_diversion], [m4_fatal([$0: unbalanced m4_divert_push:
+]m4_divert_stack)])_m4_popdef([_m4_divert_stack])m4_divert_push([KILL])])
+])

+ 1241 - 0
Engine/bin/bison-flex/data/skeletons/bison.m4

@@ -0,0 +1,1241 @@
+                                                            -*- Autoconf -*-
+
+# Language-independent M4 Macros for Bison.
+
+# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
+# Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+
+# m4_gsub(STRING, RE1, SUBST1, RE2, SUBST2, ...)
+# ----------------------------------------------
+# m4 equivalent of
+#
+#   $_ = STRING;
+#   s/RE1/SUBST1/g;
+#   s/RE2/SUBST2/g;
+#   ...
+#
+# Really similar to m4_bpatsubsts, but behaves properly with quotes.
+# See m4.at's "Generating Comments".  Super inelegant, but so far, I
+# did not find any better solution.
+m4_define([b4_gsub],
+[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([[[[$1]]]],
+                                        [$2], [$3]),
+                           [$4], [$5]),
+              [$6], [$7])])
+
+# m4_shift2 and m4_shift3 are provided by m4sugar.
+m4_define([m4_shift4], [m4_shift(m4_shift(m4_shift(m4_shift($@))))])
+
+
+## ---------------- ##
+## Identification.  ##
+## ---------------- ##
+
+# b4_generated_by
+# ---------------
+m4_define([b4_generated_by],
+[b4_comment([A Bison parser, made by GNU Bison b4_version_string.])
+])
+
+# b4_copyright(TITLE, [YEARS])
+# ----------------------------
+# If YEARS are not defined, use b4_copyright_years.
+m4_define([b4_copyright],
+[b4_generated_by
+b4_comment([$1
+
+]m4_dquote(m4_text_wrap([Copyright (C)
+]m4_ifval([$2], [[$2]], [m4_defn([b4_copyright_years])])[
+Free Software Foundation, Inc.]))[
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <https://www.gnu.org/licenses/>.])
+
+b4_comment([As a special exception, you may create a larger work that contains
+part or all of the Bison parser skeleton and distribute that work
+under terms of your choice, so long as that work isn't itself a
+parser generator using the skeleton or a modified version thereof
+as a parser skeleton.  Alternatively, if you modify or redistribute
+the parser skeleton itself, you may (at your option) remove this
+special exception, which will cause the skeleton and the resulting
+Bison output files to be licensed under the GNU General Public
+License without this special exception.
+
+This special exception was added by the Free Software Foundation in
+version 2.2 of Bison.])
+])
+
+
+# b4_disclaimer
+# -------------
+# Issue a warning about private implementation details.
+m4_define([b4_disclaimer],
+[b4_comment([DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+especially those whose name start with YY_ or yy_.  They are
+private implementation details that can be changed or removed.])
+])
+
+
+
+# b4_required_version_if(VERSION, IF_NEWER, IF_OLDER)
+# ---------------------------------------------------
+# If the version %require'd by the user is VERSION (or newer) expand
+# IF_NEWER, otherwise IF_OLDER.  VERSION should be an integer, e.g.,
+# 302 for 3.2.
+m4_define([b4_required_version_if],
+[m4_if(m4_eval($1 <= b4_required_version),
+              [1], [$2], [$3])])
+
+
+## -------- ##
+## Output.  ##
+## -------- ##
+
+# b4_output_begin(FILE1, FILE2)
+# -----------------------------
+# Enable output, i.e., send to diversion 0, expand after "#", and
+# generate the tag to output into FILE.  Must be followed by EOL.
+# FILE is FILE1 concatenated to FILE2.  FILE2 can be empty, or be
+# absolute: do the right thing.
+m4_define([b4_output_begin],
+[m4_changecom()
+m4_divert_push(0)dnl
+@output(m4_unquote([$1])@,m4_unquote([$2])@)@dnl
+])
+
+
+# b4_output_end
+# -------------
+# Output nothing, restore # as comment character (no expansions after #).
+m4_define([b4_output_end],
+[m4_divert_pop(0)
+m4_changecom([#])
+])
+
+
+# b4_divert_kill(CODE)
+# --------------------
+# Expand CODE for its side effects, discard its output.
+m4_define([b4_divert_kill],
+[m4_divert_text([KILL], [$1])])
+
+
+# b4_define_silent(MACRO, CODE)
+# -----------------------------
+# Same as m4_define, but throw away the expansion of CODE.
+m4_define([b4_define_silent],
+[m4_define([$1], [b4_divert_kill([$2])])])
+
+
+## ---------------- ##
+## Error handling.  ##
+## ---------------- ##
+
+# The following error handling macros print error directives that should not
+# become arguments of other macro invocations since they would likely then be
+# mangled.  Thus, they print to stdout directly.
+
+# b4_cat(TEXT)
+# ------------
+# Write TEXT to stdout.  Precede the final newline with an @ so that it's
+# escaped.  For example:
+#
+#   b4_cat([[@complain(invalid input@)]])
+m4_define([b4_cat],
+[m4_syscmd([cat <<'_m4eof'
+]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@
+_m4eof
+])dnl
+m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
+
+# b4_error(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------------------------
+# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]],
+#            [[invalid %s]], [[foo]])
+m4_define([b4_error],
+[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
+[m4_if([$#], [4], [],
+       [m4_foreach([b4_arg],
+                   m4_dquote(m4_shift4($@)),
+                   [[@,]b4_arg])])[@)]])])
+
+# b4_warn(FORMAT, [ARG1], [ARG2], ...)
+# ------------------------------------
+# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_warn([[invalid value for '%s': %s]], [[foo]], [[3]])
+#
+# As a simple test suite, this:
+#
+#   m4_divert(-1)
+#   m4_define([asdf], [ASDF])
+#   m4_define([fsa], [FSA])
+#   m4_define([fdsa], [FDSA])
+#   b4_warn_at([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
+#   b4_warn_at([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
+#   b4_warn_at()
+#   b4_warn_at(1)
+#   b4_warn_at(1, 2)
+#
+# Should produce this without newlines:
+#
+#   @warn_at([asdf), asdf]@,@,@,[fsa), fsa]@,[fdsa), fdsa]@)
+#   @warn(asdf), asdf@,@,@,fsa), fsa@,fdsa), fdsa@)
+#   @warn(@)
+#   @warn(1@)
+#   @warn(1@,2@)
+m4_define([b4_warn],
+[b4_warn_at([], [], $@)])
+
+# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ---------------------------------------------------
+# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
+m4_define([b4_warn_at],
+[b4_error([[warn]], $@)])
+
+# b4_complain(FORMAT, [ARG1], [ARG2], ...)
+# ----------------------------------------
+# Bounce to b4_complain_at.
+#
+# See b4_warn example.
+m4_define([b4_complain],
+[b4_complain_at([], [], $@)])
+
+# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------------------------
+# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# See b4_warn_at example.
+m4_define([b4_complain_at],
+[b4_error([[complain]], $@)])
+
+# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------
+# Bounce to b4_fatal_at.
+#
+# See b4_warn example.
+m4_define([b4_fatal],
+[b4_fatal_at([], [], $@)])
+
+# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ----------------------------------------------------
+# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
+#
+# See b4_warn_at example.
+m4_define([b4_fatal_at],
+[b4_error([[fatal]], $@)dnl
+m4_exit(1)])
+
+# b4_canary(MSG)
+# --------------
+# Issue a warning on stderr and in the output.  Used in the test suite
+# to catch spurious m4 evaluations.
+m4_define([b4_canary],
+[m4_errprintn([dead canary: $1])DEAD CANARY($1)])
+
+
+## ------------ ##
+## Data Types.  ##
+## ------------ ##
+
+# b4_ints_in(INT1, INT2, LOW, HIGH)
+# ---------------------------------
+# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
+m4_define([b4_ints_in],
+[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
+
+
+# b4_subtract(LHS, RHS)
+# ---------------------
+# Evaluate LHS - RHS if they are integer literals, otherwise expand
+# to (LHS) - (RHS).
+m4_define([b4_subtract],
+[m4_bmatch([$1$2], [^[0123456789]*$],
+           [m4_eval([$1 - $2])],
+           [($1) - ($2)])])
+
+# b4_join(ARG1, ...)
+# _b4_join(ARG1, ...)
+# -------------------
+# Join with comma, skipping empty arguments.
+# b4_join calls itself recursively until it sees the first non-empty
+# argument, then calls _b4_join (i.e., `_$0`) which prepends each
+# non-empty argument with a comma.
+m4_define([b4_join],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1],
+                 [$1[]_$0(m4_shift($@))],
+                 [$0(m4_shift($@))])])])
+
+# _b4_join(ARGS1, ...)
+# --------------------
+m4_define([_b4_join],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
+
+
+
+
+# b4_integral_parser_tables_map(MACRO)
+# -------------------------------------
+# Map MACRO on all the integral tables.  MACRO is expected to have
+# the signature MACRO(TABLE-NAME, CONTENT, COMMENT).
+m4_define([b4_integral_parser_tables_map],
+[$1([pact], [b4_pact],
+    [[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+STATE-NUM.]])
+
+$1([defact], [b4_defact],
+   [[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+Performed when YYTABLE does not specify something else to do.  Zero
+means the default is an error.]])
+
+$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
+
+$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
+
+$1([table], [b4_table],
+   [[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+positive, shift that token.  If negative, reduce the rule whose
+number is the opposite.  If YYTABLE_NINF, syntax error.]])
+
+$1([check], [b4_check])
+
+$1([stos], [b4_stos],
+   [[YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+state STATE-NUM.]])
+
+$1([r1], [b4_r1],
+   [[YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.]])
+
+$1([r2], [b4_r2],
+   [[YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.]])
+])
+
+
+# b4_parser_tables_declare
+# b4_parser_tables_define
+# ------------------------
+# Define/declare the (deterministic) parser tables.
+m4_define([b4_parser_tables_declare],
+[b4_integral_parser_tables_map([b4_integral_parser_table_declare])])
+
+m4_define([b4_parser_tables_define],
+[b4_integral_parser_tables_map([b4_integral_parser_table_define])])
+
+
+
+## ------------------ ##
+## Decoding options.  ##
+## ------------------ ##
+
+# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
+# -----------------------------------
+# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
+m4_define([b4_flag_if],
+[m4_case(b4_$1_flag,
+         [0], [$3],
+         [1], [$2],
+         [m4_fatal([invalid $1 value: ]b4_$1_flag)])])
+
+
+# b4_define_flag_if(FLAG)
+# -----------------------
+# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
+# value of the Boolean FLAG.
+m4_define([b4_define_flag_if],
+[_b4_define_flag_if($[1], $[2], [$1])])
+
+# _b4_define_flag_if($1, $2, FLAG)
+# --------------------------------
+# Work around the impossibility to define macros inside macros,
+# because issuing '[$1]' is not possible in M4.  GNU M4 should provide
+# $$1 a la M5/TeX.
+m4_define([_b4_define_flag_if],
+[m4_if([$1$2], $[1]$[2], [],
+       [m4_fatal([$0: Invalid arguments: $@])])dnl
+m4_define([b4_$3_if],
+          [b4_flag_if([$3], [$1], [$2])])])
+
+
+# b4_FLAG_if(IF-TRUE, IF-FALSE)
+# -----------------------------
+# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
+b4_define_flag_if([glr])                # Whether a GLR parser is requested.
+b4_define_flag_if([has_translations])   # Whether some tokens are internationalized.
+b4_define_flag_if([header])             # Whether a header is requested.
+b4_define_flag_if([nondeterministic])   # Whether conflicts should be handled.
+b4_define_flag_if([token_table])        # Whether yytoken_table is demanded.
+b4_define_flag_if([yacc])               # Whether POSIX Yacc is emulated.
+
+
+# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
+# -----------------------------------
+m4_define([b4_glr_cc_if],
+          [m4_if(b4_skeleton, ["glr.cc"], $@)])
+
+# b4_glr2_cc_if([IF-TRUE], [IF-FALSE])
+# ------------------------------------
+m4_define([b4_glr2_cc_if],
+          [m4_if(b4_skeleton, ["glr2.cc"], $@)])
+
+## --------- ##
+## Symbols.  ##
+## --------- ##
+
+# For a description of the Symbol handling, see README.md.
+#
+# The following macros provide access to symbol related values.
+
+# __b4_symbol(NUM, FIELD)
+# -----------------------
+# Fetch FIELD of symbol #NUM.  Fail if undefined.
+m4_define([__b4_symbol],
+[m4_indir([b4_symbol($1, $2)])])
+
+
+# _b4_symbol(NUM, FIELD)
+# ----------------------
+# Fetch FIELD of symbol #NUM (or "orig NUM", see README.md).
+# Fail if undefined.
+m4_define([_b4_symbol],
+[m4_ifdef([b4_symbol($1, number)],
+          [__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)],
+          [__b4_symbol([$1], [$2])])])
+
+
+# b4_symbol_token_kind(NUM)
+# -------------------------
+# The token kind of this symbol.
+m4_define([b4_symbol_token_kind],
+[b4_percent_define_get([api.token.prefix])dnl
+_b4_symbol([$1], [id])])
+
+
+# b4_symbol_kind_base(NUM)
+# ------------------------
+# Build the name of the kind of this symbol.  It must always exist,
+# otherwise some symbols might not be represented in the enum, which
+# might be compiled into too small a type to contain all the symbol
+# numbers.
+m4_define([b4_symbol_prefix], [b4_percent_define_get([api.symbol.prefix])])
+m4_define([b4_symbol_kind_base],
+[b4_percent_define_get([api.symbol.prefix])dnl
+m4_case([$1],
+  [-2],                             [[YYEMPTY]],
+  [0],                              [[YYEOF]],
+  [1],                              [[YYerror]],
+  [2],                              [[YYUNDEF]],
+  [m4_case(b4_symbol([$1], [tag]),
+      [$accept],                    [[YYACCEPT]],
+      [b4_symbol_if([$1], [has_id], _b4_symbol([$1], [id]),
+                                    [m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
+
+
+# b4_symbol_kind(NUM)
+# -------------------
+# Same as b4_symbol_kind, but possibly with a prefix in some
+# languages.  E.g., EOF's kind_base and kind are YYSYMBOL_YYEOF in C,
+# but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++.
+m4_copy([b4_symbol_kind_base], [b4_symbol_kind])
+
+
+# b4_symbol_slot(NUM)
+# -------------------
+# The name of union member that contains the value of these symbols.
+# Currently, we are messy, this should actually be type_tag, but type_tag
+# has several meanings.
+m4_define([b4_symbol_slot],
+[m4_case(b4_percent_define_get([[api.value.type]]),
+         [union],   [b4_symbol([$1], [type_tag])],
+         [variant], [b4_symbol([$1], [type_tag])],
+         [b4_symbol([$1], [type])])])
+
+
+# b4_symbol(NUM, FIELD)
+# ---------------------
+# Fetch FIELD of symbol #NUM (or "orig NUM", or "empty").  Fail if undefined.
+#
+# If FIELD = id, prepend the token prefix.
+m4_define([b4_symbol],
+[m4_if([$1], [empty], [b4_symbol([-2], [$2])],
+       [$1], [eof],   [b4_symbol([0], [$2])],
+       [$1], [error], [b4_symbol([1], [$2])],
+       [$1], [undef], [b4_symbol([2], [$2])],
+       [m4_case([$2],
+                [id],        [b4_symbol_token_kind([$1])],
+                [kind_base], [b4_symbol_kind_base([$1])],
+                [kind],      [b4_symbol_kind([$1])],
+                [slot],      [b4_symbol_slot([$1])],
+                [_b4_symbol($@)])])])
+
+
+# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# If FIELD about symbol #NUM is 1 expand IF-TRUE, if is 0, expand IF-FALSE.
+# Otherwise an error.
+m4_define([b4_symbol_if],
+[m4_case(b4_symbol([$1], [$2]),
+         [1], [$3],
+         [0], [$4],
+         [m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
+
+
+# b4_symbol_tag_comment(SYMBOL-NUM)
+# ---------------------------------
+# Issue a comment giving the tag of symbol NUM.
+m4_define([b4_symbol_tag_comment],
+[b4_comment([b4_symbol([$1], [tag])])
+])
+
+
+# b4_symbol_action(SYMBOL-NUM, ACTION)
+# ------------------------------------
+# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
+m4_define([b4_symbol_action],
+[b4_symbol_if([$1], [has_$2],
+[b4_dollar_pushdef([(*yyvaluep)],
+                   [$1],
+                   [],
+                   [(*yylocationp)])dnl
+    _b4_symbol_case([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
+b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])dnl
+        break;
+
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_symbol_destructor(SYMBOL-NUM)
+# b4_symbol_printer(SYMBOL-NUM)
+# --------------------------------
+m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
+m4_define([b4_symbol_printer],    [b4_symbol_action([$1], [printer])])
+
+
+# b4_symbol_actions(ACTION, [KIND = yykind])
+# ------------------------------------------
+# Emit the symbol actions for ACTION ("destructor" or "printer").
+# Dispatch on KIND.
+m4_define([b4_symbol_actions],
+[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
+m4_ifval(m4_defn([b4_actions_]),
+[switch (m4_default([$2], [yykind]))
+    {
+m4_defn([b4_actions_])[]dnl
+      default:
+        break;
+    }dnl
+],
+[b4_use(m4_default([$2], [yykind]));])dnl
+m4_popdef([b4_actions_])dnl
+])
+
+# _b4_symbol_case(SYMBOL-NUM)
+# ---------------------------
+# Issue a "case NUM" for SYMBOL-NUM.  Ends with its EOL to make it
+# easier to use with m4_map, but then, use []dnl to suppress the last
+# one.
+m4_define([_b4_symbol_case],
+[case b4_symbol([$1], [kind]): b4_symbol_tag_comment([$1])])
+])
+
+
+# b4_symbol_foreach(MACRO)
+# ------------------------
+# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM.
+m4_define([b4_symbol_foreach],
+          [m4_map([$1], m4_defn([b4_symbol_numbers]))])
+
+# b4_symbol_map(MACRO)
+# --------------------
+# Return a list (possibly empty elements) of MACRO invoked for each
+# SYMBOL-NUM.
+m4_define([b4_symbol_map],
+[m4_map_args_sep([$1(], [)], [,], b4_symbol_numbers)])
+
+
+# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# Whether NUM denotes a token kind that has an exported definition
+# (i.e., shows in enum yytokentype).
+m4_define([b4_token_visible_if],
+[b4_symbol_if([$1], [is_token],
+              [b4_symbol_if([$1], [has_id], [$2], [$3])],
+              [$3])])
+
+
+# b4_token_has_definition(NUM)
+# ----------------------------
+# 1 if NUM is visible, nothing otherwise.
+m4_define([b4_token_has_definition],
+[b4_token_visible_if([$1], [1])])
+
+# b4_any_token_visible_if([IF-TRUE], [IF-FALSE])
+# ----------------------------------------------
+# Whether there is a token that needs to be defined.
+m4_define([b4_any_token_visible_if],
+[m4_ifval(b4_symbol_foreach([b4_token_has_definition]),
+          [$1], [$2])])
+
+
+# b4_token_format(FORMAT, NUM)
+# ----------------------------
+# If token NUM has a visible ID, format FORMAT with ID, USER_NUMBER.
+m4_define([b4_token_format],
+[b4_token_visible_if([$2],
+[m4_format([[$1]],
+           b4_symbol([$2], [id]),
+           b4_symbol([$2], b4_api_token_raw_if([[number]], [[code]])))])])
+
+
+# b4_last_enum_token
+# ------------------
+# The code of the last token visible token.
+m4_define([_b4_last_enum_token],
+[b4_token_visible_if([$1],
+   [m4_define([b4_last_enum_token], [$1])])])
+b4_symbol_foreach([_b4_last_enum_token])
+
+# b4_last_symbol
+# --------------
+# The code of the last symbol.
+m4_define([b4_last_symbol], m4_eval(b4_tokens_number + b4_nterms_number - 1))
+
+## ------- ##
+## Types.  ##
+## ------- ##
+
+# _b4_type_action(NUMS)
+# ---------------------
+# Run actions for the symbol NUMS that all have the same type-name.
+# Skip NUMS that have no type-name.
+#
+# To specify the action to run, define b4_dollar_dollar(SYMBOL-NUM,
+# TAG, TYPE).
+m4_define([_b4_type_action],
+[b4_symbol_if([$1], [has_type],
+[m4_map([      _b4_symbol_case], [$@])[]dnl
+        b4_dollar_dollar([b4_symbol([$1], [number])],
+                         [b4_symbol([$1], [tag])],
+                         [b4_symbol([$1], [type])]);
+        break;
+
+])])
+
+# b4_type_foreach(MACRO, [SEP])
+# -----------------------------
+# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
+m4_define([b4_type_foreach],
+          [m4_map_sep([$1], [$2], m4_defn([b4_type_names]))])
+
+
+
+## ----------- ##
+## Synclines.  ##
+## ----------- ##
+
+# b4_basename(NAME)
+# -----------------
+# Similar to POSIX basename; the differences don't matter here.
+# Beware that NAME is not evaluated.
+m4_define([b4_basename],
+[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
+
+
+# b4_syncline(LINE, FILE)dnl
+# --------------------------
+# Should always be following by a dnl.
+#
+# Emit "#line LINE FILE /* __LINE__ __FILE__ */".
+m4_define([b4_syncline],
+[b4_flag_if([synclines],
+[b4_sync_start([$1], [$2])[]dnl
+b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
+])])
+
+# b4_sync_start(LINE, FILE)
+# -----------------------
+# Syncline for the new place.  Typically a directive for the compiler.
+m4_define([b4_sync_start], [b4_comment([$2:$1])])
+
+# b4_sync_end(LINE, FILE)
+# -----------------------
+# Syncline for the current place, which ends.  Typically a comment
+# left for the reader.
+m4_define([b4_sync_end],   [ b4_comment([$2:$1])]
+)
+# This generates dependencies on the Bison skeletons hence lots of
+# useless 'git diff'.  This location is useless for the regular
+# user (who does not care about the skeletons) and is actually not
+# useful for Bison developers too (I, Akim, never used this to locate
+# the code in skeletons that generated output).  So disable it
+# completely.  If someone thinks this was actually useful, a %define
+# variable should be provided to control the level of verbosity of
+# '#line', in replacement of --no-lines.
+m4_define([b4_sync_end])
+
+
+# b4_user_code(USER-CODE)
+# -----------------------
+# Emit code from the user, ending it with synclines.
+m4_define([b4_user_code],
+[$1
+b4_syncline([@oline@], [@ofile@])])
+
+
+# b4_define_user_code(MACRO, COMMENT)
+# -----------------------------------
+# From b4_MACRO, if defined, build b4_user_MACRO that includes the synclines.
+m4_define([b4_define_user_code],
+[m4_define([b4_user_$1],
+           [m4_ifdef([b4_$1],
+                     [m4_ifval([$2],
+                               [b4_comment([$2])
+])b4_user_code([b4_$1])])])])
+
+# b4_user_actions
+# b4_user_initial_action
+# b4_user_post_prologue
+# b4_user_pre_prologue
+# b4_user_union_members
+# ----------------------
+# Macros that issue user code, ending with synclines.
+b4_define_user_code([actions])
+b4_define_user_code([initial_action], [User initialization code.])
+b4_define_user_code([post_prologue], [Second part of user prologue.])
+b4_define_user_code([pre_prologue], [First part of user prologue.])
+b4_define_user_code([union_members])
+
+
+# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
+# -----------------------------------------------------
+# Complain if any name of type WHAT is used by the user (as recorded in
+# USER-LIST) but is not used by Bison (as recorded by macros in the
+# namespace BISON-NAMESPACE).
+#
+# USER-LIST must expand to a list specifying all user occurrences of all names
+# of type WHAT.   Each item in the list must be a triplet specifying one
+# occurrence: name, start boundary, and end boundary.  Empty string names are
+# fine.  An empty list is fine.
+#
+# For example, to define b4_foo_user_names to be used for USER-LIST with three
+# name occurrences and with correct quoting:
+#
+#   m4_define([b4_foo_user_names],
+#             [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]],
+#               [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]],
+#               [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
+#
+# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT
+# is used by Bison (in the front-end or in the skeleton).  Empty string names
+# are fine, but it would be ugly for Bison to actually use one.
+#
+# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that
+# the names bar and baz are used by Bison:
+#
+#   m4_define([b4_foo_bison_names(bar)])
+#   m4_define([b4_foo_bison_names(baz)])
+#
+# To invoke b4_check_user_names with TYPE foo, with USER-LIST
+# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct
+# quoting:
+#
+#   b4_check_user_names([[foo]], [b4_foo_user_names],
+#                       [[b4_foo_bison_names]])
+m4_define([b4_check_user_names],
+[m4_foreach([b4_occurrence], $2,
+[m4_pushdef([b4_occurrence], b4_occurrence)dnl
+m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
+m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
+m4_pushdef([b4_end], m4_shift2(b4_occurrence))dnl
+m4_ifndef($3[(]m4_quote(b4_user_name)[)],
+          [b4_complain_at([b4_start], [b4_end],
+                          [[%s '%s' is not used]],
+                          [$1], [b4_user_name])])[]dnl
+m4_popdef([b4_occurrence])dnl
+m4_popdef([b4_user_name])dnl
+m4_popdef([b4_start])dnl
+m4_popdef([b4_end])dnl
+])])
+
+
+
+## --------------------- ##
+## b4_percent_define_*.  ##
+## --------------------- ##
+
+
+# b4_percent_define_use(VARIABLE)
+# -------------------------------
+# Declare that VARIABLE was used.
+m4_define([b4_percent_define_use],
+[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
+])
+
+# b4_percent_define_get(VARIABLE, [DEFAULT])
+# ------------------------------------------
+# Mimic muscle_percent_define_get in ../src/muscle-tab.h.  That is, if
+# the %define variable VARIABLE is defined, emit its value.  Contrary
+# to its C counterpart, return DEFAULT otherwise.  Also, record
+# Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_get([[foo]])
+m4_define([b4_percent_define_get],
+[b4_percent_define_use([$1])dnl
+_b4_percent_define_ifdef([$1],
+                         [m4_indir([b4_percent_define(]$1[)])],
+                         [$2])])
+
+# b4_percent_define_get_loc(VARIABLE)
+# -----------------------------------
+# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is undefined, complain fatally since that's
+# a Bison or skeleton error.  Otherwise, return its definition location in a
+# form appropriate for the first two arguments of b4_warn_at, b4_complain_at, or
+# b4_fatal_at.  Don't record this as a Bison usage of VARIABLE as there's no
+# reason to suspect that the user-supplied value has yet influenced the output.
+#
+# For example:
+#
+#   b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]])
+m4_define([b4_percent_define_get_loc],
+[m4_ifdef([b4_percent_define_loc(]$1[)],
+          [m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
+b4_loc[]dnl
+m4_popdef([b4_loc])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_define_get_kind(VARIABLE)
+# ------------------------------------
+# Get the kind (code, keyword, string) of VARIABLE, i.e., how its
+# value was defined (braces, not delimiters, quotes).
+#
+# If the %define variable VARIABLE is undefined, complain fatally
+# since that's a Bison or skeleton error.  Don't record this as a
+# Bison usage of VARIABLE as there's no reason to suspect that the
+# user-supplied value has yet influenced the output.
+m4_define([b4_percent_define_get_kind],
+[m4_ifdef([b4_percent_define_kind(]$1[)],
+          [m4_indir([b4_percent_define_kind(]$1[)])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_define_get_syncline(VARIABLE)dnl
+# -------------------------------------------
+# Should always be following by a dnl.
+#
+# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly.
+# That is, if the %define variable VARIABLE is undefined, complain fatally
+# since that's a Bison or skeleton error.  Otherwise, return its definition
+# location as a b4_syncline invocation.  Don't record this as a Bison usage of
+# VARIABLE as there's no reason to suspect that the user-supplied value has yet
+# influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_get_syncline([[foo]])
+m4_define([b4_percent_define_get_syncline],
+[m4_ifdef([b4_percent_define_syncline(]$1[)],
+          [m4_indir([b4_percent_define_syncline(]$1[)])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# _b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
+# ------------------------------------------------------
+# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
+# IF-FALSE.  Don't record usage of VARIABLE.
+#
+# For example:
+#
+#   _b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
+m4_define([_b4_percent_define_ifdef],
+[m4_ifdef([b4_percent_define(]$1[)],
+          [$2],
+          [$3])])
+
+# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
+# ------------------------------------------------------
+# Mimic muscle_percent_define_ifdef in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
+# IF-FALSE.  Also, record Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
+m4_define([b4_percent_define_ifdef],
+[_b4_percent_define_ifdef([$1],
+                         [b4_percent_define_use([$1])$2],
+                         [$3])])
+
+
+# b4_percent_define_check_file_complain(VARIABLE)
+# -----------------------------------------------
+# Warn about %define variable VARIABLE having an incorrect
+# value.
+m4_define([b4_percent_define_check_file_complain],
+[b4_complain_at(b4_percent_define_get_loc([$1]),
+                [[%%define variable '%s' requires 'none' or '"..."' values]],
+                [$1])])
+
+
+# b4_percent_define_check_file(MACRO, VARIABLE, DEFAULT)
+# ------------------------------------------------------
+# If the %define variable VARIABLE:
+# - is undefined, then if DEFAULT is non-empty, define MACRO to DEFAULT
+# - is a string, define MACRO to its value
+# - is the keyword 'none', do nothing
+# - otherwise, warn about the incorrect value.
+m4_define([b4_percent_define_check_file],
+[b4_percent_define_ifdef([$2],
+  [m4_case(b4_percent_define_get_kind([$2]),
+    [string],
+         [m4_define([$1], b4_percent_define_get([$2]))],
+    [keyword],
+         [m4_if(b4_percent_define_get([$2]), [none], [],
+                [b4_percent_define_check_file_complain([$2])])],
+    [b4_percent_define_check_file_complain([$2])])
+   ],
+   [m4_ifval([$3],
+             [m4_define([$1], [$3])])])
+])
+
+
+
+## --------- ##
+## Options.  ##
+## --------- ##
+
+
+# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
+# --------------------------------------------------------
+# Mimic muscle_percent_define_flag_if in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
+# If it is defined to "false", expand IF-FALSE.  Complain if it is undefined
+# (a Bison or skeleton error since the default value should have been set
+# already) or defined to any other value (possibly a user error).  Also, record
+# Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]])
+m4_define([b4_percent_define_flag_if],
+[b4_percent_define_ifdef([$1],
+  [m4_case(b4_percent_define_get([$1]),
+           [], [$2], [true], [$2], [false], [$3],
+           [m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]),
+                                           [[invalid value for %%define Boolean variable '%s']],
+                                           [$1])],
+                           [[b4_percent_define_flag_if($1)]])])],
+  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+
+# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword])
+# --------------------------------------------------------------
+# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
+# Don't record this as a Bison usage of VARIABLE as there's no reason to
+# suspect that the value has yet influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_default([[foo]], [[default value]])
+m4_define([_b4_percent_define_define],
+[m4_define([b4_percent_define(]$1[)], [$2])dnl
+m4_define([b4_percent_define_kind(]$1[)],
+          [m4_default([$3], [keyword])])dnl
+m4_define([b4_percent_define_loc(]$1[)],
+          [[[[<skeleton default value>:-1.-1]],
+            [[<skeleton default value>:-1.-1]]]])dnl
+m4_define([b4_percent_define_syncline(]$1[)], [[]])])
+
+m4_define([b4_percent_define_default],
+[_b4_percent_define_ifdef([$1], [],
+                          [_b4_percent_define_define($@)])])
+
+
+# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
+# ----------------------------------------------------
+# Define b4_NAME_if that executes its $1 or $2 depending whether
+# VARIABLE was %defined.  The characters '.' and `-' in VARIABLE are mapped
+# to '_'.
+m4_define([_b4_percent_define_if_define],
+[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
+           [b4_percent_define_default([m4_default([$2], [$1])], [[false]])dnl
+b4_percent_define_flag_if(m4_default([$2], [$1]),
+                                     [$3], [$4])])])
+
+m4_define([b4_percent_define_if_define],
+[_b4_percent_define_if_define([$1], [$2], $[1], $[2])])
+
+
+# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
+# ---------------------------------------------------------------------
+m4_define([b4_percent_define_check_kind],
+[_b4_percent_define_ifdef([$1],
+  [m4_if(b4_percent_define_get_kind([$1]), [$2], [],
+    [b4_error([m4_default([$3], [complain])],
+              b4_percent_define_get_loc([$1]),
+              [m4_case([$2],
+                 [code],    [[%%define variable '%s' requires '{...}' values]],
+                 [keyword], [[%%define variable '%s' requires keyword values]],
+                 [string],  [[%%define variable '%s' requires '"..."' values]])],
+              [$1])])])dnl
+])
+
+
+# b4_percent_define_check_values(VALUES)
+# --------------------------------------
+# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
+# except that the VALUES structure is more appropriate for M4.  That is, VALUES
+# is a list of sublists of strings.  For each sublist, the first string is the
+# name of a %define variable, and all remaining strings in that sublist are the
+# valid values for that variable.  Complain if such a variable is undefined (a
+# Bison error since the default value should have been set already) or defined
+# to any other value (possibly a user error).  Don't record this as a Bison
+# usage of the variable as there's no reason to suspect that the value has yet
+# influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]],
+#                                  [[[[bar]], [[bar-value1]]]])
+m4_define([b4_percent_define_check_values],
+[m4_foreach([b4_sublist], m4_quote($@),
+            [_b4_percent_define_check_values(b4_sublist)])])
+
+m4_define([_b4_percent_define_check_values],
+[_b4_percent_define_ifdef([$1],
+  [b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
+   m4_pushdef([b4_good_value], [0])dnl
+   m4_if($#, 1, [],
+         [m4_foreach([b4_value], m4_dquote(m4_shift($@)),
+                     [m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
+                            [m4_define([b4_good_value], [1])])])])dnl
+   m4_if(b4_good_value, [0],
+         [b4_complain_at(b4_percent_define_get_loc([$1]),
+                         [[invalid value for %%define variable '%s': '%s']],
+                         [$1],
+                         m4_dquote(m4_indir([b4_percent_define(]$1[)])))
+          m4_foreach([b4_value], m4_dquote(m4_shift($@)),
+                     [b4_error([[note]], b4_percent_define_get_loc([$1]), []
+                                     [[accepted value: '%s']],
+                                     m4_dquote(b4_value))])])dnl
+   m4_popdef([b4_good_value])],
+  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_code_get([QUALIFIER])
+# --------------------------------
+# If any %code blocks for QUALIFIER are defined, emit them beginning with a
+# comment and ending with synclines and a newline.  If QUALIFIER is not
+# specified or empty, do this for the unqualified %code blocks.  Also, record
+# Bison's usage of QUALIFIER (if specified) by defining
+# b4_percent_code_bison_qualifiers(QUALIFIER).
+#
+# For example, to emit any unqualified %code blocks followed by any %code
+# blocks for the qualifier foo:
+#
+#   b4_percent_code_get
+#   b4_percent_code_get([[foo]])
+m4_define([b4_percent_code_get],
+[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
+m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
+m4_ifdef(b4_macro_name,
+[b4_comment(m4_if([$#], [0], [[[Unqualified %code blocks.]]],
+                  [[["%code ]$1[" blocks.]]]))
+b4_user_code([m4_indir(b4_macro_name)])])dnl
+m4_popdef([b4_macro_name])])
+
+# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------
+# If any %code blocks for QUALIFIER (or unqualified %code blocks if
+# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE.
+# Also, record Bison's usage of QUALIFIER (if specified) by defining
+# b4_percent_code_bison_qualifiers(QUALIFIER).
+m4_define([b4_percent_code_ifdef],
+[m4_ifdef([b4_percent_code(]$1[)],
+          [m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
+          [$3])])
+
+
+## ------------------ ##
+## Common variables.  ##
+## ------------------ ##
+
+
+# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
+# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
+# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
+# ----------------------------------------------------------
+b4_percent_define_if_define([api.token.raw])
+b4_percent_define_if_define([token_ctor], [api.token.constructor])
+b4_percent_define_if_define([locations])     # Whether locations are tracked.
+b4_percent_define_if_define([parse.assert])
+b4_percent_define_if_define([parse.trace])
+b4_percent_define_if_define([posix])
+
+
+# b4_bison_locations_if([IF-TRUE])
+# --------------------------------
+# Expand IF-TRUE if using locations, and using the default location
+# type.
+m4_define([b4_bison_locations_if],
+[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
+
+
+
+# %define parse.error "(custom|detailed|simple|verbose)"
+# ------------------------------------------------------
+b4_percent_define_default([[parse.error]], [[simple]])
+b4_percent_define_check_values([[[[parse.error]],
+                                 [[custom]], [[detailed]], [[simple]], [[verbose]]]])
+
+# b4_parse_error_case(CASE1, THEN1, CASE2, THEN2, ..., ELSE)
+# ----------------------------------------------------------
+m4_define([b4_parse_error_case],
+[m4_case(b4_percent_define_get([[parse.error]]), $@)])
+
+# b4_parse_error_bmatch(PATTERN1, THEN1, PATTERN2, THEN2, ..., ELSE)
+# ------------------------------------------------------------------
+m4_define([b4_parse_error_bmatch],
+[m4_bmatch(b4_percent_define_get([[parse.error]]), $@)])
+
+
+
+# b4_union_if([IF-UNION-ARE-USED], [IF-NOT])
+# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
+# ----------------------------------------------
+# Depend on whether api.value.type is union, or variant.
+m4_define([b4_union_flag],   [[0]])
+m4_define([b4_variant_flag], [[0]])
+b4_percent_define_ifdef([[api.value.type]],
+   [m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
+            [m4_case(b4_percent_define_get([[api.value.type]]),
+                     [union],   [m4_define([b4_union_flag],   [[1]])],
+                     [variant], [m4_define([b4_variant_flag], [[1]])])])])
+b4_define_flag_if([union])
+b4_define_flag_if([variant])
+
+
+## ----------------------------------------------------------- ##
+## After processing the skeletons, check that all the user's   ##
+## %define variables and %code qualifiers were used by Bison.  ##
+## ----------------------------------------------------------- ##
+
+m4_define([b4_check_user_names_wrap],
+[m4_ifdef([b4_percent_]$1[_user_]$2[s],
+          [b4_check_user_names([[%]$1 $2],
+                               [b4_percent_]$1[_user_]$2[s],
+                               [[b4_percent_]$1[_bison_]$2[s]])])])
+
+m4_wrap_lifo([
+b4_check_user_names_wrap([[define]], [[variable]])
+b4_check_user_names_wrap([[code]], [[qualifier]])
+])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# m4_define_default([b4_lex_param], [])   dnl breaks other skeletons
+m4_define_default([b4_epilogue], [])
+m4_define_default([b4_parse_param], [])
+
+# The initial column and line.
+m4_define_default([b4_location_initial_column], [1])
+m4_define_default([b4_location_initial_line],   [1])
+
+
+## --------------- ##
+## Sanity checks.  ##
+## --------------- ##
+
+# api.location.type={...} (C, C++ and Java).
+b4_percent_define_check_kind([api.location.type], [code], [deprecated])
+
+# api.position.type={...} (Java).
+b4_percent_define_check_kind([api.position.type], [code], [deprecated])
+
+# api.prefix >< %name-prefix.
+b4_percent_define_check_kind([api.prefix], [code], [deprecated])
+b4_percent_define_ifdef([api.prefix],
+[m4_ifdef([b4_prefix],
+[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
+                [['%s' and '%s' cannot be used together]],
+                [%name-prefix],
+                [%define api.prefix])])])
+
+# api.token.prefix={...}
+# Make it a warning for those who used betas of Bison 3.0.
+b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
+
+# api.value.type >< %union.
+b4_percent_define_ifdef([api.value.type],
+[m4_ifdef([b4_union_members],
+[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
+                [['%s' and '%s' cannot be used together]],
+                [%union],
+                [%define api.value.type])])])
+
+# api.value.type=union >< %yacc.
+b4_percent_define_ifdef([api.value.type],
+[m4_if(b4_percent_define_get([api.value.type]), [union],
+[b4_yacc_if(dnl
+[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
+                [['%s' and '%s' cannot be used together]],
+                [%yacc],
+                [%define api.value.type "union"])])])])
+
+# api.value.union.name.
+b4_percent_define_check_kind([api.value.union.name], [keyword])
+
+# parse.error (custom|detailed) >< token-table.
+b4_token_table_if(
+[b4_parse_error_bmatch([custom\|detailed],
+[b4_complain_at(b4_percent_define_get_loc([parse.error]),
+                [['%s' and '%s' cannot be used together]],
+                [%token-table],
+                [%define parse.error (custom|detailed)])])])

+ 27 - 0
Engine/bin/bison-flex/data/skeletons/c++-skel.m4

@@ -0,0 +1,27 @@
+                                                            -*- Autoconf -*-
+
+# C++ skeleton dispatching for Bison.
+
+# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
+# Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+b4_glr_if(             [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
+b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
+
+m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)

+ 778 - 0
Engine/bin/bison-flex/data/skeletons/c++.m4

@@ -0,0 +1,778 @@
+                                                            -*- Autoconf -*-
+
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Sanity checks, before defaults installed by c.m4.
+b4_percent_define_ifdef([[api.value.union.name]],
+  [b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
+                  [named %union is invalid in C++])])
+
+b4_percent_define_default([[api.symbol.prefix]], [[S_]])
+
+m4_include(b4_skeletonsdir/[c.m4])
+
+b4_percent_define_check_kind([api.namespace], [code], [deprecated])
+b4_percent_define_check_kind([api.parser.class], [code], [deprecated])
+
+
+## ----- ##
+## C++.  ##
+## ----- ##
+
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
+# Put TEXT in comment. Prefix all the output lines with PREFIX.
+m4_define([b4_comment],
+[_b4_comment([$1], [$2// ], [$2// ])])
+
+
+# b4_inline(hh|cc)
+# ----------------
+# Expand to `inline\n  ` if $1 is hh.
+m4_define([b4_inline],
+[m4_case([$1],
+  [cc], [],
+  [hh], [[inline
+  ]],
+  [m4_fatal([$0: invalid argument: $1])])])
+
+
+# b4_cxx_portability
+# ------------------
+m4_define([b4_cxx_portability],
+[#if defined __cplusplus
+# define YY_CPLUSPLUS __cplusplus
+#else
+# define YY_CPLUSPLUS 199711L
+#endif
+
+// Support move semantics when possible.
+#if 201103L <= YY_CPLUSPLUS
+# define YY_MOVE           std::move
+# define YY_MOVE_OR_COPY   move
+# define YY_MOVE_REF(Type) Type&&
+# define YY_RVREF(Type)    Type&&
+# define YY_COPY(Type)     Type
+#else
+# define YY_MOVE
+# define YY_MOVE_OR_COPY   copy
+# define YY_MOVE_REF(Type) Type&
+# define YY_RVREF(Type)    const Type&
+# define YY_COPY(Type)     const Type&
+#endif
+
+// Support noexcept when possible.
+#if 201103L <= YY_CPLUSPLUS
+# define YY_NOEXCEPT noexcept
+# define YY_NOTHROW
+#else
+# define YY_NOEXCEPT
+# define YY_NOTHROW throw ()
+#endif
+
+// Support constexpr when possible.
+#if 201703 <= YY_CPLUSPLUS
+# define YY_CONSTEXPR constexpr
+#else
+# define YY_CONSTEXPR
+#endif[]dnl
+])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+b4_percent_define_default([[api.parser.class]], [[parser]])
+
+# Don't do that so that we remember whether we're using a user
+# request, or the default value.
+#
+# b4_percent_define_default([[api.location.type]], [[location]])
+
+b4_percent_define_default([[api.filename.type]], [[const std::string]])
+# Make it a warning for those who used betas of Bison 3.0.
+b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
+
+b4_percent_define_default([[define_location_comparison]],
+                          [m4_if(b4_percent_define_get([[filename_type]]),
+                                 [std::string], [[true]], [[false]])])
+
+
+
+## ----------- ##
+## Namespace.  ##
+## ----------- ##
+
+m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
+
+
+# Don't permit an empty b4_namespace_ref.  Any '::parser::foo' appended to it
+# would compile as an absolute reference with 'parser' in the global namespace.
+# b4_namespace_open would open an anonymous namespace and thus establish
+# internal linkage.  This would compile.  However, it's cryptic, and internal
+# linkage for the parser would be specified in all translation units that
+# include the header, which is always generated.  If we ever need to permit
+# internal linkage somehow, surely we can find a cleaner approach.
+m4_if(m4_bregexp(b4_namespace_ref, [^[	 ]*$]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference is empty]])])
+
+# Instead of assuming the C++ compiler will do it, Bison should reject any
+# invalid b4_namespace_ref that would be converted to a valid
+# b4_namespace_open.  The problem is that Bison doesn't always output
+# b4_namespace_ref to uncommented code but should reserve the ability to do so
+# in future releases without risking breaking any existing user grammars.
+# Specifically, don't allow empty names as b4_namespace_open would just convert
+# those into anonymous namespaces, and that might tempt some users.
+m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*::]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference has consecutive "::"]])])
+m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*$]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference has a trailing "::"]])])
+
+m4_define([b4_namespace_open],
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
+[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
+                                                [^\(.\)[	 ]*::], [\1])),
+                         [::], [ { namespace ])[ {]])])
+
+m4_define([b4_namespace_close],
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
+m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
+                                    [^\(.\)[	 ]*\(::\)?\([^][:]\|:[^:]\)*],
+                                    [\1])),
+             [::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
+
+
+## ------------- ##
+## Token kinds.  ##
+## ------------- ##
+
+
+# b4_token_enums
+# --------------
+# Output the definition of the token kinds.
+m4_define([b4_token_enums],
+[[enum token_kind_type
+      {
+        ]b4_symbol([-2], [id])[ = -2,
+]b4_symbol_foreach([b4_token_enum])dnl
+[      };]dnl
+])
+
+
+
+## -------------- ##
+## Symbol kinds.  ##
+## -------------- ##
+
+# b4_declare_symbol_enum
+# ----------------------
+# The definition of the symbol internal numbers as an enum.
+# Defining YYEMPTY here is important: it forces the compiler
+# to use a signed type, which matters for yytoken.
+m4_define([b4_declare_symbol_enum],
+[[enum symbol_kind_type
+      {
+        YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
+        ]b4_symbol(empty, kind_base)[ = -2,
+]b4_symbol_foreach([      b4_symbol_enum])dnl
+[      };]])
+
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+
+# b4_value_type_declare
+# ---------------------
+# Declare value_type.
+m4_define([b4_value_type_declare],
+[b4_value_type_setup[]dnl
+[    /// Symbol semantic values.
+]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
+[code],
+[[    typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]],
+[m4_bmatch(b4_percent_define_get([[api.value.type]]),
+[union\|union-directive],
+[[    union value_type
+    {
+]b4_user_union_members[
+    };]])])dnl
+])
+
+
+# b4_public_types_declare
+# -----------------------
+# Define the public types: token, semantic value, location, and so forth.
+# Depending on %define token_lex, may be output in the header or source file.
+m4_define([b4_public_types_declare],
+[b4_glr2_cc_if(
+[b4_value_type_declare],
+[[#ifdef ]b4_api_PREFIX[STYPE
+# ifdef __GNUC__
+#  pragma GCC message "bison: do not #define ]b4_api_PREFIX[STYPE in C++, use %define api.value.type"
+# endif
+    typedef ]b4_api_PREFIX[STYPE value_type;
+#else
+]b4_value_type_declare[
+#endif
+    /// Backward compatibility (Bison 3.8).
+    typedef value_type semantic_type;
+]])[]b4_locations_if([
+    /// Symbol locations.
+    typedef b4_percent_define_get([[api.location.type]],
+                                  [[location]]) location_type;])[
+
+    /// Syntax errors thrown from user actions.
+    struct syntax_error : std::runtime_error
+    {
+      syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
+        : std::runtime_error (m)]b4_locations_if([
+        , location (l)])[
+      {}
+
+      syntax_error (const syntax_error& s)
+        : std::runtime_error (s.what ())]b4_locations_if([
+        , location (s.location)])[
+      {}
+
+      ~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
+
+      location_type location;])[
+    };
+
+    /// Token kinds.
+    struct token
+    {
+      ]b4_token_enums[]b4_glr2_cc_if([], [[
+      /// Backward compatibility alias (Bison 3.6).
+      typedef token_kind_type yytokentype;]])[
+    };
+
+    /// Token kind, as returned by yylex.
+    typedef token::token_kind_type token_kind_type;]b4_glr2_cc_if([], [[
+
+    /// Backward compatibility alias (Bison 3.6).
+    typedef token_kind_type token_type;]])[
+
+    /// Symbol kinds.
+    struct symbol_kind
+    {
+      ]b4_declare_symbol_enum[
+    };
+
+    /// (Internal) symbol kind.
+    typedef symbol_kind::symbol_kind_type symbol_kind_type;
+
+    /// The number of tokens.
+    static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
+]])
+
+
+# b4_symbol_type_define
+# ---------------------
+# Define symbol_type, the external type for symbols used for symbol
+# constructors.
+m4_define([b4_symbol_type_define],
+[[    /// A complete symbol.
+    ///
+    /// Expects its Base type to provide access to the symbol kind
+    /// via kind ().
+    ///
+    /// Provide access to semantic value]b4_locations_if([ and location])[.
+    template <typename Base>
+    struct basic_symbol : Base
+    {
+      /// Alias to Base.
+      typedef Base super_type;
+
+      /// Default constructor.
+      basic_symbol () YY_NOEXCEPT
+        : value ()]b4_locations_if([
+        , location ()])[
+      {}
+
+#if 201103L <= YY_CPLUSPLUS
+      /// Move constructor.
+      basic_symbol (basic_symbol&& that)
+        : Base (std::move (that))
+        , value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
+        , location (std::move (that.location))])[
+      {]b4_variant_if([
+        b4_symbol_variant([this->kind ()], [value], [move],
+                          [std::move (that.value)])
+      ])[}
+#endif
+
+      /// Copy constructor.
+      basic_symbol (const basic_symbol& that);]b4_variant_if([[
+
+      /// Constructors for typed symbols.
+]b4_type_foreach([b4_basic_symbol_constructor_define], [
+])], [[
+      /// Constructor for valueless symbols.
+      basic_symbol (typename Base::kind_type t]b4_locations_if([,
+                    YY_MOVE_REF (location_type) l])[);
+
+      /// Constructor for symbols with semantic value.
+      basic_symbol (typename Base::kind_type t,
+                    YY_RVREF (value_type) v]b4_locations_if([,
+                    YY_RVREF (location_type) l])[);
+]])[
+      /// Destroy the symbol.
+      ~basic_symbol ()
+      {
+        clear ();
+      }
+
+]b4_glr2_cc_if([[
+      /// Copy assignment.
+      basic_symbol& operator= (const basic_symbol& that)
+      {
+        Base::operator= (that);]b4_variant_if([[
+        ]b4_symbol_variant([this->kind ()], [value], [copy],
+                           [that.value])], [[
+        value = that.value]])[;]b4_locations_if([[
+        location = that.location;]])[
+        return *this;
+      }
+
+      /// Move assignment.
+      basic_symbol& operator= (basic_symbol&& that)
+      {
+        Base::operator= (std::move (that));]b4_variant_if([[
+        ]b4_symbol_variant([this->kind ()], [value], [move],
+                           [std::move (that.value)])], [[
+        value = std::move (that.value)]])[;]b4_locations_if([[
+        location = std::move (that.location);]])[
+        return *this;
+      }
+]])[
+
+      /// Destroy contents, and record that is empty.
+      void clear () YY_NOEXCEPT
+      {]b4_variant_if([[
+        // User destructor.
+        symbol_kind_type yykind = this->kind ();
+        basic_symbol<Base>& yysym = *this;
+        (void) yysym;
+        switch (yykind)
+        {
+]b4_symbol_foreach([b4_symbol_destructor])dnl
+[       default:
+          break;
+        }
+
+        // Value type destructor.
+]b4_symbol_variant([[yykind]], [[value]], [[template destroy]])])[
+        Base::clear ();
+      }
+
+]b4_parse_error_bmatch(
+[custom\|detailed],
+[[      /// The user-facing name of this symbol.
+      const char *name () const YY_NOEXCEPT
+      {
+        return ]b4_parser_class[::symbol_name (this->kind ());
+      }]],
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+      /// The user-facing name of this symbol.
+      const char *name () const YY_NOEXCEPT
+      {
+        return ]b4_parser_class[::symbol_name (this->kind ());
+      }
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[      /// The user-facing name of this symbol.
+      std::string name () const YY_NOEXCEPT
+      {
+        return ]b4_parser_class[::symbol_name (this->kind ());
+      }]])[]b4_glr2_cc_if([], [[
+
+      /// Backward compatibility (Bison 3.6).
+      symbol_kind_type type_get () const YY_NOEXCEPT;]])[
+
+      /// Whether empty.
+      bool empty () const YY_NOEXCEPT;
+
+      /// Destructive move, \a s is emptied into this.
+      void move (basic_symbol& s);
+
+      /// The semantic value.
+      value_type value;]b4_locations_if([
+
+      /// The location.
+      location_type location;])[
+
+    private:
+#if YY_CPLUSPLUS < 201103L
+      /// Assignment operator.
+      basic_symbol& operator= (const basic_symbol& that);
+#endif
+    };
+
+    /// Type access provider for token (enum) based symbols.
+    struct by_kind
+    {
+      /// The symbol kind as needed by the constructor.
+      typedef token_kind_type kind_type;
+
+      /// Default constructor.
+      by_kind () YY_NOEXCEPT;
+
+#if 201103L <= YY_CPLUSPLUS
+      /// Move constructor.
+      by_kind (by_kind&& that) YY_NOEXCEPT;
+#endif
+
+      /// Copy constructor.
+      by_kind (const by_kind& that) YY_NOEXCEPT;
+
+      /// Constructor from (external) token numbers.
+      by_kind (kind_type t) YY_NOEXCEPT;
+
+]b4_glr2_cc_if([[
+      /// Copy assignment.
+      by_kind& operator= (const by_kind& that);
+
+      /// Move assignment.
+      by_kind& operator= (by_kind&& that);
+]])[
+
+      /// Record that this symbol is empty.
+      void clear () YY_NOEXCEPT;
+
+      /// Steal the symbol kind from \a that.
+      void move (by_kind& that);
+
+      /// The (internal) type number (corresponding to \a type).
+      /// \a empty when empty.
+      symbol_kind_type kind () const YY_NOEXCEPT;]b4_glr2_cc_if([], [[
+
+      /// Backward compatibility (Bison 3.6).
+      symbol_kind_type type_get () const YY_NOEXCEPT;]])[
+
+      /// The symbol kind.
+      /// \a ]b4_symbol_prefix[YYEMPTY when empty.
+      symbol_kind_type kind_;
+    };]b4_glr2_cc_if([], [[
+
+    /// Backward compatibility for a private implementation detail (Bison 3.6).
+    typedef by_kind by_type;]])[
+
+    /// "External" symbols: returned by the scanner.
+    struct symbol_type : basic_symbol<by_kind>
+    {]b4_variant_if([[
+      /// Superclass.
+      typedef basic_symbol<by_kind> super_type;
+
+      /// Empty symbol.
+      symbol_type () YY_NOEXCEPT {}
+
+      /// Constructor for valueless symbols, and symbols from each type.
+]b4_type_foreach([_b4_symbol_constructor_define])dnl
+    ])[};
+]])
+
+
+# b4_public_types_define(hh|cc)
+# -----------------------------
+# Provide the implementation needed by the public types.
+m4_define([b4_public_types_define],
+[[  // basic_symbol.
+  template <typename Base>
+  ]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
+    : Base (that)
+    , value (]b4_variant_if([], [that.value]))b4_locations_if([
+    , location (that.location)])[
+  {]b4_variant_if([
+    b4_symbol_variant([this->kind ()], [value], [copy],
+                      [YY_MOVE (that.value)])
+  ])[}
+
+]b4_variant_if([], [[
+  /// Constructor for valueless symbols.
+  template <typename Base>
+  ]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          b4_locations_if([YY_MOVE_REF (location_type) l]))[)
+    : Base (t)
+    , value ()]b4_locations_if([
+    , location (l)])[
+  {}
+
+  template <typename Base>
+  ]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          [YY_RVREF (value_type) v],
+          b4_locations_if([YY_RVREF (location_type) l]))[)
+    : Base (t)
+    , value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
+    , location (YY_MOVE (l))])[
+  {]b4_variant_if([[
+    (void) v;
+    ]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
+
+]b4_glr2_cc_if([], [[
+  template <typename Base>
+  ]b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
+  {
+    return this->kind ();
+  }
+]])[
+
+  template <typename Base>
+  bool
+  ]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
+  {
+    return this->kind () == ]b4_symbol(empty, kind)[;
+  }
+
+  template <typename Base>
+  void
+  ]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
+  {
+    super_type::move (s);
+    ]b4_variant_if([b4_symbol_variant([this->kind ()], [value], [move],
+                                      [YY_MOVE (s.value)])],
+                   [value = YY_MOVE (s.value);])[]b4_locations_if([
+    location = YY_MOVE (s.location);])[
+  }
+
+  // by_kind.
+  ]b4_inline([$1])b4_parser_class[::by_kind::by_kind () YY_NOEXCEPT
+    : kind_ (]b4_symbol(empty, kind)[)
+  {}
+
+#if 201103L <= YY_CPLUSPLUS
+  ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT
+    : kind_ (that.kind_)
+  {
+    that.clear ();
+  }
+#endif
+
+  ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT
+    : kind_ (that.kind_)
+  {}
+
+  ]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT
+    : kind_ (yytranslate_ (t))
+  {}
+
+]b4_glr2_cc_if([[
+  ]b4_inline([$1])]b4_parser_class[::by_kind&
+  b4_parser_class[::by_kind::by_kind::operator= (const by_kind& that)
+  {
+    kind_ = that.kind_;
+    return *this;
+  }
+
+  ]b4_inline([$1])]b4_parser_class[::by_kind&
+  b4_parser_class[::by_kind::by_kind::operator= (by_kind&& that)
+  {
+    kind_ = that.kind_;
+    that.clear ();
+    return *this;
+  }
+]])[
+
+  ]b4_inline([$1])[void
+  ]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
+  {
+    kind_ = ]b4_symbol(empty, kind)[;
+  }
+
+  ]b4_inline([$1])[void
+  ]b4_parser_class[::by_kind::move (by_kind& that)
+  {
+    kind_ = that.kind_;
+    that.clear ();
+  }
+
+  ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT
+  {
+    return kind_;
+  }
+
+]b4_glr2_cc_if([], [[
+  ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
+  {
+    return this->kind ();
+  }
+]])[
+]])
+
+
+# b4_token_constructor_define
+# ----------------------------
+# Define make_FOO for all the token kinds.
+# Use at class-level.  Redefined in variant.hh.
+m4_define([b4_token_constructor_define], [])
+
+
+# b4_yytranslate_define(cc|hh)
+# ----------------------------
+# Define yytranslate_.  Sometimes used in the header file ($1=hh),
+# sometimes in the cc file.
+m4_define([b4_yytranslate_define],
+[  b4_inline([$1])b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::yytranslate_ (int t) YY_NOEXCEPT
+  {
+]b4_api_token_raw_if(
+[[    return static_cast<symbol_kind_type> (t);]],
+[[    // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
+    // TOKEN-NUM as returned by yylex.
+    static
+    const ]b4_int_type_for([b4_translate])[
+    translate_table[] =
+    {
+  ]b4_translate[
+    };
+    // Last valid token kind.
+    const int code_max = ]b4_code_max[;
+
+    if (t <= 0)
+      return symbol_kind::]b4_symbol_prefix[YYEOF;
+    else if (t <= code_max)
+      return static_cast <symbol_kind_type> (translate_table[t]);
+    else
+      return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
+  }
+]])
+
+
+# b4_lhs_value([TYPE])
+# --------------------
+m4_define([b4_lhs_value],
+[b4_symbol_value([yyval], [$1])])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, [TYPE])
+# --------------------------------------
+# FIXME: Dead code.
+m4_define([b4_rhs_value],
+[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(yyloc)])
+
+
+# b4_rhs_location(RULE-LENGTH, POS)
+# ---------------------------------
+# Expansion of @POS, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[(yylocation_stack_@{($1) - ($2)@})])
+
+
+# b4_parse_param_decl
+# -------------------
+# Extra formal arguments of the constructor.
+# Change the parameter names from "foo" into "foo_yyarg", so that
+# there is no collision bw the user chosen attribute name, and the
+# argument name in the constructor.
+m4_define([b4_parse_param_decl],
+[m4_ifset([b4_parse_param],
+          [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
+
+m4_define([b4_parse_param_decl_1],
+[$1_yyarg])
+
+
+
+# b4_parse_param_cons
+# -------------------
+# Extra initialisations of the constructor.
+m4_define([b4_parse_param_cons],
+          [m4_ifset([b4_parse_param],
+                    [
+      b4_cc_constructor_calls(b4_parse_param)])])
+m4_define([b4_cc_constructor_calls],
+          [m4_map_sep([b4_cc_constructor_call], [,
+      ], [$@])])
+m4_define([b4_cc_constructor_call],
+          [$2 ($2_yyarg)])
+
+# b4_parse_param_vars
+# -------------------
+# Extra instance variables.
+m4_define([b4_parse_param_vars],
+          [m4_ifset([b4_parse_param],
+                    [
+    // User arguments.
+b4_cc_var_decls(b4_parse_param)])])
+m4_define([b4_cc_var_decls],
+          [m4_map_sep([b4_cc_var_decl], [
+], [$@])])
+m4_define([b4_cc_var_decl],
+          [    $1;])
+
+
+## ---------##
+## Values.  ##
+## ---------##
+
+# b4_yylloc_default_define
+# ------------------------
+# Define YYLLOC_DEFAULT.
+m4_define([b4_yylloc_default_define],
+[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+# ifndef YYLLOC_DEFAULT
+#  define YYLLOC_DEFAULT(Current, Rhs, N)                               \
+    do                                                                  \
+      if (N)                                                            \
+        {                                                               \
+          (Current).begin  = YYRHSLOC (Rhs, 1).begin;                   \
+          (Current).end    = YYRHSLOC (Rhs, N).end;                     \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;      \
+        }                                                               \
+    while (false)
+# endif
+]])
+
+## -------- ##
+## Checks.  ##
+## -------- ##
+
+b4_token_ctor_if([b4_variant_if([],
+  [b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
+               [cannot use '%s' without '%s'],
+               [%define api.token.constructor],
+               [%define api.value.type variant]))])])

+ 72 - 0
Engine/bin/bison-flex/data/skeletons/c-like.m4

@@ -0,0 +1,72 @@
+                                                            -*- Autoconf -*-
+
+# Common code for C-like languages (C, C++, Java, etc.)
+
+# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+# _b4_comment(TEXT, OPEN, CONTINUE, END)
+# --------------------------------------
+# Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
+# Avoid adding indentation to the first line, as the indentation comes
+# from OPEN.  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
+# Turn "*/" in TEXT into "* /" so that we don't unexpectedly close
+# the comments before its end.
+#
+# Prefix all the output lines with PREFIX.
+m4_define([_b4_comment],
+[$2[]b4_gsub(m4_expand([$1]),
+            [[*]/], [*\\/],
+            [/[*]], [/\\*],
+            [
+\(.\)], [
+$3\1])$4])
+
+
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
+# Put TEXT in comment.  Prefix all the output lines with PREFIX.
+m4_define([b4_comment],
+[_b4_comment([$1], [$2/* ], [$2   ], [  */])])
+
+
+
+
+# _b4_dollar_dollar(VALUE, SYMBOL-NUM, FIELD, DEFAULT-FIELD)
+# ----------------------------------------------------------
+# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
+# otherwise just VALUE.  Be sure to pass "(VALUE)" if VALUE is a
+# pointer.
+m4_define([_b4_dollar_dollar],
+[b4_symbol_value([$1],
+                 [$2],
+                 m4_if([$3], [[]],
+                       [[$4]], [[$3]]))])
+
+# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
+# b4_dollar_popdef
+# ------------------------------------------------------------------
+# Define b4_dollar_dollar for VALUE-POINTER and DEFAULT-FIELD,
+# and b4_at_dollar for LOCATION.
+m4_define([b4_dollar_pushdef],
+[m4_pushdef([b4_dollar_dollar],
+            [_b4_dollar_dollar([$1], [$2], m4_dquote($][1), [$3])])dnl
+m4_pushdef([b4_at_dollar], [$4])dnl
+])
+m4_define([b4_dollar_popdef],
+[m4_popdef([b4_at_dollar])dnl
+m4_popdef([b4_dollar_dollar])dnl
+])

+ 27 - 0
Engine/bin/bison-flex/data/skeletons/c-skel.m4

@@ -0,0 +1,27 @@
+                                                            -*- Autoconf -*-
+
+# C skeleton dispatching for Bison.
+
+# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
+# Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+b4_glr_if(             [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
+b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
+
+m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)

+ 1125 - 0
Engine/bin/bison-flex/data/skeletons/c.m4

@@ -0,0 +1,1125 @@
+                                                            -*- Autoconf -*-
+
+# C M4 Macros for Bison.
+
+# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
+# Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[c-like.m4])
+
+# b4_tocpp(STRING)
+# ----------------
+# Convert STRING into a valid C macro name.
+m4_define([b4_tocpp],
+[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
+
+
+# b4_cpp_guard(FILE)
+# ------------------
+# A valid C macro name to use as a CPP header guard for FILE.
+m4_define([b4_cpp_guard],
+[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
+
+
+# b4_cpp_guard_open(FILE)
+# b4_cpp_guard_close(FILE)
+# ------------------------
+# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
+m4_define([b4_cpp_guard_open],
+[m4_ifval(m4_quote($1),
+[#ifndef b4_cpp_guard([$1])
+# define b4_cpp_guard([$1])])])
+
+m4_define([b4_cpp_guard_close],
+[m4_ifval(m4_quote($1),
+[#endif b4_comment([!b4_cpp_guard([$1])])])])
+
+
+## ---------------- ##
+## Identification.  ##
+## ---------------- ##
+
+# b4_identification
+# -----------------
+# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
+# b4_pull_flag if they use the values of the %define variables api.pure or
+# api.push-pull.
+m4_define([b4_identification],
+[[/* Identify Bison output, and Bison version.  */
+#define YYBISON ]b4_version[
+
+/* Bison version string.  */
+#define YYBISON_VERSION "]b4_version_string["
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
+
+/* Pure parsers.  */
+#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
+
+/* Push parsers.  */
+#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
+
+/* Pull parsers.  */
+#define YYPULL ]b4_pull_flag])[
+]])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# b4_api_prefix, b4_api_PREFIX
+# ----------------------------
+# Corresponds to %define api.prefix
+b4_percent_define_default([[api.prefix]], [[yy]])
+m4_define([b4_api_prefix],
+[b4_percent_define_get([[api.prefix]])])
+m4_define([b4_api_PREFIX],
+[m4_toupper(b4_api_prefix)])
+
+
+# b4_prefix
+# ---------
+# If the %name-prefix is not given, it is api.prefix.
+m4_define_default([b4_prefix], [b4_api_prefix])
+
+# If the %union is not named, its name is YYSTYPE.
+b4_percent_define_default([[api.value.union.name]],
+                          [b4_api_PREFIX[][STYPE]])
+
+b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]])
+
+## ------------------------ ##
+## Pure/impure interfaces.  ##
+## ------------------------ ##
+
+# b4_yylex_formals
+# ----------------
+# All the yylex formal arguments.
+# b4_lex_param arrives quoted twice, but we want to keep only one level.
+m4_define([b4_yylex_formals],
+[b4_pure_if([[[b4_api_PREFIX[STYPE *yylvalp]], [[&yylval]]][]dnl
+b4_locations_if([, [b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])])dnl
+m4_ifdef([b4_lex_param], [, ]b4_lex_param)])
+
+
+# b4_yylex
+# --------
+# Call yylex.
+m4_define([b4_yylex],
+[b4_function_call([yylex], [int], b4_yylex_formals)])
+
+
+# b4_user_args
+# ------------
+m4_define([b4_user_args],
+[m4_ifset([b4_parse_param], [, b4_user_args_no_comma])])
+
+# b4_user_args_no_comma
+# ---------------------
+m4_define([b4_user_args_no_comma],
+[m4_ifset([b4_parse_param], [b4_args(b4_parse_param)])])
+
+
+# b4_user_formals
+# ---------------
+# The possible parse-params formal arguments preceded by a comma.
+m4_define([b4_user_formals],
+[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])])
+
+
+# b4_parse_param
+# --------------
+# If defined, b4_parse_param arrives double quoted, but below we prefer
+# it to be single quoted.
+m4_define([b4_parse_param],
+b4_parse_param)
+
+
+# b4_parse_param_for(DECL, FORMAL, BODY)
+# ---------------------------------------
+# Iterate over the user parameters, binding the declaration to DECL,
+# the formal name to FORMAL, and evaluating the BODY.
+m4_define([b4_parse_param_for],
+[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
+[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
+m4_pushdef([$2], m4_shift($1_$2))dnl
+$3[]dnl
+m4_popdef([$2])dnl
+m4_popdef([$1])dnl
+])])
+
+
+# b4_use(EXPR)
+# ------------
+# Pacify the compiler about some maybe unused value.
+m4_define([b4_use],
+[YY_USE ($1)])
+
+# b4_parse_param_use([VAL], [LOC])
+# --------------------------------
+# 'YY_USE' VAL, LOC if locations are enabled, and all the parse-params.
+m4_define([b4_parse_param_use],
+[m4_ifvaln([$1], [  b4_use([$1]);])dnl
+b4_locations_if([m4_ifvaln([$2], [  b4_use([$2]);])])dnl
+b4_parse_param_for([Decl], [Formal], [  b4_use(Formal);
+])dnl
+])
+
+
+## ------------ ##
+## Data Types.  ##
+## ------------ ##
+
+# b4_int_type(MIN, MAX)
+# ---------------------
+# Return a narrow int type able to handle integers ranging from MIN
+# to MAX (included) in portable C code.  Assume MIN and MAX fall in
+# 'int' range.
+m4_define([b4_int_type],
+[m4_if(b4_ints_in($@,   [-127],   [127]), [1], [signed char],
+       b4_ints_in($@,      [0],   [255]), [1], [unsigned char],
+
+       b4_ints_in($@, [-32767], [32767]), [1], [short],
+       b4_ints_in($@,      [0], [65535]), [1], [unsigned short],
+
+                                               [int])])
+
+# b4_c99_int_type(MIN, MAX)
+# -------------------------
+# Like b4_int_type, but for C99.
+# b4_c99_int_type_define replaces b4_int_type with this.
+m4_define([b4_c99_int_type],
+[m4_if(b4_ints_in($@,   [-127],   [127]), [1], [yytype_int8],
+       b4_ints_in($@,      [0],   [255]), [1], [yytype_uint8],
+
+       b4_ints_in($@, [-32767], [32767]), [1], [yytype_int16],
+       b4_ints_in($@,      [0], [65535]), [1], [yytype_uint16],
+
+                                               [int])])
+
+# b4_c99_int_type_define
+# ----------------------
+# Define private types suitable for holding small integers in C99 or later.
+m4_define([b4_c99_int_type_define],
+[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
+[#ifdef short
+# undef short
+#endif
+
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+   <limits.h> and (if available) <stdint.h> are included
+   so that the code can choose integer types of a good width.  */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+#  define YY_STDINT_H
+# endif
+#endif
+
+/* Narrow types that promote to a signed type and that can represent a
+   signed or unsigned integer of at least N bits.  In tables they can
+   save space and decrease cache pressure.  Promoting to a signed type
+   helps avoid bugs in integer arithmetic.  */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
+#else
+typedef short yytype_int16;
+#endif
+
+/* Work around bug in HP-UX 11.23, which defines these macros
+   incorrectly for preprocessor constants.  This workaround can likely
+   be removed in 2023, as HPE has promised support for HP-UX 11.23
+   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
+#else
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif]])
+
+
+# b4_sizes_types_define
+# ---------------------
+# Define YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, YYSIZE_T/YYSIZE_MAXIMUM,
+# and YYSIZEOF.
+m4_define([b4_sizes_types_define],
+[[#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+#  define YYPTRDIFF_T __PTRDIFF_TYPE__
+#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+#  ifndef ptrdiff_t
+#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  endif
+#  define YYPTRDIFF_T ptrdiff_t
+#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+#  define YYPTRDIFF_T long
+#  define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM                                  \
+  YY_CAST (YYPTRDIFF_T,                                 \
+           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
+            ? YYPTRDIFF_MAXIMUM                         \
+            : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+]])
+
+
+# b4_int_type_for(NAME)
+# ---------------------
+# Return a narrow int type able to handle numbers ranging from
+# 'NAME_min' to 'NAME_max' (included).
+m4_define([b4_int_type_for],
+[b4_int_type($1_min, $1_max)])
+
+
+# b4_table_value_equals(TABLE, VALUE, LITERAL, SYMBOL)
+# ----------------------------------------------------
+# Without inducing a comparison warning from the compiler, check if the
+# literal value LITERAL equals VALUE from table TABLE, which must have
+# TABLE_min and TABLE_max defined.  SYMBOL denotes
+m4_define([b4_table_value_equals],
+[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
+               || m4_indir([b4_]$1[_max]) < $3), [1],
+       [[0]],
+       [(($2) == $4)])])
+
+
+## ----------------- ##
+## Compiler issues.  ##
+## ----------------- ##
+
+# b4_attribute_define([noreturn])
+# -------------------------------
+# Provide portable compiler "attributes".  If "noreturn" is passed, define
+# _Noreturn.
+m4_define([b4_attribute_define],
+[[#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+#  define YY_ATTRIBUTE_UNUSED
+# endif
+#endif
+
+]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11.  */
+]dnl This is close to lib/_Noreturn.h, except that we do enable
+dnl the use of [[noreturn]], because _Noreturn is used in places
+dnl where [[noreturn]] works in C++.  We need this in particular
+dnl because of glr.cc which compiles code from glr.c in C++.
+dnl And the C++ compiler chokes on _Noreturn.  Also, we do not
+dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings.
+[#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+#  define _Noreturn [[noreturn]]
+# elif ((!defined __cplusplus || defined __clang__) \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+            || (!defined __STRICT_ANSI__ \
+                && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+                    || (defined __apple_build_version__ \
+                        ? 6000000 <= __apple_build_version__ \
+                        : 3 < __clang_major__ + (5 <= __clang_minor__))))))
+   /* _Noreturn works as-is.  */
+# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
+        || 0x5110 <= __SUNPRO_C)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
+
+]])[/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YY_USE(E) ((void) (E))
+#else
+# define YY_USE(E) /* empty */
+#endif
+
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN                          \
+    _Pragma ("GCC diagnostic push")                            \
+    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END            \
+    _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+]])
+
+
+# b4_cast_define
+# --------------
+m4_define([b4_cast_define],
+[# ifndef YY_CAST
+#  ifdef __cplusplus
+#   define YY_CAST(Type, Val) static_cast<Type> (Val)
+#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+#  else
+#   define YY_CAST(Type, Val) ((Type) (Val))
+#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+#  endif
+# endif[]dnl
+])
+
+
+# b4_null_define
+# --------------
+# Portability issues: define a YY_NULLPTR appropriate for the current
+# language (C, C++98, or C++11).
+#
+# In C++ pre C++11 it is standard practice to use 0 (not NULL) for the
+# null pointer.  In C, prefer ((void*)0) to avoid having to include stdlib.h.
+m4_define([b4_null_define],
+[# ifndef YY_NULLPTR
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
+#  else
+#   define YY_NULLPTR ((void*)0)
+#  endif
+# endif[]dnl
+])
+
+
+# b4_null
+# -------
+# Return a null pointer constant.
+m4_define([b4_null], [YY_NULLPTR])
+
+
+
+## ---------##
+## Values.  ##
+## ---------##
+
+# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
+# -------------------------------------------------------------
+# Define "yy<TABLE-NAME>" whose contents is CONTENT.
+m4_define([b4_integral_parser_table_define],
+[m4_ifvaln([$3], [b4_comment([$3])])dnl
+static const b4_int_type_for([$2]) yy$1[[]] =
+{
+  $2
+};dnl
+])
+
+
+## ------------- ##
+## Token kinds.  ##
+## ------------- ##
+
+# Because C enums are not scoped, because tokens are exposed in the
+# header, and because these tokens are common to all the parsers, we
+# need to make sure their names don't collide: use the api.prefix.
+# YYEOF is special, since the user may give it a different name.
+m4_define([b4_symbol(-2, id)],  [b4_api_PREFIX[][EMPTY]])
+m4_define([b4_symbol(-2, tag)], [[No symbol.]])
+
+m4_if(b4_symbol(eof, id), [YYEOF],
+     [m4_define([b4_symbol(0, id)],  [b4_api_PREFIX[][EOF]])])
+m4_define([b4_symbol(1, id)],  [b4_api_PREFIX[][error]])
+m4_define([b4_symbol(2, id)],  [b4_api_PREFIX[][UNDEF]])
+
+
+# b4_token_define(TOKEN-NUM)
+# --------------------------
+# Output the definition of this token as #define.
+m4_define([b4_token_define],
+[b4_token_format([#define %s %s], [$1])])
+
+# b4_token_defines
+# ----------------
+# Output the definition of the tokens.
+m4_define([b4_token_defines],
+[[/* Token kinds.  */
+#define ]b4_symbol(empty, [id])[ -2
+]m4_join([
+], b4_symbol_map([b4_token_define]))
+])
+
+
+# b4_token_enum(TOKEN-NUM)
+# ------------------------
+# Output the definition of this token as an enum.
+m4_define([b4_token_enum],
+[b4_token_visible_if([$1],
+    [m4_format([    %-30s %s],
+               m4_format([[%s = %s%s%s]],
+                         b4_symbol([$1], [id]),
+                         b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])),
+                         m4_if([$1], b4_last_enum_token, [], [[,]])),
+               [b4_symbol_tag_comment([$1])])])])
+
+
+# b4_token_enums
+# --------------
+# The definition of the token kinds.
+m4_define([b4_token_enums],
+[b4_any_token_visible_if([[/* Token kinds.  */
+#ifndef ]b4_api_PREFIX[TOKENTYPE
+# define ]b4_api_PREFIX[TOKENTYPE
+  enum ]b4_api_prefix[tokentype
+  {
+    ]b4_symbol(empty, [id])[ = -2,
+]b4_symbol_foreach([b4_token_enum])dnl
+[  };
+  typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t;
+#endif
+]])])
+
+
+# b4_token_enums_defines
+# ----------------------
+# The definition of the tokens (if there are any) as enums and,
+# if POSIX Yacc is enabled, as #defines.
+m4_define([b4_token_enums_defines],
+[b4_token_enums[]b4_yacc_if([b4_token_defines])])
+
+
+# b4_symbol_translate(STRING)
+# ---------------------------
+# Used by "bison" in the array of symbol names to mark those that
+# require translation.
+m4_define([b4_symbol_translate],
+[[N_($1)]])
+
+
+
+## -------------- ##
+## Symbol kinds.  ##
+## -------------- ##
+
+# b4_symbol_enum(SYMBOL-NUM)
+# --------------------------
+# Output the definition of this symbol as an enum.
+m4_define([b4_symbol_enum],
+[m4_format([  %-40s %s],
+           m4_format([[%s = %s%s%s]],
+                     b4_symbol([$1], [kind_base]),
+                     [$1],
+                     m4_if([$1], b4_last_symbol, [], [[,]])),
+           [b4_symbol_tag_comment([$1])])])
+
+
+# b4_declare_symbol_enum
+# ----------------------
+# The definition of the symbol internal numbers as an enum.
+# Defining YYEMPTY here is important: it forces the compiler
+# to use a signed type, which matters for yytoken.
+m4_define([b4_declare_symbol_enum],
+[[/* Symbol kind.  */
+enum yysymbol_kind_t
+{
+  ]b4_symbol(empty, [kind_base])[ = -2,
+]b4_symbol_foreach([b4_symbol_enum])dnl
+[};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+]])])
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
+# ----------------------------------------------
+# See README.
+m4_define([b4_symbol_value],
+[m4_ifval([$3],
+          [($1.$3)],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [($1.b4_symbol([$2], [type]))],
+                                  [$1])],
+                    [$1])])])
+
+
+## ---------------------- ##
+## Defining C functions.  ##
+## ---------------------- ##
+
+
+# b4_formals([DECL1, NAME1], ...)
+# -------------------------------
+# The formal arguments of a C function definition.
+m4_define([b4_formals],
+[m4_if([$#], [0], [void],
+       [$#$1], [1], [void],
+               [m4_map_sep([b4_formal], [, ], [$@])])])
+
+m4_define([b4_formal],
+[$1])
+
+
+# b4_function_declare(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
+# ------------------------------------------------------------
+# Declare the function NAME.
+m4_define([b4_function_declare],
+[$2 $1 (b4_formals(m4_shift2($@)));[]dnl
+])
+
+
+
+## --------------------- ##
+## Calling C functions.  ##
+## --------------------- ##
+
+
+# b4_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
+# -----------------------------------------------------------
+# Call the function NAME with arguments NAME1, NAME2 etc.
+m4_define([b4_function_call],
+[$1 (b4_args(m4_shift2($@)))[]dnl
+])
+
+
+# b4_args([DECL1, NAME1], ...)
+# ----------------------------
+# Output the arguments NAME1, NAME2...
+m4_define([b4_args],
+[m4_map_sep([b4_arg], [, ], [$@])])
+
+m4_define([b4_arg],
+[$2])
+
+
+## ----------- ##
+## Synclines.  ##
+## ----------- ##
+
+# b4_sync_start(LINE, FILE)
+# -------------------------
+m4_define([b4_sync_start], [[#]line $1 $2])
+
+
+## -------------- ##
+## User actions.  ##
+## -------------- ##
+
+# b4_case(LABEL, STATEMENTS, [COMMENTS])
+# --------------------------------------
+m4_define([b4_case],
+[  case $1:m4_ifval([$3], [ b4_comment([$3])])
+$2
+b4_syncline([@oline@], [@ofile@])dnl
+    break;])
+
+
+# b4_predicate_case(LABEL, CONDITIONS)
+# ------------------------------------
+m4_define([b4_predicate_case],
+[  case $1:
+    if (! (
+$2)) YYERROR;
+b4_syncline([@oline@], [@ofile@])dnl
+    break;])
+
+
+# b4_yydestruct_define
+# --------------------
+# Define the "yydestruct" function.
+m4_define_default([b4_yydestruct_define],
+[[/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep]b4_locations_if(dnl
+[[, YYLTYPE *yylocationp]])[]b4_user_formals[)
+{
+]b4_parse_param_use([yyvaluep], [yylocationp])dnl
+[  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  ]b4_symbol_actions([destructor])[
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}]dnl
+])
+
+
+# b4_yy_symbol_print_define
+# -------------------------
+# Define the "yy_symbol_print" function.
+m4_define_default([b4_yy_symbol_print_define],
+[[
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl
+[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
+{
+  FILE *yyoutput = yyo;
+]b4_parse_param_use([yyoutput], [yylocationp])dnl
+[  if (!yyvaluep)
+    return;]
+b4_percent_code_get([[pre-printer]])dnl
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  b4_symbol_actions([printer])
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+b4_percent_code_get([[post-printer]])dnl
+[}
+
+
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
+
+static void
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep]b4_locations_if(dnl
+[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
+{
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+
+]b4_locations_if([  YYLOCATION_PRINT (yyo, yylocationp);
+  YYFPRINTF (yyo, ": ");
+])dnl
+[  yy_symbol_value_print (yyo, yykind, yyvaluep]dnl
+b4_locations_if([, yylocationp])[]b4_user_args[);
+  YYFPRINTF (yyo, ")");
+}]dnl
+])
+
+
+## ---------------- ##
+## api.value.type.  ##
+## ---------------- ##
+
+
+# ---------------------- #
+# api.value.type=union.  #
+# ---------------------- #
+
+# b4_symbol_type_register(SYMBOL-NUM)
+# -----------------------------------
+# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
+# Extend the definition of %union's body (b4_union_members) with a
+# field of that type, and extend the symbol's "type" field to point to
+# the field name, instead of the type name.
+m4_define([b4_symbol_type_register],
+[m4_define([b4_symbol($1, type_tag)],
+           [b4_symbol_if([$1], [has_id],
+                         [b4_symbol([$1], [id])],
+                         [yykind_[]b4_symbol([$1], [number])])])dnl
+m4_append([b4_union_members],
+m4_expand([m4_format([  %-40s %s],
+                     m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
+                     [b4_symbol_tag_comment([$1])])]))
+])
+
+
+# b4_type_define_tag(SYMBOL1-NUM, ...)
+# ------------------------------------
+# For the batch of symbols SYMBOL1-NUM... (which all have the same
+# type), enhance the %union definition for each of them, and set
+# there "type" field to the field tag name, instead of the type name.
+m4_define([b4_type_define_tag],
+[b4_symbol_if([$1], [has_type],
+              [m4_map([b4_symbol_type_register], [$@])])
+])
+
+
+# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
+# ----------------------------------------------
+# Same of b4_symbol_value, but when api.value.type=union.
+m4_define([b4_symbol_value_union],
+[m4_ifval([$3],
+          [(*($3*)(&$1))],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [($1.b4_symbol([$2], [type_tag]))],
+                                  [$1])],
+                    [$1])])])
+
+
+# b4_value_type_setup_union
+# -------------------------
+# Setup support for api.value.type=union.  Symbols are defined with a
+# type instead of a union member name: build the corresponding union,
+# and give the symbols their tag.
+m4_define([b4_value_type_setup_union],
+[m4_define([b4_union_members])
+b4_type_foreach([b4_type_define_tag])
+m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
+])
+
+
+# -------------------------- #
+# api.value.type = variant.  #
+# -------------------------- #
+
+# b4_value_type_setup_variant
+# ---------------------------
+# Setup support for api.value.type=variant.  By default, fail, specialized
+# by other skeletons.
+m4_define([b4_value_type_setup_variant],
+[b4_complain_at(b4_percent_define_get_loc([[api.value.type]]),
+                [['%s' does not support '%s']],
+                [b4_skeleton],
+                [%define api.value.type variant])])
+
+
+# _b4_value_type_setup_keyword
+# ----------------------------
+# api.value.type is defined with a keyword/string syntax.  Check if
+# that is properly defined, and prepare its use.
+m4_define([_b4_value_type_setup_keyword],
+[b4_percent_define_check_values([[[[api.value.type]],
+                                  [[none]],
+                                  [[union]],
+                                  [[union-directive]],
+                                  [[variant]],
+                                  [[yystype]]]])dnl
+m4_case(b4_percent_define_get([[api.value.type]]),
+        [union],   [b4_value_type_setup_union],
+        [variant], [b4_value_type_setup_variant])])
+
+
+# b4_value_type_setup
+# -------------------
+# Check if api.value.type is properly defined, and possibly prepare
+# its use.
+b4_define_silent([b4_value_type_setup],
+[# Define default value.
+b4_percent_define_ifdef([[api.value.type]], [],
+[# %union => api.value.type=union-directive
+m4_ifdef([b4_union_members],
+[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
+m4_define([b4_percent_define(api.value.type)], [union-directive])],
+[# no tag seen => api.value.type={int}
+m4_if(b4_tag_seen_flag, 0,
+[m4_define([b4_percent_define_kind(api.value.type)], [code])
+m4_define([b4_percent_define(api.value.type)], [int])],
+[# otherwise api.value.type=yystype
+m4_define([b4_percent_define_kind(api.value.type)], [keyword])
+m4_define([b4_percent_define(api.value.type)], [yystype])])])])
+
+# Set up.
+m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
+   [keyword\|string], [_b4_value_type_setup_keyword])
+])
+
+
+## -------------- ##
+## Declarations.  ##
+## -------------- ##
+
+
+# b4_value_type_define
+# --------------------
+m4_define([b4_value_type_define],
+[b4_value_type_setup[]dnl
+/* Value type.  */
+m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
+[code],
+[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
+typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
+# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
+# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
+#endif
+]],
+[m4_bmatch(b4_percent_define_get([[api.value.type]]),
+[union\|union-directive],
+[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
+]b4_percent_define_get_syncline([[api.value.union.name]])dnl
+[union ]b4_percent_define_get([[api.value.union.name]])[
+{
+]b4_user_union_members[
+};
+]b4_percent_define_get_syncline([[api.value.union.name]])dnl
+[typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
+# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
+# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
+#endif
+]])])])
+
+
+# b4_location_type_define
+# -----------------------
+m4_define([b4_location_type_define],
+[[/* Location type.  */
+]b4_percent_define_ifdef([[api.location.type]],
+[[typedef ]b4_percent_define_get([[api.location.type]])[ ]b4_api_PREFIX[LTYPE;
+]],
+[[#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
+typedef struct ]b4_api_PREFIX[LTYPE ]b4_api_PREFIX[LTYPE;
+struct ]b4_api_PREFIX[LTYPE
+{
+  int first_line;
+  int first_column;
+  int last_line;
+  int last_column;
+};
+# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
+# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
+#endif
+]])])
+
+
+# b4_declare_yylstype
+# -------------------
+# Declarations that might either go into the header (if --header) or
+# in the parser body.  Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
+m4_define([b4_declare_yylstype],
+[b4_value_type_define[]b4_locations_if([
+b4_location_type_define])
+
+b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
+]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
+])
+
+
+# b4_YYDEBUG_define
+# -----------------
+m4_define([b4_YYDEBUG_define],
+[[/* Debug traces.  */
+]m4_if(b4_api_prefix, [yy],
+[[#ifndef YYDEBUG
+# define YYDEBUG ]b4_parse_trace_if([1], [0])[
+#endif]],
+[[#ifndef ]b4_api_PREFIX[DEBUG
+# if defined YYDEBUG
+#if YYDEBUG
+#   define ]b4_api_PREFIX[DEBUG 1
+#  else
+#   define ]b4_api_PREFIX[DEBUG 0
+#  endif
+# else /* ! defined YYDEBUG */
+#  define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
+# endif /* ! defined YYDEBUG */
+#endif  /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
+])
+
+# b4_declare_yydebug
+# ------------------
+m4_define([b4_declare_yydebug],
+[b4_YYDEBUG_define[
+#if ]b4_api_PREFIX[DEBUG
+extern int ]b4_prefix[debug;
+#endif][]dnl
+])
+
+# b4_yylloc_default_define
+# ------------------------
+# Define YYLLOC_DEFAULT.
+m4_define([b4_yylloc_default_define],
+[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#ifndef YYLLOC_DEFAULT
+# 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)
+#endif
+]])
+
+# b4_yylocation_print_define
+# --------------------------
+# Define YYLOCATION_PRINT.
+m4_define([b4_yylocation_print_define],
+[b4_locations_if([[
+/* YYLOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
+
+# ifndef YYLOCATION_PRINT
+
+#  if defined YY_LOCATION_PRINT
+
+   /* Temporary convenience wrapper in case some people defined the
+      undocumented and private YY_LOCATION_PRINT macros.  */
+#   define YYLOCATION_PRINT(File, Loc)  YY_LOCATION_PRINT(File, *(Loc))
+
+#  elif defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
+
+YY_ATTRIBUTE_UNUSED
+static int
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+{
+  int res = 0;
+  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+  if (0 <= yylocp->first_line)
+    {
+      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
+      if (0 <= yylocp->first_column)
+        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
+    }
+  if (0 <= yylocp->last_line)
+    {
+      if (yylocp->first_line < yylocp->last_line)
+        {
+          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
+          if (0 <= end_col)
+            res += YYFPRINTF (yyo, ".%d", end_col);
+        }
+      else if (0 <= end_col && yylocp->first_column < end_col)
+        res += YYFPRINTF (yyo, "-%d", end_col);
+    }
+  return res;
+}
+
+#   define YYLOCATION_PRINT  yy_location_print_
+
+    /* Temporary convenience wrapper in case some people defined the
+       undocumented and private YY_LOCATION_PRINT macros.  */
+#   define YY_LOCATION_PRINT(File, Loc)  YYLOCATION_PRINT(File, &(Loc))
+
+#  else
+
+#   define YYLOCATION_PRINT(File, Loc) ((void) 0)
+    /* Temporary convenience wrapper in case some people defined the
+       undocumented and private YY_LOCATION_PRINT macros.  */
+#   define YY_LOCATION_PRINT  YYLOCATION_PRINT
+
+#  endif
+# endif /* !defined YYLOCATION_PRINT */]])
+])
+
+# b4_yyloc_default
+# ----------------
+# Expand to a possible default value for yylloc.
+m4_define([b4_yyloc_default],
+[[
+# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
+  = { ]m4_join([, ],
+               m4_defn([b4_location_initial_line]),
+               m4_defn([b4_location_initial_column]),
+               m4_defn([b4_location_initial_line]),
+               m4_defn([b4_location_initial_column]))[ }
+# endif
+]])

+ 26 - 0
Engine/bin/bison-flex/data/skeletons/d-skel.m4

@@ -0,0 +1,26 @@
+                                                            -*- Autoconf -*-
+
+# D skeleton dispatching for Bison.
+
+# Copyright (C) 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+b4_glr_if(             [b4_complain([%%glr-parser not supported for D])])
+b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
+
+m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)

+ 628 - 0
Engine/bin/bison-flex/data/skeletons/d.m4

@@ -0,0 +1,628 @@
+                                                            -*- Autoconf -*-
+
+# D language support for Bison
+
+# Copyright (C) 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+m4_include(b4_skeletonsdir/[c-like.m4])
+
+
+# b4_symbol_action(SYMBOL-NUM, ACTION)
+# ------------------------------------
+# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
+m4_define([b4_symbol_action],
+[b4_symbol_if([$1], [has_$2],
+[b4_dollar_pushdef([yyval],
+                   [$1],
+                   [],
+                   [yyloc])dnl
+    _b4_symbol_case([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
+b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])dnl
+        break;
+
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_use(EXPR)
+# ------------
+# Pacify the compiler about some maybe unused value.
+m4_define([b4_use],
+[])
+
+
+# b4_sync_start(LINE, FILE)
+# -------------------------
+m4_define([b4_sync_start], [[#]line $1 $2])
+
+
+# b4_list2(LIST1, LIST2)
+# ----------------------
+# Join two lists with a comma if necessary.
+m4_define([b4_list2],
+          [$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
+
+
+# b4_percent_define_get3(DEF, PRE, POST, NOT)
+# -------------------------------------------
+# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
+# otherwise NOT.
+m4_define([b4_percent_define_get3],
+          [m4_ifval(m4_quote(b4_percent_define_get([$1])),
+                [$2[]b4_percent_define_get([$1])[]$3], [$4])])
+
+# b4_percent_define_if_get2(ARG1, ARG2, DEF, NOT)
+# -----------------------------------------------
+# Expand to the value of DEF if ARG1 or ARG2 are %define'ed,
+# otherwise NOT.
+m4_define([b4_percent_define_if_get2],
+          [m4_ifval(m4_quote(b4_percent_define_get([$1])),
+                [$3], [m4_ifval(m4_quote(b4_percent_define_get([$2])),
+                      [$3], [$4])])])
+
+# b4_percent_define_class_before_interface(CLASS, INTERFACE)
+# ----------------------------------------------------------
+# Expand to a ', ' if both a class and an interface have been %define'ed
+m4_define([b4_percent_define_class_before_interface],
+          [m4_ifval(m4_quote(b4_percent_define_get([$1])),
+                [m4_ifval(m4_quote(b4_percent_define_get([$2])),
+                      [, ])])])
+
+
+# b4_flag_value(BOOLEAN-FLAG)
+# ---------------------------
+m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
+
+
+# b4_parser_class_declaration
+# ---------------------------
+# The declaration of the parser class ("class YYParser"), with all its
+# qualifiers/annotations.
+b4_percent_define_default([[api.parser.abstract]], [[false]])
+b4_percent_define_default([[api.parser.final]],    [[false]])
+b4_percent_define_default([[api.parser.public]],   [[false]])
+
+m4_define([b4_parser_class_declaration],
+[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
+b4_percent_define_flag_if([api.parser.public],   [public ])dnl
+b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
+b4_percent_define_flag_if([api.parser.final],    [final ])dnl
+[class ]b4_parser_class[]dnl
+b4_percent_define_if_get2([api.parser.extends], [api.parser.implements], [ : ])dnl
+b4_percent_define_get([api.parser.extends])dnl
+b4_percent_define_class_before_interface([api.parser.extends], [api.parser.implements])dnl
+b4_percent_define_get([api.parser.implements])])
+
+
+# b4_lexer_if(TRUE, FALSE)
+# ------------------------
+m4_define([b4_lexer_if],
+[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
+
+
+# b4_position_type_if(TRUE, FALSE)
+# --------------------------------
+m4_define([b4_position_type_if],
+[b4_percent_define_ifdef([[position_type]], [$1], [$2])])
+
+
+# b4_location_type_if(TRUE, FALSE)
+# --------------------------------
+m4_define([b4_location_type_if],
+[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
+
+
+# b4_identification
+# -----------------
+m4_define([b4_identification],
+[[/** Version number for the Bison executable that generated this parser.  */
+  public static immutable string yy_bison_version = "]b4_version_string[";
+
+  /** Name of the skeleton that generated this parser.  */
+  public static immutable string yy_bison_skeleton = ]b4_skeleton[;
+]])
+
+
+## ------------ ##
+## Data types.  ##
+## ------------ ##
+
+# b4_int_type(MIN, MAX)
+# ---------------------
+# Return the smallest int type able to handle numbers ranging from
+# MIN to MAX (included).
+m4_define([b4_int_type],
+[m4_if(b4_ints_in($@,   [-128],   [127]), [1], [byte],
+       b4_ints_in($@, [-32768], [32767]), [1], [short],
+                                               [int])])
+
+# b4_int_type_for(NAME)
+# ---------------------
+# Return the smallest int type able to handle numbers ranging from
+# `NAME_min' to `NAME_max' (included).
+m4_define([b4_int_type_for],
+[b4_int_type($1_min, $1_max)])
+
+# b4_null
+# -------
+m4_define([b4_null], [null])
+
+
+# b4_integral_parser_table_define(NAME, DATA, COMMENT)
+#-----------------------------------------------------
+# Define "yy<TABLE-NAME>" whose contents is CONTENT.
+m4_define([b4_integral_parser_table_define],
+[m4_ifvaln([$3], [b4_comment([$3], [  ])])dnl
+private static immutable b4_int_type_for([$2])[[]] yy$1_ =
+@{
+  $2
+@};dnl
+])
+
+
+## ------------- ##
+## Token kinds.  ##
+## ------------- ##
+
+m4_define([b4_symbol(-2, id)],  [[YYEMPTY]])
+b4_percent_define_default([[api.token.raw]], [[true]])
+
+# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
+# ---------------------------------------
+# Output the definition of this token as an enum.
+m4_define([b4_token_enum],
+[b4_token_format([  %s = %s,
+], [$1])])
+
+# b4_token_enums
+# --------------
+# Output the definition of the tokens as enums.
+m4_define([b4_token_enums],
+[/* Token kinds.  */
+public enum TokenKind {
+  ]b4_symbol(empty, id)[ = -2,
+b4_symbol_foreach([b4_token_enum])dnl
+}
+])
+
+# b4_symbol_translate(STRING)
+# ---------------------------
+# Used by "bison" in the array of symbol names to mark those that
+# require translation.
+m4_define([b4_symbol_translate],
+[[_($1)]])
+
+
+# _b4_token_constructor_define(SYMBOL-NUM)
+# ----------------------------------------
+# Define Symbol.FOO for SYMBOL-NUM.
+m4_define([_b4_token_constructor_define],
+[b4_token_visible_if([$1],
+[[
+    static auto ]b4_symbol([$1], [id])[(]b4_symbol_if([$1], [has_type],
+[b4_union_if([b4_symbol([$1], [type]],
+[[typeof(YYSemanticType.]b4_symbol([$1], [type])[]])) [val]])dnl
+[]b4_locations_if([b4_symbol_if([$1], [has_type], [[, ]])[Location l]])[)
+    {
+      return Symbol(TokenKind.]b4_symbol([$1], [id])[]b4_symbol_if([$1], [has_type],
+      [[, val]])[]b4_locations_if([[, l]])[);
+    }]])])
+
+# b4_token_constructor_define
+# ---------------------------
+# Define Symbol.FOO for each token kind FOO.
+m4_define([b4_token_constructor_define],
+[[
+    /* Implementation of token constructors for each symbol type visible to
+     * the user. The code generates static methods that have the same names
+     * as the TokenKinds.
+     */]b4_symbol_foreach([_b4_token_constructor_define])dnl
+])
+
+## -------------- ##
+## Symbol kinds.  ##
+## -------------- ##
+
+# b4_symbol_kind(NUM)
+# -------------------
+m4_define([b4_symbol_kind],
+[SymbolKind.b4_symbol_kind_base($@)])
+
+
+# b4_symbol_enum(SYMBOL-NUM)
+# --------------------------
+# Output the definition of this symbol as an enum.
+m4_define([b4_symbol_enum],
+[m4_format([    %-30s %s],
+           m4_format([[%s = %s,]],
+                     b4_symbol([$1], [kind_base]),
+                     [$1]),
+           [b4_symbol_tag_comment([$1])])])
+
+
+# b4_declare_symbol_enum
+# ----------------------
+# The definition of the symbol internal numbers as an enum.
+# Defining YYEMPTY here is important: it forces the compiler
+# to use a signed type, which matters for yytoken.
+m4_define([b4_declare_symbol_enum],
+[[  /* Symbol kinds.  */
+  struct SymbolKind
+  {
+    enum
+    {
+    ]b4_symbol(empty, kind_base)[ = -2,  /* No symbol.  */
+]b4_symbol_foreach([b4_symbol_enum])dnl
+[    }
+
+    private int yycode_;
+    alias yycode_ this;
+
+    this(int code)
+    {
+      yycode_ = code;
+    }
+
+    /* Return YYSTR after stripping away unnecessary quotes and
+     backslashes, so that it's suitable for yyerror.  The heuristic is
+     that double-quoting is unnecessary unless the string contains an
+     apostrophe, a comma, or backslash (other than backslash-backslash).
+     YYSTR is taken from yytname.  */
+    final void toString(W)(W sink) const
+    if (isOutputRange!(W, char))
+    {
+      immutable string[] yy_sname = @{
+  ]b4_symbol_names[
+      @};]b4_has_translations_if([[
+      /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
+        internationalizable.  */
+      immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{
+  ]b4_translatable[
+      @};]])[
+
+      put(sink, yy_sname[yycode_]);
+    }
+  }
+]])
+
+
+# b4_case(ID, CODE, [COMMENTS])
+# -----------------------------
+m4_define([b4_case], [    case $1:m4_ifval([$3], [ b4_comment([$3])])
+$2
+      break;])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
+b4_percent_define_default([[stype]], [[YYSemanticType]])])
+
+# %name-prefix
+m4_define_default([b4_prefix], [[YY]])
+
+b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])])
+m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
+
+#b4_percent_define_default([[location_type]], [Location])])
+m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_percent_define_get([[location_type]])],[YYLocation]))
+
+#b4_percent_define_default([[position_type]], [Position])])
+m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
+
+
+## ---------------- ##
+## api.value.type.  ##
+## ---------------- ##
+
+
+# ---------------------- #
+# api.value.type=union.  #
+# ---------------------- #
+
+# b4_symbol_type_register(SYMBOL-NUM)
+# -----------------------------------
+# Symbol SYMBOL-NUM has a type (for union) instead of a type-tag.
+# Extend the definition of %union's body (b4_union_members) with a
+# field of that type, and extend the symbol's "type" field to point to
+# the field name, instead of the type name.
+m4_define([b4_symbol_type_register],
+[m4_define([b4_symbol($1, type_tag)],
+           [b4_symbol_if([$1], [has_id],
+                         [b4_symbol([$1], [id])],
+                         [yykind_[]b4_symbol([$1], [number])])])dnl
+m4_append([b4_union_members],
+m4_expand([m4_format([  %-40s %s],
+                     m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
+                     [b4_symbol_tag_comment([$1])])]))
+])
+
+
+# b4_type_define_tag(SYMBOL1-NUM, ...)
+# ------------------------------------
+# For the batch of symbols SYMBOL1-NUM... (which all have the same
+# type), enhance the %union definition for each of them, and set
+# there "type" field to the field tag name, instead of the type name.
+m4_define([b4_type_define_tag],
+[b4_symbol_if([$1], [has_type],
+              [m4_map([b4_symbol_type_register], [$@])])
+])
+
+
+# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
+# ----------------------------------------------
+# Same of b4_symbol_value, but when api.value.type=union.
+m4_define([b4_symbol_value_union],
+[m4_ifval([$3],
+          [(*($3*)(&$1))],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [($1.b4_symbol([$2], [type_tag]))],
+                                  [$1])],
+                    [$1])])])
+
+
+# b4_value_type_setup_union
+# -------------------------
+# Setup support for api.value.type=union.  Symbols are defined with a
+# type instead of a union member name: build the corresponding union,
+# and give the symbols their tag.
+m4_define([b4_value_type_setup_union],
+[m4_define([b4_union_members])
+b4_type_foreach([b4_type_define_tag])
+m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
+])
+
+
+# _b4_value_type_setup_keyword
+# ----------------------------
+# api.value.type is defined with a keyword/string syntax.  Check if
+# that is properly defined, and prepare its use.
+m4_define([_b4_value_type_setup_keyword],
+[b4_percent_define_check_values([[[[api.value.type]],
+                                  [[none]],
+                                  [[union]],
+                                  [[union-directive]],
+                                  [[yystype]]]])dnl
+m4_case(b4_percent_define_get([[api.value.type]]),
+        [union],   [b4_value_type_setup_union])])
+
+
+# b4_value_type_setup
+# -------------------
+# Check if api.value.type is properly defined, and possibly prepare
+# its use.
+b4_define_silent([b4_value_type_setup],
+[
+# Define default value.
+b4_percent_define_ifdef([[api.value.type]], [],
+[# %union => api.value.type=union-directive
+m4_ifdef([b4_union_members],
+[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
+m4_define([b4_percent_define(api.value.type)], [union-directive])],
+[# no tag seen => api.value.type={int}
+m4_if(b4_tag_seen_flag, 0,
+[m4_define([b4_percent_define_kind(api.value.type)], [code])
+m4_define([b4_percent_define(api.value.type)], [int])],
+[# otherwise api.value.type=yystype
+m4_define([b4_percent_define_kind(api.value.type)], [keyword])
+m4_define([b4_percent_define(api.value.type)], [yystype])])])])
+
+# Set up.
+m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
+   [keyword], [_b4_value_type_setup_keyword])
+])
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
+# ----------------------------------------------
+# See README.  FIXME: factor in c-like?
+m4_define([b4_symbol_value],
+[m4_ifval([$3],
+          [($1.$3)],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [($1.b4_symbol([$2], [type]))],
+                                  [$1])],
+                    [$1])])])
+
+# b4_lhs_value(SYMBOL-NUM, [TYPE])
+# --------------------------------
+# See README.
+m4_define([b4_lhs_value],
+[b4_symbol_value([yyval], [$1], [$2])])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
+# --------------------------------------------------
+# See README.
+#
+# In this simple implementation, %token and %type have class names
+# between the angle brackets.
+m4_define([b4_rhs_value],
+[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(yyloc)])
+
+
+# b4_rhs_location(RULE-LENGTH, POS)
+# ---------------------------------
+# Expansion of @POS, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[yystack.locationAt (b4_subtract($@))])
+
+
+# b4_lex_param
+# b4_parse_param
+# --------------
+# If defined, b4_lex_param arrives double quoted, but below we prefer
+# it to be single quoted.  Same for b4_parse_param.
+
+# TODO: should be in bison.m4
+m4_define_default([b4_lex_param], [[]]))
+m4_define([b4_lex_param], b4_lex_param))
+m4_define([b4_parse_param], b4_parse_param))
+
+# b4_lex_param_decl
+# -------------------
+# Extra formal arguments of the constructor.
+m4_define([b4_lex_param_decl],
+[m4_ifset([b4_lex_param],
+          [b4_remove_comma([$1],
+                           b4_param_decls(b4_lex_param))],
+          [$1])])
+
+m4_define([b4_param_decls],
+          [m4_map([b4_param_decl], [$@])])
+m4_define([b4_param_decl], [, $1])
+
+m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
+
+
+
+# b4_parse_param_decl
+# -------------------
+# Extra formal arguments of the constructor.
+m4_define([b4_parse_param_decl],
+[m4_ifset([b4_parse_param],
+          [b4_remove_comma([$1],
+                           b4_param_decls(b4_parse_param))],
+          [$1])])
+
+
+
+# b4_lex_param_call
+# -------------------
+# Delegating the lexer parameters to the lexer constructor.
+m4_define([b4_lex_param_call],
+          [m4_ifset([b4_lex_param],
+                    [b4_remove_comma([$1],
+                                     b4_param_calls(b4_lex_param))],
+                    [$1])])
+m4_define([b4_param_calls],
+          [m4_map([b4_param_call], [$@])])
+m4_define([b4_param_call], [, $2])
+
+
+
+# b4_parse_param_cons
+# -------------------
+# Extra initialisations of the constructor.
+m4_define([b4_parse_param_cons],
+          [m4_ifset([b4_parse_param],
+                    [b4_constructor_calls(b4_parse_param)])])
+
+m4_define([b4_constructor_calls],
+          [m4_map([b4_constructor_call], [$@])])
+m4_define([b4_constructor_call],
+          [this.$2 = $2;
+          ])
+
+
+
+# b4_parse_param_vars
+# -------------------
+# Extra instance variables.
+m4_define([b4_parse_param_vars],
+          [m4_ifset([b4_parse_param],
+                    [
+    /* User arguments.  */
+b4_var_decls(b4_parse_param)])])
+
+m4_define([b4_var_decls],
+          [m4_map_sep([b4_var_decl], [
+], [$@])])
+m4_define([b4_var_decl],
+          [    protected $1;])
+
+
+# b4_public_types_declare
+# -----------------------
+# Define the public types: token, semantic value, location, and so forth.
+# Depending on %define token_lex, may be output in the header or source file.
+m4_define([b4_public_types_declare],
+[[
+alias Symbol = ]b4_parser_class[.Symbol;
+alias Value = ]b4_yystype[;]b4_locations_if([[
+alias Location = ]b4_location_type[;
+alias Position = ]b4_position_type[;]b4_push_if([[
+alias PUSH_MORE = ]b4_parser_class[.YYPUSH_MORE;
+alias ABORT = ]b4_parser_class[.YYABORT;
+alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[
+]])
+
+
+# b4_basic_symbol_constructor_define
+# ----------------------------------
+# Create Symbol struct constructors for all the visible types.
+m4_define([b4_basic_symbol_constructor_define],
+[b4_token_visible_if([$1],
+[[    this(TokenKind token]b4_symbol_if([$1], [has_type],
+[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl
+[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[)
+    {
+      kind = yytranslate_(token);]b4_union_if([b4_symbol_if([$1], [has_type], [[
+      static foreach (member; __traits(allMembers, YYSemanticType))
+      {
+        static if (is(typeof(mixin("value_." ~ member)) == ]b4_symbol([$1], [type])[))
+        {
+          mixin("value_." ~ member ~ " = val;");
+        }
+      }]])], [b4_symbol_if([$1], [has_type], [[
+      value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([
+      location_ = loc;])[
+    }
+]])])
+
+
+# b4_symbol_type_define
+# ---------------------
+# Define symbol_type, the external type for symbols used for symbol
+# constructors.
+m4_define([b4_symbol_type_define],
+[[
+  /**
+    * A complete symbol
+    */
+  struct Symbol
+  {
+    private SymbolKind kind;
+    private Value value_;]b4_locations_if([[
+    private Location location_;]])[
+
+]b4_type_foreach([b4_basic_symbol_constructor_define])[
+    SymbolKind token() { return kind; }
+    Value value() { return value_; }]b4_locations_if([[
+    Location location() { return location_; }]])[
+]b4_token_ctor_if([b4_token_constructor_define])[
+  }
+]])

+ 2763 - 0
Engine/bin/bison-flex/data/skeletons/glr.c

@@ -0,0 +1,2763 @@
+#                                                             -*- C -*-
+
+# GLR skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+# If we are loaded by glr.cc, do not override c++.m4 definitions by
+# those of c.m4.
+m4_if(b4_skeleton, ["glr.c"],
+      [m4_include(b4_skeletonsdir/[c.m4])])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# Stack parameters.
+m4_define_default([b4_stack_depth_max], [10000])
+m4_define_default([b4_stack_depth_init],  [200])
+
+# Included header.
+b4_percent_define_default([[api.header.include]],
+                          [["@basename(]b4_spec_header_file[@)"]])
+
+## ------------------------ ##
+## Pure/impure interfaces.  ##
+## ------------------------ ##
+
+b4_define_flag_if([pure])
+# If glr.cc is including this file and thus has already set b4_pure_flag,
+# do not change the value of b4_pure_flag, and do not record a use of api.pure.
+m4_ifndef([b4_pure_flag],
+[b4_percent_define_default([[api.pure]], [[false]])
+ m4_define([b4_pure_flag],
+           [b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])])
+
+# b4_yyerror_args
+# ---------------
+# Optional effective arguments passed to yyerror: user args plus yylloc, and
+# a trailing comma.
+m4_define([b4_yyerror_args],
+[b4_pure_if([b4_locations_if([yylocp, ])])dnl
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
+
+
+# b4_lyyerror_args
+# ----------------
+# Same as above, but on the lookahead, hence &yylloc instead of yylocp.
+m4_define([b4_lyyerror_args],
+[b4_pure_if([b4_locations_if([&yylloc, ])])dnl
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
+
+
+# b4_pure_args
+# ------------
+# Same as b4_yyerror_args, but with a leading comma.
+m4_define([b4_pure_args],
+[b4_pure_if([b4_locations_if([, yylocp])])[]b4_user_args])
+
+
+# b4_lpure_args
+# -------------
+# Same as above, but on the lookahead, hence &yylloc instead of yylocp.
+m4_define([b4_lpure_args],
+[b4_pure_if([b4_locations_if([, &yylloc])])[]b4_user_args])
+
+
+
+# b4_pure_formals
+# ---------------
+# Arguments passed to yyerror: user formals plus yylocp with leading comma.
+m4_define([b4_pure_formals],
+[b4_pure_if([b4_locations_if([, YYLTYPE *yylocp])])[]b4_user_formals])
+
+
+# b4_locuser_formals(LOC = yylocp)
+# --------------------------------
+# User formal arguments, possibly preceded by location argument.
+m4_define([b4_locuser_formals],
+[b4_locations_if([, YYLTYPE *m4_default([$1], [yylocp])])[]b4_user_formals])
+
+
+# b4_locuser_args(LOC = yylocp)
+# -----------------------------
+m4_define([b4_locuser_args],
+[b4_locations_if([, m4_default([$1], [yylocp])])[]b4_user_args])
+
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_lhs_value(SYMBOL-NUM, [TYPE])
+# --------------------------------
+# See README.
+m4_define([b4_lhs_value],
+[b4_symbol_value([(*yyvalp)], [$1], [$2])])
+
+
+# b4_rhs_data(RULE-LENGTH, POS)
+# -----------------------------
+# See README.
+m4_define([b4_rhs_data],
+[YY_CAST (yyGLRStackItem const *, yyvsp)@{YYFILL (b4_subtract([$2], [$1]))@}.yystate])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
+# --------------------------------------------------
+# Expansion of $$ or $<TYPE>$, for symbol SYMBOL-NUM.
+m4_define([b4_rhs_value],
+[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yyval], [$3], [$4])])
+
+
+
+## ----------- ##
+## Locations.  ##
+## ----------- ##
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(*yylocp)])
+
+
+# b4_rhs_location(RULE-LENGTH, NUM)
+# ---------------------------------
+# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[(b4_rhs_data([$1], [$2]).yyloc)])
+
+
+# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
+# ---------------------------------------------------
+m4_define([b4_call_merger],
+[b4_case([$1],
+         [    b4_symbol_if([$3], [has_type],
+                           [yy0->b4_symbol($3, slot) = $2 (*yy0, *yy1);],
+                           [*yy0 = $2 (*yy0, *yy1);])])])
+
+
+## -------------- ##
+## Declarations.  ##
+## -------------- ##
+
+# b4_shared_declarations
+# ----------------------
+# Declaration that might either go into the header (if --header)
+# or open coded in the parser body.  glr.cc has its own definition.
+m4_if(b4_skeleton, ["glr.c"],
+[m4_define([b4_shared_declarations],
+[b4_declare_yydebug[
+]b4_percent_code_get([[requires]])[
+]b4_token_enums[
+]b4_declare_yylstype[
+int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
+]b4_percent_code_get([[provides]])[]dnl
+])
+])
+
+## -------------- ##
+## Output files.  ##
+## -------------- ##
+
+# Unfortunately the order of generation between the header and the
+# implementation file matters (for glr.c) because of the current
+# implementation of api.value.type=union.  In that case we still use a
+# union for YYSTYPE, but we generate the contents of this union when
+# setting up YYSTYPE.  This is needed for other aspects, such as
+# defining yy_symbol_value_print, since we need to now the name of the
+# members of this union.
+#
+# To avoid this issue, just generate the header before the
+# implementation file.  But we should also make them more independent.
+
+# ----------------- #
+# The header file.  #
+# ----------------- #
+
+# glr.cc produces its own header.
+b4_glr_cc_if([],
+[b4_header_if(
+[b4_output_begin([b4_spec_header_file])
+b4_copyright([Skeleton interface for Bison GLR parsers in C],
+             [2002-2015, 2018-2021])[
+]b4_cpp_guard_open([b4_spec_mapped_header_file])[
+]b4_shared_declarations[
+]b4_cpp_guard_close([b4_spec_mapped_header_file])[
+]b4_output_end[
+]])])
+
+
+# ------------------------- #
+# The implementation file.  #
+# ------------------------- #
+
+b4_output_begin([b4_parser_file_name])
+b4_copyright([Skeleton implementation for Bison GLR parsers in C],
+             [2002-2015, 2018-2021])[
+/* C GLR parser skeleton written by Paul Hilfinger.  */
+
+]b4_disclaimer[
+]b4_identification[
+
+]b4_percent_code_get([[top]])[
+]m4_if(b4_api_prefix, [yy], [],
+[[/* Substitute the type names.  */
+#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
+#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
+]m4_if(b4_prefix, [yy], [],
+[[/* Substitute the variable and function names.  */
+#define ]b4_glr_cc_if([yy_parse_impl], [yyparse])[ ]b4_prefix[]b4_glr_cc_if([_parse_impl], [parse])[
+#define yylex   ]b4_prefix[lex
+#define yyerror ]b4_prefix[error
+#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
+#define yylval  ]b4_prefix[lval
+#define yychar  ]b4_prefix[char
+#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
+#define yylloc  ]b4_prefix[lloc]])]))[
+
+]b4_user_pre_prologue[
+]b4_cast_define[
+]b4_null_define[
+
+]b4_header_if([[#include ]b4_percent_define_get([[api.header.include]])],
+              [b4_shared_declarations])[
+
+]b4_glr_cc_if([b4_glr_cc_setup],
+              [b4_declare_symbol_enum])[
+
+/* Default (constant) value used for initialization for null
+   right-hand sides.  Unlike the standard yacc.c template, here we set
+   the default value of $$ to a zeroed-out value.  Since the default
+   value is undefined, this behavior is technically correct.  */
+static YYSTYPE yyval_default;]b4_locations_if([[
+static YYLTYPE yyloc_default][]b4_yyloc_default;])[
+
+]b4_user_post_prologue[
+]b4_percent_code_get[]dnl
+
+[#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+]b4_c99_int_type_define[
+]b4_sizes_types_define[
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+]b4_has_translations_if([
+#ifndef N_
+# define N_(Msgid) Msgid
+#endif
+])[
+
+#ifndef YYFREE
+# define YYFREE free
+#endif
+#ifndef YYMALLOC
+# define YYMALLOC malloc
+#endif
+#ifndef YYREALLOC
+# define YYREALLOC realloc
+#endif
+
+#ifdef __cplusplus
+  typedef bool yybool;
+# define yytrue true
+# define yyfalse false
+#else
+  /* When we move to stdbool, get rid of the various casts to yybool.  */
+  typedef signed char yybool;
+# define yytrue 1
+# define yyfalse 0
+#endif
+
+#ifndef YYSETJMP
+# include <setjmp.h>
+# define YYJMP_BUF jmp_buf
+# define YYSETJMP(Env) setjmp (Env)
+/* Pacify Clang and ICC.  */
+# define YYLONGJMP(Env, Val)                    \
+ do {                                           \
+   longjmp (Env, Val);                          \
+   YY_ASSERT (0);                               \
+ } while (yyfalse)
+#endif
+
+]b4_attribute_define([noreturn])[
+
+]b4_parse_assert_if([[#ifdef NDEBUG
+# define YY_ASSERT(E) ((void) (0 && (E)))
+#else
+# include <assert.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_ASSERT(E) assert (E)
+#endif
+]],
+[[#define YY_ASSERT(E) ((void) (0 && (E)))]])[
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  ]b4_final_state_number[
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   ]b4_last[
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  ]b4_tokens_number[
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  ]b4_nterms_number[
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  ]b4_rules_number[
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  ]b4_states_number[
+/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule.  */
+#define YYMAXRHS ]b4_r2_max[
+/* YYMAXLEFT -- Maximum number of symbols to the left of a handle
+   accessed by $0, $-1, etc., in any rule.  */
+#define YYMAXLEFT ]b4_max_left_semantic_context[
+
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   ]b4_code_max[
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+]b4_api_token_raw_if(dnl
+[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]],
+[[#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : ]b4_symbol_prefix[YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex.  */
+static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
+{
+  ]b4_translate[
+};]])[
+
+#if ]b4_api_PREFIX[DEBUG
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const ]b4_int_type_for([b4_rline])[ yyrline[] =
+{
+  ]b4_rline[
+};
+#endif
+
+#define YYPACT_NINF (]b4_pact_ninf[)
+#define YYTABLE_NINF (]b4_table_ninf[)
+
+]b4_parser_tables_define[
+
+/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none).  */
+static const ]b4_int_type_for([b4_dprec])[ yydprec[] =
+{
+  ]b4_dprec[
+};
+
+/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM.  */
+static const ]b4_int_type_for([b4_merger])[ yymerger[] =
+{
+  ]b4_merger[
+};
+
+/* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as
+   in the case of predicates.  */
+static const yybool yyimmediate[] =
+{
+  ]b4_immediate[
+};
+
+/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
+   list of conflicting reductions corresponding to action entry for
+   state STATE-NUM in yytable.  0 means no conflicts.  The list in
+   yyconfl is terminated by a rule number of 0.  */
+static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
+{
+  ]b4_conflict_list_heads[
+};
+
+/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
+   0, pointed into by YYCONFLP.  */
+]dnl Do not use b4_int_type_for here, since there are places where
+dnl pointers onto yyconfl are taken, whose type is "short*".
+dnl We probably ought to introduce a type for confl.
+[static const short yyconfl[] =
+{
+  ]b4_conflicting_rules[
+};
+
+]b4_locations_if([[
+]b4_yylloc_default_define[
+# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
+]])[
+
+]b4_pure_if(
+[
+#undef yynerrs
+#define yynerrs (yystackp->yyerrcnt)
+#undef yychar
+#define yychar (yystackp->yyrawchar)
+#undef yylval
+#define yylval (yystackp->yyval)
+#undef yylloc
+#define yylloc (yystackp->yyloc)
+m4_if(b4_prefix[], [yy], [],
+[#define b4_prefix[]nerrs yynerrs
+#define b4_prefix[]char yychar
+#define b4_prefix[]lval yylval
+#define b4_prefix[]lloc yylloc])],
+[YYSTYPE yylval;]b4_locations_if([[
+YYLTYPE yylloc;]])[
+
+int yynerrs;
+int yychar;])[
+
+enum { YYENOMEM = -2 };
+
+typedef enum { yyok, yyaccept, yyabort, yyerr, yynomem } YYRESULTTAG;
+
+#define YYCHK(YYE)                              \
+  do {                                          \
+    YYRESULTTAG yychk_flag = YYE;               \
+    if (yychk_flag != yyok)                     \
+      return yychk_flag;                        \
+  } while (0)
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH ]b4_stack_depth_init[
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH ]b4_stack_depth_max[
+#endif
+
+/* Minimum number of free items on the stack allowed after an
+   allocation.  This is to allow allocation and initialization
+   to be completed by functions that call yyexpandGLRStack before the
+   stack is expanded, thus insuring that all necessary pointers get
+   properly redirected to new data.  */
+#define YYHEADROOM 2
+
+#ifndef YYSTACKEXPANDABLE
+#  define YYSTACKEXPANDABLE 1
+#endif
+
+#if YYSTACKEXPANDABLE
+# define YY_RESERVE_GLRSTACK(Yystack)                   \
+  do {                                                  \
+    if (Yystack->yyspaceLeft < YYHEADROOM)              \
+      yyexpandGLRStack (Yystack);                       \
+  } while (0)
+#else
+# define YY_RESERVE_GLRSTACK(Yystack)                   \
+  do {                                                  \
+    if (Yystack->yyspaceLeft < YYHEADROOM)              \
+      yyMemoryExhausted (Yystack);                      \
+  } while (0)
+#endif
+
+/** State numbers. */
+typedef int yy_state_t;
+
+/** Rule numbers. */
+typedef int yyRuleNum;
+
+/** Item references. */
+typedef short yyItemNum;
+
+typedef struct yyGLRState yyGLRState;
+typedef struct yyGLRStateSet yyGLRStateSet;
+typedef struct yySemanticOption yySemanticOption;
+typedef union yyGLRStackItem yyGLRStackItem;
+typedef struct yyGLRStack yyGLRStack;
+
+struct yyGLRState
+{
+  /** Type tag: always true.  */
+  yybool yyisState;
+  /** Type tag for yysemantics.  If true, yyval applies, otherwise
+   *  yyfirstVal applies.  */
+  yybool yyresolved;
+  /** Number of corresponding LALR(1) machine state.  */
+  yy_state_t yylrState;
+  /** Preceding state in this stack */
+  yyGLRState* yypred;
+  /** Source position of the last token produced by my symbol */
+  YYPTRDIFF_T yyposn;
+  union {
+    /** First in a chain of alternative reductions producing the
+     *  nonterminal corresponding to this state, threaded through
+     *  yynext.  */
+    yySemanticOption* yyfirstVal;
+    /** Semantic value for this state.  */
+    YYSTYPE yyval;
+  } yysemantics;]b4_locations_if([[
+  /** Source location for this state.  */
+  YYLTYPE yyloc;]])[
+};
+
+struct yyGLRStateSet
+{
+  yyGLRState** yystates;
+  /** During nondeterministic operation, yylookaheadNeeds tracks which
+   *  stacks have actually needed the current lookahead.  During deterministic
+   *  operation, yylookaheadNeeds[0] is not maintained since it would merely
+   *  duplicate yychar != ]b4_symbol(empty, id)[.  */
+  yybool* yylookaheadNeeds;
+  YYPTRDIFF_T yysize;
+  YYPTRDIFF_T yycapacity;
+};
+
+struct yySemanticOption
+{
+  /** Type tag: always false.  */
+  yybool yyisState;
+  /** Rule number for this reduction */
+  yyRuleNum yyrule;
+  /** The last RHS state in the list of states to be reduced.  */
+  yyGLRState* yystate;
+  /** The lookahead for this reduction.  */
+  int yyrawchar;
+  YYSTYPE yyval;]b4_locations_if([[
+  YYLTYPE yyloc;]])[
+  /** Next sibling in chain of options.  To facilitate merging,
+   *  options are chained in decreasing order by address.  */
+  yySemanticOption* yynext;
+};
+
+/** Type of the items in the GLR stack.  The yyisState field
+ *  indicates which item of the union is valid.  */
+union yyGLRStackItem {
+  yyGLRState yystate;
+  yySemanticOption yyoption;
+};
+
+struct yyGLRStack {
+  int yyerrState;
+]b4_locations_if([[  /* To compute the location of the error token.  */
+  yyGLRStackItem yyerror_range[3];]])[
+]b4_pure_if(
+[
+  int yyerrcnt;
+  int yyrawchar;
+  YYSTYPE yyval;]b4_locations_if([[
+  YYLTYPE yyloc;]])[
+])[
+  YYJMP_BUF yyexception_buffer;
+  yyGLRStackItem* yyitems;
+  yyGLRStackItem* yynextFree;
+  YYPTRDIFF_T yyspaceLeft;
+  yyGLRState* yysplitPoint;
+  yyGLRState* yylastDeleted;
+  yyGLRStateSet yytops;
+};
+
+#if YYSTACKEXPANDABLE
+static void yyexpandGLRStack (yyGLRStack* yystackp);
+#endif
+
+_Noreturn static void
+yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
+{
+  if (yymsg != YY_NULLPTR)
+    yyerror (]b4_yyerror_args[yymsg);
+  YYLONGJMP (yystackp->yyexception_buffer, 1);
+}
+
+_Noreturn static void
+yyMemoryExhausted (yyGLRStack* yystackp)
+{
+  YYLONGJMP (yystackp->yyexception_buffer, 2);
+}
+
+/** Accessing symbol of state YYSTATE.  */
+static inline yysymbol_kind_t
+yy_accessing_symbol (yy_state_t yystate)
+{
+  return YY_CAST (yysymbol_kind_t, yystos[yystate]);
+}
+
+#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag], [[1]])[
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
+]b4_parse_error_bmatch([simple\|verbose],
+[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  ]b4_tname[
+};
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}]],
+[[static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  static const char *const yy_sname[] =
+  {
+  ]b4_symbol_names[
+  };]b4_has_translations_if([[
+  /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
+     internationalizable.  */
+  static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
+  {
+  ]b4_translatable[
+  };
+  return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
+          ? _(yy_sname[yysymbol])
+          : yy_sname[yysymbol]);]], [[
+  return yy_sname[yysymbol];]])[
+}]])[
+#endif
+
+/** Left-hand-side symbol for rule #YYRULE.  */
+static inline yysymbol_kind_t
+yylhsNonterm (yyRuleNum yyrule)
+{
+  return YY_CAST (yysymbol_kind_t, yyr1[yyrule]);
+}
+
+#if ]b4_api_PREFIX[DEBUG
+
+# ifndef YYFPRINTF
+#  define YYFPRINTF fprintf
+# endif
+
+# define YY_FPRINTF                             \
+  YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
+
+# define YY_FPRINTF_(Args)                      \
+  do {                                          \
+    YYFPRINTF Args;                             \
+    YY_IGNORE_USELESS_CAST_END                  \
+  } while (0)
+
+# define YY_DPRINTF                             \
+  YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
+
+# define YY_DPRINTF_(Args)                      \
+  do {                                          \
+    if (yydebug)                                \
+      YYFPRINTF Args;                           \
+    YY_IGNORE_USELESS_CAST_END                  \
+  } while (0)
+
+]b4_yylocation_print_define[
+
+]b4_yy_symbol_print_define[
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                  \
+  do {                                                                  \
+    if (yydebug)                                                        \
+      {                                                                 \
+        YY_FPRINTF ((stderr, "%s ", Title));                            \
+        yy_symbol_print (stderr, Kind, Value]b4_locuser_args([Location])[);        \
+        YY_FPRINTF ((stderr, "\n"));                                    \
+      }                                                                 \
+  } while (0)
+
+static inline void
+yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
+                 yyRuleNum yyrule]b4_user_formals[);
+
+# define YY_REDUCE_PRINT(Args)          \
+  do {                                  \
+    if (yydebug)                        \
+      yy_reduce_print Args;             \
+  } while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+
+static void yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
+  YY_ATTRIBUTE_UNUSED;
+static void yypdumpstack (yyGLRStack* yystackp)
+  YY_ATTRIBUTE_UNUSED;
+
+#else /* !]b4_api_PREFIX[DEBUG */
+
+# define YY_DPRINTF(Args) do {} while (yyfalse)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
+# define YY_REDUCE_PRINT(Args)
+
+#endif /* !]b4_api_PREFIX[DEBUG */
+
+]b4_parse_error_case(
+         [simple],
+[[]],
+[[#ifndef yystrlen
+# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
+#endif
+
+]b4_parse_error_bmatch(
+           [detailed\|verbose],
+[[#ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#  define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+# endif
+#endif]])[
+
+]b4_parse_error_case(
+         [verbose],
+[[#ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYPTRDIFF_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYPTRDIFF_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            else
+              goto append;
+
+          append:
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
+    do_not_strip_quotes: ;
+    }
+
+  if (yyres)
+    return yystpcpy (yyres, yystr) - yyres;
+  else
+    return yystrlen (yystr);
+}
+#endif
+]])])[
+
+/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
+ *  at YYVSP[YYLOW0].yystate.yypred.  Leaves YYVSP[YYLOW1].yystate.yypred
+ *  containing the pointer to the next state in the chain.  */
+static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
+static void
+yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
+{
+  int i;
+  yyGLRState *s = yyvsp[yylow0].yystate.yypred;
+  for (i = yylow0-1; i >= yylow1; i -= 1)
+    {
+#if ]b4_api_PREFIX[DEBUG
+      yyvsp[i].yystate.yylrState = s->yylrState;
+#endif
+      yyvsp[i].yystate.yyresolved = s->yyresolved;
+      if (s->yyresolved)
+        yyvsp[i].yystate.yysemantics.yyval = s->yysemantics.yyval;
+      else
+        /* The effect of using yyval or yyloc (in an immediate rule) is
+         * undefined.  */
+        yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
+      yyvsp[i].yystate.yyloc = s->yyloc;]])[
+      s = yyvsp[i].yystate.yypred = s->yypred;
+    }
+}
+
+]m4_define([b4_yygetToken_call],
+           [[yygetToken (&yychar][]b4_pure_if([, yystackp])[]b4_user_args[)]])[
+/** If yychar is empty, fetch the next token.  */
+static inline yysymbol_kind_t
+yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals[)
+{
+  yysymbol_kind_t yytoken;
+]b4_parse_param_use()dnl
+[  if (*yycharp == ]b4_symbol(empty, id)[)
+    {
+      YY_DPRINTF ((stderr, "Reading a token\n"));]b4_glr_cc_if([[
+#if YY_EXCEPTIONS
+      try
+        {
+#endif // YY_EXCEPTIONS
+          *yycharp = ]b4_yylex[;
+#if YY_EXCEPTIONS
+        }
+      catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
+        {
+          YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
+          yylloc = yyexc.location;])[
+          yyerror (]b4_lyyerror_args[yyexc.what ());
+          // Map errors caught in the scanner to the undefined token,
+          // so that error handling is started.  However, record this
+          // with this special value of yychar.
+          *yycharp = ]b4_symbol(error, id)[;
+        }
+#endif // YY_EXCEPTIONS]], [[
+      *yycharp = ]b4_yylex[;]])[
+    }
+  if (*yycharp <= ]b4_symbol(eof, [id])[)
+    {
+      *yycharp = ]b4_symbol(eof, [id])[;
+      yytoken = ]b4_symbol_prefix[YYEOF;
+      YY_DPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (*yycharp);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+  return yytoken;
+}
+
+/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1.  Otherwise, fill in
+ * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
+ * For convenience, always return YYLOW1.  */
+static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
+     YY_ATTRIBUTE_UNUSED;
+static inline int
+yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
+{
+  if (!yynormal && yylow1 < *yylow)
+    {
+      yyfillin (yyvsp, *yylow, yylow1);
+      *yylow = yylow1;
+    }
+  return yylow1;
+}
+
+/** Perform user action for rule number YYN, with RHS length YYRHSLEN,
+ *  and top stack item YYVSP.  YYLVALP points to place to put semantic
+ *  value ($$), and yylocp points to place for location information
+ *  (@@$).  Returns yyok for normal return, yyaccept for YYACCEPT,
+ *  yyerr for YYERROR, yyabort for YYABORT, yynomem for YYNOMEM.  */
+static YYRESULTTAG
+yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp,
+              yyGLRStack* yystackp, YYPTRDIFF_T yyk,
+              YYSTYPE* yyvalp]b4_locuser_formals[)
+{
+  const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
+  int yylow = 1;
+]b4_parse_param_use([yyvalp], [yylocp])dnl
+[  YY_USE (yyk);
+  YY_USE (yyrhslen);
+# undef yyerrok
+# define yyerrok (yystackp->yyerrState = 0)
+# undef YYACCEPT
+# define YYACCEPT return yyaccept
+# undef YYABORT
+# define YYABORT return yyabort
+# undef YYNOMEM
+# define YYNOMEM return yynomem
+# undef YYERROR
+# define YYERROR return yyerrok, yyerr
+# undef YYRECOVERING
+# define YYRECOVERING() (yystackp->yyerrState != 0)
+# undef yyclearin
+# define yyclearin (yychar = ]b4_symbol(empty, id)[)
+# undef YYFILL
+# define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal)
+# undef YYBACKUP
+# define YYBACKUP(Token, Value)                                              \
+  return yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")),     \
+         yyerrok, yyerr
+
+  if (yyrhslen == 0)
+    *yyvalp = yyval_default;
+  else
+    *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yyval;]b4_locations_if([[
+  /* Default location. */
+  YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
+  yystackp->yyerror_range[1].yystate.yyloc = *yylocp;]])[
+  /* If yyk == -1, we are running a deferred action on a temporary
+     stack.  In that case, YY_REDUCE_PRINT must not play with YYFILL,
+     so pretend the stack is "normal". */
+  YY_REDUCE_PRINT ((yynormal || yyk == -1, yyvsp, yyk, yyrule]b4_user_args[));]b4_glr_cc_if([[
+#if YY_EXCEPTIONS
+  typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error;
+  try
+  {
+#endif // YY_EXCEPTIONS]])[
+  switch (yyrule)
+    {
+]b4_user_actions[
+      default: break;
+    }]b4_glr_cc_if([[
+#if YY_EXCEPTIONS
+  }
+  catch (const syntax_error& yyexc)
+    {
+      YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
+      *yylocp = yyexc.location;])[
+      yyerror (]b4_yyerror_args[yyexc.what ());
+      YYERROR;
+    }
+#endif // YY_EXCEPTIONS]])[
+  YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), yyvalp, yylocp);
+
+  return yyok;
+# undef yyerrok
+# undef YYABORT
+# undef YYACCEPT
+# undef YYNOMEM
+# undef YYERROR
+# undef YYBACKUP
+# undef yyclearin
+# undef YYRECOVERING
+}
+
+
+static void
+yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
+{
+  YY_USE (yy0);
+  YY_USE (yy1);
+
+  switch (yyn)
+    {
+]b4_mergers[
+      default: break;
+    }
+}
+
+                              /* Bison grammar-table manipulation.  */
+
+]b4_yydestruct_define[
+
+/** Number of symbols composing the right hand side of rule #RULE.  */
+static inline int
+yyrhsLength (yyRuleNum yyrule)
+{
+  return yyr2[yyrule];
+}
+
+static void
+yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
+{
+  if (yys->yyresolved)
+    yydestruct (yymsg, yy_accessing_symbol (yys->yylrState),
+                &yys->yysemantics.yyval]b4_locuser_args([&yys->yyloc])[);
+  else
+    {
+#if ]b4_api_PREFIX[DEBUG
+      if (yydebug)
+        {
+          if (yys->yysemantics.yyfirstVal)
+            YY_FPRINTF ((stderr, "%s unresolved", yymsg));
+          else
+            YY_FPRINTF ((stderr, "%s incomplete", yymsg));
+          YY_SYMBOL_PRINT ("", yy_accessing_symbol (yys->yylrState), YY_NULLPTR, &yys->yyloc);
+        }
+#endif
+
+      if (yys->yysemantics.yyfirstVal)
+        {
+          yySemanticOption *yyoption = yys->yysemantics.yyfirstVal;
+          yyGLRState *yyrh;
+          int yyn;
+          for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule);
+               yyn > 0;
+               yyrh = yyrh->yypred, yyn -= 1)
+            yydestroyGLRState (yymsg, yyrh]b4_user_args[);
+        }
+    }
+}
+
+#define yypact_value_is_default(Yyn) \
+  ]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
+
+/** True iff LR state YYSTATE has only a default reduction (regardless
+ *  of token).  */
+static inline yybool
+yyisDefaultedState (yy_state_t yystate)
+{
+  return yypact_value_is_default (yypact[yystate]);
+}
+
+/** The default reduction for YYSTATE, assuming it has one.  */
+static inline yyRuleNum
+yydefaultAction (yy_state_t yystate)
+{
+  return yydefact[yystate];
+}
+
+#define yytable_value_is_error(Yyn) \
+  ]b4_table_value_equals([[table]], [[Yyn]], [b4_table_ninf], [YYTABLE_NINF])[
+
+/** The action to take in YYSTATE on seeing YYTOKEN.
+ *  Result R means
+ *    R < 0:  Reduce on rule -R.
+ *    R = 0:  Error.
+ *    R > 0:  Shift to state R.
+ *  Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
+ *  of conflicting reductions.
+ */
+static inline int
+yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short** yyconflicts)
+{
+  int yyindex = yypact[yystate] + yytoken;
+  if (yytoken == ]b4_symbol(error, kind)[)
+    {
+      // This is the error token.
+      *yyconflicts = yyconfl;
+      return 0;
+    }
+  else if (yyisDefaultedState (yystate)
+           || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
+    {
+      *yyconflicts = yyconfl;
+      return -yydefact[yystate];
+    }
+  else if (! yytable_value_is_error (yytable[yyindex]))
+    {
+      *yyconflicts = yyconfl + yyconflp[yyindex];
+      return yytable[yyindex];
+    }
+  else
+    {
+      *yyconflicts = yyconfl + yyconflp[yyindex];
+      return 0;
+    }
+}
+
+/** Compute post-reduction state.
+ * \param yystate   the current state
+ * \param yysym     the nonterminal to push on the stack
+ */
+static inline yy_state_t
+yyLRgotoState (yy_state_t yystate, yysymbol_kind_t yysym)
+{
+  int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
+  if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
+    return yytable[yyr];
+  else
+    return yydefgoto[yysym - YYNTOKENS];
+}
+
+static inline yybool
+yyisShiftAction (int yyaction)
+{
+  return 0 < yyaction;
+}
+
+static inline yybool
+yyisErrorAction (int yyaction)
+{
+  return yyaction == 0;
+}
+
+                                /* GLRStates */
+
+/** Return a fresh GLRStackItem in YYSTACKP.  The item is an LR state
+ *  if YYISSTATE, and otherwise a semantic option.  Callers should call
+ *  YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient
+ *  headroom.  */
+
+static inline yyGLRStackItem*
+yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState)
+{
+  yyGLRStackItem* yynewItem = yystackp->yynextFree;
+  yystackp->yyspaceLeft -= 1;
+  yystackp->yynextFree += 1;
+  yynewItem->yystate.yyisState = yyisState;
+  return yynewItem;
+}
+
+/** Add a new semantic action that will execute the action for rule
+ *  YYRULE on the semantic values in YYRHS to the list of
+ *  alternative actions for YYSTATE.  Assumes that YYRHS comes from
+ *  stack #YYK of *YYSTACKP. */
+static void
+yyaddDeferredAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyGLRState* yystate,
+                     yyGLRState* yyrhs, yyRuleNum yyrule)
+{
+  yySemanticOption* yynewOption =
+    &yynewGLRStackItem (yystackp, yyfalse)->yyoption;
+  YY_ASSERT (!yynewOption->yyisState);
+  yynewOption->yystate = yyrhs;
+  yynewOption->yyrule = yyrule;
+  if (yystackp->yytops.yylookaheadNeeds[yyk])
+    {
+      yynewOption->yyrawchar = yychar;
+      yynewOption->yyval = yylval;]b4_locations_if([
+      yynewOption->yyloc = yylloc;])[
+    }
+  else
+    yynewOption->yyrawchar = ]b4_symbol(empty, id)[;
+  yynewOption->yynext = yystate->yysemantics.yyfirstVal;
+  yystate->yysemantics.yyfirstVal = yynewOption;
+
+  YY_RESERVE_GLRSTACK (yystackp);
+}
+
+                                /* GLRStacks */
+
+/** Initialize YYSET to a singleton set containing an empty stack.  */
+static yybool
+yyinitStateSet (yyGLRStateSet* yyset)
+{
+  yyset->yysize = 1;
+  yyset->yycapacity = 16;
+  yyset->yystates
+    = YY_CAST (yyGLRState**,
+               YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
+                         * sizeof yyset->yystates[0]));
+  if (! yyset->yystates)
+    return yyfalse;
+  yyset->yystates[0] = YY_NULLPTR;
+  yyset->yylookaheadNeeds
+    = YY_CAST (yybool*,
+               YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
+                         * sizeof yyset->yylookaheadNeeds[0]));
+  if (! yyset->yylookaheadNeeds)
+    {
+      YYFREE (yyset->yystates);
+      return yyfalse;
+    }
+  memset (yyset->yylookaheadNeeds,
+          0,
+          YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]);
+  return yytrue;
+}
+
+static void yyfreeStateSet (yyGLRStateSet* yyset)
+{
+  YYFREE (yyset->yystates);
+  YYFREE (yyset->yylookaheadNeeds);
+}
+
+/** Initialize *YYSTACKP to a single empty stack, with total maximum
+ *  capacity for all stacks of YYSIZE.  */
+static yybool
+yyinitGLRStack (yyGLRStack* yystackp, YYPTRDIFF_T yysize)
+{
+  yystackp->yyerrState = 0;
+  yynerrs = 0;
+  yystackp->yyspaceLeft = yysize;
+  yystackp->yyitems
+    = YY_CAST (yyGLRStackItem*,
+               YYMALLOC (YY_CAST (YYSIZE_T, yysize)
+                         * sizeof yystackp->yynextFree[0]));
+  if (!yystackp->yyitems)
+    return yyfalse;
+  yystackp->yynextFree = yystackp->yyitems;
+  yystackp->yysplitPoint = YY_NULLPTR;
+  yystackp->yylastDeleted = YY_NULLPTR;
+  return yyinitStateSet (&yystackp->yytops);
+}
+
+
+#if YYSTACKEXPANDABLE
+# define YYRELOC(YYFROMITEMS, YYTOITEMS, YYX, YYTYPE)                   \
+  &((YYTOITEMS)                                                         \
+    - ((YYFROMITEMS) - YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX))))->YYTYPE
+
+/** If *YYSTACKP is expandable, extend it.  WARNING: Pointers into the
+    stack from outside should be considered invalid after this call.
+    We always expand when there are 1 or fewer items left AFTER an
+    allocation, so that we can avoid having external pointers exist
+    across an allocation.  */
+static void
+yyexpandGLRStack (yyGLRStack* yystackp)
+{
+  yyGLRStackItem* yynewItems;
+  yyGLRStackItem* yyp0, *yyp1;
+  YYPTRDIFF_T yynewSize;
+  YYPTRDIFF_T yyn;
+  YYPTRDIFF_T yysize = yystackp->yynextFree - yystackp->yyitems;
+  if (YYMAXDEPTH - YYHEADROOM < yysize)
+    yyMemoryExhausted (yystackp);
+  yynewSize = 2*yysize;
+  if (YYMAXDEPTH < yynewSize)
+    yynewSize = YYMAXDEPTH;
+  yynewItems
+    = YY_CAST (yyGLRStackItem*,
+               YYMALLOC (YY_CAST (YYSIZE_T, yynewSize)
+                         * sizeof yynewItems[0]));
+  if (! yynewItems)
+    yyMemoryExhausted (yystackp);
+  for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize;
+       0 < yyn;
+       yyn -= 1, yyp0 += 1, yyp1 += 1)
+    {
+      *yyp1 = *yyp0;
+      if (*YY_REINTERPRET_CAST (yybool *, yyp0))
+        {
+          yyGLRState* yys0 = &yyp0->yystate;
+          yyGLRState* yys1 = &yyp1->yystate;
+          if (yys0->yypred != YY_NULLPTR)
+            yys1->yypred =
+              YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
+          if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
+            yys1->yysemantics.yyfirstVal =
+              YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
+        }
+      else
+        {
+          yySemanticOption* yyv0 = &yyp0->yyoption;
+          yySemanticOption* yyv1 = &yyp1->yyoption;
+          if (yyv0->yystate != YY_NULLPTR)
+            yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
+          if (yyv0->yynext != YY_NULLPTR)
+            yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
+        }
+    }
+  if (yystackp->yysplitPoint != YY_NULLPTR)
+    yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
+                                      yystackp->yysplitPoint, yystate);
+
+  for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
+    if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
+      yystackp->yytops.yystates[yyn] =
+        YYRELOC (yystackp->yyitems, yynewItems,
+                 yystackp->yytops.yystates[yyn], yystate);
+  YYFREE (yystackp->yyitems);
+  yystackp->yyitems = yynewItems;
+  yystackp->yynextFree = yynewItems + yysize;
+  yystackp->yyspaceLeft = yynewSize - yysize;
+}
+#endif
+
+static void
+yyfreeGLRStack (yyGLRStack* yystackp)
+{
+  YYFREE (yystackp->yyitems);
+  yyfreeStateSet (&yystackp->yytops);
+}
+
+/** Assuming that YYS is a GLRState somewhere on *YYSTACKP, update the
+ *  splitpoint of *YYSTACKP, if needed, so that it is at least as deep as
+ *  YYS.  */
+static inline void
+yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
+{
+  if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
+    yystackp->yysplitPoint = yys;
+}
+
+/** Invalidate stack #YYK in *YYSTACKP.  */
+static inline void
+yymarkStackDeleted (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
+{
+  if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
+    yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
+  yystackp->yytops.yystates[yyk] = YY_NULLPTR;
+}
+
+/** Undelete the last stack in *YYSTACKP that was marked as deleted.  Can
+    only be done once after a deletion, and only when all other stacks have
+    been deleted.  */
+static void
+yyundeleteLastStack (yyGLRStack* yystackp)
+{
+  if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
+    return;
+  yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
+  yystackp->yytops.yysize = 1;
+  YY_DPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
+  yystackp->yylastDeleted = YY_NULLPTR;
+}
+
+static inline void
+yyremoveDeletes (yyGLRStack* yystackp)
+{
+  YYPTRDIFF_T yyi, yyj;
+  yyi = yyj = 0;
+  while (yyj < yystackp->yytops.yysize)
+    {
+      if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
+        {
+          if (yyi == yyj)
+            YY_DPRINTF ((stderr, "Removing dead stacks.\n"));
+          yystackp->yytops.yysize -= 1;
+        }
+      else
+        {
+          yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi];
+          /* In the current implementation, it's unnecessary to copy
+             yystackp->yytops.yylookaheadNeeds[yyi] since, after
+             yyremoveDeletes returns, the parser immediately either enters
+             deterministic operation or shifts a token.  However, it doesn't
+             hurt, and the code might evolve to need it.  */
+          yystackp->yytops.yylookaheadNeeds[yyj] =
+            yystackp->yytops.yylookaheadNeeds[yyi];
+          if (yyj != yyi)
+            YY_DPRINTF ((stderr, "Rename stack %ld -> %ld.\n",
+                        YY_CAST (long, yyi), YY_CAST (long, yyj)));
+          yyj += 1;
+        }
+      yyi += 1;
+    }
+}
+
+/** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
+ * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
+ * value *YYVALP and source location *YYLOCP.  */
+static inline void
+yyglrShift (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
+            YYPTRDIFF_T yyposn,
+            YYSTYPE* yyvalp]b4_locations_if([, YYLTYPE* yylocp])[)
+{
+  yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
+
+  yynewState->yylrState = yylrState;
+  yynewState->yyposn = yyposn;
+  yynewState->yyresolved = yytrue;
+  yynewState->yypred = yystackp->yytops.yystates[yyk];
+  yynewState->yysemantics.yyval = *yyvalp;]b4_locations_if([
+  yynewState->yyloc = *yylocp;])[
+  yystackp->yytops.yystates[yyk] = yynewState;
+
+  YY_RESERVE_GLRSTACK (yystackp);
+}
+
+/** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR
+ *  state YYLRSTATE, at input position YYPOSN, with the (unresolved)
+ *  semantic value of YYRHS under the action for YYRULE.  */
+static inline void
+yyglrShiftDefer (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
+                 YYPTRDIFF_T yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
+{
+  yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
+  YY_ASSERT (yynewState->yyisState);
+
+  yynewState->yylrState = yylrState;
+  yynewState->yyposn = yyposn;
+  yynewState->yyresolved = yyfalse;
+  yynewState->yypred = yystackp->yytops.yystates[yyk];
+  yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
+  yystackp->yytops.yystates[yyk] = yynewState;
+
+  /* Invokes YY_RESERVE_GLRSTACK.  */
+  yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
+}
+
+#if ]b4_api_PREFIX[DEBUG
+
+/*----------------------------------------------------------------------.
+| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
+`----------------------------------------------------------------------*/
+
+static inline void
+yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
+                 yyRuleNum yyrule]b4_user_formals[)
+{
+  int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
+  int yylow = 1;])[
+  int yyi;
+  YY_FPRINTF ((stderr, "Reducing stack %ld by rule %d (line %d):\n",
+               YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
+  if (! yynormal)
+    yyfillin (yyvsp, 1, -yynrhs);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YY_FPRINTF ((stderr, "   $%d = ", yyi + 1));
+      yy_symbol_print (stderr,
+                       yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].yystate.yylrState),
+                       &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yyval]b4_locations_if([,
+                       &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
+                       b4_user_args[);
+      if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
+        YY_FPRINTF ((stderr, " (unresolved)"));
+      YY_FPRINTF ((stderr, "\n"));
+    }
+}
+#endif
+
+/** Pop the symbols consumed by reduction #YYRULE from the top of stack
+ *  #YYK of *YYSTACKP, and perform the appropriate semantic action on their
+ *  semantic values.  Assumes that all ambiguities in semantic values
+ *  have been previously resolved.  Set *YYVALP to the resulting value,
+ *  and *YYLOCP to the computed location (if any).  Return value is as
+ *  for userAction.  */
+static inline YYRESULTTAG
+yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
+            YYSTYPE* yyvalp]b4_locuser_formals[)
+{
+  int yynrhs = yyrhsLength (yyrule);
+
+  if (yystackp->yysplitPoint == YY_NULLPTR)
+    {
+      /* Standard special case: single stack.  */
+      yyGLRStackItem* yyrhs
+        = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yytops.yystates[yyk]);
+      YY_ASSERT (yyk == 0);
+      yystackp->yynextFree -= yynrhs;
+      yystackp->yyspaceLeft += yynrhs;
+      yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
+      return yyuserAction (yyrule, yynrhs, yyrhs, yystackp, yyk,
+                           yyvalp]b4_locuser_args[);
+    }
+  else
+    {
+      yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
+      yyGLRState* yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
+        = yystackp->yytops.yystates[yyk];
+      int yyi;]b4_locations_if([[
+      if (yynrhs == 0)
+        /* Set default location.  */
+        yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[
+      for (yyi = 0; yyi < yynrhs; yyi += 1)
+        {
+          yys = yys->yypred;
+          YY_ASSERT (yys);
+        }
+      yyupdateSplit (yystackp, yys);
+      yystackp->yytops.yystates[yyk] = yys;
+      return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
+                           yystackp, yyk, yyvalp]b4_locuser_args[);
+    }
+}
+
+/** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE,
+ *  and push back on the resulting nonterminal symbol.  Perform the
+ *  semantic action associated with YYRULE and store its value with the
+ *  newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently
+ *  unambiguous.  Otherwise, store the deferred semantic action with
+ *  the new state.  If the new state would have an identical input
+ *  position, LR state, and predecessor to an existing state on the stack,
+ *  it is identified with that existing state, eliminating stack #YYK from
+ *  *YYSTACKP.  In this case, the semantic value is
+ *  added to the options for the existing state's semantic value.
+ */
+static inline YYRESULTTAG
+yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
+             yybool yyforceEval]b4_user_formals[)
+{
+  YYPTRDIFF_T yyposn = yystackp->yytops.yystates[yyk]->yyposn;
+
+  if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
+    {
+      YYSTYPE yyval;]b4_locations_if([[
+      YYLTYPE yyloc;]])[
+
+      YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yyval]b4_locuser_args([&yyloc])[);
+      if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
+        YY_DPRINTF ((stderr,
+                     "Parse on stack %ld rejected by rule %d (line %d).\n",
+                     YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
+      if (yyflag != yyok)
+        return yyflag;
+      yyglrShift (yystackp, yyk,
+                  yyLRgotoState (yystackp->yytops.yystates[yyk]->yylrState,
+                                 yylhsNonterm (yyrule)),
+                  yyposn, &yyval]b4_locations_if([, &yyloc])[);
+    }
+  else
+    {
+      YYPTRDIFF_T yyi;
+      int yyn;
+      yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk];
+      yy_state_t yynewLRState;
+
+      for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength (yyrule);
+           0 < yyn; yyn -= 1)
+        {
+          yys = yys->yypred;
+          YY_ASSERT (yys);
+        }
+      yyupdateSplit (yystackp, yys);
+      yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
+      YY_DPRINTF ((stderr,
+                   "Reduced stack %ld by rule %d (line %d); action deferred.  "
+                   "Now in state %d.\n",
+                   YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule],
+                   yynewLRState));
+      for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
+        if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
+          {
+            yyGLRState *yysplit = yystackp->yysplitPoint;
+            yyGLRState *yyp = yystackp->yytops.yystates[yyi];
+            while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
+              {
+                if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
+                  {
+                    yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
+                    yymarkStackDeleted (yystackp, yyk);
+                    YY_DPRINTF ((stderr, "Merging stack %ld into stack %ld.\n",
+                                 YY_CAST (long, yyk), YY_CAST (long, yyi)));
+                    return yyok;
+                  }
+                yyp = yyp->yypred;
+              }
+          }
+      yystackp->yytops.yystates[yyk] = yys;
+      yyglrShiftDefer (yystackp, yyk, yynewLRState, yyposn, yys0, yyrule);
+    }
+  return yyok;
+}
+
+static YYPTRDIFF_T
+yysplitStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
+{
+  if (yystackp->yysplitPoint == YY_NULLPTR)
+    {
+      YY_ASSERT (yyk == 0);
+      yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
+    }
+  if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
+    {
+      YYPTRDIFF_T state_size = YYSIZEOF (yystackp->yytops.yystates[0]);
+      YYPTRDIFF_T half_max_capacity = YYSIZE_MAXIMUM / 2 / state_size;
+      if (half_max_capacity < yystackp->yytops.yycapacity)
+        yyMemoryExhausted (yystackp);
+      yystackp->yytops.yycapacity *= 2;
+
+      {
+        yyGLRState** yynewStates
+          = YY_CAST (yyGLRState**,
+                     YYREALLOC (yystackp->yytops.yystates,
+                                (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
+                                 * sizeof yynewStates[0])));
+        if (yynewStates == YY_NULLPTR)
+          yyMemoryExhausted (yystackp);
+        yystackp->yytops.yystates = yynewStates;
+      }
+
+      {
+        yybool* yynewLookaheadNeeds
+          = YY_CAST (yybool*,
+                     YYREALLOC (yystackp->yytops.yylookaheadNeeds,
+                                (YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
+                                 * sizeof yynewLookaheadNeeds[0])));
+        if (yynewLookaheadNeeds == YY_NULLPTR)
+          yyMemoryExhausted (yystackp);
+        yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
+      }
+    }
+  yystackp->yytops.yystates[yystackp->yytops.yysize]
+    = yystackp->yytops.yystates[yyk];
+  yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
+    = yystackp->yytops.yylookaheadNeeds[yyk];
+  yystackp->yytops.yysize += 1;
+  return yystackp->yytops.yysize - 1;
+}
+
+/** True iff YYY0 and YYY1 represent identical options at the top level.
+ *  That is, they represent the same rule applied to RHS symbols
+ *  that produce the same terminal symbols.  */
+static yybool
+yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1)
+{
+  if (yyy0->yyrule == yyy1->yyrule)
+    {
+      yyGLRState *yys0, *yys1;
+      int yyn;
+      for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
+           yyn = yyrhsLength (yyy0->yyrule);
+           yyn > 0;
+           yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
+        if (yys0->yyposn != yys1->yyposn)
+          return yyfalse;
+      return yytrue;
+    }
+  else
+    return yyfalse;
+}
+
+/** Assuming identicalOptions (YYY0,YYY1), destructively merge the
+ *  alternative semantic values for the RHS-symbols of YYY1 and YYY0.  */
+static void
+yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
+{
+  yyGLRState *yys0, *yys1;
+  int yyn;
+  for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
+       yyn = yyrhsLength (yyy0->yyrule);
+       0 < yyn;
+       yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
+    {
+      if (yys0 == yys1)
+        break;
+      else if (yys0->yyresolved)
+        {
+          yys1->yyresolved = yytrue;
+          yys1->yysemantics.yyval = yys0->yysemantics.yyval;
+        }
+      else if (yys1->yyresolved)
+        {
+          yys0->yyresolved = yytrue;
+          yys0->yysemantics.yyval = yys1->yysemantics.yyval;
+        }
+      else
+        {
+          yySemanticOption** yyz0p = &yys0->yysemantics.yyfirstVal;
+          yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
+          while (yytrue)
+            {
+              if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
+                break;
+              else if (*yyz0p == YY_NULLPTR)
+                {
+                  *yyz0p = yyz1;
+                  break;
+                }
+              else if (*yyz0p < yyz1)
+                {
+                  yySemanticOption* yyz = *yyz0p;
+                  *yyz0p = yyz1;
+                  yyz1 = yyz1->yynext;
+                  (*yyz0p)->yynext = yyz;
+                }
+              yyz0p = &(*yyz0p)->yynext;
+            }
+          yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal;
+        }
+    }
+}
+
+/** Y0 and Y1 represent two possible actions to take in a given
+ *  parsing state; return 0 if no combination is possible,
+ *  1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred.  */
+static int
+yypreference (yySemanticOption* y0, yySemanticOption* y1)
+{
+  yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
+  int p0 = yydprec[r0], p1 = yydprec[r1];
+
+  if (p0 == p1)
+    {
+      if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
+        return 0;
+      else
+        return 1;
+    }
+  if (p0 == 0 || p1 == 0)
+    return 0;
+  if (p0 < p1)
+    return 3;
+  if (p1 < p0)
+    return 2;
+  return 0;
+}
+
+static YYRESULTTAG
+yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[);
+
+
+/** Resolve the previous YYN states starting at and including state YYS
+ *  on *YYSTACKP. If result != yyok, some states may have been left
+ *  unresolved possibly with empty semantic option chains.  Regardless
+ *  of whether result = yyok, each state has been left with consistent
+ *  data so that yydestroyGLRState can be invoked if necessary.  */
+static YYRESULTTAG
+yyresolveStates (yyGLRState* yys, int yyn,
+                 yyGLRStack* yystackp]b4_user_formals[)
+{
+  if (0 < yyn)
+    {
+      YY_ASSERT (yys->yypred);
+      YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp]b4_user_args[));
+      if (! yys->yyresolved)
+        YYCHK (yyresolveValue (yys, yystackp]b4_user_args[));
+    }
+  return yyok;
+}
+
+/** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its
+ *  user action, and return the semantic value and location in *YYVALP
+ *  and *YYLOCP.  Regardless of whether result = yyok, all RHS states
+ *  have been destroyed (assuming the user action destroys all RHS
+ *  semantic values if invoked).  */
+static YYRESULTTAG
+yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
+                 YYSTYPE* yyvalp]b4_locuser_formals[)
+{
+  yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
+  int yynrhs = yyrhsLength (yyopt->yyrule);
+  YYRESULTTAG yyflag =
+    yyresolveStates (yyopt->yystate, yynrhs, yystackp]b4_user_args[);
+  if (yyflag != yyok)
+    {
+      yyGLRState *yys;
+      for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1)
+        yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
+      return yyflag;
+    }
+
+  yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;]b4_locations_if([[
+  if (yynrhs == 0)
+    /* Set default location.  */
+    yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
+  {
+    int yychar_current = yychar;
+    YYSTYPE yylval_current = yylval;]b4_locations_if([
+    YYLTYPE yylloc_current = yylloc;])[
+    yychar = yyopt->yyrawchar;
+    yylval = yyopt->yyval;]b4_locations_if([
+    yylloc = yyopt->yyloc;])[
+    yyflag = yyuserAction (yyopt->yyrule, yynrhs,
+                           yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
+                           yystackp, -1, yyvalp]b4_locuser_args[);
+    yychar = yychar_current;
+    yylval = yylval_current;]b4_locations_if([
+    yylloc = yylloc_current;])[
+  }
+  return yyflag;
+}
+
+#if ]b4_api_PREFIX[DEBUG
+static void
+yyreportTree (yySemanticOption* yyx, int yyindent)
+{
+  int yynrhs = yyrhsLength (yyx->yyrule);
+  int yyi;
+  yyGLRState* yys;
+  yyGLRState* yystates[1 + YYMAXRHS];
+  yyGLRState yyleftmost_state;
+
+  for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
+    yystates[yyi] = yys;
+  if (yys == YY_NULLPTR)
+    {
+      yyleftmost_state.yyposn = 0;
+      yystates[0] = &yyleftmost_state;
+    }
+  else
+    yystates[0] = yys;
+
+  if (yyx->yystate->yyposn < yys->yyposn + 1)
+    YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, empty>\n",
+                 yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)),
+                 yyx->yyrule - 1));
+  else
+    YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, tokens %ld .. %ld>\n",
+                 yyindent, "", yysymbol_name (yylhsNonterm (yyx->yyrule)),
+                 yyx->yyrule - 1, YY_CAST (long, yys->yyposn + 1),
+                 YY_CAST (long, yyx->yystate->yyposn)));
+  for (yyi = 1; yyi <= yynrhs; yyi += 1)
+    {
+      if (yystates[yyi]->yyresolved)
+        {
+          if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
+            YY_FPRINTF ((stderr, "%*s%s <empty>\n", yyindent+2, "",
+                         yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState))));
+          else
+            YY_FPRINTF ((stderr, "%*s%s <tokens %ld .. %ld>\n", yyindent+2, "",
+                         yysymbol_name (yy_accessing_symbol (yystates[yyi]->yylrState)),
+                         YY_CAST (long, yystates[yyi-1]->yyposn + 1),
+                         YY_CAST (long, yystates[yyi]->yyposn)));
+        }
+      else
+        yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
+    }
+}
+#endif
+
+static YYRESULTTAG
+yyreportAmbiguity (yySemanticOption* yyx0,
+                   yySemanticOption* yyx1]b4_pure_formals[)
+{
+  YY_USE (yyx0);
+  YY_USE (yyx1);
+
+#if ]b4_api_PREFIX[DEBUG
+  YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
+  YY_FPRINTF ((stderr, "Option 1,\n"));
+  yyreportTree (yyx0, 2);
+  YY_FPRINTF ((stderr, "\nOption 2,\n"));
+  yyreportTree (yyx1, 2);
+  YY_FPRINTF ((stderr, "\n"));
+#endif
+
+  yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
+  return yyabort;
+}]b4_locations_if([[
+
+/** Resolve the locations for each of the YYN1 states in *YYSTACKP,
+ *  ending at YYS1.  Has no effect on previously resolved states.
+ *  The first semantic option of a state is always chosen.  */
+static void
+yyresolveLocations (yyGLRState *yys1, int yyn1,
+                    yyGLRStack *yystackp]b4_user_formals[)
+{
+  if (0 < yyn1)
+    {
+      yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
+      if (!yys1->yyresolved)
+        {
+          yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
+          int yynrhs;
+          yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
+          YY_ASSERT (yyoption);
+          yynrhs = yyrhsLength (yyoption->yyrule);
+          if (0 < yynrhs)
+            {
+              yyGLRState *yys;
+              int yyn;
+              yyresolveLocations (yyoption->yystate, yynrhs,
+                                  yystackp]b4_user_args[);
+              for (yys = yyoption->yystate, yyn = yynrhs;
+                   yyn > 0;
+                   yys = yys->yypred, yyn -= 1)
+                yyrhsloc[yyn].yystate.yyloc = yys->yyloc;
+            }
+          else
+            {
+              /* Both yyresolveAction and yyresolveLocations traverse the GSS
+                 in reverse rightmost order.  It is only necessary to invoke
+                 yyresolveLocations on a subforest for which yyresolveAction
+                 would have been invoked next had an ambiguity not been
+                 detected.  Thus the location of the previous state (but not
+                 necessarily the previous state itself) is guaranteed to be
+                 resolved already.  */
+              yyGLRState *yyprevious = yyoption->yystate;
+              yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
+            }
+          YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
+        }
+    }
+}]])[
+
+/** Resolve the ambiguity represented in state YYS in *YYSTACKP,
+ *  perform the indicated actions, and set the semantic value of YYS.
+ *  If result != yyok, the chain of semantic options in YYS has been
+ *  cleared instead or it has been left unmodified except that
+ *  redundant options may have been removed.  Regardless of whether
+ *  result = yyok, YYS has been left with consistent data so that
+ *  yydestroyGLRState can be invoked if necessary.  */
+static YYRESULTTAG
+yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
+{
+  yySemanticOption* yyoptionList = yys->yysemantics.yyfirstVal;
+  yySemanticOption* yybest = yyoptionList;
+  yySemanticOption** yypp;
+  yybool yymerge = yyfalse;
+  YYSTYPE yyval;
+  YYRESULTTAG yyflag;]b4_locations_if([
+  YYLTYPE *yylocp = &yys->yyloc;])[
+
+  for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
+    {
+      yySemanticOption* yyp = *yypp;
+
+      if (yyidenticalOptions (yybest, yyp))
+        {
+          yymergeOptionSets (yybest, yyp);
+          *yypp = yyp->yynext;
+        }
+      else
+        {
+          switch (yypreference (yybest, yyp))
+            {
+            case 0:]b4_locations_if([[
+              yyresolveLocations (yys, 1, yystackp]b4_user_args[);]])[
+              return yyreportAmbiguity (yybest, yyp]b4_pure_args[);
+              break;
+            case 1:
+              yymerge = yytrue;
+              break;
+            case 2:
+              break;
+            case 3:
+              yybest = yyp;
+              yymerge = yyfalse;
+              break;
+            default:
+              /* This cannot happen so it is not worth a YY_ASSERT (yyfalse),
+                 but some compilers complain if the default case is
+                 omitted.  */
+              break;
+            }
+          yypp = &yyp->yynext;
+        }
+    }
+
+  if (yymerge)
+    {
+      yySemanticOption* yyp;
+      int yyprec = yydprec[yybest->yyrule];
+      yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args[);
+      if (yyflag == yyok)
+        for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
+          {
+            if (yyprec == yydprec[yyp->yyrule])
+              {
+                YYSTYPE yyval_other;]b4_locations_if([
+                YYLTYPE yydummy;])[
+                yyflag = yyresolveAction (yyp, yystackp, &yyval_other]b4_locuser_args([&yydummy])[);
+                if (yyflag != yyok)
+                  {
+                    yydestruct ("Cleanup: discarding incompletely merged value for",
+                                yy_accessing_symbol (yys->yylrState),
+                                &yyval]b4_locuser_args[);
+                    break;
+                  }
+                yyuserMerge (yymerger[yyp->yyrule], &yyval, &yyval_other);
+              }
+          }
+    }
+  else
+    yyflag = yyresolveAction (yybest, yystackp, &yyval]b4_locuser_args([yylocp])[);
+
+  if (yyflag == yyok)
+    {
+      yys->yyresolved = yytrue;
+      yys->yysemantics.yyval = yyval;
+    }
+  else
+    yys->yysemantics.yyfirstVal = YY_NULLPTR;
+  return yyflag;
+}
+
+static YYRESULTTAG
+yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
+{
+  if (yystackp->yysplitPoint != YY_NULLPTR)
+    {
+      yyGLRState* yys;
+      int yyn;
+
+      for (yyn = 0, yys = yystackp->yytops.yystates[0];
+           yys != yystackp->yysplitPoint;
+           yys = yys->yypred, yyn += 1)
+        continue;
+      YYCHK (yyresolveStates (yystackp->yytops.yystates[0], yyn, yystackp
+                             ]b4_user_args[));
+    }
+  return yyok;
+}
+
+/** Called when returning to deterministic operation to clean up the extra
+ * stacks. */
+static void
+yycompressStack (yyGLRStack* yystackp)
+{
+  /* yyr is the state after the split point.  */
+  yyGLRState *yyr;
+
+  if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
+    return;
+
+  {
+    yyGLRState *yyp, *yyq;
+    for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
+         yyp != yystackp->yysplitPoint;
+         yyr = yyp, yyp = yyq, yyq = yyp->yypred)
+      yyp->yypred = yyr;
+  }
+
+  yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
+  yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yysplitPoint) + 1;
+  yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
+  yystackp->yysplitPoint = YY_NULLPTR;
+  yystackp->yylastDeleted = YY_NULLPTR;
+
+  while (yyr != YY_NULLPTR)
+    {
+      yystackp->yynextFree->yystate = *yyr;
+      yyr = yyr->yypred;
+      yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate;
+      yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate;
+      yystackp->yynextFree += 1;
+      yystackp->yyspaceLeft -= 1;
+    }
+}
+
+static YYRESULTTAG
+yyprocessOneStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk,
+                   YYPTRDIFF_T yyposn]b4_pure_formals[)
+{
+  while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
+    {
+      yy_state_t yystate = yystackp->yytops.yystates[yyk]->yylrState;
+      YY_DPRINTF ((stderr, "Stack %ld Entering state %d\n",
+                   YY_CAST (long, yyk), yystate));
+
+      YY_ASSERT (yystate != YYFINAL);
+
+      if (yyisDefaultedState (yystate))
+        {
+          YYRESULTTAG yyflag;
+          yyRuleNum yyrule = yydefaultAction (yystate);
+          if (yyrule == 0)
+            {
+              YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
+              yymarkStackDeleted (yystackp, yyk);
+              return yyok;
+            }
+          yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule]]b4_user_args[);
+          if (yyflag == yyerr)
+            {
+              YY_DPRINTF ((stderr,
+                           "Stack %ld dies "
+                           "(predicate failure or explicit user error).\n",
+                           YY_CAST (long, yyk)));
+              yymarkStackDeleted (yystackp, yyk);
+              return yyok;
+            }
+          if (yyflag != yyok)
+            return yyflag;
+        }
+      else
+        {
+          yysymbol_kind_t yytoken = ]b4_yygetToken_call[;
+          const short* yyconflicts;
+          const int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
+          yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
+
+          for (/* nothing */; *yyconflicts; yyconflicts += 1)
+            {
+              YYRESULTTAG yyflag;
+              YYPTRDIFF_T yynewStack = yysplitStack (yystackp, yyk);
+              YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
+                           YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
+              yyflag = yyglrReduce (yystackp, yynewStack,
+                                    *yyconflicts,
+                                    yyimmediate[*yyconflicts]]b4_user_args[);
+              if (yyflag == yyok)
+                YYCHK (yyprocessOneStack (yystackp, yynewStack,
+                                          yyposn]b4_pure_args[));
+              else if (yyflag == yyerr)
+                {
+                  YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yynewStack)));
+                  yymarkStackDeleted (yystackp, yynewStack);
+                }
+              else
+                return yyflag;
+            }
+
+          if (yyisShiftAction (yyaction))
+            break;
+          else if (yyisErrorAction (yyaction))
+            {
+              YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
+              yymarkStackDeleted (yystackp, yyk);
+              break;
+            }
+          else
+            {
+              YYRESULTTAG yyflag = yyglrReduce (yystackp, yyk, -yyaction,
+                                                yyimmediate[-yyaction]]b4_user_args[);
+              if (yyflag == yyerr)
+                {
+                  YY_DPRINTF ((stderr,
+                               "Stack %ld dies "
+                               "(predicate failure or explicit user error).\n",
+                               YY_CAST (long, yyk)));
+                  yymarkStackDeleted (yystackp, yyk);
+                  break;
+                }
+              else if (yyflag != yyok)
+                return yyflag;
+            }
+        }
+    }
+  return yyok;
+}
+
+]b4_parse_error_case([simple], [],
+[[/* Put in YYARG at most YYARGN of the expected tokens given the
+   current YYSTACKP, and return the number of tokens stored in YYARG.  If
+   YYARG is null, return the number of expected tokens (guaranteed to
+   be less than YYNTOKENS).  */
+static int
+yypcontext_expected_tokens (const yyGLRStack* yystackp,
+                            yysymbol_kind_t yyarg[], int yyargn)
+{
+  /* Actual size of YYARG. */
+  int yycount = 0;
+  int yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
+  if (!yypact_value_is_default (yyn))
+    {
+      /* Start YYX at -YYN if negative to avoid negative indexes in
+         YYCHECK.  In other words, skip the first -YYN actions for
+         this state because they are default actions.  */
+      int yyxbegin = yyn < 0 ? -yyn : 0;
+      /* Stay within bounds of both yycheck and yytname.  */
+      int yychecklim = YYLAST - yyn + 1;
+      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+      int yyx;
+      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+        if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
+            && !yytable_value_is_error (yytable[yyx + yyn]))
+          {
+            if (!yyarg)
+              ++yycount;
+            else if (yycount == yyargn)
+              return 0;
+            else
+              yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
+          }
+    }
+  if (yyarg && yycount == 0 && 0 < yyargn)
+    yyarg[0] = ]b4_symbol(empty, kind)[;
+  return yycount;
+}]])[
+
+]b4_parse_error_bmatch(
+         [custom],
+[[/* User defined function to report a syntax error.  */
+typedef yyGLRStack yypcontext_t;
+static int
+yyreport_syntax_error (const yyGLRStack* yystackp]b4_user_formals[);
+
+/* The kind of the lookahead of this context.  */
+static yysymbol_kind_t
+yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
+
+static yysymbol_kind_t
+yypcontext_token (const yyGLRStack *yystackp)
+{
+  YY_USE (yystackp);
+  yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
+  return yytoken;
+}
+
+]b4_locations_if([[/* The location of the lookahead of this context.  */
+static const YYLTYPE *
+yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
+
+static const YYLTYPE *
+yypcontext_location (const yyGLRStack *yystackp)
+{
+  YY_USE (yystackp);
+  return &yylloc;
+}]])],
+         [detailed\|verbose],
+[[static int
+yy_syntax_error_arguments (const yyGLRStack* yystackp,
+                           yysymbol_kind_t yyarg[], int yyargn)
+{
+  yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
+  /* Actual size of YYARG. */
+  int yycount = 0;
+  /* There are many possibilities here to consider:
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != ]b4_symbol(empty, kind)[)
+    {
+      int yyn;
+      if (yyarg)
+        yyarg[yycount] = yytoken;
+      ++yycount;
+      yyn = yypcontext_expected_tokens (yystackp,
+                                        yyarg ? yyarg + 1 : yyarg, yyargn - 1);
+      if (yyn == YYENOMEM)
+        return YYENOMEM;
+      else
+        yycount += yyn;
+    }
+  return yycount;
+}
+]])[
+
+
+static void
+yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
+{
+  if (yystackp->yyerrState != 0)
+    return;
+]b4_parse_error_case(
+         [custom],
+[[  if (yyreport_syntax_error (yystackp]b4_user_args[))
+    yyMemoryExhausted (yystackp);]],
+         [simple],
+[[  yyerror (]b4_lyyerror_args[YY_("syntax error"));]],
+[[  {
+  yybool yysize_overflow = yyfalse;
+  char* yymsg = YY_NULLPTR;
+  enum { YYARGS_MAX = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* Arguments of yyformat: reported tokens (one for the "unexpected",
+     one per "expected"). */
+  yysymbol_kind_t yyarg[YYARGS_MAX];
+  /* Cumulated lengths of YYARG.  */
+  YYPTRDIFF_T yysize = 0;
+
+  /* Actual size of YYARG. */
+  int yycount
+    = yy_syntax_error_arguments (yystackp, yyarg, YYARGS_MAX);
+  if (yycount == YYENOMEM)
+    yyMemoryExhausted (yystackp);
+
+  switch (yycount)
+    {
+#define YYCASE_(N, S)                   \
+      case N:                           \
+        yyformat = S;                   \
+      break
+    default: /* Avoid compiler warnings. */
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+    }
+
+  /* Compute error message size.  Don't count the "%s"s, but reserve
+     room for the terminator.  */
+  yysize = yystrlen (yyformat) - 2 * yycount + 1;
+  {
+    int yyi;
+    for (yyi = 0; yyi < yycount; ++yyi)
+      {
+        YYPTRDIFF_T yysz
+          = ]b4_parse_error_case(
+                     [verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]],
+                     [[yystrlen (yysymbol_name (yyarg[yyi]))]]);[
+        if (YYSIZE_MAXIMUM - yysize < yysz)
+          yysize_overflow = yytrue;
+        else
+          yysize += yysz;
+      }
+  }
+
+  if (!yysize_overflow)
+    yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (YYSIZE_T, yysize)));
+
+  if (yymsg)
+    {
+      char *yyp = yymsg;
+      int yyi = 0;
+      while ((*yyp = *yyformat))
+        {
+          if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+            {]b4_parse_error_case([verbose], [[
+              yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);]], [[
+              yyp = yystpcpy (yyp, yysymbol_name (yyarg[yyi++]));]])[
+              yyformat += 2;
+            }
+          else
+            {
+              ++yyp;
+              ++yyformat;
+            }
+        }
+      yyerror (]b4_lyyerror_args[yymsg);
+      YYFREE (yymsg);
+    }
+  else
+    {
+      yyerror (]b4_lyyerror_args[YY_("syntax error"));
+      yyMemoryExhausted (yystackp);
+    }
+  }]])[
+  yynerrs += 1;
+}
+
+/* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
+   yylval, and yylloc are the syntactic category, semantic value, and location
+   of the lookahead.  */
+static void
+yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
+{
+  if (yystackp->yyerrState == 3)
+    /* We just shifted the error token and (perhaps) took some
+       reductions.  Skip tokens until we can proceed.  */
+    while (yytrue)
+      {
+        yysymbol_kind_t yytoken;
+        int yyj;
+        if (yychar == ]b4_symbol(eof, [id])[)
+          yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
+        if (yychar != ]b4_symbol(empty, id)[)
+          {]b4_locations_if([[
+            /* We throw away the lookahead, but the error range
+               of the shifted error token must take it into account.  */
+            yyGLRState *yys = yystackp->yytops.yystates[0];
+            yyGLRStackItem yyerror_range[3];
+            yyerror_range[1].yystate.yyloc = yys->yyloc;
+            yyerror_range[2].yystate.yyloc = yylloc;
+            YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
+            yytoken = YYTRANSLATE (yychar);
+            yydestruct ("Error: discarding",
+                        yytoken, &yylval]b4_locuser_args([&yylloc])[);
+            yychar = ]b4_symbol(empty, id)[;
+          }
+        yytoken = ]b4_yygetToken_call[;
+        yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
+        if (yypact_value_is_default (yyj))
+          return;
+        yyj += yytoken;
+        if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
+          {
+            if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
+              return;
+          }
+        else if (! yytable_value_is_error (yytable[yyj]))
+          return;
+      }
+
+  /* Reduce to one stack.  */
+  {
+    YYPTRDIFF_T yyk;
+    for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
+      if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
+        break;
+    if (yyk >= yystackp->yytops.yysize)
+      yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
+    for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
+      yymarkStackDeleted (yystackp, yyk);
+    yyremoveDeletes (yystackp);
+    yycompressStack (yystackp);
+  }
+
+  /* Pop stack until we find a state that shifts the error token.  */
+  yystackp->yyerrState = 3;
+  while (yystackp->yytops.yystates[0] != YY_NULLPTR)
+    {
+      yyGLRState *yys = yystackp->yytops.yystates[0];
+      int yyj = yypact[yys->yylrState];
+      if (! yypact_value_is_default (yyj))
+        {
+          yyj += ]b4_symbol(error, kind)[;
+          if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == ]b4_symbol(error, kind)[
+              && yyisShiftAction (yytable[yyj]))
+            {
+              /* Shift the error token.  */
+              int yyaction = yytable[yyj];]b4_locations_if([[
+              /* First adjust its location.*/
+              YYLTYPE yyerrloc;
+              yystackp->yyerror_range[2].yystate.yyloc = yylloc;
+              YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
+              YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol (yyaction),
+                               &yylval, &yyerrloc);
+              yyglrShift (yystackp, 0, yyaction,
+                          yys->yyposn, &yylval]b4_locations_if([, &yyerrloc])[);
+              yys = yystackp->yytops.yystates[0];
+              break;
+            }
+        }]b4_locations_if([[
+      yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
+      if (yys->yypred != YY_NULLPTR)
+        yydestroyGLRState ("Error: popping", yys]b4_user_args[);
+      yystackp->yytops.yystates[0] = yys->yypred;
+      yystackp->yynextFree -= 1;
+      yystackp->yyspaceLeft += 1;
+    }
+  if (yystackp->yytops.yystates[0] == YY_NULLPTR)
+    yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
+}
+
+#define YYCHK1(YYE)                             \
+  do {                                          \
+    switch (YYE) {                              \
+    case yyok:     break;                       \
+    case yyabort:  goto yyabortlab;             \
+    case yyaccept: goto yyacceptlab;            \
+    case yyerr:    goto yyuser_error;           \
+    case yynomem:  goto yyexhaustedlab;         \
+    default:       goto yybuglab;               \
+    }                                           \
+  } while (0)
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+int
+]b4_glr_cc_if([yy_parse_impl], [yyparse])[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
+{
+  int yyresult;
+  yyGLRStack yystack;
+  yyGLRStack* const yystackp = &yystack;
+  YYPTRDIFF_T yyposn;
+
+  YY_DPRINTF ((stderr, "Starting parse\n"));
+
+  yychar = ]b4_symbol(empty, id)[;
+  yylval = yyval_default;]b4_locations_if([
+  yylloc = yyloc_default;])[
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
+  b4_user_initial_action
+b4_dollar_popdef])[]dnl
+[
+  if (! yyinitGLRStack (yystackp, YYINITDEPTH))
+    goto yyexhaustedlab;
+  switch (YYSETJMP (yystack.yyexception_buffer))
+    {
+    case 0: break;
+    case 1: goto yyabortlab;
+    case 2: goto yyexhaustedlab;
+    default: goto yybuglab;
+    }
+  yyglrShift (&yystack, 0, 0, 0, &yylval]b4_locations_if([, &yylloc])[);
+  yyposn = 0;
+
+  while (yytrue)
+    {
+      /* For efficiency, we have two loops, the first of which is
+         specialized to deterministic operation (single stack, no
+         potential ambiguity).  */
+      /* Standard mode. */
+      while (yytrue)
+        {
+          yy_state_t yystate = yystack.yytops.yystates[0]->yylrState;
+          YY_DPRINTF ((stderr, "Entering state %d\n", yystate));
+          if (yystate == YYFINAL)
+            goto yyacceptlab;
+          if (yyisDefaultedState (yystate))
+            {
+              yyRuleNum yyrule = yydefaultAction (yystate);
+              if (yyrule == 0)
+                {]b4_locations_if([[
+                  yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
+                  yyreportSyntaxError (&yystack]b4_user_args[);
+                  goto yyuser_error;
+                }
+              YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_user_args[));
+            }
+          else
+            {
+              yysymbol_kind_t yytoken = ]b4_yygetToken_call;[
+              const short* yyconflicts;
+              int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
+              if (*yyconflicts)
+                /* Enter nondeterministic mode.  */
+                break;
+              if (yyisShiftAction (yyaction))
+                {
+                  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+                  yychar = ]b4_symbol(empty, id)[;
+                  yyposn += 1;
+                  yyglrShift (&yystack, 0, yyaction, yyposn, &yylval]b4_locations_if([, &yylloc])[);
+                  if (0 < yystack.yyerrState)
+                    yystack.yyerrState -= 1;
+                }
+              else if (yyisErrorAction (yyaction))
+                {]b4_locations_if([[
+                  yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
+                  /* Issue an error message unless the scanner already
+                     did. */
+                  if (yychar != ]b4_symbol(error, id)[)
+                    yyreportSyntaxError (&yystack]b4_user_args[);
+                  goto yyuser_error;
+                }
+              else
+                YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue]b4_user_args[));
+            }
+        }
+
+      /* Nondeterministic mode. */
+      while (yytrue)
+        {
+          yysymbol_kind_t yytoken_to_shift;
+          YYPTRDIFF_T yys;
+
+          for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
+            yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(empty, id)[;
+
+          /* yyprocessOneStack returns one of three things:
+
+              - An error flag.  If the caller is yyprocessOneStack, it
+                immediately returns as well.  When the caller is finally
+                yyparse, it jumps to an error label via YYCHK1.
+
+              - yyok, but yyprocessOneStack has invoked yymarkStackDeleted
+                (&yystack, yys), which sets the top state of yys to NULL.  Thus,
+                yyparse's following invocation of yyremoveDeletes will remove
+                the stack.
+
+              - yyok, when ready to shift a token.
+
+             Except in the first case, yyparse will invoke yyremoveDeletes and
+             then shift the next token onto all remaining stacks.  This
+             synchronization of the shift (that is, after all preceding
+             reductions on all stacks) helps prevent double destructor calls
+             on yylval in the event of memory exhaustion.  */
+
+          for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
+            YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn]b4_lpure_args[));
+          yyremoveDeletes (&yystack);
+          if (yystack.yytops.yysize == 0)
+            {
+              yyundeleteLastStack (&yystack);
+              if (yystack.yytops.yysize == 0)
+                yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
+              YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
+              YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
+              yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
+              yyreportSyntaxError (&yystack]b4_user_args[);
+              goto yyuser_error;
+            }
+
+          /* If any yyglrShift call fails, it will fail after shifting.  Thus,
+             a copy of yylval will already be on stack 0 in the event of a
+             failure in the following loop.  Thus, yychar is set to ]b4_symbol(empty, id)[
+             before the loop to make sure the user destructor for yylval isn't
+             called twice.  */
+          yytoken_to_shift = YYTRANSLATE (yychar);
+          yychar = ]b4_symbol(empty, id)[;
+          yyposn += 1;
+          for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
+            {
+              yy_state_t yystate = yystack.yytops.yystates[yys]->yylrState;
+              const short* yyconflicts;
+              int yyaction = yygetLRActions (yystate, yytoken_to_shift,
+                              &yyconflicts);
+              /* Note that yyconflicts were handled by yyprocessOneStack.  */
+              YY_DPRINTF ((stderr, "On stack %ld, ", YY_CAST (long, yys)));
+              YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
+              yyglrShift (&yystack, yys, yyaction, yyposn,
+                          &yylval]b4_locations_if([, &yylloc])[);
+              YY_DPRINTF ((stderr, "Stack %ld now in state %d\n",
+                           YY_CAST (long, yys),
+                           yystack.yytops.yystates[yys]->yylrState));
+            }
+
+          if (yystack.yytops.yysize == 1)
+            {
+              YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
+              YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));
+              yycompressStack (&yystack);
+              break;
+            }
+        }
+      continue;
+    yyuser_error:
+      yyrecoverSyntaxError (&yystack]b4_user_args[);
+      yyposn = yystack.yytops.yystates[0]->yyposn;
+    }
+
+ yyacceptlab:
+  yyresult = 0;
+  goto yyreturnlab;
+
+ yybuglab:
+  YY_ASSERT (yyfalse);
+  goto yyabortlab;
+
+ yyabortlab:
+  yyresult = 1;
+  goto yyreturnlab;
+
+ yyexhaustedlab:
+  yyerror (]b4_lyyerror_args[YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturnlab;
+
+ yyreturnlab:
+  if (yychar != ]b4_symbol(empty, id)[)
+    yydestruct ("Cleanup: discarding lookahead",
+                YYTRANSLATE (yychar), &yylval]b4_locuser_args([&yylloc])[);
+
+  /* If the stack is well-formed, pop the stack until it is empty,
+     destroying its entries as we go.  But free the stack regardless
+     of whether it is well-formed.  */
+  if (yystack.yyitems)
+    {
+      yyGLRState** yystates = yystack.yytops.yystates;
+      if (yystates)
+        {
+          YYPTRDIFF_T yysize = yystack.yytops.yysize;
+          YYPTRDIFF_T yyk;
+          for (yyk = 0; yyk < yysize; yyk += 1)
+            if (yystates[yyk])
+              {
+                while (yystates[yyk])
+                  {
+                    yyGLRState *yys = yystates[yyk];]b4_locations_if([[
+                    yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
+                    if (yys->yypred != YY_NULLPTR)
+                      yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
+                    yystates[yyk] = yys->yypred;
+                    yystack.yynextFree -= 1;
+                    yystack.yyspaceLeft += 1;
+                  }
+                break;
+              }
+        }
+      yyfreeGLRStack (&yystack);
+    }
+
+  return yyresult;
+}
+
+/* DEBUGGING ONLY */
+#if ]b4_api_PREFIX[DEBUG
+/* Print *YYS and its predecessors. */
+static void
+yy_yypstack (yyGLRState* yys)
+{
+  if (yys->yypred)
+    {
+      yy_yypstack (yys->yypred);
+      YY_FPRINTF ((stderr, " -> "));
+    }
+  YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
+}
+
+/* Print YYS (possibly NULL) and its predecessors. */
+static void
+yypstates (yyGLRState* yys)
+{
+  if (yys == YY_NULLPTR)
+    YY_FPRINTF ((stderr, "<null>"));
+  else
+    yy_yypstack (yys);
+  YY_FPRINTF ((stderr, "\n"));
+}
+
+/* Print the stack #YYK.  */
+static void
+yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
+{
+  yypstates (yystackp->yytops.yystates[yyk]);
+}
+
+/* Print all the stacks.  */
+static void
+yypdumpstack (yyGLRStack* yystackp)
+{
+#define YYINDEX(YYX)                                                    \
+  YY_CAST (long,                                                        \
+           ((YYX)                                                       \
+            ? YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX)) - yystackp->yyitems \
+            : -1))
+
+  yyGLRStackItem* yyp;
+  for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
+    {
+      YY_FPRINTF ((stderr, "%3ld. ",
+                   YY_CAST (long, yyp - yystackp->yyitems)));
+      if (*YY_REINTERPRET_CAST (yybool *, yyp))
+        {
+          YY_ASSERT (yyp->yystate.yyisState);
+          YY_ASSERT (yyp->yyoption.yyisState);
+          YY_FPRINTF ((stderr, "Res: %d, LR State: %d, posn: %ld, pred: %ld",
+                       yyp->yystate.yyresolved, yyp->yystate.yylrState,
+                       YY_CAST (long, yyp->yystate.yyposn),
+                       YYINDEX (yyp->yystate.yypred)));
+          if (! yyp->yystate.yyresolved)
+            YY_FPRINTF ((stderr, ", firstVal: %ld",
+                         YYINDEX (yyp->yystate.yysemantics.yyfirstVal)));
+        }
+      else
+        {
+          YY_ASSERT (!yyp->yystate.yyisState);
+          YY_ASSERT (!yyp->yyoption.yyisState);
+          YY_FPRINTF ((stderr, "Option. rule: %d, state: %ld, next: %ld",
+                       yyp->yyoption.yyrule - 1,
+                       YYINDEX (yyp->yyoption.yystate),
+                       YYINDEX (yyp->yyoption.yynext)));
+        }
+      YY_FPRINTF ((stderr, "\n"));
+    }
+
+  YY_FPRINTF ((stderr, "Tops:"));
+  {
+    YYPTRDIFF_T yyi;
+    for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
+      YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi),
+                   YYINDEX (yystackp->yytops.yystates[yyi])));
+    YY_FPRINTF ((stderr, "\n"));
+  }
+#undef YYINDEX
+}
+#endif
+
+#undef yylval
+#undef yychar
+#undef yynerrs]b4_locations_if([
+#undef yylloc])
+
+m4_if(b4_prefix, [yy], [],
+[[/* Substitute the variable and function names.  */
+#define yyparse ]b4_prefix[parse
+#define yylex   ]b4_prefix[lex
+#define yyerror ]b4_prefix[error
+#define yylval  ]b4_prefix[lval
+#define yychar  ]b4_prefix[char
+#define yydebug ]b4_prefix[debug
+#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
+#define yylloc  ]b4_prefix[lloc]])])[
+
+]b4_glr_cc_if([b4_glr_cc_pre_epilogue
+b4_glr_cc_cleanup])[
+]b4_percent_code_get([[epilogue]])[]dnl
+b4_epilogue[]dnl
+b4_output_end

+ 397 - 0
Engine/bin/bison-flex/data/skeletons/glr.cc

@@ -0,0 +1,397 @@
+# C++ GLR skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+# This skeleton produces a C++ class that encapsulates a C glr parser.
+# This is in order to reduce the maintenance burden.  The glr.c
+# skeleton is clean and pure enough so that there are no real
+# problems.  The C++ interface is the same as that of lalr1.cc.  In
+# fact, glr.c can replace yacc.c without the user noticing any
+# difference, and similarly for glr.cc replacing lalr1.cc.
+#
+# The passing of parse-params
+#
+#   The additional arguments are stored as members of the parser
+#   object, yyparser.  The C routines need to carry yyparser
+#   throughout the C parser; that's easy: make yyparser an
+#   additional parse-param.  But because the C++ skeleton needs to
+#   know the "real" original parse-param, we save them
+#   (b4_parse_param_orig).  Note that b4_parse_param is overquoted
+#   (and c.m4 strips one level of quotes).  This is a PITA, and
+#   explains why there are so many levels of quotes.
+#
+# The locations
+#
+#   We use location.cc just like lalr1.cc, but because glr.c stores
+#   the locations in a union, the position and location classes
+#   must not have a constructor.  Therefore, contrary to lalr1.cc, we
+#   must not define "b4_location_constructors".  As a consequence the
+#   user must initialize the first positions (in particular the
+#   filename member).
+
+# We require a pure interface.
+m4_define([b4_pure_flag], [1])
+
+m4_include(b4_skeletonsdir/[c++.m4])
+b4_bison_locations_if([m4_include(b4_skeletonsdir/[location.cc])])
+
+m4_define([b4_parser_class],
+          [b4_percent_define_get([[api.parser.class]])])
+
+# Save the parse parameters.
+m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
+
+# b4_parse_param_wrap
+# -------------------
+# New ones.
+m4_ifset([b4_parse_param],
+[m4_define([b4_parse_param_wrap],
+           [[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]],]
+m4_defn([b4_parse_param]))],
+[m4_define([b4_parse_param_wrap],
+           [[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
+])
+
+
+# b4_yy_symbol_print_define
+# -------------------------
+# Bypass the default implementation to generate the "yy_symbol_print"
+# and "yy_symbol_value_print" functions.
+m4_define([b4_yy_symbol_print_define],
+[[/*--------------------.
+| Print this symbol.  |
+`--------------------*/
+
+static void
+yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
+                 const ]b4_namespace_ref::b4_parser_class[::value_type *yyvaluep]b4_locations_if([[,
+                 const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
+{
+]b4_parse_param_use[]dnl
+[  yyparser.yy_symbol_print_ (yytoken, yyvaluep]b4_locations_if([, yylocationp])[);
+}
+]])[
+
+# Hijack the initial action to initialize the locations.
+]b4_bison_locations_if([m4_define([b4_initial_action],
+[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
+m4_defn([b4_initial_action])]))])[
+
+# Hijack the post prologue to declare yyerror.
+]m4_append([b4_post_prologue],
+[b4_syncline([@oline@], [@ofile@])dnl
+[static void
+yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
+         ]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
+         ])[const char* msg);]])[
+
+# Inserted before the epilogue to define implementations (yyerror, parser member
+# functions etc.).
+]m4_define([b4_glr_cc_pre_epilogue],
+[b4_syncline([@oline@], [@ofile@])dnl
+[
+/*------------------.
+| Report an error.  |
+`------------------*/
+
+static void
+yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
+         ]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
+         ])[const char* msg)
+{
+]b4_parse_param_use[]dnl
+[  yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
+}
+
+
+]b4_namespace_open[
+]dnl In this section, the parse params are the original parse_params.
+m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
+[  /// Build a parser object.
+  ]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
+    :])[
+#if ]b4_api_PREFIX[DEBUG
+    ]m4_ifset([b4_parse_param], [  ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
+#endif]b4_parse_param_cons[
+  {}
+
+  ]b4_parser_class::~b4_parser_class[ ()
+  {}
+
+  ]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
+  {}
+
+  int
+  ]b4_parser_class[::operator() ()
+  {
+    return parse ();
+  }
+
+  int
+  ]b4_parser_class[::parse ()
+  {
+    return ::yy_parse_impl (*this]b4_user_args[);
+  }
+
+#if ]b4_api_PREFIX[DEBUG
+  /*--------------------.
+  | Print this symbol.  |
+  `--------------------*/
+
+  void
+  ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
+                           const value_type* yyvaluep]b4_locations_if([[,
+                           const location_type* yylocationp]])[) const
+  {]b4_locations_if([[
+    YY_USE (yylocationp);]])[
+    YY_USE (yyvaluep);
+    std::ostream& yyo = debug_stream ();
+    std::ostream& yyoutput = yyo;
+    YY_USE (yyoutput);
+    ]b4_symbol_actions([printer])[
+  }
+
+
+  void
+  ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
+                           const value_type* yyvaluep]b4_locations_if([[,
+                           const location_type* yylocationp]])[) const
+  {
+    *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
+               << ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
+               << *yylocationp << ": "]])[;
+    yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
+    *yycdebug_ << ')';
+  }
+
+  std::ostream&
+  ]b4_parser_class[::debug_stream () const
+  {
+    return *yycdebug_;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_stream (std::ostream& o)
+  {
+    yycdebug_ = &o;
+  }
+
+
+  ]b4_parser_class[::debug_level_type
+  ]b4_parser_class[::debug_level () const
+  {
+    return yydebug;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_level (debug_level_type l)
+  {
+    // Actually, it is yydebug which is really used.
+    yydebug = l;
+  }
+
+#endif
+]m4_popdef([b4_parse_param])dnl
+b4_namespace_close[]dnl
+])
+
+
+m4_define([b4_define_symbol_kind],
+[m4_format([#define %-15s %s],
+           b4_symbol($][1, kind_base),
+           b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
+])
+
+# b4_glr_cc_setup
+# ---------------
+# Setup redirections for glr.c: Map the names used in c.m4 to the ones used
+# in c++.m4.
+m4_define([b4_glr_cc_setup],
+[[]b4_attribute_define[
+]b4_null_define[
+
+// This skeleton is based on C, yet compiles it as C++.
+// So expect warnings about C style casts.
+#if defined __clang__ && 306 <= __clang_major__ * 100 + __clang_minor__
+# pragma clang diagnostic ignored "-Wold-style-cast"
+#elif defined __GNUC__ && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
+// -pedantic reports as being a C++11 extension.
+#if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
+    && defined __clang__ && 4 <= __clang_major__
+# pragma clang diagnostic ignored "-Wc++11-long-long"
+#endif
+
+#undef ]b4_symbol(empty, [id])[
+#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[
+#undef ]b4_symbol(eof, [id])[
+#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[
+#undef ]b4_symbol(error, [id])[
+#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
+
+#ifndef ]b4_api_PREFIX[STYPE
+# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
+#endif
+#ifndef ]b4_api_PREFIX[LTYPE
+# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
+#endif
+
+typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
+
+// Expose C++ symbol kinds to C.
+]b4_define_symbol_kind(-2)dnl
+b4_symbol_foreach([b4_define_symbol_kind])])[
+]])
+
+
+m4_define([b4_undef_symbol_kind],
+[[#undef ]b4_symbol($1, kind_base)[
+]])
+
+
+# b4_glr_cc_cleanup
+# -----------------
+# Remove redirections for glr.c.
+m4_define([b4_glr_cc_cleanup],
+[[#undef ]b4_symbol(empty, [id])[
+#undef ]b4_symbol(eof, [id])[
+#undef ]b4_symbol(error, [id])[
+
+]b4_undef_symbol_kind(-2)dnl
+b4_symbol_foreach([b4_undef_symbol_kind])dnl
+])
+
+
+# b4_shared_declarations(hh|cc)
+# -----------------------------
+# Declaration that might either go into the header (if --header, $1 = hh)
+# or in the implementation file.
+m4_define([b4_shared_declarations],
+[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
+b4_percent_code_get([[requires]])[
+#include <iostream>
+#include <stdexcept>
+#include <string>
+
+]b4_cxx_portability[
+]m4_ifdef([b4_location_include],
+          [[# include ]b4_location_include])[
+]b4_variant_if([b4_variant_includes])[
+
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+#  define YY_EXCEPTIONS 0
+# else
+#  define YY_EXCEPTIONS 1
+# endif
+#endif
+
+]b4_YYDEBUG_define[
+
+]b4_namespace_open[
+
+]b4_bison_locations_if([m4_ifndef([b4_location_file],
+                                  [b4_location_define])])[
+
+  /// A Bison parser.
+  class ]b4_parser_class[
+  {
+  public:
+]b4_public_types_declare[
+
+    /// Build a parser object.
+    ]b4_parser_class[ (]b4_parse_param_decl[);
+    virtual ~]b4_parser_class[ ();
+
+    /// Parse.  An alias for parse ().
+    /// \returns  0 iff parsing succeeded.
+    int operator() ();
+
+    /// Parse.
+    /// \returns  0 iff parsing succeeded.
+    virtual int parse ();
+
+#if ]b4_api_PREFIX[DEBUG
+    /// The current debugging stream.
+    std::ostream& debug_stream () const;
+    /// Set the current debugging stream.
+    void set_debug_stream (std::ostream &);
+
+    /// Type for debugging levels.
+    typedef int debug_level_type;
+    /// The current debugging level.
+    debug_level_type debug_level () const;
+    /// Set the current debugging level.
+    void set_debug_level (debug_level_type l);
+#endif
+
+    /// Report a syntax error.]b4_locations_if([[
+    /// \param loc    where the syntax error is found.]])[
+    /// \param msg    a description of the syntax error.
+    virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
+
+# if ]b4_api_PREFIX[DEBUG
+  public:
+    /// \brief Report a symbol value on the debug stream.
+    /// \param yykind       The symbol kind.
+    /// \param yyvaluep     Its semantic value.]b4_locations_if([[
+    /// \param yylocationp  Its location.]])[
+    virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
+                                         const value_type* yyvaluep]b4_locations_if([[,
+                                         const location_type* yylocationp]])[) const;
+    /// \brief Report a symbol on the debug stream.
+    /// \param yykind       The symbol kind.
+    /// \param yyvaluep     Its semantic value.]b4_locations_if([[
+    /// \param yylocationp  Its location.]])[
+    virtual void yy_symbol_print_ (symbol_kind_type yykind,
+                                   const value_type* yyvaluep]b4_locations_if([[,
+                                   const location_type* yylocationp]])[) const;
+  private:
+    /// Debug stream.
+    std::ostream* yycdebug_;
+#endif
+
+]b4_parse_param_vars[
+  };
+
+]b4_namespace_close[
+
+]b4_percent_code_get([[provides]])[
+]m4_popdef([b4_parse_param])dnl
+])[
+
+]b4_header_if(
+[b4_output_begin([b4_spec_header_file])
+b4_copyright([Skeleton interface for Bison GLR parsers in C++],
+             [2002-2015, 2018-2021])[
+// C++ GLR parser skeleton written by Akim Demaille.
+
+]b4_disclaimer[
+]b4_cpp_guard_open([b4_spec_mapped_header_file])[
+]b4_shared_declarations[
+]b4_cpp_guard_close([b4_spec_mapped_header_file])[
+]b4_output_end])
+
+# Let glr.c (and b4_shared_declarations) believe that the user
+# arguments include the parser itself.
+m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
+m4_include(b4_skeletonsdir/[glr.c])
+m4_popdef([b4_parse_param])

+ 3533 - 0
Engine/bin/bison-flex/data/skeletons/glr2.cc

@@ -0,0 +1,3533 @@
+# C++ GLR skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[c++.m4])
+
+# api.value.type=variant is valid.
+m4_define([b4_value_type_setup_variant])
+
+# b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED)
+# -------------------------------------------
+m4_define([b4_tname_if],
+[m4_case(b4_percent_define_get([[parse.error]]),
+         [verbose],         [$1],
+         [b4_token_table_if([$1],
+                            [$2])])])
+
+b4_bison_locations_if([
+   m4_define([b4_location_constructors])
+   m4_include(b4_skeletonsdir/[location.cc])])
+b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])])
+
+m4_define([b4_parser_class],
+          [b4_percent_define_get([[api.parser.class]])])
+
+]m4_define([b4_define_symbol_kind],
+[m4_format([#define %-15s %s],
+           b4_symbol($][1, kind_base),
+           b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
+])
+
+
+# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
+# -------------------------------------------------------------
+# Define "yy<TABLE-NAME>" whose contents is CONTENT.  Does not use "static",
+# should be in unnamed namespace.
+m4_define([b4_integral_parser_table_define],
+[m4_ifvaln([$3], [  b4_comment([$3])])dnl
+  const b4_int_type_for([$2]) yy$1[[]] =
+  {
+  $2
+  };dnl
+])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# Stack parameters.
+m4_define_default([b4_stack_depth_max], [10000])
+m4_define_default([b4_stack_depth_init],  [200])
+
+
+
+## ------------ ##
+## Interfaces.  ##
+## ------------ ##
+
+# b4_user_formals
+# ---------------
+# The possible parse-params formal arguments preceded by a comma.
+#
+# This is not shared with yacc.c in c.m4 because  GLR relies on ISO C
+# formal argument declarations.
+m4_define([b4_user_formals],
+[m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])])
+
+
+# b4_symbol_kind(NUM)
+# -------------------
+m4_define([b4_symbol_kind],
+[symbol_kind::b4_symbol_kind_base($@)])
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_lhs_value(SYMBOL-NUM, [TYPE])
+# --------------------------------
+# See README.
+m4_define([b4_lhs_value],
+[b4_symbol_value([(*yyvalp)], [$1], [$2])])
+
+
+# b4_rhs_data(RULE-LENGTH, POS)
+# -----------------------------
+# See README.
+m4_define([b4_rhs_data],
+[(static_cast<glr_stack_item const *>(yyvsp))@{YYFILL (b4_subtract([$2], [$1]))@}.getState()])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
+# --------------------------------------------------
+# Expansion of $$ or $<TYPE>$, for symbol SYMBOL-NUM.
+m4_define([b4_rhs_value],
+[b4_symbol_value([b4_rhs_data([$1], [$2]).value ()], [$3], [$4])])
+
+
+
+## ----------- ##
+## Locations.  ##
+## ----------- ##
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(*yylocp)])
+
+
+# b4_rhs_location(RULE-LENGTH, NUM)
+# ---------------------------------
+# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[(b4_rhs_data([$1], [$2]).yyloc)])
+
+
+# b4_symbol_action(SYMBOL-NUM, KIND)
+# ----------------------------------
+# Run the action KIND (destructor or printer) for SYMBOL-NUM.
+# Same as in C, but using references instead of pointers.
+#
+# Currently we need two different b4_symbol_action: once for the
+# self-contained symbols, and another time for yy_destroy_ and
+# yy_symbol_value_print_, which don't use genuine symbols yet.
+m4_define([b4_symbol_action],
+[b4_symbol_if([$1], [has_$2],
+[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl
+b4_dollar_pushdef([yysym.value],
+                  [$1],
+                  [],
+                  [yysym.location])dnl
+      _b4_symbol_case([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
+        b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])dnl
+        break;
+
+m4_popdef([b4_symbol_value])[]dnl
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_symbol_action_for_yyval(SYMBOL-NUM, KIND)
+# --------------------------------------------
+# Run the action KIND (destructor or printer) for SYMBOL-NUM.
+# Same as in C, but using references instead of pointers.
+m4_define([b4_symbol_action_for_yyval],
+[b4_symbol_if([$1], [has_$2],
+[b4_dollar_pushdef([yyval],
+                   [$1],
+                   [],
+                   [yyloc])dnl
+      _b4_symbol_case([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
+        b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])dnl
+        break;
+
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
+# ---------------------------------------------------
+m4_define([b4_call_merger],
+[b4_case([$1],
+         [    b4_symbol_if([$3], [has_type],
+                           [b4_variant_if([yy0.as< b4_symbol($3, type) > () = $2 (yy0.as< b4_symbol($3, type) >(), yy1.as< b4_symbol($3, type) >());],
+                                          [yy0.b4_symbol($3, slot) = $2 (yy0, yy1);])],
+                           [yy0 = $2 (yy0, yy1);])])])
+
+# b4_yylex
+# --------
+# Call yylex.
+m4_define([b4_yylex],
+[b4_token_ctor_if(
+[b4_function_call([yylex],
+                  [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
+[b4_function_call([yylex], [int],
+                  [[value_type *], [&this->yyla.value]][]dnl
+b4_locations_if([, [[location_type *], [&this->yyla.location]]])dnl
+m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
+
+
+# b4_shared_declarations(hh|cc)
+# -----------------------------
+# Declaration that might either go into the header (if --header, $1 = hh)
+# or in the implementation file.
+m4_define([b4_shared_declarations],
+[b4_percent_code_get([[requires]])[
+#include <algorithm>
+#include <cstddef> // ptrdiff_t
+#include <cstring> // memcpy
+#include <iostream>
+#include <iomanip>
+#include <limits>
+#include <stdexcept>
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+]b4_cxx_portability[
+]m4_ifdef([b4_location_include],
+          [[# include ]b4_location_include])[
+]b4_variant_if([b4_variant_includes])[
+
+]b4_YYDEBUG_define[
+
+]b4_namespace_open[
+
+]b4_bison_locations_if([m4_ifndef([b4_location_file],
+                                  [b4_location_define])])[
+
+  /// A Bison parser.
+  class ]b4_parser_class[
+  {
+  public:
+]b4_public_types_declare[
+]b4_symbol_type_define[
+
+    // FIXME: should be private eventually.
+    class glr_stack;
+    class glr_state;
+
+    /// Build a parser object.
+    ]b4_parser_class[ (]b4_parse_param_decl[);
+    ~]b4_parser_class[ ();
+
+    /// Parse.  An alias for parse ().
+    /// \returns  0 iff parsing succeeded.
+    int operator() ();
+
+    /// Parse.
+    /// \returns  0 iff parsing succeeded.
+    int parse ();
+
+#if ]b4_api_PREFIX[DEBUG
+    /// The current debugging stream.
+    std::ostream& debug_stream () const;
+    /// Set the current debugging stream.
+    void set_debug_stream (std::ostream &);
+
+    /// Type for debugging levels.
+    using debug_level_type = int;
+    /// The current debugging level.
+    debug_level_type debug_level () const;
+    /// Set the current debugging level.
+    void set_debug_level (debug_level_type l);
+#endif
+
+    /// Report a syntax error.]b4_locations_if([[
+    /// \param loc    where the syntax error is found.]])[
+    /// \param msg    a description of the syntax error.
+    void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
+
+]b4_parse_error_bmatch(
+[custom\|detailed],
+[[    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static const char *symbol_name (symbol_kind_type yysymbol);]],
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static const char *symbol_name (symbol_kind_type yysymbol);
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static std::string symbol_name (symbol_kind_type yysymbol);]])[
+
+]b4_token_constructor_define[
+]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
+    class context
+    {
+    public:
+      context (glr_stack& yystack, const symbol_type& yyla);
+      const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
+      symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[
+      const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
+]])[
+      /// Put in YYARG at most YYARGN of the expected tokens, and return the
+      /// number of tokens stored in YYARG.  If YYARG is null, return the
+      /// number of expected tokens (guaranteed to be less than YYNTOKENS).
+      int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
+
+    private:
+      glr_stack& yystack_;
+      const symbol_type& yyla_;
+    };
+]])[
+# if ]b4_api_PREFIX[DEBUG
+  public:
+    /// \brief Report a symbol value on the debug stream.
+    /// \param yykind   The symbol kind.
+    /// \param yyval    Its semantic value.]b4_locations_if([[
+    /// \param yyloc    Its location.]])[
+    void yy_symbol_value_print_ (symbol_kind_type yykind,
+                                 const value_type& yyval]b4_locations_if([[,
+                                 const location_type& yyloc]])[) const;
+    /// \brief Report a symbol on the debug stream.
+    /// \param yykind   The symbol kind.
+    /// \param yyval    Its semantic value.]b4_locations_if([[
+    /// \param yyloc    Its location.]])[
+    void yy_symbol_print_ (symbol_kind_type yykind,
+                           const value_type& yyval]b4_locations_if([[,
+                           const location_type& yyloc]])[) const;
+  private:
+    /// Debug stream.
+    std::ostream* yycdebug_;
+#endif
+
+]b4_parse_error_bmatch(
+[custom], [[
+  private:
+    /// Report a syntax error
+    /// \param yyctx     the context in which the error occurred.
+    void report_syntax_error (const context& yyctx) const;]],
+[detailed\|verbose], [[
+  private:
+    /// The arguments of the error message.
+    int yy_syntax_error_arguments_ (const context& yyctx,
+                                    symbol_kind_type yyarg[], int yyargn) const;
+
+    /// Generate an error message.
+    /// \param yyctx     the context in which the error occurred.
+    virtual std::string yysyntax_error_ (const context& yyctx) const;]])[
+
+    /// Convert a scanner token kind \a t to a symbol kind.
+    /// In theory \a t should be a token_kind_type, but character literals
+    /// are valid, yet not members of the token_kind_type enum.
+    static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT;
+
+]b4_parse_error_bmatch(
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+    /// For a symbol, its name in clear.
+    static const char* const yytname_[];
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[    /// Convert the symbol name \a n to a form suitable for a diagnostic.
+    static std::string yytnamerr_ (const char *yystr);
+
+    /// For a symbol, its name in clear.
+    static const char* const yytname_[];
+]])[
+
+    /// \brief Reclaim the memory associated to a symbol.
+    /// \param yymsg     Why this token is reclaimed.
+    ///                  If null, print nothing.
+    /// \param yykind    The symbol kind.
+    void yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
+                      value_type& yyval]b4_locations_if([[,
+                      location_type& yyloc]])[);
+
+]b4_parse_param_vars[
+    // Needs access to yy_destroy_, report_syntax_error, etc.
+    friend glr_stack;
+  };
+
+]b4_token_ctor_if([b4_yytranslate_define([$1])[
+]b4_public_types_define([$1])])[
+]b4_namespace_close[
+
+]b4_percent_code_get([[provides]])[
+]])[
+
+
+## -------------- ##
+## Output files.  ##
+## -------------- ##
+
+
+# ------------- #
+# Header file.  #
+# ------------- #
+
+]b4_header_if([[
+]b4_output_begin([b4_spec_header_file])[
+]b4_copyright([Skeleton interface for Bison GLR parsers in C++],
+             [2002-2015, 2018-2021])[
+// C++ GLR parser skeleton written by Valentin Tolmer.
+
+]b4_disclaimer[
+]b4_cpp_guard_open([b4_spec_mapped_header_file])[
+]b4_shared_declarations([hh])[
+]b4_cpp_guard_close([b4_spec_mapped_header_file])[
+]b4_output_end])[
+
+
+# --------------------- #
+# Implementation file.  #
+# --------------------- #
+
+]b4_output_begin([b4_parser_file_name])[
+]b4_copyright([Skeleton implementation for Bison GLR parsers in C],
+              [2002-2015, 2018-2021])[
+// C++ GLR parser skeleton written by Valentin Tolmer.
+
+]b4_disclaimer[
+]b4_identification[
+
+]b4_percent_code_get([[top]])[
+]m4_if(b4_prefix, [yy], [],
+[[/* Substitute the variable and function names.  */
+#define yyparse ]b4_prefix[parse
+#define yylex   ]b4_prefix[lex
+#define yyerror ]b4_prefix[error
+#define yydebug ]b4_prefix[debug]])[
+
+]b4_user_pre_prologue[
+
+]b4_null_define[
+
+]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
+              [b4_shared_declarations([cc])])[
+
+namespace
+{
+  /* Default (constant) value used for initialization for null
+     right-hand sides.  Unlike the standard yacc.c template, here we set
+     the default value of $$ to a zeroed-out value.  Since the default
+     value is undefined, this behavior is technically correct.  */
+  ]b4_namespace_ref[::]b4_parser_class[::value_type yyval_default;
+}
+
+]b4_user_post_prologue[
+]b4_percent_code_get[
+
+#include <cstdio>
+#include <cstdlib>
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+#  define YY_EXCEPTIONS 0
+# else
+#  define YY_EXCEPTIONS 1
+# endif
+#endif
+
+#ifndef YYFREE
+# define YYFREE free
+#endif
+#ifndef YYMALLOC
+# define YYMALLOC malloc
+#endif
+
+#ifndef YYSETJMP
+# include <setjmp.h>
+# define YYJMP_BUF jmp_buf
+# define YYSETJMP(Env) setjmp (Env)
+/* Pacify Clang and ICC.  */
+# define YYLONGJMP(Env, Val)                    \
+ do {                                           \
+   longjmp (Env, Val);                          \
+   YYASSERT (0);                                \
+ } while (false)
+#endif
+
+]b4_attribute_define([noreturn])[
+
+#if defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_NULL_DEREFERENCE_BEGIN                               \
+  _Pragma ("GCC diagnostic push")                                       \
+  _Pragma ("GCC diagnostic ignored \"-Wnull-dereference\"")
+# define YY_IGNORE_NULL_DEREFERENCE_END         \
+  _Pragma ("GCC diagnostic pop")
+#else
+# define YY_IGNORE_NULL_DEREFERENCE_BEGIN
+# define YY_IGNORE_NULL_DEREFERENCE_END
+#endif
+
+]b4_null_define[
+]b4_cast_define[
+
+// FIXME: Use the same conventions as lalr1.cc.
+]b4_parse_assert_if[
+#ifndef YYASSERT
+# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
+#endif
+
+#ifdef YYDEBUG
+# define YYDASSERT(Condition) YYASSERT(Condition)
+#else
+# define YYDASSERT(Condition)
+#endif
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  ]b4_final_state_number[
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   ]b4_last[
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  ]b4_tokens_number[
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  ]b4_nterms_number[
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  ]b4_rules_number[
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  ]b4_states_number[
+/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule.  */
+#define YYMAXRHS ]b4_r2_max[
+/* YYMAXLEFT -- Maximum number of symbols to the left of a handle
+   accessed by $0, $-1, etc., in any rule.  */
+#define YYMAXLEFT ]b4_max_left_semantic_context[
+
+namespace
+{
+#if ]b4_api_PREFIX[DEBUG
+  /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+  const ]b4_int_type_for([b4_rline])[ yyrline[] =
+  {
+  ]b4_rline[
+  };
+#endif
+
+#define YYPACT_NINF ]b4_pact_ninf[
+#define YYTABLE_NINF ]b4_table_ninf[
+
+]b4_parser_tables_define[
+
+  /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none).  */
+  const ]b4_int_type_for([b4_dprec])[ yydprec[] =
+  {
+  ]b4_dprec[
+  };
+
+  /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM.  */
+  const ]b4_int_type_for([b4_merger])[ yymerger[] =
+  {
+  ]b4_merger[
+  };
+
+  /* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as
+     in the case of predicates.  */
+  const bool yyimmediate[] =
+  {
+  ]b4_immediate[
+  };
+
+  /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
+     list of conflicting reductions corresponding to action entry for
+     state STATE-NUM in yytable.  0 means no conflicts.  The list in
+     yyconfl is terminated by a rule number of 0.  */
+  const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
+  {
+  ]b4_conflict_list_heads[
+  };
+
+  /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
+     0, pointed into by YYCONFLP.  */
+  ]dnl Do not use b4_int_type_for here, since there are places where
+  dnl pointers onto yyconfl are taken, whose type is "short*".
+  dnl We probably ought to introduce a type for confl.
+  [const short yyconfl[] =
+  {
+  ]b4_conflicting_rules[
+  };
+} // namespace
+
+
+/* Error token number */
+#define YYTERROR 1
+
+]b4_locations_if([[
+]b4_yylloc_default_define[
+# define YYRHSLOC(Rhs, K) ((Rhs)[K].getState().yyloc)
+]])[
+
+enum YYRESULTTAG { yyok, yyaccept, yyabort, yyerr };
+
+#define YYCHK(YYE)                              \
+  do {                                          \
+    YYRESULTTAG yychk_flag = YYE;               \
+    if (yychk_flag != yyok)                     \
+      return yychk_flag;                        \
+  } while (false)
+
+#if ]b4_api_PREFIX[DEBUG
+
+#define YYCDEBUG if (!yydebug) {} else std::cerr
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                  \
+  do {                                                                  \
+    if (yydebug)                                                        \
+      {                                                                 \
+        std::cerr << Title << ' ';                                      \
+        yyparser.yy_symbol_print_ (Kind, Value]b4_locations_if([, Location])[); \
+        std::cerr << '\n';                                              \
+      }                                                                 \
+  } while (false)
+
+# define YY_REDUCE_PRINT(Args)                  \
+  do {                                          \
+    if (yydebug)                                \
+      yystateStack.yy_reduce_print Args;        \
+  } while (false)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+
+namespace
+{
+  using glr_stack = ]b4_namespace_ref[::]b4_parser_class[::glr_stack;
+  using glr_state = ]b4_namespace_ref[::]b4_parser_class[::glr_state;
+
+  void yypstack (const glr_stack& yystack, size_t yyk)
+    YY_ATTRIBUTE_UNUSED;
+  void yypdumpstack (const glr_stack& yystack)
+    YY_ATTRIBUTE_UNUSED;
+}
+
+#else /* !]b4_api_PREFIX[DEBUG */
+
+# define YYCDEBUG if (true) {} else std::cerr
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) {}
+# define YY_REDUCE_PRINT(Args) {}
+
+#endif /* !]b4_api_PREFIX[DEBUG */
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH ]b4_stack_depth_init[
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH ]b4_stack_depth_max[
+#endif
+
+/* Minimum number of free items on the stack allowed after an
+   allocation.  This is to allow allocation and initialization
+   to be completed by functions that call yyexpandGLRStack before the
+   stack is expanded, thus insuring that all necessary pointers get
+   properly redirected to new data.  */
+#define YYHEADROOM 2
+
+#ifndef YYSTACKEXPANDABLE
+# define YYSTACKEXPANDABLE 1
+#endif
+
+namespace
+{
+  template <typename Parameter>
+  class strong_index_alias
+  {
+  public:
+    static strong_index_alias create (std::ptrdiff_t value)
+    {
+      strong_index_alias result;
+      result.value_ = value;
+      return result;
+    }
+
+    std::ptrdiff_t const& get () const { return value_; }
+
+    size_t uget () const { return static_cast<size_t> (value_); }
+
+    strong_index_alias operator+ (std::ptrdiff_t other) const
+    {
+      return strong_index_alias (get () + other);
+    }
+
+    void operator+= (std::ptrdiff_t other)
+    {
+      value_ += other;
+    }
+
+    strong_index_alias operator- (std::ptrdiff_t other)
+    {
+      return strong_index_alias (get () - other);
+    }
+
+    void operator-= (std::ptrdiff_t other)
+    {
+      value_ -= other;
+    }
+
+    size_t operator- (strong_index_alias other)
+    {
+      return strong_index_alias (get () - other.get ());
+    }
+
+    strong_index_alias& operator++ ()
+    {
+      ++value_;
+      return *this;
+    }
+
+    bool isValid () const
+    {
+      return value_ != INVALID_INDEX;
+    }
+
+    void setInvalid()
+    {
+      value_ = INVALID_INDEX;
+    }
+
+    bool operator== (strong_index_alias other)
+    {
+      return get () == other.get ();
+    }
+
+    bool operator!= (strong_index_alias other)
+    {
+      return get () != other.get ();
+    }
+
+    bool operator< (strong_index_alias other)
+    {
+      return get () < other.get ();
+    }
+
+  private:
+    static const std::ptrdiff_t INVALID_INDEX;
+
+    // WARNING: 0-initialized.
+    std::ptrdiff_t value_;
+  }; // class strong_index_alias
+
+  template<typename T>
+  const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX =
+    std::numeric_limits<std::ptrdiff_t>::max ();
+
+  using state_set_index = strong_index_alias<struct glr_state_set_tag>;
+
+  state_set_index create_state_set_index (std::ptrdiff_t value)
+  {
+    return state_set_index::create (value);
+  }
+
+  /** State numbers, as in LALR(1) machine */
+  using state_num = int;
+
+  /** Rule numbers, as in LALR(1) machine */
+  using rule_num = int;
+
+  using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
+  using glr_state = parser_type::glr_state;
+  using symbol_kind = parser_type::symbol_kind;
+  using symbol_kind_type = parser_type::symbol_kind_type;
+  using symbol_type = parser_type::symbol_type;
+  using value_type = parser_type::value_type;]b4_locations_if([[
+  using location_type = parser_type::location_type;]])[
+
+  // Forward declarations.
+  class glr_stack_item;
+  class semantic_option;
+} // namespace
+
+namespace
+{
+  /** Accessing symbol of state YYSTATE.  */
+  inline symbol_kind_type
+  yy_accessing_symbol (state_num yystate)
+  {
+    return YY_CAST (symbol_kind_type, yystos[yystate]);
+  }
+
+  /** Left-hand-side symbol for rule #YYRULE.  */
+  inline symbol_kind_type
+  yylhsNonterm (rule_num yyrule)
+  {
+    return static_cast<symbol_kind_type>(yyr1[yyrule]);
+  }
+
+  /** Number of symbols composing the right hand side of rule #RULE.  */
+  inline int
+  yyrhsLength (rule_num yyrule)
+  {
+    return yyr2[yyrule];
+  }
+}
+
+namespace ]b4_namespace_ref[
+{
+  class ]b4_parser_class[::glr_state
+  {
+  public:
+    glr_state ()
+      : yyresolved (false)
+      , yylrState (0)
+      , yyposn (0)
+      , yypred (0)
+      , yyfirstVal (0)]b4_locations_if([[
+      , yyloc ()]])[]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {}
+
+    /// Build with a semantic value.
+    glr_state (state_num lrState, size_t posn, const value_type& val]b4_locations_if([[, const location_type& loc]])[)
+      : yyresolved (true)
+      , yylrState (lrState)
+      , yyposn (posn)
+      , yypred (0)
+      , yyval (]b4_variant_if([], [[val]])[)]b4_locations_if([[
+      , yyloc (loc)]])[]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {]b4_variant_if([[
+      ]b4_symbol_variant([yy_accessing_symbol (lrState)],
+                         [yyval], [copy], [val])])[}
+
+    /// Build with a semantic option.
+    glr_state (state_num lrState, size_t posn)
+      : yyresolved (false)
+      , yylrState (lrState)
+      , yyposn (posn)
+      , yypred (0)
+      , yyfirstVal (0)]b4_locations_if([[
+      , yyloc ()]])[]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {}
+
+    glr_state (const glr_state& other)
+      : yyresolved (other.yyresolved)
+      , yylrState (other.yylrState)
+      , yyposn (other.yyposn)
+      , yypred (0)]b4_locations_if([[
+      , yyloc (other.yyloc)]])[]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {
+      setPred (other.pred ());
+      if (other.yyresolved)]b4_variant_if([[
+        {
+          new (&yyval) value_type ();
+          ]b4_symbol_variant([yy_accessing_symbol (other.yylrState)],
+                             [yyval], [copy], [other.value ()])[
+        }]], [[
+        new (&yyval) value_type (other.value ());]])[
+      else
+        {
+          yyfirstVal = 0;
+          setFirstVal (other.firstVal ());
+        }]b4_parse_assert_if([[
+      check_();]])[
+    }
+
+    ~glr_state ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      if (yyresolved)
+        {]b4_variant_if([[
+          symbol_kind_type yykind = yy_accessing_symbol (yylrState);
+          // FIXME: User destructors.
+          // Value type destructor.
+          ]b4_symbol_variant([[yykind]], [[yyval]], [[template destroy]])])[
+          yyval.~value_type ();
+        }]b4_parse_assert_if([[
+      magic_ = 0;]])[
+    }
+
+    glr_state& operator= (const glr_state& other)
+    {]b4_parse_assert_if([[
+      check_ ();
+      other.check_ ();]])[
+      if (!yyresolved && other.yyresolved)
+        new (&yyval) value_type;
+      yyresolved = other.yyresolved;
+      yylrState = other.yylrState;
+      yyposn = other.yyposn;
+      setPred (other.pred ());
+      if (other.yyresolved)]b4_variant_if([[
+        ]b4_symbol_variant([yy_accessing_symbol (other.yylrState)],
+                           [yyval], [copy], [other.value ()])], [[
+        value () = other.value ();]])[
+      else
+        setFirstVal (other.firstVal ());]b4_locations_if([[
+      yyloc = other.yyloc;]])[
+      return *this;
+    }
+
+    /** Type tag for the semantic value.  If true, yyval applies, otherwise
+     *  yyfirstVal applies.  */
+    bool yyresolved;
+    /** Number of corresponding LALR(1) machine state.  */
+    state_num yylrState;
+    /** Source position of the last token produced by my symbol */
+    size_t yyposn;
+
+    /// Only call pred() and setPred() on objects in yyitems, not temporaries.
+    glr_state* pred ();
+    const glr_state* pred () const;
+    void setPred (const glr_state* state);
+
+    /// Only call firstVal() and setFirstVal() on objects in yyitems, not
+    /// temporaries.
+    semantic_option* firstVal ();
+    const semantic_option* firstVal () const;
+    void setFirstVal (const semantic_option* option);
+
+    value_type& value ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      return yyval;
+    }
+
+    const value_type& value () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      return yyval;
+    }
+
+    void
+    destroy (char const *yymsg, ]b4_namespace_ref[::]b4_parser_class[& yyparser);
+
+    /* DEBUGGING ONLY */
+  #if ]b4_api_PREFIX[DEBUG
+    void yy_yypstack () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      if (pred () != YY_NULLPTR)
+        {
+          pred ()->yy_yypstack ();
+          std::cerr << " -> ";
+        }
+      std::cerr << yylrState << "@@" << yyposn;
+    }
+  #endif
+
+    std::ptrdiff_t indexIn (const glr_stack_item* array) const YY_ATTRIBUTE_UNUSED;
+
+    glr_stack_item* asItem ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      return asItem(this);
+    }
+
+    const glr_stack_item* asItem () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      return asItem (this);
+    }
+
+  private:
+    template <typename T>
+    static const glr_stack_item* asItem (const T* state)
+    {
+      return reinterpret_cast<const glr_stack_item*>(state);
+    }
+    template <typename T>
+    static glr_stack_item* asItem (T* state)
+    {
+      return reinterpret_cast<glr_stack_item*> (state);
+    }
+    static const char *as_pointer_ (const glr_state *state)
+    {
+      return reinterpret_cast<const char *> (state);
+    }
+    static char *as_pointer_ (glr_state *state)
+    {
+      return reinterpret_cast<char *> (state);
+    }
+    /** Preceding state in this stack */
+    std::ptrdiff_t yypred;
+    union {
+      /** First in a chain of alternative reductions producing the
+       *  nonterminal corresponding to this state, threaded through
+       *  yyfirstVal.  Value "0" means empty.  */
+      std::ptrdiff_t yyfirstVal;
+      /** Semantic value for this state.  */
+      value_type yyval;
+    };]b4_locations_if([[
+   // FIXME: Why public?
+   public:
+    /** Source location for this state.  */
+    location_type yyloc;]])[
+
+]b4_parse_assert_if([[
+  public:
+    // Check invariants.
+    void check_ () const
+    {
+      YY_IGNORE_NULL_DEREFERENCE_BEGIN
+      YYASSERT (this->magic_ == MAGIC);
+      YY_IGNORE_NULL_DEREFERENCE_END
+    }
+
+    // A magic number to check our pointer arithmetic is sane.
+    enum { MAGIC = 713705 };
+    unsigned int magic_;]])[
+  }; // class ]b4_parser_class[::glr_state
+} // namespace ]b4_namespace_ref[
+
+
+namespace
+{
+  /** A stack of GLRState representing the different heads during
+    * nondeterministic evaluation. */
+  class glr_state_set
+  {
+  public:
+    /** Initialize YYSET to a singleton set containing an empty stack.  */
+    glr_state_set ()
+      : yylastDeleted (YY_NULLPTR)
+    {
+      yystates.push_back (YY_NULLPTR);
+      yylookaheadNeeds.push_back (false);
+    }
+
+    // Behave like a vector of states.
+    glr_state*& operator[] (state_set_index index)
+    {
+      return yystates[index.uget()];
+    }
+
+    glr_state* operator[] (state_set_index index) const
+    {
+      return yystates[index.uget()];
+    }
+
+    size_t size () const
+    {
+      return yystates.size ();
+    }
+
+    std::vector<glr_state*>::iterator begin ()
+    {
+      return yystates.begin ();
+    }
+
+    std::vector<glr_state*>::iterator end ()
+    {
+      return yystates.end ();
+    }
+
+    bool lookaheadNeeds (state_set_index index) const
+    {
+      return yylookaheadNeeds[index.uget ()];
+    }
+
+    bool setLookaheadNeeds (state_set_index index, bool value)
+    {
+      return yylookaheadNeeds[index.uget ()] = value;
+    }
+
+    /** Invalidate stack #YYK.  */
+    void
+    yymarkStackDeleted (state_set_index yyk)
+    {
+      size_t k = yyk.uget ();
+      if (yystates[k] != YY_NULLPTR)
+        yylastDeleted = yystates[k];
+      yystates[k] = YY_NULLPTR;
+    }
+
+    /** Undelete the last stack in *this that was marked as deleted.  Can
+        only be done once after a deletion, and only when all other stacks have
+        been deleted.  */
+    void
+    yyundeleteLastStack ()
+    {
+      if (yylastDeleted == YY_NULLPTR || !yystates.empty ())
+        return;
+      yystates.push_back (yylastDeleted);
+      YYCDEBUG << "Restoring last deleted stack as stack #0.\n";
+      clearLastDeleted ();
+    }
+
+    /** Remove the dead stacks (yystates[i] == YY_NULLPTR) and shift the later
+     * ones.  */
+    void
+    yyremoveDeletes ()
+    {
+      size_t newsize = yystates.size ();
+      /* j is the number of live stacks we have seen.  */
+      for (size_t i = 0, j = 0; j < newsize; ++i)
+        {
+          if (yystates[i] == YY_NULLPTR)
+            {
+              if (i == j)
+                {
+                  YYCDEBUG << "Removing dead stacks.\n";
+                }
+              newsize -= 1;
+            }
+          else
+            {
+              yystates[j] = yystates[i];
+              /* In the current implementation, it's unnecessary to copy
+                 yylookaheadNeeds[i] since, after
+                 yyremoveDeletes returns, the parser immediately either enters
+                 deterministic operation or shifts a token.  However, it doesn't
+                 hurt, and the code might evolve to need it.  */
+              yylookaheadNeeds[j] = yylookaheadNeeds[i];
+              if (j != i)
+                {
+                  YYCDEBUG << "Rename stack " << i << " -> " << j << ".\n";
+                }
+              j += 1;
+            }
+        }
+      yystates.resize (newsize);
+      yylookaheadNeeds.resize (newsize);
+    }
+
+
+    state_set_index
+    yysplitStack (state_set_index yyk)
+    {
+      const size_t k = yyk.uget ();
+      yystates.push_back (yystates[k]);
+      yylookaheadNeeds.push_back (yylookaheadNeeds[k]);
+      return create_state_set_index (static_cast<std::ptrdiff_t> (yystates.size () - 1));
+    }
+
+    void clearLastDeleted ()
+    {
+      yylastDeleted = YY_NULLPTR;
+    }
+
+  private:
+
+    std::vector<glr_state*> yystates;
+    /** During nondeterministic operation, yylookaheadNeeds tracks which
+     *  stacks have actually needed the current lookahead.  During deterministic
+     *  operation, yylookaheadNeeds[0] is not maintained since it would merely
+     *  duplicate !yyla.empty ().  */
+    std::vector<bool> yylookaheadNeeds;
+
+    /** The last stack we invalidated.  */
+    glr_state* yylastDeleted;
+  }; // class glr_state_set
+} // namespace
+
+namespace
+{
+  class semantic_option
+  {
+  public:
+    semantic_option ()
+      : yyrule (0)
+      , yystate (0)
+      , yynext (0)
+      , yyla ()]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {}
+
+    semantic_option (rule_num rule)
+      : yyrule (rule)
+      , yystate (0)
+      , yynext (0)
+      , yyla ()]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {}
+
+    semantic_option (const semantic_option& that)
+      : yyrule (that.yyrule)
+      , yystate (that.yystate)
+      , yynext (that.yynext)
+      , yyla (that.yyla)]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {]b4_parse_assert_if([[
+      that.check_ ();]])[
+    }
+
+    // Needed for the assignment in yynewSemanticOption.
+    semantic_option& operator= (const semantic_option& that)
+    {]b4_parse_assert_if([[
+      check_ ();
+      that.check_ ();]])[
+      yyrule = that.yyrule;
+      yystate = that.yystate;
+      yynext = that.yynext;
+      yyla = that.yyla;
+      return *this;
+    }
+
+    /// Only call state() and setState() on objects in yyitems, not temporaries.
+    glr_state* state();
+    const glr_state* state() const;
+    void setState(const glr_state* s);
+
+    const semantic_option* next () const YY_ATTRIBUTE_UNUSED;
+    semantic_option* next ();
+    void setNext (const semantic_option* s);
+
+    std::ptrdiff_t indexIn (const glr_stack_item* array) const YY_ATTRIBUTE_UNUSED;
+
+    /** True iff YYY0 and YYY1 represent identical options at the top level.
+     *  That is, they represent the same rule applied to RHS symbols
+     *  that produce the same terminal symbols.  */
+    bool
+    isIdenticalTo (const semantic_option& yyy1) const
+    {]b4_parse_assert_if([[
+      check_ ();
+      yyy1.check_ ();]])[
+      if (this->yyrule == yyy1.yyrule)
+        {
+          const glr_state *yys0, *yys1;
+          int yyn;
+          for (yys0 = this->state(),
+               yys1 = yyy1.state(),
+               yyn = yyrhsLength (this->yyrule);
+               yyn > 0;
+               yys0 = yys0->pred(),
+               yys1 = yys1->pred(), yyn -= 1)
+            if (yys0->yyposn != yys1->yyposn)
+              return false;
+          return true;
+        }
+      else
+        return false;
+    }
+
+    /** Assuming identicalOptions (YYY0,YYY1), destructively merge the
+     *  alternative semantic values for the RHS-symbols of YYY1 and YYY0.  */
+    void
+    mergeWith (semantic_option& yyy1)
+    {]b4_parse_assert_if([[
+      check_ ();
+      yyy1.check_ ();]])[
+      glr_state *yys0 = this->state ();
+      glr_state *yys1 = yyy1.state ();
+      for (int yyn = yyrhsLength (this->yyrule);
+           yyn > 0;
+           yyn -= 1, yys0 = yys0->pred (), yys1 = yys1->pred ())
+        {
+          if (yys0 == yys1)
+            break;
+          else if (yys0->yyresolved)
+            {
+              yys1->yyresolved = true;]b4_variant_if([[
+              YYASSERT (yys1->yylrState == yys0->yylrState);
+              ]b4_symbol_variant([yy_accessing_symbol (yys0->yylrState)],
+                                 [yys1->value ()], [copy], [yys0->value ()])], [[
+              yys1->value () = yys0->value ();]])[
+            }
+          else if (yys1->yyresolved)
+            {
+              yys0->yyresolved = true;]b4_variant_if([[
+              YYASSERT (yys0->yylrState == yys1->yylrState);
+              ]b4_symbol_variant([yy_accessing_symbol (yys1->yylrState)],
+                                 [yys0->value ()], [copy], [yys1->value ()])], [[
+              yys0->value () = yys1->value ();]])[
+            }
+          else
+            {
+              semantic_option* yyz0prev = YY_NULLPTR;
+              semantic_option* yyz0 = yys0->firstVal();
+              semantic_option* yyz1 = yys1->firstVal();
+              while (true)
+                {
+                  if (yyz1 == yyz0 || yyz1 == YY_NULLPTR)
+                    break;
+                  else if (yyz0 == YY_NULLPTR)
+                    {
+                      if (yyz0prev != YY_NULLPTR)
+                        yyz0prev->setNext (yyz1);
+                      else
+                        yys0->setFirstVal (yyz1);
+                      break;
+                    }
+                  else if (yyz0 < yyz1)
+                    {
+                      semantic_option* yyz = yyz0;
+                      if (yyz0prev != YY_NULLPTR)
+                        yyz0prev->setNext(yyz1);
+                      else
+                        yys0->setFirstVal(yyz1);
+                      yyz1 = yyz1->next();
+                      yyz0->setNext(yyz);
+                    }
+                  yyz0prev = yyz0;
+                  yyz0 = yyz0->next();
+                }
+              yys1->setFirstVal(yys0->firstVal());
+            }
+        }
+    }
+
+#if ]b4_api_PREFIX[DEBUG
+    void yyreportTree (size_t yyindent = 2) const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      int yynrhs = yyrhsLength (this->yyrule);
+      const glr_state* yystates[1 + YYMAXRHS];
+      glr_state yyleftmost_state;
+
+      {
+        const glr_state* yys = this->state();
+        for (int yyi = yynrhs; 0 < yyi; yyi -= 1)
+          {
+            yystates[yyi] = yys;
+            yys = yys->pred();
+          }
+        if (yys == YY_NULLPTR)
+          {
+            yyleftmost_state.yyposn = 0;
+            yystates[0] = &yyleftmost_state;
+          }
+        else
+          yystates[0] = yys;
+      }
+
+      std::string yylhs = ]b4_namespace_ref[::]b4_parser_class[::symbol_name (yylhsNonterm (this->yyrule));
+      YYASSERT(this->state());
+      if (this->state()->yyposn < yystates[0]->yyposn + 1)
+        std::cerr << std::string(yyindent, ' ') << yylhs << " -> <Rule "
+                  << this->yyrule - 1 << ", empty>\n";
+      else
+        std::cerr << std::string(yyindent, ' ') << yylhs << " -> <Rule "
+                  << this->yyrule - 1 << ", tokens "
+                  << yystates[0]->yyposn + 1 << " .. "
+                  << this->state()->yyposn << ">\n";
+      for (int yyi = 1; yyi <= yynrhs; yyi += 1)
+        {
+          if (yystates[yyi]->yyresolved)
+            {
+              std::string yysym = ]b4_namespace_ref[::]b4_parser_class[::symbol_name (yy_accessing_symbol (yystates[yyi]->yylrState));
+              if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
+                std::cerr << std::string(yyindent + 2, ' ') << yysym
+                          << " <empty>\n";
+              else
+                std::cerr << std::string(yyindent + 2, ' ') << yysym
+                          << " <tokens " << yystates[yyi-1]->yyposn + 1
+                          << " .. " << yystates[yyi]->yyposn << ">\n";
+            }
+          else
+            yystates[yyi]->firstVal ()->yyreportTree (yyindent+2);
+        }
+    }
+#endif
+
+    /** Rule number for this reduction */
+    rule_num yyrule;
+
+  private:
+    template <typename T>
+    static const glr_stack_item* asItem(const T* state)
+    {
+      return reinterpret_cast<const glr_stack_item*>(state);
+    }
+    template <typename T>
+    static glr_stack_item* asItem(T* state)
+    {
+      return reinterpret_cast<glr_stack_item*>(state);
+    }
+    /** The last RHS state in the list of states to be reduced.  */
+    std::ptrdiff_t yystate;
+    /** Next sibling in chain of options.  To facilitate merging,
+     *  options are chained in decreasing order by address.  */
+    std::ptrdiff_t yynext;
+
+  public:
+    /** The lookahead for this reduction.  */
+    symbol_type yyla;
+
+]b4_parse_assert_if([[
+  public:
+    // Check invariants.
+    void check_ () const
+    {
+      YY_IGNORE_NULL_DEREFERENCE_BEGIN
+      YYASSERT (this->magic_ == MAGIC);
+      YY_IGNORE_NULL_DEREFERENCE_END
+    }
+
+    // A magic number to check our pointer arithmetic is sane.
+    enum { MAGIC = 0xeff1cace };
+    unsigned int magic_;]])[
+  }; // class semantic_option
+} // namespace
+
+namespace
+{
+  /** Type of the items in the GLR stack.
+   *  It can be either a glr_state or a semantic_option. The is_state_ field
+   *  indicates which item of the union is valid.  */
+  class glr_stack_item
+  {
+  public:
+    glr_stack_item (bool state = true)
+      : is_state_ (state)]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {
+      if (is_state_)
+        new (&raw_) glr_state;
+      else
+        new (&raw_) semantic_option;
+    }
+
+    glr_stack_item (const glr_stack_item& other) YY_NOEXCEPT YY_NOTHROW
+      : is_state_ (other.is_state_)]b4_parse_assert_if([[
+      , magic_ (MAGIC)]])[
+    {]b4_parse_assert_if([[
+      other.check_ ();]])[
+      std::memcpy (raw_, other.raw_, union_size);
+    }
+
+    glr_stack_item& operator= (glr_stack_item other)
+    {]b4_parse_assert_if([[
+      check_ ();
+      other.check_ ();]])[
+      std::swap (is_state_, other.is_state_);
+      std::swap (raw_, other.raw_);
+      return *this;
+    }
+
+    ~glr_stack_item ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      if (is_state ())
+        getState ().~glr_state ();
+      else
+        getOption ().~semantic_option ();
+    }
+
+    void setState (const glr_state &state)
+    {]b4_parse_assert_if([[
+      check_ ();
+      state.check_ ();]])[
+      if (this != state.asItem ())
+        {
+          if (is_state_)
+            getState ().~glr_state ();
+          else
+            getOption ().~semantic_option ();
+          new (&raw_) glr_state (state);
+          is_state_ = true;
+        }
+    }
+
+    glr_state& getState ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      YYDASSERT (is_state ());
+      void *yyp = raw_;
+      glr_state& res = *static_cast<glr_state*> (yyp);]b4_parse_assert_if([[
+      res.check_ ();]])[
+      return res;
+    }
+
+    const glr_state& getState () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      YYDASSERT (is_state ());
+      const void *yyp = raw_;
+      const glr_state& res = *static_cast<const glr_state*> (yyp);]b4_parse_assert_if([[
+      res.check_ ();]])[
+      return res;
+    }
+
+    semantic_option& getOption ()
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      YYDASSERT (!is_state ());
+      void *yyp = raw_;
+      return *static_cast<semantic_option*> (yyp);
+    }
+    const semantic_option& getOption () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      YYDASSERT (!is_state ());
+      const void *yyp = raw_;
+      return *static_cast<const semantic_option*> (yyp);
+    }
+    bool is_state () const
+    {]b4_parse_assert_if([[
+      check_ ();]])[
+      return is_state_;
+    }
+
+  private:
+    /// The possible contents of raw_. Since they have constructors, they cannot
+    /// be directly included in the union.
+    union contents
+    {
+      char yystate[sizeof (glr_state)];
+      char yyoption[sizeof (semantic_option)];
+    };
+    enum { union_size = sizeof (contents) };
+    union {
+      /// Strongest alignment constraints.
+      long double yyalign_me;
+      /// A buffer large enough to store the contents.
+      char raw_[union_size];
+    };
+    /** Type tag for the union. */
+    bool is_state_;
+]b4_parse_assert_if([[
+  public:
+    // Check invariants.
+    void check_ () const
+    {
+      YYASSERT (this->magic_ == MAGIC);
+      YYASSERT (this->is_state_ == false || this->is_state_ == true);
+    }
+    // A magic number to check our pointer arithmetic is sane.
+    enum { MAGIC = 0xDEAD1ACC }; // 3735886540.
+    const unsigned int magic_;]])[
+  }; // class glr_stack_item
+} // namespace
+
+glr_state* glr_state::pred ()
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  YY_IGNORE_NULL_DEREFERENCE_BEGIN
+  return yypred ? &asItem (as_pointer_ (this) - yypred)->getState () : YY_NULLPTR;
+  YY_IGNORE_NULL_DEREFERENCE_END
+}
+
+const glr_state* glr_state::pred () const
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  YY_IGNORE_NULL_DEREFERENCE_BEGIN
+  return yypred ? &asItem (as_pointer_ (this) - yypred)->getState () : YY_NULLPTR;
+  YY_IGNORE_NULL_DEREFERENCE_END
+}
+
+void glr_state::setPred (const glr_state* state)
+{]b4_parse_assert_if([[
+  check_ ();
+  if (state)
+    state->check_ ();]])[
+  yypred = state ? as_pointer_ (this) - as_pointer_ (state) : 0;
+}
+
+semantic_option* glr_state::firstVal ()
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR;
+}
+
+const semantic_option* glr_state::firstVal () const
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR;
+}
+
+void glr_state::setFirstVal (const semantic_option* option)
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  yyfirstVal = option ? asItem(this) - asItem(option) : 0;
+}
+
+std::ptrdiff_t glr_state::indexIn (const glr_stack_item* array) const
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  return asItem(this) - array;
+}
+
+std::ptrdiff_t semantic_option::indexIn (const glr_stack_item* array) const
+{
+  return asItem(this) - array;
+}
+
+glr_state* semantic_option::state ()
+{
+  YY_IGNORE_NULL_DEREFERENCE_BEGIN
+  return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR;
+  YY_IGNORE_NULL_DEREFERENCE_END
+}
+
+const glr_state* semantic_option::state () const
+{
+  return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR;
+}
+
+void semantic_option::setState (const glr_state* s)
+{
+  yystate = s ? asItem(this) - asItem(s) : 0;
+}
+
+const semantic_option* semantic_option::next () const
+{
+  return yynext ? &(asItem(this) - yynext)->getOption() : YY_NULLPTR;
+}
+
+semantic_option* semantic_option::next ()
+{
+  return yynext ? &(asItem(this) - yynext)->getOption() : YY_NULLPTR;
+}
+
+void semantic_option::setNext (const semantic_option* s)
+{
+  yynext = s ? asItem(this) - asItem(s) : 0;
+}
+
+void glr_state::destroy (char const* yymsg, ]b4_namespace_ref[::]b4_parser_class[& yyparser)
+{]b4_parse_assert_if([[
+  check_ ();]])[
+  if (yyresolved)
+    yyparser.yy_destroy_ (yymsg, yy_accessing_symbol(yylrState),
+                          value ()]b4_locations_if([, yyloc])[);
+  else
+    {
+#if ]b4_api_PREFIX[DEBUG
+      YYCDEBUG << yymsg
+               << (firstVal() ? " unresolved " : " incomplete ")
+               << (yy_accessing_symbol (yylrState) < YYNTOKENS ? "token" : "nterm")
+               << ' ' << yyparser.symbol_name (yy_accessing_symbol (yylrState))
+               << " ("]b4_locations_if([[
+               << yyloc << ": "]])[
+               << ")\n";
+#endif
+      if (firstVal() != YY_NULLPTR)
+        {
+          semantic_option& yyoption = *firstVal ();
+          glr_state *yyrh = yyoption.state ();
+          for (int yyn = yyrhsLength (yyoption.yyrule); yyn > 0; yyn -= 1)
+            {
+              yyrh->destroy (yymsg, yyparser);
+              yyrh = yyrh->pred();
+            }
+        }
+    }
+}
+
+
+#undef YYFILL
+#define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal)
+
+namespace
+{
+  class state_stack
+  {
+  public:
+    using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
+    using symbol_kind = parser_type::symbol_kind;
+    using value_type = parser_type::value_type;]b4_locations_if([[
+    using location_type = parser_type::location_type;]])[
+
+    /** Initialize to a single empty stack, with total maximum
+     *  capacity for all stacks of YYSIZE.  */
+    state_stack (size_t yysize)
+      : yysplitPoint (YY_NULLPTR)
+    {
+      yyitems.reserve (yysize);
+    }
+
+#if YYSTACKEXPANDABLE
+    /** Returns false if it tried to expand but could not. */
+    bool
+    yyexpandGLRStackIfNeeded ()
+    {
+      return YYHEADROOM <= spaceLeft () || yyexpandGLRStack ();
+    }
+
+  private:
+    /** If *this is expandable, extend it.  WARNING: Pointers into the
+        stack from outside should be considered invalid after this call.
+        We always expand when there are 1 or fewer items left AFTER an
+        allocation, so that we can avoid having external pointers exist
+        across an allocation.  */
+    bool
+    yyexpandGLRStack ()
+    {
+      const size_t oldsize = yyitems.size();
+      if (YYMAXDEPTH - YYHEADROOM < oldsize)
+        return false;
+      const size_t yynewSize = YYMAXDEPTH < 2 * oldsize ? YYMAXDEPTH : 2 * oldsize;
+      const glr_stack_item *oldbase = &yyitems[0];
+
+      yyitems.reserve (yynewSize);
+      const glr_stack_item *newbase = &yyitems[0];
+
+      // Adjust the pointers.  Perform raw pointer arithmetic, as there
+      // is no reason for objects to be aligned on their size.
+      const ptrdiff_t disp
+        = reinterpret_cast<const char*> (newbase) - reinterpret_cast<const char*> (oldbase);
+      if (yysplitPoint)
+        const_cast<glr_state*&> (yysplitPoint)
+          = reinterpret_cast<glr_state*> (reinterpret_cast<char*> (const_cast<glr_state*> (yysplitPoint)) + disp);
+
+      for (std::vector<glr_state*>::iterator
+             i = yytops.begin (),
+             yyend = yytops.end ();
+           i != yyend; ++i)
+        if (glr_state_not_null (*i))
+          *i = reinterpret_cast<glr_state*>(reinterpret_cast<char*>(*i) + disp);
+
+      return true;
+    }
+
+  public:
+#else
+    bool yyexpandGLRStackIfNeeded ()
+    {
+      return YYHEADROOM <= spaceLeft ();
+    }
+#endif
+#undef YYSTACKEXPANDABLE
+
+    static bool glr_state_not_null (glr_state* s)
+    {
+      return s != YY_NULLPTR;
+    }
+
+    bool
+    reduceToOneStack ()
+    {
+      using iterator = std::vector<glr_state*>::iterator;
+      const iterator yybegin = yytops.begin();
+      const iterator yyend = yytops.end();
+      const iterator yyit = std::find_if(yybegin, yyend, glr_state_not_null);
+      if (yyit == yyend)
+        return false;
+      for (state_set_index yyk = create_state_set_index(yyit + 1 - yybegin);
+           yyk.uget() != numTops(); ++yyk)
+        yytops.yymarkStackDeleted (yyk);
+      yytops.yyremoveDeletes ();
+      yycompressStack ();
+      return true;
+    }
+
+    /** Called when returning to deterministic operation to clean up the extra
+     * stacks. */
+    void
+    yycompressStack ()
+    {
+      if (yytops.size() != 1 || !isSplit())
+        return;
+
+      // yyr is the state after the split point.
+      glr_state* yyr = YY_NULLPTR;
+      for (glr_state *yyp = firstTop(), *yyq = yyp->pred();
+           yyp != yysplitPoint;
+           yyr = yyp, yyp = yyq, yyq = yyp->pred())
+        yyp->setPred(yyr);
+
+      // This const_cast is okay, since anyway we have access to the mutable
+      // yyitems into which yysplitPoint points.
+      glr_stack_item* nextFreeItem
+        = const_cast<glr_state*> (yysplitPoint)->asItem () + 1;
+      yysplitPoint = YY_NULLPTR;
+      yytops.clearLastDeleted ();
+
+      while (yyr != YY_NULLPTR)
+        {
+          nextFreeItem->setState (*yyr);
+          glr_state& nextFreeState = nextFreeItem->getState();
+          yyr = yyr->pred();
+          nextFreeState.setPred(&(nextFreeItem - 1)->getState());
+          setFirstTop (&nextFreeState);
+          ++nextFreeItem;
+        }
+      yyitems.resize(static_cast<size_t>(nextFreeItem - yyitems.data()));
+    }
+
+    bool isSplit() const {
+      return yysplitPoint != YY_NULLPTR;
+    }
+
+    // Present the interface of a vector of glr_stack_item.
+    std::vector<glr_stack_item>::const_iterator begin () const
+    {
+      return yyitems.begin ();
+    }
+
+    std::vector<glr_stack_item>::const_iterator end () const
+    {
+      return yyitems.end ();
+    }
+
+    size_t size() const
+    {
+      return yyitems.size ();
+    }
+
+    glr_stack_item& operator[] (size_t i)
+    {
+      return yyitems[i];
+    }
+
+    glr_stack_item& stackItemAt (size_t index)
+    {
+      return yyitems[index];
+    }
+
+    size_t numTops () const
+    {
+      return yytops.size ();
+    }
+
+    glr_state* firstTop () const
+    {
+      return yytops[create_state_set_index (0)];
+    }
+
+    glr_state* topAt (state_set_index i) const
+    {
+      return yytops[i];
+    }
+
+    void setFirstTop (glr_state* value)
+    {
+      yytops[create_state_set_index (0)] = value;
+    }
+
+    void setTopAt (state_set_index i, glr_state* value)
+    {
+      yytops[i] = value;
+    }
+
+    void pop_back ()
+    {
+      yyitems.pop_back ();
+    }
+
+    void pop_back (size_t n)
+    {
+      yyitems.resize (yyitems.size () - n);
+    }
+
+    state_set_index
+    yysplitStack (state_set_index yyk)
+    {
+      if (!isSplit ())
+        {
+          YYASSERT (yyk.get () == 0);
+          yysplitPoint = topAt (yyk);
+        }
+      return yytops.yysplitStack (yyk);
+    }
+
+    /** Assuming that YYS is a GLRState somewhere on *this, update the
+     *  splitpoint of *this, if needed, so that it is at least as deep as
+     *  YYS.  */
+    void
+    yyupdateSplit (glr_state& yys)
+    {
+      if (isSplit() && &yys < yysplitPoint)
+        yysplitPoint = &yys;
+    }
+
+    /** Return a fresh GLRState.
+     * Callers should call yyreserveStack afterwards to make sure there is
+     * sufficient headroom.  */
+    glr_state& yynewGLRState (const glr_state& newState)
+    {
+      glr_state& state = yyitems[yynewGLRStackItem (true)].getState ();
+#if false && 201103L <= YY_CPLUSPLUS
+      state = std::move (newState);
+#else
+      state = newState;
+#endif
+      return state;
+    }
+
+    /** Return a fresh SemanticOption.
+     * Callers should call yyreserveStack afterwards to make sure there is
+     * sufficient headroom.  */
+    semantic_option& yynewSemanticOption (semantic_option newOption)
+    {
+      semantic_option& option = yyitems[yynewGLRStackItem (false)].getOption ();
+      option = std::move (newOption);
+      return option;
+    }
+
+    /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1.  Otherwise, fill in
+     * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
+     * For convenience, always return YYLOW1.  */
+    int
+    yyfill (glr_stack_item *yyvsp, int &yylow, int yylow1, bool yynormal)
+    {
+      if (!yynormal && yylow1 < yylow)
+        {
+          yyfillin (yyvsp, yylow, yylow1);
+          yylow = yylow1;
+        }
+      return yylow1;
+    }
+
+    /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
+     *  at YYVSP[YYLOW0].getState().pred().  Leaves YYVSP[YYLOW1].getState().pred()
+     *  containing the pointer to the next state in the chain.  */
+    void
+    yyfillin (glr_stack_item *yyvsp, int yylow0, int yylow1)
+    {
+      glr_state* s = yyvsp[yylow0].getState().pred();
+      YYASSERT(s != YY_NULLPTR);
+      for (int i = yylow0-1; i >= yylow1; i -= 1, s = s->pred())
+        {
+          glr_state& yys = yyvsp[i].getState();
+#if ]b4_api_PREFIX[DEBUG
+          yys.yylrState = s->yylrState;
+#endif
+          yys.yyresolved = s->yyresolved;
+          if (s->yyresolved)
+            {]b4_variant_if([[
+              new (&yys.value ()) value_type ();
+              ]b4_symbol_variant([yy_accessing_symbol (s->yylrState)],
+                                 [yys.value ()], [copy], [s->value ()])], [[
+              new (&yys.value ()) value_type (s->value ());]])[
+            }
+          else
+            /* The effect of using yyval or yyloc (in an immediate
+             * rule) is undefined.  */
+            yys.setFirstVal (YY_NULLPTR);]b4_locations_if([[
+          yys.yyloc = s->yyloc;]])[
+          yys.setPred(s->pred());
+        }
+    }
+
+#if ]b4_api_PREFIX[DEBUG
+
+    /*----------------------------------------------------------------------.
+    | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
+    `----------------------------------------------------------------------*/
+
+    void
+    yy_reduce_print (bool yynormal, glr_stack_item* yyvsp, state_set_index yyk,
+                     rule_num yyrule, parser_type& yyparser)
+    {
+      int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
+      int yylow = 1;])[
+      int yyi;
+      std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1
+                << " (line " << int (yyrline[yyrule]) << "):\n";
+      if (! yynormal)
+        yyfillin (yyvsp, 1, -yynrhs);
+      /* The symbols being reduced.  */
+      for (yyi = 0; yyi < yynrhs; yyi++)
+        {
+          std::cerr << "   $" << yyi + 1 << " = ";
+          yyparser.yy_symbol_print_
+            (yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].getState().yylrState),
+             yyvsp[yyi - yynrhs + 1].getState().value ()]b4_locations_if([[,
+             ]b4_rhs_location(yynrhs, yyi + 1)])[);
+          if (!yyvsp[yyi - yynrhs + 1].getState().yyresolved)
+            std::cerr << " (unresolved)";
+          std::cerr << '\n';
+        }
+    }
+
+
+#define YYINDEX(YYX)                                                         \
+      ((YYX) == YY_NULLPTR ? -1 : (YYX)->indexIn (yyitems.data ()))
+
+    void
+    dumpStack () const
+    {
+      for (size_t yyi = 0; yyi < size(); ++yyi)
+        {
+          const glr_stack_item& item = yyitems[yyi];
+          std::cerr << std::setw(3) << yyi << ". ";
+          if (item.is_state())
+            {
+              std::cerr << "Res: " << item.getState().yyresolved
+                        << ", LR State: " << item.getState().yylrState
+                        << ", posn: " << item.getState().yyposn
+                        << ", pred: " << YYINDEX(item.getState().pred());
+              if (! item.getState().yyresolved)
+                std::cerr << ", firstVal: "
+                          << YYINDEX(item.getState().firstVal());
+            }
+          else
+            {
+              std::cerr << "Option. rule: " << item.getOption().yyrule - 1
+                        << ", state: " << YYINDEX(item.getOption().state())
+                        << ", next: " << YYINDEX(item.getOption().next());
+            }
+          std::cerr << '\n';
+        }
+      std::cerr << "Tops:";
+      for (state_set_index yyi = create_state_set_index(0); yyi.uget() < numTops(); ++yyi) {
+        std::cerr << yyi.get() << ": " << YYINDEX(topAt(yyi)) << "; ";
+      }
+      std::cerr << '\n';
+    }
+
+#undef YYINDEX
+#endif
+
+    YYRESULTTAG
+    yyreportAmbiguity (const semantic_option& yyx0,
+                       const semantic_option& yyx1, parser_type& yyparser]b4_locations_if([, const location_type& yyloc])[)
+    {
+      YY_USE (yyx0);
+      YY_USE (yyx1);
+
+#if ]b4_api_PREFIX[DEBUG
+      std::cerr << "Ambiguity detected.\n"
+        "Option 1,\n";
+      yyx0.yyreportTree ();
+      std::cerr << "\nOption 2,\n";
+      yyx1.yyreportTree ();
+      std::cerr << '\n';
+#endif
+
+      yyparser.error (]b4_locations_if([yyloc, ])[YY_("syntax is ambiguous"));
+      return yyabort;
+    }
+
+#if ]b4_api_PREFIX[DEBUG
+    /* Print YYS (possibly NULL) and its predecessors. */
+    void
+    yypstates (const glr_state* yys) const
+    {
+      if (yys != YY_NULLPTR)
+        yys->yy_yypstack();
+      else
+        std::cerr << "<null>";
+      std::cerr << '\n';
+    }
+#endif
+
+  private:
+    size_t spaceLeft() const
+    {
+      return yyitems.capacity() - yyitems.size();
+    }
+
+    /** Return a fresh GLRStackItem in this.  The item is an LR state
+     *  if YYIS_STATE, and otherwise a semantic option.  Callers should call
+     *  yyreserveStack afterwards to make sure there is sufficient
+     *  headroom.  */
+    size_t
+    yynewGLRStackItem (bool yyis_state)
+    {
+      YYDASSERT(yyitems.size() < yyitems.capacity());
+      yyitems.push_back(glr_stack_item(yyis_state));
+      return yyitems.size() - 1;
+    }
+
+
+  public:
+    std::vector<glr_stack_item> yyitems;
+    // Where the stack splits. Anything below this address is deterministic.
+    const glr_state* yysplitPoint;
+    glr_state_set yytops;
+  }; // class state_stack
+} // namespace
+
+#undef YYFILL
+#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal)
+
+namespace ]b4_namespace_ref[
+{
+  class ]b4_parser_class[::glr_stack
+  {
+  public:
+]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
+    // Needs access to yypact_value_is_default, etc.
+    friend context;
+]])[
+
+    glr_stack (size_t yysize, parser_type& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[)
+      : yyerrState (0)
+      , yystateStack (yysize)
+      , yyerrcnt (0)
+      , yyla ()
+      , yyparser (yyparser_yyarg)]m4_ifset([b4_parse_param], [,b4_parse_param_cons])[
+    {}
+
+    ~glr_stack ()
+    {
+      if (!this->yyla.empty ())
+        yyparser.yy_destroy_ ("Cleanup: discarding lookahead",
+                              this->yyla.kind (), this->yyla.value]b4_locations_if([, this->yyla.location])[);
+      popall_ ();
+    }
+
+    int yyerrState;
+]b4_locations_if([[  /* To compute the location of the error token.  */
+    glr_stack_item yyerror_range[3];]])[
+    state_stack yystateStack;
+    int yyerrcnt;
+    symbol_type yyla;
+    YYJMP_BUF yyexception_buffer;
+    parser_type& yyparser;
+
+  #define YYCHK1(YYE)                                                          \
+    do {                                                                       \
+      switch (YYE) {                                                           \
+      case yyok:                                                               \
+        break;                                                                 \
+      case yyabort:                                                            \
+        goto yyabortlab;                                                       \
+      case yyaccept:                                                           \
+        goto yyacceptlab;                                                      \
+      case yyerr:                                                              \
+        goto yyuser_error;                                                     \
+      default:                                                                 \
+        goto yybuglab;                                                         \
+      }                                                                        \
+    } while (false)
+
+    int
+    parse ()
+    {
+      int yyresult;
+      size_t yyposn;
+
+      YYCDEBUG << "Starting parse\n";
+
+      this->yyla.clear ();
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([yyla.value], [], [], [yyla.location])dnl
+      b4_user_initial_action
+b4_dollar_popdef])[]dnl
+[
+      switch (YYSETJMP (this->yyexception_buffer))
+        {
+        case 0: break;
+        case 1: goto yyabortlab;
+        case 2: goto yyexhaustedlab;
+        default: goto yybuglab;
+        }
+      this->yyglrShift (create_state_set_index(0), 0, 0, this->yyla.value]b4_locations_if([, this->yyla.location])[);
+      yyposn = 0;
+
+      while (true)
+        {
+          /* For efficiency, we have two loops, the first of which is
+             specialized to deterministic operation (single stack, no
+             potential ambiguity).  */
+          /* Standard mode */
+          while (true)
+            {
+              const state_num yystate = this->firstTopState()->yylrState;
+              YYCDEBUG << "Entering state " << yystate << '\n';
+              if (yystate == YYFINAL)
+                goto yyacceptlab;
+              if (yy_is_defaulted_state (yystate))
+                {
+                  const rule_num yyrule = yy_default_action (yystate);
+                  if (yyrule == 0)
+                    {]b4_locations_if([[
+                      this->yyerror_range[1].getState().yyloc = this->yyla.location;]])[
+                      this->yyreportSyntaxError ();
+                      goto yyuser_error;
+                    }
+                  YYCHK1 (this->yyglrReduce (create_state_set_index(0), yyrule, true));
+                }
+              else
+                {
+                  yyget_token ();
+                  const short* yyconflicts;
+                  const int yyaction = yygetLRActions (yystate, this->yyla.kind (), yyconflicts);
+                  if (*yyconflicts != 0)
+                    break;
+                  if (yy_is_shift_action (yyaction))
+                    {
+                      YY_SYMBOL_PRINT ("Shifting", this->yyla.kind (), this->yyla.value, this->yyla.location);
+                      yyposn += 1;
+                      // FIXME: we should move yylval.
+                      this->yyglrShift (create_state_set_index(0), yyaction, yyposn, this->yyla.value]b4_locations_if([, this->yyla.location])[);
+                      yyla.clear ();
+                      if (0 < this->yyerrState)
+                        this->yyerrState -= 1;
+                    }
+                  else if (yy_is_error_action (yyaction))
+                    {]b4_locations_if([[
+                      this->yyerror_range[1].getState().yyloc = this->yyla.location;]])[
+                      /* Don't issue an error message again for exceptions
+                         thrown from the scanner.  */
+                      if (this->yyla.kind () != ]b4_symbol(error, kind)[)
+                        this->yyreportSyntaxError ();
+                      goto yyuser_error;
+                    }
+                  else
+                    YYCHK1 (this->yyglrReduce (create_state_set_index(0), -yyaction, true));
+                }
+            }
+
+          while (true)
+            {
+              for (state_set_index yys = create_state_set_index(0); yys.uget() < this->yystateStack.numTops(); ++yys)
+                this->yystateStack.yytops.setLookaheadNeeds(yys, !this->yyla.empty ());
+
+              /* yyprocessOneStack returns one of three things:
+
+                  - An error flag.  If the caller is yyprocessOneStack, it
+                    immediately returns as well.  When the caller is finally
+                    yyparse, it jumps to an error label via YYCHK1.
+
+                  - yyok, but yyprocessOneStack has invoked yymarkStackDeleted
+                    (yys), which sets the top state of yys to NULL.  Thus,
+                    yyparse's following invocation of yyremoveDeletes will remove
+                    the stack.
+
+                  - yyok, when ready to shift a token.
+
+                 Except in the first case, yyparse will invoke yyremoveDeletes and
+                 then shift the next token onto all remaining stacks.  This
+                 synchronization of the shift (that is, after all preceding
+                 reductions on all stacks) helps prevent double destructor calls
+                 on yylval in the event of memory exhaustion.  */
+
+              for (state_set_index yys = create_state_set_index (0); yys.uget () < this->yystateStack.numTops (); ++yys)
+                YYCHK1 (this->yyprocessOneStack (yys, yyposn]b4_locations_if([, &this->yyla.location])[));
+              this->yystateStack.yytops.yyremoveDeletes ();
+              if (this->yystateStack.yytops.size() == 0)
+                {
+                  this->yystateStack.yytops.yyundeleteLastStack ();
+                  if (this->yystateStack.yytops.size() == 0)
+                    this->yyFail (]b4_locations_if([&this->yyla.location, ])[YY_("syntax error"));
+                  YYCHK1 (this->yyresolveStack ());
+                  YYCDEBUG << "Returning to deterministic operation.\n";]b4_locations_if([[
+                  this->yyerror_range[1].getState ().yyloc = this->yyla.location;]])[
+                  this->yyreportSyntaxError ();
+                  goto yyuser_error;
+                }
+
+              /* If any yyglrShift call fails, it will fail after shifting.  Thus,
+                 a copy of yylval will already be on stack 0 in the event of a
+                 failure in the following loop.  Thus, yyla is emptied
+                 before the loop to make sure the user destructor for yylval isn't
+                 called twice.  */
+              symbol_kind_type yytoken_to_shift = this->yyla.kind ();
+              this->yyla.kind_ = ]b4_symbol(empty, kind)[;
+              yyposn += 1;
+              for (state_set_index yys = create_state_set_index (0); yys.uget () < this->yystateStack.numTops (); ++yys)
+                {
+                  const state_num yystate = this->topState (yys)->yylrState;
+                  const short* yyconflicts;
+                  const int yyaction = yygetLRActions (yystate, yytoken_to_shift, yyconflicts);
+                  /* Note that yyconflicts were handled by yyprocessOneStack.  */
+                  YYCDEBUG << "On stack " << yys.get() << ", ";
+                  YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, this->yyla.value, this->yyla.location);
+                  this->yyglrShift (yys, yyaction, yyposn, this->yyla.value]b4_locations_if([, this->yyla.location])[);
+                  YYCDEBUG << "Stack " << yys.get() << " now in state "
+                           << this->topState(yys)->yylrState << '\n';
+                }
+]b4_variant_if([[
+                // FIXME: User destructors.
+                // Value type destructor.
+                ]b4_symbol_variant([[yytoken_to_shift]], [[this->yyla.value]], [[template destroy]])])[
+
+              if (this->yystateStack.yytops.size () == 1)
+                {
+                  YYCHK1 (this->yyresolveStack ());
+                  YYCDEBUG << "Returning to deterministic operation.\n";
+                  this->yystateStack.yycompressStack ();
+                  break;
+                }
+            }
+          continue;
+        yyuser_error:
+          this->yyrecoverSyntaxError (]b4_locations_if([&this->yyla.location])[);
+          yyposn = this->firstTopState()->yyposn;
+        }
+
+    yyacceptlab:
+      yyresult = 0;
+      goto yyreturn;
+
+    yybuglab:
+      YYASSERT (false);
+      goto yyabortlab;
+
+    yyabortlab:
+      yyresult = 1;
+      goto yyreturn;
+
+    yyexhaustedlab:
+      yyparser.error (]b4_locations_if([this->yyla.location, ])[YY_("memory exhausted"));
+      yyresult = 2;
+      goto yyreturn;
+
+    yyreturn:
+      return yyresult;
+    }
+  #undef YYCHK1
+
+    void yyreserveGlrStack ()
+    {
+      if (!yystateStack.yyexpandGLRStackIfNeeded ())
+        yyMemoryExhausted ();
+    }
+
+    _Noreturn void
+    yyMemoryExhausted ()
+    {
+      YYLONGJMP (yyexception_buffer, 2);
+    }
+
+    _Noreturn void
+    yyFail (]b4_locations_if([location_type* yylocp, ])[const char* yymsg)
+    {
+      if (yymsg != YY_NULLPTR)
+        yyparser.error (]b4_locations_if([*yylocp, ])[yymsg);
+      YYLONGJMP (yyexception_buffer, 1);
+    }
+
+                                  /* GLRStates */
+
+
+    /** Add a new semantic action that will execute the action for rule
+     *  YYRULE on the semantic values in YYRHS to the list of
+     *  alternative actions for YYSTATE.  Assumes that YYRHS comes from
+     *  stack #YYK of *this. */
+    void
+    yyaddDeferredAction (state_set_index yyk, glr_state* yystate,
+                         glr_state* yyrhs, rule_num yyrule)
+    {
+      semantic_option& yyopt = yystateStack.yynewSemanticOption (semantic_option (yyrule));
+      yyopt.setState (yyrhs);
+      yyopt.setNext (yystate->firstVal ());
+      if (yystateStack.yytops.lookaheadNeeds (yyk))
+        yyopt.yyla = this->yyla;
+      yystate->setFirstVal (&yyopt);
+
+      yyreserveGlrStack ();
+    }
+
+  #if ]b4_api_PREFIX[DEBUG
+    void yypdumpstack () const
+    {
+      yystateStack.dumpStack();
+    }
+  #endif
+
+    void
+    yyreportSyntaxError ()
+    {
+      if (yyerrState != 0)
+        return;
+]b4_parse_error_case(
+[simple], [[
+      std::string msg = YY_("syntax error");
+      yyparser.error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]],
+[custom], [[
+      context yyctx (*this, yyla);
+      yyparser.report_syntax_error (yyctx);]],
+[[
+      context yyctx (*this, yyla);
+      std::string msg = yyparser.yysyntax_error_ (yyctx);
+      yyparser.error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]])[
+      yyerrcnt += 1;
+    }
+
+    /* Recover from a syntax error on this, assuming that yytoken,
+       yylval, and yylloc are the syntactic category, semantic value, and location
+       of the lookahead.  */
+    void
+    yyrecoverSyntaxError (]b4_locations_if([location_type* yylocp])[)
+    {
+      if (yyerrState == 3)
+        /* We just shifted the error token and (perhaps) took some
+           reductions.  Skip tokens until we can proceed.  */
+        while (true)
+          {
+            if (this->yyla.kind () == ]b4_symbol(eof, kind)[)
+              yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR);
+            if (this->yyla.kind () != ]b4_symbol(empty, kind)[)
+              {]b4_locations_if([[
+                /* We throw away the lookahead, but the error range
+                   of the shifted error token must take it into account.  */
+                glr_state *yys = firstTopState();
+                yyerror_range[1].getState().yyloc = yys->yyloc;
+                yyerror_range[2].getState().yyloc = this->yyla.location;
+                YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
+                yyparser.yy_destroy_ ("Error: discarding",
+                                      this->yyla.kind (), this->yyla.value]b4_locations_if([, this->yyla.location])[);]b4_variant_if([[
+                // Value type destructor.
+                ]b4_symbol_variant([[this->yyla.kind ()]], [[this->yyla.value]], [[template destroy]])])[
+                this->yyla.kind_ = ]b4_symbol(empty, kind)[;
+              }
+            yyget_token ();
+            int yyj = yypact[firstTopState()->yylrState];
+            if (yypact_value_is_default (yyj))
+              return;
+            yyj += this->yyla.kind ();
+            if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != this->yyla.kind ())
+              {
+                if (yydefact[firstTopState()->yylrState] != 0)
+                  return;
+              }
+            else if (! yytable_value_is_error (yytable[yyj]))
+              return;
+          }
+
+      if (!yystateStack.reduceToOneStack())
+        yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR);
+
+      /* Now pop stack until we find a state that shifts the error token.  */
+      yyerrState = 3;
+      while (firstTopState () != YY_NULLPTR)
+        {
+          glr_state *yys = firstTopState ();
+          int yyj = yypact[yys->yylrState];
+          if (! yypact_value_is_default (yyj))
+            {
+              yyj += YYTERROR;
+              if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
+                  && yy_is_shift_action (yytable[yyj]))
+                {
+                  /* Shift the error token.  */]b4_locations_if([[
+                  /* First adjust its location.*/
+                  location_type yyerrloc;
+                  yyerror_range[2].getState().yyloc = this->yyla.location;
+                  YYLLOC_DEFAULT (yyerrloc, (yyerror_range), 2);]])[
+                  YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol (yytable[yyj]),
+                                   this->yyla.value, yyerrloc);
+                  yyglrShift (create_state_set_index(0), yytable[yyj],
+                              yys->yyposn, yyla.value]b4_locations_if([, yyerrloc])[);
+                  yys = firstTopState();
+                  break;
+                }
+            }]b4_locations_if([[
+          yyerror_range[1].getState().yyloc = yys->yyloc;]])[
+          if (yys->pred() != YY_NULLPTR)
+            yys->destroy ("Error: popping", yyparser);
+          yystateStack.setFirstTop(yys->pred());
+          yystateStack.pop_back();
+        }
+      if (firstTopState() == YY_NULLPTR)
+        yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR);
+    }
+
+    YYRESULTTAG
+    yyprocessOneStack (state_set_index yyk,
+                       size_t yyposn]b4_locations_if([, location_type* yylocp])[)
+    {
+      while (yystateStack.topAt(yyk) != YY_NULLPTR)
+        {
+          const state_num yystate = topState(yyk)->yylrState;
+          YYCDEBUG << "Stack " << yyk.get()
+                   << " Entering state " << yystate << '\n';
+
+          YYASSERT (yystate != YYFINAL);
+
+          if (yy_is_defaulted_state (yystate))
+            {
+              const rule_num yyrule = yy_default_action (yystate);
+              if (yyrule == 0)
+                {
+                  YYCDEBUG << "Stack " << yyk.get() << " dies.\n";
+                  yystateStack.yytops.yymarkStackDeleted (yyk);
+                  return yyok;
+                }
+              const YYRESULTTAG yyflag
+                = yyglrReduce (yyk, yyrule, yyimmediate[yyrule]);
+              if (yyflag == yyerr)
+                {
+                  YYCDEBUG << "Stack " << yyk.get() << " dies"
+                    " (predicate failure or explicit user error).\n";
+                  yystateStack.yytops.yymarkStackDeleted (yyk);
+                  return yyok;
+                }
+              if (yyflag != yyok)
+                return yyflag;
+            }
+          else
+            {
+              yystateStack.yytops.setLookaheadNeeds(yyk, true);
+              yyget_token ();
+              const short* yyconflicts;
+              const int yyaction = yygetLRActions (yystate, this->yyla.kind (), yyconflicts);
+
+              for (; *yyconflicts != 0; ++yyconflicts)
+                {
+                  state_set_index yynewStack = yystateStack.yysplitStack (yyk);
+                  YYCDEBUG << "Splitting off stack " << yynewStack.get()
+                           << " from " << yyk.get() << ".\n";
+                  YYRESULTTAG yyflag =
+                    yyglrReduce (yynewStack, *yyconflicts, yyimmediate[*yyconflicts]);
+                  if (yyflag == yyok)
+                    YYCHK (yyprocessOneStack (yynewStack,
+                                              yyposn]b4_locations_if([, yylocp])[));
+                  else if (yyflag == yyerr)
+                    {
+                      YYCDEBUG << "Stack " << yynewStack.get() << " dies.\n";
+                      yystateStack.yytops.yymarkStackDeleted (yynewStack);
+                    }
+                  else
+                    return yyflag;
+                }
+
+              if (yy_is_shift_action (yyaction))
+                break;
+              else if (yy_is_error_action (yyaction))
+                {
+                  YYCDEBUG << "Stack " << yyk.get() << " dies.\n";
+                  yystateStack.yytops.yymarkStackDeleted (yyk);
+                  break;
+                }
+              else
+                {
+                  YYRESULTTAG yyflag
+                    = yyglrReduce (yyk, -yyaction, yyimmediate[-yyaction]);
+                  if (yyflag == yyerr)
+                    {
+                      YYCDEBUG << "Stack " << yyk.get() << " dies"
+                        " (predicate failure or explicit user error).\n";
+                      yystateStack.yytops.yymarkStackDeleted (yyk);
+                      break;
+                    }
+                  else if (yyflag != yyok)
+                    return yyflag;
+                }
+            }
+        }
+      return yyok;
+    }
+
+    /** Perform user action for rule number YYN, with RHS length YYRHSLEN,
+     *  and top stack item YYVSP.  YYVALP points to place to put semantic
+     *  value ($$), and yylocp points to place for location information
+     *  (@@$).  Returns yyok for normal return, yyaccept for YYACCEPT,
+     *  yyerr for YYERROR, yyabort for YYABORT.  */
+    YYRESULTTAG
+    yyuserAction (rule_num yyrule, int yyrhslen, glr_stack_item* yyvsp, state_set_index yyk,
+                  value_type* yyvalp]b4_locations_if([, location_type* yylocp])[)
+    {
+      bool yynormal YY_ATTRIBUTE_UNUSED = !yystateStack.isSplit();
+      int yylow = 1;
+]b4_parse_param_use([yyvalp], [yylocp])dnl
+[      YY_USE (yyk);
+      YY_USE (yyrhslen);
+    # undef yyerrok
+    # define yyerrok (yyerrState = 0)
+    # undef YYACCEPT
+    # define YYACCEPT return yyaccept
+    # undef YYABORT
+    # define YYABORT return yyabort
+    # undef YYERROR
+    # define YYERROR return yyerrok, yyerr
+    # undef YYRECOVERING
+    # define YYRECOVERING() (yyerrState != 0)
+    # undef yytoken
+    # define yytoken this->yyla.kind_
+    # undef yyclearin
+    # define yyclearin (yytoken = ]b4_symbol(empty, kind)[)
+    # undef YYBACKUP
+    # define YYBACKUP(Token, Value)                                              \
+      return yyparser.error (]b4_locations_if([*yylocp, ])[YY_("syntax error: cannot back up")),     \
+             yyerrok, yyerr
+
+]b4_variant_if([[
+      /* Variants are always initialized to an empty instance of the
+         correct type. The default '$$ = $1' action is NOT applied
+         when using variants.  */
+      // However we really need to prepare yyvsp now if we want to get
+      // correct locations, so invoke YYFILL for $1 anyway.
+      (void) YYFILL (1-yyrhslen);
+      ]b4_symbol_variant([[yylhsNonterm (yyrule)]], [(*yyvalp)], [emplace])], [[
+      if (yyrhslen == 0)
+        *yyvalp = yyval_default;
+      else
+        *yyvalp = yyvsp[YYFILL (1-yyrhslen)].getState().value ();]])[]b4_locations_if([[
+      /* Default location. */
+      YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
+      yyerror_range[1].getState().yyloc = *yylocp;
+]])[
+    /* If yyk == -1, we are running a deferred action on a temporary
+       stack.  In that case, YY_REDUCE_PRINT must not play with YYFILL,
+       so pretend the stack is "normal". */
+    YY_REDUCE_PRINT ((yynormal || yyk == create_state_set_index (-1), yyvsp, yyk, yyrule, yyparser));
+    #if YY_EXCEPTIONS
+      try
+      {
+    #endif // YY_EXCEPTIONS
+      switch (yyrule)
+        {
+    ]b4_user_actions[
+          default: break;
+        }
+    #if YY_EXCEPTIONS
+      }
+      catch (const syntax_error& yyexc)
+        {
+          YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';]b4_locations_if([
+          *yylocp = yyexc.location;])[
+          yyparser.error (]b4_locations_if([*yylocp, ])[yyexc.what ());
+          YYERROR;
+        }
+    #endif // YY_EXCEPTIONS
+    YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), *yyvalp, *yylocp);
+
+      return yyok;
+    # undef yyerrok
+    # undef YYABORT
+    # undef YYACCEPT
+    # undef YYERROR
+    # undef YYBACKUP
+    # undef yytoken
+    # undef yyclearin
+    # undef YYRECOVERING
+    }
+
+    YYRESULTTAG
+    yyresolveStack ()
+    {
+      if (yystateStack.isSplit ())
+        {
+          int yyn = 0;
+          for (glr_state* yys = firstTopState ();
+               yys != yystateStack.yysplitPoint;
+               yys = yys->pred ())
+            yyn += 1;
+          YYCHK (yyresolveStates (*firstTopState (), yyn));
+        }
+      return yyok;
+    }
+
+    /** Pop the symbols consumed by reduction #YYRULE from the top of stack
+     *  #YYK of *YYSTACKP, and perform the appropriate semantic action on their
+     *  semantic values.  Assumes that all ambiguities in semantic values
+     *  have been previously resolved.  Set *YYVALP to the resulting value,
+     *  and *YYLOCP to the computed location (if any).  Return value is as
+     *  for userAction.  */
+    YYRESULTTAG
+    yydoAction (state_set_index yyk, rule_num yyrule,
+                value_type* yyvalp]b4_locations_if([, location_type* yylocp])[)
+    {
+      const int yynrhs = yyrhsLength (yyrule);
+
+      if (!yystateStack.isSplit())
+        {
+          /* Standard special case: single stack.  */
+          YYASSERT (yyk.get() == 0);
+          glr_stack_item* yyrhs = yystateStack.firstTop()->asItem();
+          const YYRESULTTAG res
+            = yyuserAction (yyrule, yynrhs, yyrhs, yyk, yyvalp]b4_locations_if([, yylocp])[);
+          yystateStack.pop_back(static_cast<size_t>(yynrhs));
+          yystateStack.setFirstTop(&yystateStack[yystateStack.size() - 1].getState());
+          return res;
+        }
+      else
+        {
+          glr_stack_item yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
+          glr_state* yys = yystateStack.topAt(yyk);
+          yyrhsVals[YYMAXRHS + YYMAXLEFT].getState().setPred(yys);]b4_locations_if([[
+          if (yynrhs == 0)
+            /* Set default location.  */
+            yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yys->yyloc;]])[
+          for (int yyi = 0; yyi < yynrhs; yyi += 1)
+            {
+              yys = yys->pred();
+              YYASSERT (yys != YY_NULLPTR);
+            }
+          yystateStack.yyupdateSplit (*yys);
+          yystateStack.setTopAt(yyk, yys);
+          return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
+                               yyk,
+                               yyvalp]b4_locations_if([, yylocp])[);
+        }
+    }
+
+    /** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE,
+     *  and push back on the resulting nonterminal symbol.  Perform the
+     *  semantic action associated with YYRULE and store its value with the
+     *  newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently
+     *  unambiguous.  Otherwise, store the deferred semantic action with
+     *  the new state.  If the new state would have an identical input
+     *  position, LR state, and predecessor to an existing state on the stack,
+     *  it is identified with that existing state, eliminating stack #YYK from
+     *  *YYSTACKP.  In this case, the semantic value is
+     *  added to the options for the existing state's semantic value.
+     */
+    YYRESULTTAG
+    yyglrReduce (state_set_index yyk, rule_num yyrule, bool yyforceEval)
+    {
+      size_t yyposn = topState(yyk)->yyposn;
+
+      if (yyforceEval || !yystateStack.isSplit())
+        {
+          value_type val;]b4_locations_if([[
+          location_type loc;]])[
+
+          YYRESULTTAG yyflag = yydoAction (yyk, yyrule, &val]b4_locations_if([, &loc])[);
+          if (yyflag == yyerr && yystateStack.isSplit())
+            {]b4_parse_trace_if([[
+              YYCDEBUG << "Parse on stack " << yyk.get ()
+                       << " rejected by rule " << yyrule - 1
+                       << " (line " << int (yyrline[yyrule]) << ").\n";
+            ]])[}
+          if (yyflag != yyok)
+            return yyflag;
+          yyglrShift (yyk,
+                      yyLRgotoState (topState(yyk)->yylrState,
+                                     yylhsNonterm (yyrule)),
+                      yyposn, val]b4_locations_if([, loc])[);]b4_variant_if([[
+          // FIXME: User destructors.
+          // Value type destructor.
+          ]b4_symbol_variant([[yylhsNonterm (yyrule)]], [[val]], [[template destroy]])])[
+        }
+      else
+        {
+          glr_state *yys = yystateStack.topAt(yyk);
+          glr_state *yys0 = yys;
+          for (int yyn = yyrhsLength (yyrule); 0 < yyn; yyn -= 1)
+            {
+              yys = yys->pred();
+              YYASSERT (yys != YY_NULLPTR);
+            }
+          yystateStack.yyupdateSplit (*yys);
+          state_num yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));]b4_parse_trace_if([[
+          YYCDEBUG << "Reduced stack " << yyk.get ()
+                   << " by rule " << yyrule - 1 << " (line " << int (yyrline[yyrule])
+                   << "); action deferred.  Now in state " << yynewLRState
+                   << ".\n";]])[
+          for (state_set_index yyi = create_state_set_index(0); yyi.uget() < yystateStack.numTops(); ++yyi)
+            if (yyi != yyk && yystateStack.topAt(yyi) != YY_NULLPTR)
+              {
+                const glr_state* yysplit = yystateStack.yysplitPoint;
+                glr_state* yyp = yystateStack.topAt(yyi);
+                while (yyp != yys && yyp != yysplit
+                       && yyp->yyposn >= yyposn)
+                  {
+                    if (yyp->yylrState == yynewLRState
+                        && yyp->pred() == yys)
+                      {
+                        yyaddDeferredAction (yyk, yyp, yys0, yyrule);
+                        yystateStack.yytops.yymarkStackDeleted (yyk);
+                        YYCDEBUG << "Merging stack " << yyk.get ()
+                                 << " into stack " << yyi.get () << ".\n";
+                        return yyok;
+                      }
+                    yyp = yyp->pred();
+                  }
+              }
+          yystateStack.setTopAt(yyk, yys);
+          yyglrShiftDefer (yyk, yynewLRState, yyposn, yys0, yyrule);
+        }
+      return yyok;
+    }
+
+    /** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR
+     *  state YYLRSTATE, at input position YYPOSN, with the (unresolved)
+     *  semantic value of YYRHS under the action for YYRULE.  */
+    void
+    yyglrShiftDefer (state_set_index yyk, state_num yylrState,
+                     size_t yyposn, glr_state* yyrhs, rule_num yyrule)
+    {
+      glr_state& yynewState = yystateStack.yynewGLRState (
+        glr_state (yylrState, yyposn));
+      yynewState.setPred (yystateStack.topAt (yyk));
+      yystateStack.setTopAt (yyk, &yynewState);
+
+      /* Invokes yyreserveStack.  */
+      yyaddDeferredAction (yyk, &yynewState, yyrhs, yyrule);
+    }
+
+    /** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
+     * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
+     * value YYVAL_ARG and source location YYLOC_ARG.  */
+    void
+    yyglrShift (state_set_index yyk, state_num yylrState,
+                size_t yyposn,
+                const value_type& yyval_arg]b4_locations_if([, const location_type& yyloc_arg])[)
+    {
+      glr_state& yynewState = yystateStack.yynewGLRState (
+        glr_state (yylrState, yyposn, yyval_arg]b4_locations_if([, yyloc_arg])[));
+      yynewState.setPred (yystateStack.topAt(yyk));
+      yystateStack.setTopAt (yyk, &yynewState);
+      yyreserveGlrStack ();
+    }
+
+#if ]b4_api_PREFIX[DEBUG
+    void
+    yypstack (state_set_index yyk) const
+    {
+      yystateStack.yypstates (yystateStack.topAt (yyk));
+    }
+#endif
+
+    glr_state* topState(state_set_index i) {
+      return yystateStack.topAt(i);
+    }
+
+    glr_state* firstTopState() {
+      return yystateStack.firstTop();
+    }
+
+  private:
+
+    void popall_ ()
+    {
+      /* If the stack is well-formed, pop the stack until it is empty,
+         destroying its entries as we go.  But free the stack regardless
+         of whether it is well-formed.  */
+      for (state_set_index k = create_state_set_index(0); k.uget() < yystateStack.numTops(); k += 1)
+        if (yystateStack.topAt(k) != YY_NULLPTR)
+          {
+            while (yystateStack.topAt(k) != YY_NULLPTR)
+              {
+                glr_state* state = topState(k);]b4_locations_if([[
+                yyerror_range[1].getState().yyloc = state->yyloc;]])[
+                if (state->pred() != YY_NULLPTR)
+                  state->destroy ("Cleanup: popping", yyparser);
+                yystateStack.setTopAt(k, state->pred());
+                yystateStack.pop_back();
+              }
+              break;
+          }
+    }
+
+    /** Resolve the previous YYN states starting at and including state YYS
+     *  on *YYSTACKP. If result != yyok, some states may have been left
+     *  unresolved possibly with empty semantic option chains.  Regardless
+     *  of whether result = yyok, each state has been left with consistent
+     *  data so that destroy can be invoked if necessary.  */
+    YYRESULTTAG
+    yyresolveStates (glr_state& yys, int yyn)
+    {
+      if (0 < yyn)
+        {
+          YYASSERT (yys.pred() != YY_NULLPTR);
+          YYCHK (yyresolveStates (*yys.pred(), yyn-1));
+          if (! yys.yyresolved)
+            YYCHK (yyresolveValue (yys));
+        }
+      return yyok;
+    }
+
+    static void
+    yyuserMerge (int yyn, value_type& yy0, value_type& yy1)
+    {
+      YY_USE (yy0);
+      YY_USE (yy1);
+
+      switch (yyn)
+        {
+]b4_mergers[
+          default: break;
+        }
+    }
+
+    /** Resolve the ambiguity represented in state YYS in *YYSTACKP,
+     *  perform the indicated actions, and set the semantic value of YYS.
+     *  If result != yyok, the chain of semantic options in YYS has been
+     *  cleared instead or it has been left unmodified except that
+     *  redundant options may have been removed.  Regardless of whether
+     *  result = yyok, YYS has been left with consistent data so that
+     *  destroy can be invoked if necessary.  */
+    YYRESULTTAG
+    yyresolveValue (glr_state& yys)
+    {
+      semantic_option* yybest = yys.firstVal();
+      YYASSERT(yybest != YY_NULLPTR);
+      bool yymerge = false;
+      YYRESULTTAG yyflag;]b4_locations_if([
+      location_type *yylocp = &yys.yyloc;])[
+
+      semantic_option* yypPrev = yybest;
+      for (semantic_option* yyp = yybest->next();
+           yyp != YY_NULLPTR; )
+        {
+          if (yybest->isIdenticalTo (*yyp))
+            {
+              yybest->mergeWith (*yyp);
+              yypPrev->setNext(yyp->next());
+              yyp = yypPrev->next();
+            }
+          else
+            {
+              switch (yypreference (*yybest, *yyp))
+                {
+                case 0:]b4_locations_if([[
+                  yyresolveLocations (yys, 1);]])[
+                  return yystateStack.yyreportAmbiguity (*yybest, *yyp, yyparser]b4_locations_if([, *yylocp])[);
+                  break;
+                case 1:
+                  yymerge = true;
+                  break;
+                case 2:
+                  break;
+                case 3:
+                  yybest = yyp;
+                  yymerge = false;
+                  break;
+                default:
+                  /* This cannot happen so it is not worth a YYASSERT (false),
+                     but some compilers complain if the default case is
+                     omitted.  */
+                  break;
+                }
+              yypPrev = yyp;
+              yyp = yyp->next();
+            }
+        }
+
+      value_type val;
+      if (yymerge)
+        {
+          int yyprec = yydprec[yybest->yyrule];
+          yyflag = yyresolveAction (*yybest, &val]b4_locations_if([, yylocp])[);
+          if (yyflag == yyok)
+            for (semantic_option* yyp = yybest->next();
+                 yyp != YY_NULLPTR;
+                 yyp = yyp->next())
+              {
+                if (yyprec == yydprec[yyp->yyrule])
+                  {
+                    value_type yyval_other;]b4_locations_if([
+                    location_type yydummy;])[
+                    yyflag = yyresolveAction (*yyp, &yyval_other]b4_locations_if([, &yydummy])[);
+                    if (yyflag != yyok)
+                      {
+                        yyparser.yy_destroy_ ("Cleanup: discarding incompletely merged value for",
+                                              yy_accessing_symbol (yys.yylrState),
+                                              this->yyla.value]b4_locations_if([, *yylocp])[);
+                        break;
+                      }
+                    yyuserMerge (yymerger[yyp->yyrule], val, yyval_other);]b4_variant_if([[
+                    // FIXME: User destructors.
+                    // Value type destructor.
+                    ]b4_symbol_variant([[yy_accessing_symbol (yys.yylrState)]], [[yyval_other]], [[template destroy]])])[
+                  }
+              }
+        }
+      else
+        yyflag = yyresolveAction (*yybest, &val]b4_locations_if([, yylocp])[);
+
+      if (yyflag == yyok)
+        {
+          yys.yyresolved = true;
+          YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN]b4_variant_if([[
+          new (&yys.value ()) value_type ();
+          ]b4_symbol_variant([yy_accessing_symbol (yys.yylrState)],
+                             [yys.value ()], [copy], [val])], [[
+          new (&yys.value ()) value_type (val);]])[
+
+          YY_IGNORE_MAYBE_UNINITIALIZED_END
+        }
+      else
+        yys.setFirstVal(YY_NULLPTR);
+]b4_variant_if([[
+      // FIXME: User destructors.
+      // Value type destructor.
+      ]b4_symbol_variant([[yy_accessing_symbol (yys.yylrState)]], [[val]], [[template destroy]])])[
+      return yyflag;
+    }
+
+    /** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its
+     *  user action, and return the semantic value and location in *YYVALP
+     *  and *YYLOCP.  Regardless of whether result = yyok, all RHS states
+     *  have been destroyed (assuming the user action destroys all RHS
+     *  semantic values if invoked).  */
+    YYRESULTTAG
+    yyresolveAction (semantic_option& yyopt, value_type* yyvalp]b4_locations_if([, location_type* yylocp])[)
+    {
+      glr_state* yyoptState = yyopt.state();
+      YYASSERT(yyoptState != YY_NULLPTR);
+      int yynrhs = yyrhsLength (yyopt.yyrule);
+      YYRESULTTAG yyflag = yyresolveStates (*yyoptState, yynrhs);
+      if (yyflag != yyok)
+        {
+          for (glr_state *yys = yyoptState; yynrhs > 0; yys = yys->pred(), yynrhs -= 1)
+            yys->destroy ("Cleanup: popping", yyparser);
+          return yyflag;
+        }
+
+      glr_stack_item yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
+      yyrhsVals[YYMAXRHS + YYMAXLEFT].getState().setPred(yyopt.state());]b4_locations_if([[
+      if (yynrhs == 0)
+        /* Set default location.  */
+        yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yyoptState->yyloc;]])[
+      {
+        symbol_type yyla_current = std::move (this->yyla);
+        this->yyla = std::move (yyopt.yyla);
+        yyflag = yyuserAction (yyopt.yyrule, yynrhs,
+                               yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
+                               create_state_set_index (-1),
+                               yyvalp]b4_locations_if([, yylocp])[);
+        this->yyla = std::move (yyla_current);
+      }
+      return yyflag;
+    }]b4_locations_if([[
+
+    /** Resolve the locations for each of the YYN1 states in *YYSTACKP,
+     *  ending at YYS1.  Has no effect on previously resolved states.
+     *  The first semantic option of a state is always chosen.  */
+    void
+    yyresolveLocations (glr_state &yys1, int yyn1)
+    {
+      if (0 < yyn1)
+        {
+          yyresolveLocations (*yys1.pred(), yyn1 - 1);
+          if (!yys1.yyresolved)
+            {
+              glr_stack_item yyrhsloc[1 + YYMAXRHS];
+              YYASSERT (yys1.firstVal() != YY_NULLPTR);
+              semantic_option& yyoption = *yys1.firstVal();
+              const int yynrhs = yyrhsLength (yyoption.yyrule);
+              if (0 < yynrhs)
+                {
+                  yyresolveLocations (*yyoption.state(), yynrhs);
+                  const glr_state *yys = yyoption.state();
+                  for (int yyn = yynrhs; yyn > 0; yyn -= 1)
+                  {
+                    yyrhsloc[yyn].getState().yyloc = yys->yyloc;
+                    yys = yys->pred();
+                  }
+                }
+              else
+                {
+                  /* Both yyresolveAction and yyresolveLocations traverse the GSS
+                     in reverse rightmost order.  It is only necessary to invoke
+                     yyresolveLocations on a subforest for which yyresolveAction
+                     would have been invoked next had an ambiguity not been
+                     detected.  Thus the location of the previous state (but not
+                     necessarily the previous state itself) is guaranteed to be
+                     resolved already.  */
+                  YY_IGNORE_NULL_DEREFERENCE_BEGIN
+                  yyrhsloc[0].getState().yyloc = yyoption.state()->yyloc;
+                  YY_IGNORE_NULL_DEREFERENCE_END
+                }
+              YYLLOC_DEFAULT ((yys1.yyloc), yyrhsloc, yynrhs);
+            }
+        }
+    }]])[
+
+    /** If yytoken is empty, fetch the next token.  */
+    void
+    yyget_token ()
+    {
+]b4_parse_param_use()dnl
+[      if (this->yyla.empty ())
+        {
+          YYCDEBUG << "Reading a token\n";
+#if YY_EXCEPTIONS
+          try
+#endif // YY_EXCEPTIONS
+            {]b4_token_ctor_if([[
+              symbol_type yylookahead (]b4_yylex[);
+              yyla.move (yylookahead);]], [[
+              yyla.kind_ = yyparser.yytranslate_ (]b4_yylex[);]])[
+            }
+#if YY_EXCEPTIONS
+          catch (const parser_type::syntax_error& yyexc)
+            {
+              YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([
+              this->yyla.location = yyexc.location;])[
+              yyparser.error (]b4_locations_if([this->yyla.location, ])[yyexc.what ());
+              // Map errors caught in the scanner to the error token, so that error
+              // handling is started.
+              this->yyla.kind_ = ]b4_symbol(error, kind)[;
+            }
+        }
+#endif // YY_EXCEPTIONS
+      if (this->yyla.kind () == ]b4_symbol(eof, kind)[)
+        YYCDEBUG << "Now at end of input.\n";
+      else
+        YY_SYMBOL_PRINT ("Next token is", this->yyla.kind (), this->yyla.value, this->yyla.location);
+    }
+
+
+                                /* Bison grammar-table manipulation.  */
+
+    /** The action to take in YYSTATE on seeing YYTOKEN.
+     *  Result R means
+     *    R < 0:  Reduce on rule -R.
+     *    R = 0:  Error.
+     *    R > 0:  Shift to state R.
+     *  Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
+     *  of conflicting reductions.
+     */
+    static int
+    yygetLRActions (state_num yystate, symbol_kind_type yytoken, const short*& yyconflicts)
+    {
+      int yyindex = yypact[yystate] + yytoken;
+      if (yytoken == ]b4_symbol(error, kind)[)
+        {
+          // This is the error token.
+          yyconflicts = yyconfl;
+          return 0;
+        }
+      else if (yy_is_defaulted_state (yystate)
+               || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
+        {
+          yyconflicts = yyconfl;
+          return -yydefact[yystate];
+        }
+      else if (! yytable_value_is_error (yytable[yyindex]))
+        {
+          yyconflicts = yyconfl + yyconflp[yyindex];
+          return yytable[yyindex];
+        }
+      else
+        {
+          yyconflicts = yyconfl + yyconflp[yyindex];
+          return 0;
+        }
+    }
+
+    /** Compute post-reduction state.
+     * \param yystate   the current state
+     * \param yysym     the nonterminal to push on the stack
+     */
+    static state_num
+    yyLRgotoState (state_num yystate, symbol_kind_type yysym)
+    {
+      const int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
+      if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
+        return yytable[yyr];
+      else
+        return yydefgoto[yysym - YYNTOKENS];
+    }
+
+    static bool
+    yypact_value_is_default (state_num yystate)
+    {
+      return ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf], [YYPACT_NINF])[;
+    }
+
+    static bool
+    yytable_value_is_error (int yytable_value YY_ATTRIBUTE_UNUSED)
+    {
+      return ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf], [YYTABLE_NINF])[;
+    }
+
+    static bool
+    yy_is_shift_action (int yyaction) YY_NOEXCEPT
+    {
+      return 0 < yyaction;
+    }
+
+    static bool
+    yy_is_error_action (int yyaction) YY_NOEXCEPT
+    {
+      return yyaction == 0;
+    }
+
+    /** Whether LR state YYSTATE has only a default reduction
+     *  (regardless of token).  */
+    static bool
+    yy_is_defaulted_state (state_num yystate)
+    {
+      return yypact_value_is_default (yypact[yystate]);
+    }
+
+    /** The default reduction for YYSTATE, assuming it has one.  */
+    static rule_num
+    yy_default_action (state_num yystate)
+    {
+      return yydefact[yystate];
+    }
+
+                                    /* GLRStacks */
+
+    /** Y0 and Y1 represent two possible actions to take in a given
+     *  parsing state; return 0 if no combination is possible,
+     *  1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred.  */
+    static int
+    yypreference (const semantic_option& y0, const semantic_option& y1)
+    {
+      const rule_num r0 = y0.yyrule, r1 = y1.yyrule;
+      const int p0 = yydprec[r0], p1 = yydprec[r1];
+
+      if (p0 == p1)
+        {
+          if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
+            return 0;
+          else
+            return 1;
+        }
+      else if (p0 == 0 || p1 == 0)
+        return 0;
+      else if (p0 < p1)
+        return 3;
+      else if (p1 < p0)
+        return 2;
+      else
+        return 0;
+    }
+
+]b4_parse_param_vars[
+  }; // class ]b4_parser_class[::glr_stack
+} // namespace ]b4_namespace_ref[
+
+
+#if ]b4_api_PREFIX[DEBUG
+namespace
+{
+  void
+  yypstack (const glr_stack& yystack, size_t yyk)
+  {
+    yystack.yypstack (create_state_set_index (static_cast<std::ptrdiff_t> (yyk)));
+  }
+
+  void
+  yypdumpstack (const glr_stack& yystack)
+  {
+    yystack.yypdumpstack ();
+  }
+}
+#endif
+
+]b4_namespace_open[
+  /// Build a parser object.
+  ]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
+    :])[
+#if ]b4_api_PREFIX[DEBUG
+    ]m4_ifset([b4_parse_param], [  ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
+#endif]b4_parse_param_cons[
+  {}
+
+  ]b4_parser_class::~b4_parser_class[ ()
+  {}
+
+  ]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
+  {}
+
+  int
+  ]b4_parser_class[::operator() ()
+  {
+    return parse ();
+  }
+
+  int
+  ]b4_parser_class[::parse ()
+  {
+    glr_stack yystack(YYINITDEPTH, *this]b4_user_args[);
+    return yystack.parse ();
+  }
+
+]b4_parse_error_bmatch([custom\|detailed],
+[[  const char *
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    static const char *const yy_sname[] =
+    {
+    ]b4_symbol_names[
+    };]b4_has_translations_if([[
+    /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
+       internationalizable.  */
+    static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
+    {
+    ]b4_translatable[
+    };
+    return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
+            ? _(yy_sname[yysymbol])
+            : yy_sname[yysymbol]);]], [[
+    return yy_sname[yysymbol];]])[
+  }
+]],
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+  const char *
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    return yytname_[yysymbol];
+  }
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[  /* Return YYSTR after stripping away unnecessary quotes and
+     backslashes, so that it's suitable for yyerror.  The heuristic is
+     that double-quoting is unnecessary unless the string contains an
+     apostrophe, a comma, or backslash (other than backslash-backslash).
+     YYSTR is taken from yytname.  */
+  std::string
+  ]b4_parser_class[::yytnamerr_ (const char *yystr)
+  {
+    if (*yystr == '"')
+      {
+        std::string yyr;
+        char const *yyp = yystr;
+
+        for (;;)
+          switch (*++yyp)
+            {
+            case '\'':
+            case ',':
+              goto do_not_strip_quotes;
+
+            case '\\':
+              if (*++yyp != '\\')
+                goto do_not_strip_quotes;
+              else
+                goto append;
+
+            append:
+            default:
+              yyr += *yyp;
+              break;
+
+            case '"':
+              return yyr;
+            }
+      do_not_strip_quotes: ;
+      }
+
+    return yystr;
+  }
+
+  std::string
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    return yytnamerr_ (yytname_[yysymbol]);
+  }
+]])[
+
+]b4_parse_error_bmatch([simple\|verbose],
+[[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[
+  // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+  // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
+  const char*
+  const ]b4_parser_class[::yytname_[] =
+  {
+  ]b4_tname[
+  };
+#endif
+]])[
+
+]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
+  // ]b4_parser_class[::context.
+  ]b4_parser_class[::context::context (glr_stack& yystack, const symbol_type& yyla)
+    : yystack_ (yystack)
+    , yyla_ (yyla)
+  {}
+
+  int
+  ]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const
+  {
+    // Actual number of expected tokens
+    int yycount = 0;
+    const int yyn = yypact[yystack_.firstTopState()->yylrState];
+    if (!yystack_.yypact_value_is_default (yyn))
+      {
+        /* Start YYX at -YYN if negative to avoid negative indexes in
+           YYCHECK.  In other words, skip the first -YYN actions for this
+           state because they are default actions.  */
+        const int yyxbegin = yyn < 0 ? -yyn : 0;
+        /* Stay within bounds of both yycheck and yytname.  */
+        const int yychecklim = YYLAST - yyn + 1;
+        const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+        for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
+          if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
+              && !yystack_.yytable_value_is_error (yytable[yyx + yyn]))
+            {
+              if (!yyarg)
+                ++yycount;
+              else if (yycount == yyargn)
+                return 0;
+              else
+                yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
+            }
+      }
+    if (yyarg && yycount == 0 && 0 < yyargn)
+      yyarg[0] = ]b4_symbol(empty, kind)[;
+    return yycount;
+  }
+
+]])[
+
+]b4_parse_error_bmatch([detailed\|verbose], [[
+  int
+  ]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
+                                                 symbol_kind_type yyarg[], int yyargn) const
+  {
+    /* There are many possibilities here to consider:
+       - If this state is a consistent state with a default action, then
+         the only way this function was invoked is if the default action
+         is an error action.  In that case, don't check for expected
+         tokens because there are none.
+       - The only way there can be no lookahead present (in yyla) is
+         if this state is a consistent state with a default action.
+         Thus, detecting the absence of a lookahead is sufficient to
+         determine that there is no unexpected or expected token to
+         report.  In that case, just report a simple "syntax error".
+       - Don't assume there isn't a lookahead just because this state is
+         a consistent state with a default action.  There might have
+         been a previous inconsistent state, consistent state with a
+         non-default action, or user semantic action that manipulated
+         yyla.  (However, yyla is currently not documented for users.)
+    */
+
+    if (!yyctx.lookahead ().empty ())
+      {
+        if (yyarg)
+          yyarg[0] = yyctx.token ();
+        int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
+        return yyn + 1;
+      }
+    return 0;
+  }
+
+  // Generate an error message.
+  std::string
+  ]b4_parser_class[::yysyntax_error_ (const context& yyctx) const
+  {
+    // Its maximum.
+    enum { YYARGS_MAX = 5 };
+    // Arguments of yyformat.
+    symbol_kind_type yyarg[YYARGS_MAX];
+    int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
+
+    char const* yyformat = YY_NULLPTR;
+    switch (yycount)
+      {
+#define YYCASE_(N, S)                         \
+        case N:                               \
+          yyformat = S;                       \
+        break
+      default: // Avoid compiler warnings.
+        YYCASE_ (0, YY_("syntax error"));
+        YYCASE_ (1, YY_("syntax error, unexpected %s"));
+        YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
+        YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+        YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+        YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+      }
+
+    std::string yyres;
+    // Argument number.
+    std::ptrdiff_t yyi = 0;
+    for (char const* yyp = yyformat; *yyp; ++yyp)
+      if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
+        {
+          yyres += symbol_name (yyarg[yyi++]);
+          ++yyp;
+        }
+      else
+        yyres += *yyp;
+    return yyres;
+  }]])[
+
+  void
+  ]b4_parser_class[::yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
+                           value_type& yyval]b4_locations_if([[,
+                           location_type& yyloc]])[)
+  {
+    YY_USE (yyval);]b4_locations_if([[
+    YY_USE (yyloc);]])[
+    if (!yymsg)
+      yymsg = "Deleting";
+    ]b4_parser_class[& yyparser = *this;
+    YY_USE (yyparser);
+    YY_SYMBOL_PRINT (yymsg, yykind, yyval, yyloc);
+
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    ]m4_do([m4_pushdef([b4_symbol_action], m4_defn([b4_symbol_action_for_yyval]))],
+           [b4_symbol_actions([destructor])],
+           [m4_popdef([b4_symbol_action])])[
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
+  }
+
+#if ]b4_api_PREFIX[DEBUG
+  /*--------------------.
+  | Print this symbol.  |
+  `--------------------*/
+
+  void
+  ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
+                           const value_type& yyval]b4_locations_if([[,
+                           const location_type& yyloc]])[) const
+  {]b4_locations_if([[
+    YY_USE (yyloc);]])[
+    YY_USE (yyval);
+    std::ostream& yyo = debug_stream ();
+    YY_USE (yyo);
+    ]m4_do([m4_pushdef([b4_symbol_action], m4_defn([b4_symbol_action_for_yyval]))],
+           [b4_symbol_actions([printer])],
+           [m4_popdef([b4_symbol_action])])[
+  }
+
+  void
+  ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
+                           const value_type& yyval]b4_locations_if([[,
+                           const location_type& yyloc]])[) const
+  {
+    *yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
+               << ' ' << symbol_name (yykind) << " ("]b4_locations_if([[
+               << yyloc << ": "]])[;
+    yy_symbol_value_print_ (yykind, yyval]b4_locations_if([[, yyloc]])[);
+    *yycdebug_ << ')';
+  }
+
+  std::ostream&
+  ]b4_parser_class[::debug_stream () const
+  {
+    return *yycdebug_;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_stream (std::ostream& o)
+  {
+    yycdebug_ = &o;
+  }
+
+
+  ]b4_parser_class[::debug_level_type
+  ]b4_parser_class[::debug_level () const
+  {
+    return yydebug;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_level (debug_level_type l)
+  {
+    // Actually, it is yydebug which is really used.
+    yydebug = l;
+  }
+#endif // ]b4_api_PREFIX[DEBUG
+
+]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
+
+]b4_token_ctor_if([], [[
+  /*---------.
+  | symbol.  |
+  `---------*/
+]b4_public_types_define([cc])])[
+]b4_namespace_close[]dnl
+b4_epilogue[]dnl
+b4_output_end

+ 27 - 0
Engine/bin/bison-flex/data/skeletons/java-skel.m4

@@ -0,0 +1,27 @@
+                                                            -*- Autoconf -*-
+
+# Java skeleton dispatching for Bison.
+
+# Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation,
+# Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+b4_glr_if(             [b4_complain([%%glr-parser not supported for Java])])
+b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
+
+m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)

+ 502 - 0
Engine/bin/bison-flex/data/skeletons/java.m4

@@ -0,0 +1,502 @@
+                                                            -*- Autoconf -*-
+
+# Java language support for Bison
+
+# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[c-like.m4])
+
+
+# b4_list2(LIST1, LIST2)
+# ----------------------
+# Join two lists with a comma if necessary.
+m4_define([b4_list2],
+          [$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
+
+
+# b4_percent_define_get3(DEF, PRE, POST, NOT)
+# -------------------------------------------
+# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
+# otherwise NOT.
+m4_define([b4_percent_define_get3],
+          [m4_ifval(m4_quote(b4_percent_define_get([$1])),
+                [$2[]b4_percent_define_get([$1])[]$3], [$4])])
+
+
+
+# b4_flag_value(BOOLEAN-FLAG)
+# ---------------------------
+m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
+
+
+# b4_parser_class_declaration
+# ---------------------------
+# The declaration of the parser class ("class YYParser"), with all its
+# qualifiers/annotations.
+b4_percent_define_default([[api.parser.abstract]], [[false]])
+b4_percent_define_default([[api.parser.final]],    [[false]])
+b4_percent_define_default([[api.parser.public]],   [[false]])
+b4_percent_define_default([[api.parser.strictfp]], [[false]])
+
+m4_define([b4_parser_class_declaration],
+[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
+b4_percent_define_flag_if([api.parser.public],   [public ])dnl
+b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
+b4_percent_define_flag_if([api.parser.final],    [final ])dnl
+b4_percent_define_flag_if([api.parser.strictfp], [strictfp ])dnl
+[class ]b4_parser_class[]dnl
+b4_percent_define_get3([api.parser.extends], [ extends ])dnl
+b4_percent_define_get3([api.parser.implements], [ implements ])])
+
+
+# b4_lexer_if(TRUE, FALSE)
+# ------------------------
+m4_define([b4_lexer_if],
+[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
+
+
+# b4_identification
+# -----------------
+m4_define([b4_identification],
+[[  /** Version number for the Bison executable that generated this parser.  */
+  public static final String bisonVersion = "]b4_version_string[";
+
+  /** Name of the skeleton that generated this parser.  */
+  public static final String bisonSkeleton = ]b4_skeleton[;
+]])
+
+
+## ------------ ##
+## Data types.  ##
+## ------------ ##
+
+# b4_int_type(MIN, MAX)
+# ---------------------
+# Return the smallest int type able to handle numbers ranging from
+# MIN to MAX (included).
+m4_define([b4_int_type],
+[m4_if(b4_ints_in($@,   [-128],   [127]), [1], [byte],
+       b4_ints_in($@, [-32768], [32767]), [1], [short],
+                                               [int])])
+
+# b4_int_type_for(NAME)
+# ---------------------
+# Return the smallest int type able to handle numbers ranging from
+# 'NAME_min' to 'NAME_max' (included).
+m4_define([b4_int_type_for],
+[b4_int_type($1_min, $1_max)])
+
+# b4_null
+# -------
+m4_define([b4_null], [null])
+
+
+# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
+# -------------------------------------------------------
+# We use intermediate functions (e.g., yypact_init) to work around the
+# 64KB limit for JVM methods.  See
+# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.
+m4_define([b4_typed_parser_table_define],
+[m4_ifval([$4], [b4_comment([$4])
+  ])dnl
+[private static final ]$1[[] yy$2_ = yy$2_init();
+  private static final ]$1[[] yy$2_init()
+  {
+    return new ]$1[[]
+    {
+  ]$3[
+    };
+  }]])
+
+
+# b4_integral_parser_table_define(NAME, DATA, COMMENT)
+#-----------------------------------------------------
+m4_define([b4_integral_parser_table_define],
+[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
+
+
+## ------------- ##
+## Token kinds.  ##
+## ------------- ##
+
+
+# b4_token_enum(TOKEN-NUM)
+# ------------------------
+# Output the definition of this token as an enum.
+m4_define([b4_token_enum],
+[b4_token_visible_if([$1],
+    [m4_format([[    /** Token %s, to be returned by the scanner.  */
+    static final int %s = %s%s;
+]],
+               b4_symbol([$1], [tag]),
+               b4_symbol([$1], [id]),
+               b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
+
+
+# b4_token_enums
+# --------------
+# Output the definition of the tokens (if there are) as enums.
+m4_define([b4_token_enums],
+[b4_any_token_visible_if([    /* Token kinds.  */
+b4_symbol_foreach([b4_token_enum])])])
+
+
+
+## -------------- ##
+## Symbol kinds.  ##
+## -------------- ##
+
+
+# b4_symbol_kind(NUM)
+# -------------------
+m4_define([b4_symbol_kind],
+[SymbolKind.b4_symbol_kind_base($@)])
+
+
+# b4_symbol_enum(SYMBOL-NUM)
+# --------------------------
+# Output the definition of this symbol as an enum.
+m4_define([b4_symbol_enum],
+[m4_format([    %-30s %s],
+           m4_format([[%s(%s)%s]],
+                     b4_symbol([$1], [kind_base]),
+                     [$1],
+                     m4_if([$1], b4_last_symbol, [[;]], [[,]])),
+           [b4_symbol_tag_comment([$1])])])
+
+
+# b4_declare_symbol_enum
+# ----------------------
+# The definition of the symbol internal numbers as an enum.
+m4_define([b4_declare_symbol_enum],
+[[  public enum SymbolKind
+  {
+]b4_symbol_foreach([b4_symbol_enum])[
+
+    private final int yycode_;
+
+    SymbolKind (int n) {
+      this.yycode_ = n;
+    }
+
+    private static final SymbolKind[] values_ = {
+      ]m4_map_args_sep([b4_symbol_kind(], [)], [,
+      ], b4_symbol_numbers)[
+    };
+
+    static final SymbolKind get(int code) {
+      return values_[code];
+    }
+
+    public final int getCode() {
+      return this.yycode_;
+    }
+
+]b4_parse_error_bmatch(
+[simple\|verbose],
+[[    /* Return YYSTR after stripping away unnecessary quotes and
+       backslashes, so that it's suitable for yyerror.  The heuristic is
+       that double-quoting is unnecessary unless the string contains an
+       apostrophe, a comma, or backslash (other than backslash-backslash).
+       YYSTR is taken from yytname.  */
+    private static String yytnamerr_(String yystr)
+    {
+      if (yystr.charAt (0) == '"')
+        {
+          StringBuffer yyr = new StringBuffer();
+          strip_quotes: for (int i = 1; i < yystr.length(); i++)
+            switch (yystr.charAt(i))
+              {
+              case '\'':
+              case ',':
+                break strip_quotes;
+
+              case '\\':
+                if (yystr.charAt(++i) != '\\')
+                  break strip_quotes;
+                /* Fall through.  */
+              default:
+                yyr.append(yystr.charAt(i));
+                break;
+
+              case '"':
+                return yyr.toString();
+              }
+        }
+      return yystr;
+    }
+
+    /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+       First, the terminals, then, starting at \a YYNTOKENS_, nonterminals.  */
+    ]b4_typed_parser_table_define([String], [tname], [b4_tname])[
+
+    /* The user-facing name of this symbol.  */
+    public final String getName() {
+      return yytnamerr_(yytname_[yycode_]);
+    }
+]],
+[custom\|detailed],
+[[    /* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+       First, the terminals, then, starting at \a YYNTOKENS_, nonterminals.  */
+    ]b4_typed_parser_table_define([String], [names], [b4_symbol_names])[
+
+    /* The user-facing name of this symbol.  */
+    public final String getName() {
+      return yynames_[yycode_];
+    }]])[
+  };
+]])])
+
+
+
+# b4_case(ID, CODE, [COMMENTS])
+# -----------------------------
+# We need to fool Java's stupid unreachable code detection.
+m4_define([b4_case],
+[  case $1:m4_ifval([$3], [ b4_comment([$3])])
+  if (yyn == $1)
+    $2;
+  break;
+])
+
+
+# b4_predicate_case(LABEL, CONDITIONS)
+# ------------------------------------
+m4_define([b4_predicate_case],
+[  case $1:
+     if (! ($2)) YYERROR;
+    break;
+])
+
+
+## -------- ##
+## Checks.  ##
+## -------- ##
+
+b4_percent_define_check_kind([[api.value.type]],    [code], [deprecated])
+
+b4_percent_define_check_kind([[annotations]],       [code], [deprecated])
+b4_percent_define_check_kind([[extends]],           [code], [deprecated])
+b4_percent_define_check_kind([[implements]],        [code], [deprecated])
+b4_percent_define_check_kind([[init_throws]],       [code], [deprecated])
+b4_percent_define_check_kind([[lex_throws]],        [code], [deprecated])
+b4_percent_define_check_kind([[api.parser.class]],  [code], [deprecated])
+b4_percent_define_check_kind([[throws]],            [code], [deprecated])
+
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
+b4_percent_define_default([[api.value.type]], [[Object]])
+b4_percent_define_default([[api.symbol.prefix]], [[S_]])
+
+# b4_api_prefix, b4_api_PREFIX
+# ----------------------------
+# Corresponds to %define api.prefix
+b4_percent_define_default([[api.prefix]], [[YY]])
+m4_define([b4_api_prefix],
+[b4_percent_define_get([[api.prefix]])])
+m4_define([b4_api_PREFIX],
+[m4_toupper(b4_api_prefix)])
+
+# b4_prefix
+# ---------
+# If the %name-prefix is not given, it is api.prefix.
+m4_define_default([b4_prefix], [b4_api_prefix])
+
+b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
+m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
+
+b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
+m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
+
+b4_percent_define_default([[throws]], [])
+m4_define([b4_throws], [b4_percent_define_get([[throws]])])
+
+b4_percent_define_default([[init_throws]], [])
+m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
+
+b4_percent_define_default([[api.location.type]], [Location])
+m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
+
+b4_percent_define_default([[api.position.type]], [Position])
+m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_symbol_translate(STRING)
+# ---------------------------
+# Used by "bison" in the array of symbol names to mark those that
+# require translation.
+m4_define([b4_symbol_translate],
+[[i18n($1)]])
+
+
+# b4_trans(STRING)
+# ----------------
+# Translate a string if i18n is enabled.  Avoid collision with b4_translate.
+m4_define([b4_trans],
+[b4_has_translations_if([i18n($1)], [$1])])
+
+
+
+# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
+# ----------------------------------------------
+# See README.
+m4_define([b4_symbol_value],
+[m4_ifval([$3],
+          [(($3)($1))],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [((b4_symbol([$2], [type]))($1))],
+                                  [$1])],
+                    [$1])])])
+
+
+# b4_lhs_value([SYMBOL-NUM], [TYPE])
+# ----------------------------------
+# See README.
+m4_define([b4_lhs_value], [yyval])
+
+
+# b4_rhs_data(RULE-LENGTH, POS)
+# -----------------------------
+# See README.
+m4_define([b4_rhs_data],
+[yystack.valueAt (b4_subtract($@))])
+
+# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
+# --------------------------------------------------
+# See README.
+#
+# In this simple implementation, %token and %type have class names
+# between the angle brackets.
+m4_define([b4_rhs_value],
+[b4_symbol_value([b4_rhs_data([$1], [$2])], [$3], [$4])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(yyloc)])
+
+
+# b4_rhs_location(RULE-LENGTH, POS)
+# ---------------------------------
+# Expansion of @POS, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[yystack.locationAt (b4_subtract($@))])
+
+
+# b4_lex_param
+# b4_parse_param
+# --------------
+# If defined, b4_lex_param arrives double quoted, but below we prefer
+# it to be single quoted.  Same for b4_parse_param.
+
+# TODO: should be in bison.m4
+m4_define_default([b4_lex_param], [[]])
+m4_define([b4_lex_param], b4_lex_param)
+m4_define([b4_parse_param], b4_parse_param)
+
+# b4_lex_param_decl
+# -----------------
+# Extra formal arguments of the constructor.
+m4_define([b4_lex_param_decl],
+[m4_ifset([b4_lex_param],
+          [b4_remove_comma([$1],
+                           b4_param_decls(b4_lex_param))],
+          [$1])])
+
+m4_define([b4_param_decls],
+          [m4_map([b4_param_decl], [$@])])
+m4_define([b4_param_decl], [, $1])
+
+m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
+
+
+
+# b4_parse_param_decl
+# -------------------
+# Extra formal arguments of the constructor.
+m4_define([b4_parse_param_decl],
+[m4_ifset([b4_parse_param],
+          [b4_remove_comma([$1],
+                           b4_param_decls(b4_parse_param))],
+          [$1])])
+
+
+
+# b4_lex_param_call
+# -----------------
+# Delegating the lexer parameters to the lexer constructor.
+m4_define([b4_lex_param_call],
+          [m4_ifset([b4_lex_param],
+                    [b4_remove_comma([$1],
+                                     b4_param_calls(b4_lex_param))],
+                    [$1])])
+m4_define([b4_param_calls],
+          [m4_map([b4_param_call], [$@])])
+m4_define([b4_param_call], [, $2])
+
+
+
+# b4_parse_param_cons
+# -------------------
+# Extra initialisations of the constructor.
+m4_define([b4_parse_param_cons],
+          [m4_ifset([b4_parse_param],
+                    [b4_constructor_calls(b4_parse_param)])])
+
+m4_define([b4_constructor_calls],
+          [m4_map([b4_constructor_call], [$@])])
+m4_define([b4_constructor_call],
+          [this.$2 = $2;
+          ])
+
+
+
+# b4_parse_param_vars
+# -------------------
+# Extra instance variables.
+m4_define([b4_parse_param_vars],
+          [m4_ifset([b4_parse_param],
+                    [
+    /* User arguments.  */
+b4_var_decls(b4_parse_param)])])
+
+m4_define([b4_var_decls],
+          [m4_map_sep([b4_var_decl], [
+], [$@])])
+m4_define([b4_var_decl],
+          [    protected final $1;])
+
+
+
+# b4_maybe_throws(THROWS)
+# -----------------------
+# Expand to either an empty string or "throws THROWS".
+m4_define([b4_maybe_throws],
+          [m4_ifval($1, [ throws $1])])

+ 1633 - 0
Engine/bin/bison-flex/data/skeletons/lalr1.cc

@@ -0,0 +1,1633 @@
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[c++.m4])
+
+# api.value.type=variant is valid.
+m4_define([b4_value_type_setup_variant])
+
+# parse.lac
+b4_percent_define_default([[parse.lac]], [[none]])
+b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
+b4_define_flag_if([lac])
+m4_define([b4_lac_flag],
+          [m4_if(b4_percent_define_get([[parse.lac]]),
+                 [none], [[0]], [[1]])])
+
+
+# b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED)
+# -------------------------------------------
+m4_define([b4_tname_if],
+[m4_case(b4_percent_define_get([[parse.error]]),
+         [verbose],         [$1],
+         [b4_token_table_if([$1],
+                            [$2])])])
+
+
+# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
+# --------------------------------------------------------------
+# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
+m4_define([b4_integral_parser_table_declare],
+[m4_ifval([$3], [b4_comment([$3], [    ])
+])dnl
+    static const b4_int_type_for([$2]) yy$1_[[]];dnl
+])
+
+# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
+# -------------------------------------------------------------
+# Define "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
+m4_define([b4_integral_parser_table_define],
+[  const b4_int_type_for([$2])
+  b4_parser_class::yy$1_[[]] =
+  {
+  $2
+  };dnl
+])
+
+
+# b4_symbol_kind(NUM)
+# -------------------
+m4_define([b4_symbol_kind],
+[symbol_kind::b4_symbol_kind_base($@)])
+
+
+# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
+# -------------------------------------------------
+# Same as b4_symbol_value, but used in a template method.  It makes
+# a difference when using variants.  Note that b4_value_type_setup_union
+# overrides b4_symbol_value, so we must override it again.
+m4_copy([b4_symbol_value], [b4_symbol_value_template])
+m4_append([b4_value_type_setup_union],
+[m4_copy_force([b4_symbol_value_union], [b4_symbol_value_template])])
+
+# b4_lhs_value(SYMBOL-NUM, [TYPE])
+# --------------------------------
+# See README.
+m4_define([b4_lhs_value],
+[b4_symbol_value([yylhs.value], [$1], [$2])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[yylhs.location])
+
+
+# b4_rhs_data(RULE-LENGTH, POS)
+# -----------------------------
+# See README.
+m4_define([b4_rhs_data],
+[yystack_@{b4_subtract($@)@}])
+
+
+# b4_rhs_state(RULE-LENGTH, POS)
+# ------------------------------
+# The state corresponding to the symbol #POS, where the current
+# rule has RULE-LENGTH symbols on RHS.
+m4_define([b4_rhs_state],
+[b4_rhs_data([$1], [$2]).state])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
+# --------------------------------------------------
+# See README.
+m4_define([_b4_rhs_value],
+[b4_symbol_value([b4_rhs_data([$1], [$2]).value], [$3], [$4])])
+
+m4_define([b4_rhs_value],
+[b4_percent_define_ifdef([api.value.automove],
+                         [YY_MOVE (_b4_rhs_value($@))],
+                         [_b4_rhs_value($@)])])
+
+
+# b4_rhs_location(RULE-LENGTH, POS)
+# ---------------------------------
+# Expansion of @POS, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[b4_rhs_data([$1], [$2]).location])
+
+
+# b4_symbol_action(SYMBOL-NUM, KIND)
+# ----------------------------------
+# Run the action KIND (destructor or printer) for SYMBOL-NUM.
+# Same as in C, but using references instead of pointers.
+m4_define([b4_symbol_action],
+[b4_symbol_if([$1], [has_$2],
+[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl
+b4_dollar_pushdef([yysym.value],
+                  [$1],
+                  [],
+                  [yysym.location])dnl
+      _b4_symbol_case([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
+        b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])dnl
+        break;
+
+m4_popdef([b4_symbol_value])[]dnl
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_yylex
+# --------
+# Call yylex.
+m4_define([b4_yylex],
+[b4_token_ctor_if(
+[b4_function_call([yylex],
+                  [symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
+[b4_function_call([yylex], [int],
+                  [[value_type *], [&yyla.value]][]dnl
+b4_locations_if([, [[location_type *], [&yyla.location]]])dnl
+m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
+
+
+m4_pushdef([b4_copyright_years],
+           [2002-2015, 2018-2021])
+
+m4_define([b4_parser_class],
+          [b4_percent_define_get([[api.parser.class]])])
+
+b4_bison_locations_if([# Backward compatibility.
+   m4_define([b4_location_constructors])
+   m4_include(b4_skeletonsdir/[location.cc])])
+m4_include(b4_skeletonsdir/[stack.hh])
+b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])])
+
+
+# b4_shared_declarations(hh|cc)
+# -----------------------------
+# Declaration that might either go into the header (if --header, $1 = hh)
+# or in the implementation file.
+m4_define([b4_shared_declarations],
+[b4_percent_code_get([[requires]])[
+]b4_parse_assert_if([# include <cassert>])[
+# include <cstdlib> // std::abort
+# include <iostream>
+# include <stdexcept>
+# include <string>
+# include <vector>
+
+]b4_cxx_portability[
+]m4_ifdef([b4_location_include],
+          [[# include ]b4_location_include])[
+]b4_variant_if([b4_variant_includes])[
+
+]b4_attribute_define[
+]b4_cast_define[
+]b4_null_define[
+
+]b4_YYDEBUG_define[
+
+]b4_namespace_open[
+
+]b4_bison_locations_if([m4_ifndef([b4_location_file],
+                                  [b4_location_define])])[
+
+  /// A Bison parser.
+  class ]b4_parser_class[
+  {
+  public:
+]b4_public_types_declare[
+]b4_symbol_type_define[
+    /// Build a parser object.
+    ]b4_parser_class[ (]b4_parse_param_decl[);
+    virtual ~]b4_parser_class[ ();
+
+#if 201103L <= YY_CPLUSPLUS
+    /// Non copyable.
+    ]b4_parser_class[ (const ]b4_parser_class[&) = delete;
+    /// Non copyable.
+    ]b4_parser_class[& operator= (const ]b4_parser_class[&) = delete;
+#endif
+
+    /// Parse.  An alias for parse ().
+    /// \returns  0 iff parsing succeeded.
+    int operator() ();
+
+    /// Parse.
+    /// \returns  0 iff parsing succeeded.
+    virtual int parse ();
+
+#if ]b4_api_PREFIX[DEBUG
+    /// The current debugging stream.
+    std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
+    /// Set the current debugging stream.
+    void set_debug_stream (std::ostream &);
+
+    /// Type for debugging levels.
+    typedef int debug_level_type;
+    /// The current debugging level.
+    debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
+    /// Set the current debugging level.
+    void set_debug_level (debug_level_type l);
+#endif
+
+    /// Report a syntax error.]b4_locations_if([[
+    /// \param loc    where the syntax error is found.]])[
+    /// \param msg    a description of the syntax error.
+    virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
+
+    /// Report a syntax error.
+    void error (const syntax_error& err);
+
+]b4_parse_error_bmatch(
+[custom\|detailed],
+[[    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static const char *symbol_name (symbol_kind_type yysymbol);]],
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static const char *symbol_name (symbol_kind_type yysymbol);
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[    /// The user-facing name of the symbol whose (internal) number is
+    /// YYSYMBOL.  No bounds checking.
+    static std::string symbol_name (symbol_kind_type yysymbol);]])[
+
+]b4_token_constructor_define[
+]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
+    class context
+    {
+    public:
+      context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
+      const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
+      symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }]b4_locations_if([[
+      const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
+]])[
+      /// Put in YYARG at most YYARGN of the expected tokens, and return the
+      /// number of tokens stored in YYARG.  If YYARG is null, return the
+      /// number of expected tokens (guaranteed to be less than YYNTOKENS).
+      int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
+
+    private:
+      const ]b4_parser_class[& yyparser_;
+      const symbol_type& yyla_;
+    };
+]])[
+  private:
+#if YY_CPLUSPLUS < 201103L
+    /// Non copyable.
+    ]b4_parser_class[ (const ]b4_parser_class[&);
+    /// Non copyable.
+    ]b4_parser_class[& operator= (const ]b4_parser_class[&);
+#endif
+]b4_lac_if([[
+    /// Check the lookahead yytoken.
+    /// \returns  true iff the token will be eventually shifted.
+    bool yy_lac_check_ (symbol_kind_type yytoken) const;
+    /// Establish the initial context if no initial context currently exists.
+    /// \returns  true iff the token will be eventually shifted.
+    bool yy_lac_establish_ (symbol_kind_type yytoken);
+    /// Discard any previous initial lookahead context because of event.
+    /// \param event  the event which caused the lookahead to be discarded.
+    ///               Only used for debbuging output.
+    void yy_lac_discard_ (const char* event);]])[
+
+    /// Stored state numbers (used for stacks).
+    typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ state_type;
+]b4_parse_error_bmatch(
+[custom], [[
+    /// Report a syntax error
+    /// \param yyctx     the context in which the error occurred.
+    void report_syntax_error (const context& yyctx) const;]],
+[detailed\|verbose], [[
+    /// The arguments of the error message.
+    int yy_syntax_error_arguments_ (const context& yyctx,
+                                    symbol_kind_type yyarg[], int yyargn) const;
+
+    /// Generate an error message.
+    /// \param yyctx     the context in which the error occurred.
+    virtual std::string yysyntax_error_ (const context& yyctx) const;]])[
+    /// Compute post-reduction state.
+    /// \param yystate   the current state
+    /// \param yysym     the nonterminal to push on the stack
+    static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
+
+    /// Whether the given \c yypact_ value indicates a defaulted state.
+    /// \param yyvalue   the value to check
+    static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT;
+
+    /// Whether the given \c yytable_ value indicates a syntax error.
+    /// \param yyvalue   the value to check
+    static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT;
+
+    static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
+    static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
+
+    /// Convert a scanner token kind \a t to a symbol kind.
+    /// In theory \a t should be a token_kind_type, but character literals
+    /// are valid, yet not members of the token_kind_type enum.
+    static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT;
+
+]b4_parse_error_bmatch(
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+    /// For a symbol, its name in clear.
+    static const char* const yytname_[];
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[    /// Convert the symbol name \a n to a form suitable for a diagnostic.
+    static std::string yytnamerr_ (const char *yystr);
+
+    /// For a symbol, its name in clear.
+    static const char* const yytname_[];
+]])[
+
+    // Tables.
+]b4_parser_tables_declare[
+
+#if ]b4_api_PREFIX[DEBUG
+]b4_integral_parser_table_declare([rline], [b4_rline],
+     [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
+    /// Report on the debug stream that the rule \a r is going to be reduced.
+    virtual void yy_reduce_print_ (int r) const;
+    /// Print the state stack on the debug stream.
+    virtual void yy_stack_print_ () const;
+
+    /// Debugging level.
+    int yydebug_;
+    /// Debug stream.
+    std::ostream* yycdebug_;
+
+    /// \brief Display a symbol kind, value and location.
+    /// \param yyo    The output stream.
+    /// \param yysym  The symbol.
+    template <typename Base>
+    void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
+#endif
+
+    /// \brief Reclaim the memory associated to a symbol.
+    /// \param yymsg     Why this token is reclaimed.
+    ///                  If null, print nothing.
+    /// \param yysym     The symbol.
+    template <typename Base>
+    void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
+
+  private:
+    /// Type access provider for state based symbols.
+    struct by_state
+    {
+      /// Default constructor.
+      by_state () YY_NOEXCEPT;
+
+      /// The symbol kind as needed by the constructor.
+      typedef state_type kind_type;
+
+      /// Constructor.
+      by_state (kind_type s) YY_NOEXCEPT;
+
+      /// Copy constructor.
+      by_state (const by_state& that) YY_NOEXCEPT;
+
+      /// Record that this symbol is empty.
+      void clear () YY_NOEXCEPT;
+
+      /// Steal the symbol kind from \a that.
+      void move (by_state& that);
+
+      /// The symbol kind (corresponding to \a state).
+      /// \a ]b4_symbol(empty, kind)[ when empty.
+      symbol_kind_type kind () const YY_NOEXCEPT;
+
+      /// The state number used to denote an empty symbol.
+      /// We use the initial state, as it does not have a value.
+      enum { empty_state = 0 };
+
+      /// The state.
+      /// \a empty when empty.
+      state_type state;
+    };
+
+    /// "Internal" symbol: element of the stack.
+    struct stack_symbol_type : basic_symbol<by_state>
+    {
+      /// Superclass.
+      typedef basic_symbol<by_state> super_type;
+      /// Construct an empty symbol.
+      stack_symbol_type ();
+      /// Move or copy construction.
+      stack_symbol_type (YY_RVREF (stack_symbol_type) that);
+      /// Steal the contents from \a sym to build this.
+      stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
+#if YY_CPLUSPLUS < 201103L
+      /// Assignment, needed by push_back by some old implementations.
+      /// Moves the contents of that.
+      stack_symbol_type& operator= (stack_symbol_type& that);
+
+      /// Assignment, needed by push_back by other implementations.
+      /// Needed by some other old implementations.
+      stack_symbol_type& operator= (const stack_symbol_type& that);
+#endif
+    };
+
+]b4_stack_define[
+
+    /// Stack type.
+    typedef stack<stack_symbol_type> stack_type;
+
+    /// The stack.
+    stack_type yystack_;]b4_lac_if([[
+    /// The stack for LAC.
+    /// Logically, the yy_lac_stack's lifetime is confined to the function
+    /// yy_lac_check_. We just store it as a member of this class to hold
+    /// on to the memory and to avoid frequent reallocations.
+    /// Since yy_lac_check_ is const, this member must be mutable.
+    mutable std::vector<state_type> yylac_stack_;
+    /// Whether an initial LAC context was established.
+    bool yy_lac_established_;
+]])[
+
+    /// Push a new state on the stack.
+    /// \param m    a debug message to display
+    ///             if null, no trace is output.
+    /// \param sym  the symbol
+    /// \warning the contents of \a s.value is stolen.
+    void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
+
+    /// Push a new look ahead token on the state on the stack.
+    /// \param m    a debug message to display
+    ///             if null, no trace is output.
+    /// \param s    the state
+    /// \param sym  the symbol (for its value and location).
+    /// \warning the contents of \a sym.value is stolen.
+    void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
+
+    /// Pop \a n symbols from the stack.
+    void yypop_ (int n = 1) YY_NOEXCEPT;
+
+    /// Constants.
+    enum
+    {
+      yylast_ = ]b4_last[,     ///< Last index in yytable_.
+      yynnts_ = ]b4_nterms_number[,  ///< Number of nonterminal symbols.
+      yyfinal_ = ]b4_final_state_number[ ///< Termination state number.
+    };
+
+]b4_parse_param_vars[
+]b4_percent_code_get([[yy_bison_internal_hook]])[
+  };
+
+]b4_token_ctor_if([b4_yytranslate_define([$1])[
+]b4_public_types_define([$1])])[
+]b4_namespace_close[
+
+]b4_percent_code_get([[provides]])[
+]])[
+
+
+## -------------- ##
+## Output files.  ##
+## -------------- ##
+
+# ------------- #
+# Header file.  #
+# ------------- #
+
+]b4_header_if([[
+]b4_output_begin([b4_spec_header_file])[
+]b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])[
+
+/**
+ ** \file ]b4_spec_mapped_header_file[
+ ** Define the ]b4_namespace_ref[::parser class.
+ */
+
+// C++ LALR(1) parser skeleton written by Akim Demaille.
+
+]b4_disclaimer[
+]b4_cpp_guard_open([b4_spec_mapped_header_file])[
+]b4_shared_declarations(hh)[
+]b4_cpp_guard_close([b4_spec_mapped_header_file])[
+]b4_output_end[
+]])[
+
+
+# --------------------- #
+# Implementation file.  #
+# --------------------- #
+
+]b4_output_begin([b4_parser_file_name])[
+]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])[
+]b4_disclaimer[
+]b4_percent_code_get([[top]])[]dnl
+m4_if(b4_prefix, [yy], [],
+[
+// Take the name prefix into account.
+[#]define yylex   b4_prefix[]lex])[
+
+]b4_user_pre_prologue[
+
+]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
+               [b4_shared_declarations([cc])])[
+
+]b4_user_post_prologue[
+]b4_percent_code_get[
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(msgid) msgid
+# endif
+#endif
+]b4_has_translations_if([
+#ifndef N_
+# define N_(Msgid) Msgid
+#endif
+])[
+
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+#  define YY_EXCEPTIONS 0
+# else
+#  define YY_EXCEPTIONS 1
+# endif
+#endif
+
+]b4_locations_if([dnl
+[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
+]b4_yylloc_default_define])[
+
+// Enable debugging if requested.
+#if ]b4_api_PREFIX[DEBUG
+
+// A pseudo ostream that takes yydebug_ into account.
+# define YYCDEBUG if (yydebug_) (*yycdebug_)
+
+# define YY_SYMBOL_PRINT(Title, Symbol)         \
+  do {                                          \
+    if (yydebug_)                               \
+    {                                           \
+      *yycdebug_ << Title << ' ';               \
+      yy_print_ (*yycdebug_, Symbol);           \
+      *yycdebug_ << '\n';                       \
+    }                                           \
+  } while (false)
+
+# define YY_REDUCE_PRINT(Rule)          \
+  do {                                  \
+    if (yydebug_)                       \
+      yy_reduce_print_ (Rule);          \
+  } while (false)
+
+# define YY_STACK_PRINT()               \
+  do {                                  \
+    if (yydebug_)                       \
+      yy_stack_print_ ();                \
+  } while (false)
+
+#else // !]b4_api_PREFIX[DEBUG
+
+# define YYCDEBUG if (false) std::cerr
+# define YY_SYMBOL_PRINT(Title, Symbol)  YY_USE (Symbol)
+# define YY_REDUCE_PRINT(Rule)           static_cast<void> (0)
+# define YY_STACK_PRINT()                static_cast<void> (0)
+
+#endif // !]b4_api_PREFIX[DEBUG
+
+#define yyerrok         (yyerrstatus_ = 0)
+#define yyclearin       (yyla.clear ())
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+#define YYRECOVERING()  (!!yyerrstatus_)
+
+]b4_namespace_open[
+  /// Build a parser object.
+  ]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)
+#if ]b4_api_PREFIX[DEBUG
+    : yydebug_ (false),
+      yycdebug_ (&std::cerr)]b4_lac_if([,], [m4_ifset([b4_parse_param], [,])])[
+#else
+]b4_lac_if([    :], [m4_ifset([b4_parse_param], [    :])])[
+#endif]b4_lac_if([[
+      yy_lac_established_ (false)]m4_ifset([b4_parse_param], [,])])[]b4_parse_param_cons[
+  {}
+
+  ]b4_parser_class::~b4_parser_class[ ()
+  {}
+
+  ]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
+  {}
+
+  /*---------.
+  | symbol.  |
+  `---------*/
+
+]b4_token_ctor_if([], [b4_public_types_define([cc])])[
+
+  // by_state.
+  ]b4_parser_class[::by_state::by_state () YY_NOEXCEPT
+    : state (empty_state)
+  {}
+
+  ]b4_parser_class[::by_state::by_state (const by_state& that) YY_NOEXCEPT
+    : state (that.state)
+  {}
+
+  void
+  ]b4_parser_class[::by_state::clear () YY_NOEXCEPT
+  {
+    state = empty_state;
+  }
+
+  void
+  ]b4_parser_class[::by_state::move (by_state& that)
+  {
+    state = that.state;
+    that.clear ();
+  }
+
+  ]b4_parser_class[::by_state::by_state (state_type s) YY_NOEXCEPT
+    : state (s)
+  {}
+
+  ]b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::by_state::kind () const YY_NOEXCEPT
+  {
+    if (state == empty_state)
+      return ]b4_symbol(empty, kind)[;
+    else
+      return YY_CAST (symbol_kind_type, yystos_[+state]);
+  }
+
+  ]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
+  {}
+
+  ]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
+    : super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
+  {]b4_variant_if([
+    b4_symbol_variant([that.kind ()],
+                      [value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
+#if 201103L <= YY_CPLUSPLUS
+    // that is emptied.
+    that.state = empty_state;
+#endif
+  }
+
+  ]b4_parser_class[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
+    : super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
+  {]b4_variant_if([
+    b4_symbol_variant([that.kind ()],
+                      [value], [move], [YY_MOVE (that.value)])])[
+    // that is emptied.
+    that.kind_ = ]b4_symbol(empty, kind)[;
+  }
+
+#if YY_CPLUSPLUS < 201103L
+  ]b4_parser_class[::stack_symbol_type&
+  ]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that)
+  {
+    state = that.state;
+    ]b4_variant_if([b4_symbol_variant([that.kind ()],
+                                      [value], [copy], [that.value])],
+                   [[value = that.value;]])[]b4_locations_if([
+    location = that.location;])[
+    return *this;
+  }
+
+  ]b4_parser_class[::stack_symbol_type&
+  ]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
+  {
+    state = that.state;
+    ]b4_variant_if([b4_symbol_variant([that.kind ()],
+                                      [value], [move], [that.value])],
+                   [[value = that.value;]])[]b4_locations_if([
+    location = that.location;])[
+    // that is emptied.
+    that.state = empty_state;
+    return *this;
+  }
+#endif
+
+  template <typename Base>
+  void
+  ]b4_parser_class[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
+  {
+    if (yymsg)
+      YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
+
+    // User destructor.
+    b4_symbol_actions([destructor], [yysym.kind ()])])[
+  }
+
+#if ]b4_api_PREFIX[DEBUG
+  template <typename Base>
+  void
+  ]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
+  {
+    std::ostream& yyoutput = yyo;
+    YY_USE (yyoutput);
+    if (yysym.empty ())
+      yyo << "empty symbol";
+    else
+      {
+        symbol_kind_type yykind = yysym.kind ();
+        yyo << (yykind < YYNTOKENS ? "token" : "nterm")
+            << ' ' << yysym.name () << " ("]b4_locations_if([
+            << yysym.location << ": "])[;
+        ]b4_symbol_actions([printer])[
+        yyo << ')';
+      }
+  }
+#endif
+
+  void
+  ]b4_parser_class[::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
+  {
+    if (m)
+      YY_SYMBOL_PRINT (m, sym);
+    yystack_.push (YY_MOVE (sym));
+  }
+
+  void
+  ]b4_parser_class[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
+  {
+#if 201103L <= YY_CPLUSPLUS
+    yypush_ (m, stack_symbol_type (s, std::move (sym)));
+#else
+    stack_symbol_type ss (s, sym);
+    yypush_ (m, ss);
+#endif
+  }
+
+  void
+  ]b4_parser_class[::yypop_ (int n) YY_NOEXCEPT
+  {
+    yystack_.pop (n);
+  }
+
+#if ]b4_api_PREFIX[DEBUG
+  std::ostream&
+  ]b4_parser_class[::debug_stream () const
+  {
+    return *yycdebug_;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_stream (std::ostream& o)
+  {
+    yycdebug_ = &o;
+  }
+
+
+  ]b4_parser_class[::debug_level_type
+  ]b4_parser_class[::debug_level () const
+  {
+    return yydebug_;
+  }
+
+  void
+  ]b4_parser_class[::set_debug_level (debug_level_type l)
+  {
+    yydebug_ = l;
+  }
+#endif // ]b4_api_PREFIX[DEBUG
+
+  ]b4_parser_class[::state_type
+  ]b4_parser_class[::yy_lr_goto_state_ (state_type yystate, int yysym)
+  {
+    int yyr = yypgoto_[yysym - YYNTOKENS] + yystate;
+    if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
+      return yytable_[yyr];
+    else
+      return yydefgoto_[yysym - YYNTOKENS];
+  }
+
+  bool
+  ]b4_parser_class[::yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT
+  {
+    return yyvalue == yypact_ninf_;
+  }
+
+  bool
+  ]b4_parser_class[::yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT
+  {
+    return yyvalue == yytable_ninf_;
+  }
+
+  int
+  ]b4_parser_class[::operator() ()
+  {
+    return parse ();
+  }
+
+  int
+  ]b4_parser_class[::parse ()
+  {
+    int yyn;
+    /// Length of the RHS of the rule being reduced.
+    int yylen = 0;
+
+    // Error handling.
+    int yynerrs_ = 0;
+    int yyerrstatus_ = 0;
+
+    /// The lookahead symbol.
+    symbol_type yyla;]b4_locations_if([[
+
+    /// The locations where the error started and ended.
+    stack_symbol_type yyerror_range[3];]])[
+
+    /// The return value of parse ().
+    int yyresult;]b4_lac_if([[
+
+    // Discard the LAC context in case there still is one left from a
+    // previous invocation.
+    yy_lac_discard_ ("init");]])[
+
+#if YY_EXCEPTIONS
+    try
+#endif // YY_EXCEPTIONS
+      {
+    YYCDEBUG << "Starting parse\n";
+
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([yyla.value], [], [], [yyla.location])dnl
+    b4_user_initial_action
+b4_dollar_popdef])[]dnl
+
+  [  /* Initialize the stack.  The initial state will be set in
+       yynewstate, since the latter expects the semantical and the
+       location values to have been already stored, initialize these
+       stacks with a primary value.  */
+    yystack_.clear ();
+    yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
+
+  /*-----------------------------------------------.
+  | yynewstate -- push a new symbol on the stack.  |
+  `-----------------------------------------------*/
+  yynewstate:
+    YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
+    YY_STACK_PRINT ();
+
+    // Accept?
+    if (yystack_[0].state == yyfinal_)
+      YYACCEPT;
+
+    goto yybackup;
+
+
+  /*-----------.
+  | yybackup.  |
+  `-----------*/
+  yybackup:
+    // Try to take a decision without lookahead.
+    yyn = yypact_[+yystack_[0].state];
+    if (yy_pact_value_is_default_ (yyn))
+      goto yydefault;
+
+    // Read a lookahead token.
+    if (yyla.empty ())
+      {
+        YYCDEBUG << "Reading a token\n";
+#if YY_EXCEPTIONS
+        try
+#endif // YY_EXCEPTIONS
+          {]b4_token_ctor_if([[
+            symbol_type yylookahead (]b4_yylex[);
+            yyla.move (yylookahead);]], [[
+            yyla.kind_ = yytranslate_ (]b4_yylex[);]])[
+          }
+#if YY_EXCEPTIONS
+        catch (const syntax_error& yyexc)
+          {
+            YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
+            error (yyexc);
+            goto yyerrlab1;
+          }
+#endif // YY_EXCEPTIONS
+      }
+    YY_SYMBOL_PRINT ("Next token is", yyla);
+
+    if (yyla.kind () == ]b4_symbol(error, kind)[)
+    {
+      // The scanner already issued an error message, process directly
+      // to error recovery.  But do not keep the error token as
+      // lookahead, it is too special and may lead us to an endless
+      // loop in error recovery. */
+      yyla.kind_ = ]b4_symbol(undef, kind)[;
+      goto yyerrlab1;
+    }
+
+    /* If the proper action on seeing token YYLA.TYPE is to reduce or
+       to detect an error, take that action.  */
+    yyn += yyla.kind ();
+    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.kind ())
+      {]b4_lac_if([[
+        if (!yy_lac_establish_ (yyla.kind ()))
+          goto yyerrlab;]])[
+        goto yydefault;
+      }
+
+    // Reduce or error.
+    yyn = yytable_[yyn];
+    if (yyn <= 0)
+      {
+        if (yy_table_value_is_error_ (yyn))
+          goto yyerrlab;]b4_lac_if([[
+        if (!yy_lac_establish_ (yyla.kind ()))
+          goto yyerrlab;
+]])[
+        yyn = -yyn;
+        goto yyreduce;
+      }
+
+    // Count tokens shifted since error; after three, turn off error status.
+    if (yyerrstatus_)
+      --yyerrstatus_;
+
+    // Shift the lookahead token.
+    yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla));]b4_lac_if([[
+    yy_lac_discard_ ("shift");]])[
+    goto yynewstate;
+
+
+  /*-----------------------------------------------------------.
+  | yydefault -- do the default action for the current state.  |
+  `-----------------------------------------------------------*/
+  yydefault:
+    yyn = yydefact_[+yystack_[0].state];
+    if (yyn == 0)
+      goto yyerrlab;
+    goto yyreduce;
+
+
+  /*-----------------------------.
+  | yyreduce -- do a reduction.  |
+  `-----------------------------*/
+  yyreduce:
+    yylen = yyr2_[yyn];
+    {
+      stack_symbol_type yylhs;
+      yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([[
+      /* Variants are always initialized to an empty instance of the
+         correct type. The default '$$ = $1' action is NOT applied
+         when using variants.  */
+      ]b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [[
+      /* If YYLEN is nonzero, implement the default value of the
+         action: '$$ = $1'.  Otherwise, use the top of the stack.
+
+         Otherwise, the following line sets YYLHS.VALUE to garbage.
+         This behavior is undocumented and Bison users should not rely
+         upon it.  */
+      if (yylen)
+        yylhs.value = yystack_@{yylen - 1@}.value;
+      else
+        yylhs.value = yystack_@{0@}.value;]])[
+]b4_locations_if([dnl
+[
+      // Default location.
+      {
+        stack_type::slice range (yystack_, yylen);
+        YYLLOC_DEFAULT (yylhs.location, range, yylen);
+        yyerror_range[1].location = yylhs.location;
+      }]])[
+
+      // Perform the reduction.
+      YY_REDUCE_PRINT (yyn);
+#if YY_EXCEPTIONS
+      try
+#endif // YY_EXCEPTIONS
+        {
+          switch (yyn)
+            {
+]b4_user_actions[
+            default:
+              break;
+            }
+        }
+#if YY_EXCEPTIONS
+      catch (const syntax_error& yyexc)
+        {
+          YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
+          error (yyexc);
+          YYERROR;
+        }
+#endif // YY_EXCEPTIONS
+      YY_SYMBOL_PRINT ("-> $$ =", yylhs);
+      yypop_ (yylen);
+      yylen = 0;
+
+      // Shift the result of the reduction.
+      yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
+    }
+    goto yynewstate;
+
+
+  /*--------------------------------------.
+  | yyerrlab -- here on detecting error.  |
+  `--------------------------------------*/
+  yyerrlab:
+    // If not already recovering from an error, report this error.
+    if (!yyerrstatus_)
+      {
+        ++yynerrs_;]b4_parse_error_case(
+                  [simple], [[
+        std::string msg = YY_("syntax error");
+        error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]],
+                  [custom], [[
+        context yyctx (*this, yyla);
+        report_syntax_error (yyctx);]],
+                  [[
+        context yyctx (*this, yyla);
+        std::string msg = yysyntax_error_ (yyctx);
+        error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]])[
+      }
+
+]b4_locations_if([[
+    yyerror_range[1].location = yyla.location;]])[
+    if (yyerrstatus_ == 3)
+      {
+        /* If just tried and failed to reuse lookahead token after an
+           error, discard it.  */
+
+        // Return failure if at end of input.
+        if (yyla.kind () == ]b4_symbol(eof, kind)[)
+          YYABORT;
+        else if (!yyla.empty ())
+          {
+            yy_destroy_ ("Error: discarding", yyla);
+            yyla.clear ();
+          }
+      }
+
+    // Else will try to reuse lookahead token after shifting the error token.
+    goto yyerrlab1;
+
+
+  /*---------------------------------------------------.
+  | yyerrorlab -- error raised explicitly by YYERROR.  |
+  `---------------------------------------------------*/
+  yyerrorlab:
+    /* Pacify compilers when the user code never invokes YYERROR and
+       the label yyerrorlab therefore never appears in user code.  */
+    if (false)
+      YYERROR;
+
+    /* Do not reclaim the symbols of the rule whose action triggered
+       this YYERROR.  */
+    yypop_ (yylen);
+    yylen = 0;
+    YY_STACK_PRINT ();
+    goto yyerrlab1;
+
+
+  /*-------------------------------------------------------------.
+  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
+  `-------------------------------------------------------------*/
+  yyerrlab1:
+    yyerrstatus_ = 3;   // Each real token shifted decrements this.
+    // Pop stack until we find a state that shifts the error token.
+    for (;;)
+      {
+        yyn = yypact_[+yystack_[0].state];
+        if (!yy_pact_value_is_default_ (yyn))
+          {
+            yyn += ]b4_symbol(error, kind)[;
+            if (0 <= yyn && yyn <= yylast_
+                && yycheck_[yyn] == ]b4_symbol(error, kind)[)
+              {
+                yyn = yytable_[yyn];
+                if (0 < yyn)
+                  break;
+              }
+          }
+
+        // Pop the current state because it cannot handle the error token.
+        if (yystack_.size () == 1)
+          YYABORT;
+]b4_locations_if([[
+        yyerror_range[1].location = yystack_[0].location;]])[
+        yy_destroy_ ("Error: popping", yystack_[0]);
+        yypop_ ();
+        YY_STACK_PRINT ();
+      }
+    {
+      stack_symbol_type error_token;
+]b4_locations_if([[
+      yyerror_range[2].location = yyla.location;
+      YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
+
+      // Shift the error token.]b4_lac_if([[
+      yy_lac_discard_ ("error recovery");]])[
+      error_token.state = state_type (yyn);
+      yypush_ ("Shifting", YY_MOVE (error_token));
+    }
+    goto yynewstate;
+
+
+  /*-------------------------------------.
+  | yyacceptlab -- YYACCEPT comes here.  |
+  `-------------------------------------*/
+  yyacceptlab:
+    yyresult = 0;
+    goto yyreturn;
+
+
+  /*-----------------------------------.
+  | yyabortlab -- YYABORT comes here.  |
+  `-----------------------------------*/
+  yyabortlab:
+    yyresult = 1;
+    goto yyreturn;
+
+
+  /*-----------------------------------------------------.
+  | yyreturn -- parsing is finished, return the result.  |
+  `-----------------------------------------------------*/
+  yyreturn:
+    if (!yyla.empty ())
+      yy_destroy_ ("Cleanup: discarding lookahead", yyla);
+
+    /* Do not reclaim the symbols of the rule whose action triggered
+       this YYABORT or YYACCEPT.  */
+    yypop_ (yylen);
+    YY_STACK_PRINT ();
+    while (1 < yystack_.size ())
+      {
+        yy_destroy_ ("Cleanup: popping", yystack_[0]);
+        yypop_ ();
+      }
+
+    return yyresult;
+  }
+#if YY_EXCEPTIONS
+    catch (...)
+      {
+        YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
+        // Do not try to display the values of the reclaimed symbols,
+        // as their printers might throw an exception.
+        if (!yyla.empty ())
+          yy_destroy_ (YY_NULLPTR, yyla);
+
+        while (1 < yystack_.size ())
+          {
+            yy_destroy_ (YY_NULLPTR, yystack_[0]);
+            yypop_ ();
+          }
+        throw;
+      }
+#endif // YY_EXCEPTIONS
+  }
+
+  void
+  ]b4_parser_class[::error (const syntax_error& yyexc)
+  {
+    error (]b4_join(b4_locations_if([yyexc.location]),
+                    [[yyexc.what ()]])[);
+  }
+
+]b4_parse_error_bmatch([custom\|detailed],
+[[  const char *
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    static const char *const yy_sname[] =
+    {
+    ]b4_symbol_names[
+    };]b4_has_translations_if([[
+    /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
+       internationalizable.  */
+    static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
+    {
+    ]b4_translatable[
+    };
+    return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
+            ? _(yy_sname[yysymbol])
+            : yy_sname[yysymbol]);]], [[
+    return yy_sname[yysymbol];]])[
+  }
+]],
+[simple],
+[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+  const char *
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    return yytname_[yysymbol];
+  }
+#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
+]],
+[verbose],
+[[  /* Return YYSTR after stripping away unnecessary quotes and
+     backslashes, so that it's suitable for yyerror.  The heuristic is
+     that double-quoting is unnecessary unless the string contains an
+     apostrophe, a comma, or backslash (other than backslash-backslash).
+     YYSTR is taken from yytname.  */
+  std::string
+  ]b4_parser_class[::yytnamerr_ (const char *yystr)
+  {
+    if (*yystr == '"')
+      {
+        std::string yyr;
+        char const *yyp = yystr;
+
+        for (;;)
+          switch (*++yyp)
+            {
+            case '\'':
+            case ',':
+              goto do_not_strip_quotes;
+
+            case '\\':
+              if (*++yyp != '\\')
+                goto do_not_strip_quotes;
+              else
+                goto append;
+
+            append:
+            default:
+              yyr += *yyp;
+              break;
+
+            case '"':
+              return yyr;
+            }
+      do_not_strip_quotes: ;
+      }
+
+    return yystr;
+  }
+
+  std::string
+  ]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
+  {
+    return yytnamerr_ (yytname_[yysymbol]);
+  }
+]])[
+
+]b4_parse_error_bmatch([custom\|detailed\|verbose], [[
+  // ]b4_parser_class[::context.
+  ]b4_parser_class[::context::context (const ]b4_parser_class[& yyparser, const symbol_type& yyla)
+    : yyparser_ (yyparser)
+    , yyla_ (yyla)
+  {}
+
+  int
+  ]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const
+  {
+    // Actual number of expected tokens
+    int yycount = 0;
+]b4_lac_if([[
+#if ]b4_api_PREFIX[DEBUG
+    // Execute LAC once. We don't care if it is successful, we
+    // only do it for the sake of debugging output.
+    if (!yyparser_.yy_lac_established_)
+      yyparser_.yy_lac_check_ (yyla_.kind ());
+#endif
+
+    for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
+      {
+        symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
+        if (yysym != ]b4_symbol(error, kind)[
+            && yysym != ]b4_symbol(undef, kind)[
+            && yyparser_.yy_lac_check_ (yysym))
+          {
+            if (!yyarg)
+              ++yycount;
+            else if (yycount == yyargn)
+              return 0;
+            else
+              yyarg[yycount++] = yysym;
+          }
+      }]], [[
+    const int yyn = yypact_[+yyparser_.yystack_[0].state];
+    if (!yy_pact_value_is_default_ (yyn))
+      {
+        /* Start YYX at -YYN if negative to avoid negative indexes in
+           YYCHECK.  In other words, skip the first -YYN actions for
+           this state because they are default actions.  */
+        const int yyxbegin = yyn < 0 ? -yyn : 0;
+        // Stay within bounds of both yycheck and yytname.
+        const int yychecklim = yylast_ - yyn + 1;
+        const int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+        for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
+          if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
+              && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
+            {
+              if (!yyarg)
+                ++yycount;
+              else if (yycount == yyargn)
+                return 0;
+              else
+                yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
+            }
+      }
+]])[
+    if (yyarg && yycount == 0 && 0 < yyargn)
+      yyarg[0] = ]b4_symbol(empty, kind)[;
+    return yycount;
+  }
+
+]])[
+
+]b4_lac_if([[
+  bool
+  ]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const
+  {
+    // Logically, the yylac_stack's lifetime is confined to this function.
+    // Clear it, to get rid of potential left-overs from previous call.
+    yylac_stack_.clear ();
+    // Reduce until we encounter a shift and thereby accept the token.
+#if ]b4_api_PREFIX[DEBUG
+    YYCDEBUG << "LAC: checking lookahead " << symbol_name (yytoken) << ':';
+#endif
+    std::ptrdiff_t lac_top = 0;
+    while (true)
+      {
+        state_type top_state = (yylac_stack_.empty ()
+                                ? yystack_[lac_top].state
+                                : yylac_stack_.back ());
+        int yyrule = yypact_[+top_state];
+        if (yy_pact_value_is_default_ (yyrule)
+            || (yyrule += yytoken) < 0 || yylast_ < yyrule
+            || yycheck_[yyrule] != yytoken)
+          {
+            // Use the default action.
+            yyrule = yydefact_[+top_state];
+            if (yyrule == 0)
+              {
+                YYCDEBUG << " Err\n";
+                return false;
+              }
+          }
+        else
+          {
+            // Use the action from yytable.
+            yyrule = yytable_[yyrule];
+            if (yy_table_value_is_error_ (yyrule))
+              {
+                YYCDEBUG << " Err\n";
+                return false;
+              }
+            if (0 < yyrule)
+              {
+                YYCDEBUG << " S" << yyrule << '\n';
+                return true;
+              }
+            yyrule = -yyrule;
+          }
+        // By now we know we have to simulate a reduce.
+        YYCDEBUG << " R" << yyrule - 1;
+        // Pop the corresponding number of values from the stack.
+        {
+          std::ptrdiff_t yylen = yyr2_[yyrule];
+          // First pop from the LAC stack as many tokens as possible.
+          std::ptrdiff_t lac_size = std::ptrdiff_t (yylac_stack_.size ());
+          if (yylen < lac_size)
+            {
+              yylac_stack_.resize (std::size_t (lac_size - yylen));
+              yylen = 0;
+            }
+          else if (lac_size)
+            {
+              yylac_stack_.clear ();
+              yylen -= lac_size;
+            }
+          // Only afterwards look at the main stack.
+          // We simulate popping elements by incrementing lac_top.
+          lac_top += yylen;
+        }
+        // Keep top_state in sync with the updated stack.
+        top_state = (yylac_stack_.empty ()
+                     ? yystack_[lac_top].state
+                     : yylac_stack_.back ());
+        // Push the resulting state of the reduction.
+        state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
+        YYCDEBUG << " G" << int (state);
+        yylac_stack_.push_back (state);
+      }
+  }
+
+  // Establish the initial context if no initial context currently exists.
+  bool
+  ]b4_parser_class[::yy_lac_establish_ (symbol_kind_type yytoken)
+  {
+    /* Establish the initial context for the current lookahead if no initial
+       context is currently established.
+
+       We define a context as a snapshot of the parser stacks.  We define
+       the initial context for a lookahead as the context in which the
+       parser initially examines that lookahead in order to select a
+       syntactic action.  Thus, if the lookahead eventually proves
+       syntactically unacceptable (possibly in a later context reached via a
+       series of reductions), the initial context can be used to determine
+       the exact set of tokens that would be syntactically acceptable in the
+       lookahead's place.  Moreover, it is the context after which any
+       further semantic actions would be erroneous because they would be
+       determined by a syntactically unacceptable token.
+
+       yy_lac_establish_ should be invoked when a reduction is about to be
+       performed in an inconsistent state (which, for the purposes of LAC,
+       includes consistent states that don't know they're consistent because
+       their default reductions have been disabled).
+
+       For parse.lac=full, the implementation of yy_lac_establish_ is as
+       follows.  If no initial context is currently established for the
+       current lookahead, then check if that lookahead can eventually be
+       shifted if syntactic actions continue from the current context.  */
+    if (yy_lac_established_)
+      return true;
+    else
+      {
+#if ]b4_api_PREFIX[DEBUG
+        YYCDEBUG << "LAC: initial context established for "
+                 << symbol_name (yytoken) << '\n';
+#endif
+        yy_lac_established_ = true;
+        return yy_lac_check_ (yytoken);
+      }
+  }
+
+  // Discard any previous initial lookahead context.
+  void
+  ]b4_parser_class[::yy_lac_discard_ (const char* event)
+  {
+   /* Discard any previous initial lookahead context because of Event,
+      which may be a lookahead change or an invalidation of the currently
+      established initial context for the current lookahead.
+
+      The most common example of a lookahead change is a shift.  An example
+      of both cases is syntax error recovery.  That is, a syntax error
+      occurs when the lookahead is syntactically erroneous for the
+      currently established initial context, so error recovery manipulates
+      the parser stacks to try to find a new initial context in which the
+      current lookahead is syntactically acceptable.  If it fails to find
+      such a context, it discards the lookahead.  */
+    if (yy_lac_established_)
+      {
+        YYCDEBUG << "LAC: initial context discarded due to "
+                 << event << '\n';
+        yy_lac_established_ = false;
+      }
+  }]])[
+
+]b4_parse_error_bmatch([detailed\|verbose], [[
+  int
+  ]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
+                                                 symbol_kind_type yyarg[], int yyargn) const
+  {
+    /* There are many possibilities here to consider:
+       - If this state is a consistent state with a default action, then
+         the only way this function was invoked is if the default action
+         is an error action.  In that case, don't check for expected
+         tokens because there are none.
+       - The only way there can be no lookahead present (in yyla) is
+         if this state is a consistent state with a default action.
+         Thus, detecting the absence of a lookahead is sufficient to
+         determine that there is no unexpected or expected token to
+         report.  In that case, just report a simple "syntax error".
+       - Don't assume there isn't a lookahead just because this state is
+         a consistent state with a default action.  There might have
+         been a previous inconsistent state, consistent state with a
+         non-default action, or user semantic action that manipulated
+         yyla.  (However, yyla is currently not documented for users.)]b4_lac_if([[
+         In the first two cases, it might appear that the current syntax
+         error should have been detected in the previous state when
+         yy_lac_check was invoked.  However, at that time, there might
+         have been a different syntax error that discarded a different
+         initial context during error recovery, leaving behind the
+         current lookahead.]], [[
+       - Of course, the expected token list depends on states to have
+         correct lookahead information, and it depends on the parser not
+         to perform extra reductions after fetching a lookahead from the
+         scanner and before detecting a syntax error.  Thus, state merging
+         (from LALR or IELR) and default reductions corrupt the expected
+         token list.  However, the list is correct for canonical LR with
+         one exception: it will still contain any token that will not be
+         accepted due to an error action in a later state.]])[
+    */
+
+    if (!yyctx.lookahead ().empty ())
+      {
+        if (yyarg)
+          yyarg[0] = yyctx.token ();
+        int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
+        return yyn + 1;
+      }
+    return 0;
+  }
+
+  // Generate an error message.
+  std::string
+  ]b4_parser_class[::yysyntax_error_ (const context& yyctx) const
+  {
+    // Its maximum.
+    enum { YYARGS_MAX = 5 };
+    // Arguments of yyformat.
+    symbol_kind_type yyarg[YYARGS_MAX];
+    int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
+
+    char const* yyformat = YY_NULLPTR;
+    switch (yycount)
+      {
+#define YYCASE_(N, S)                         \
+        case N:                               \
+          yyformat = S;                       \
+        break
+      default: // Avoid compiler warnings.
+        YYCASE_ (0, YY_("syntax error"));
+        YYCASE_ (1, YY_("syntax error, unexpected %s"));
+        YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
+        YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+        YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+        YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+      }
+
+    std::string yyres;
+    // Argument number.
+    std::ptrdiff_t yyi = 0;
+    for (char const* yyp = yyformat; *yyp; ++yyp)
+      if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
+        {
+          yyres += symbol_name (yyarg[yyi++]);
+          ++yyp;
+        }
+      else
+        yyres += *yyp;
+    return yyres;
+  }]])[
+
+
+  const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class::yypact_ninf_ = b4_pact_ninf[;
+
+  const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class::yytable_ninf_ = b4_table_ninf[;
+
+]b4_parser_tables_define[
+
+]b4_parse_error_bmatch([simple\|verbose],
+[[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[
+  // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+  // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
+  const char*
+  const ]b4_parser_class[::yytname_[] =
+  {
+  ]b4_tname[
+  };
+#endif
+]])[
+
+#if ]b4_api_PREFIX[DEBUG][
+]b4_integral_parser_table_define([rline], [b4_rline])[
+
+  void
+  ]b4_parser_class[::yy_stack_print_ () const
+  {
+    *yycdebug_ << "Stack now";
+    for (stack_type::const_iterator
+           i = yystack_.begin (),
+           i_end = yystack_.end ();
+         i != i_end; ++i)
+      *yycdebug_ << ' ' << int (i->state);
+    *yycdebug_ << '\n';
+  }
+
+  void
+  ]b4_parser_class[::yy_reduce_print_ (int yyrule) const
+  {
+    int yylno = yyrline_[yyrule];
+    int yynrhs = yyr2_[yyrule];
+    // Print the symbols being reduced, and their result.
+    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
+               << " (line " << yylno << "):\n";
+    // The symbols being reduced.
+    for (int yyi = 0; yyi < yynrhs; yyi++)
+      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
+                       ]b4_rhs_data(yynrhs, yyi + 1)[);
+  }
+#endif // ]b4_api_PREFIX[DEBUG
+
+]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
+]b4_namespace_close[
+]b4_epilogue[]dnl
+b4_output_end
+
+
+m4_popdef([b4_copyright_years])dnl

+ 1326 - 0
Engine/bin/bison-flex/data/skeletons/lalr1.d

@@ -0,0 +1,1326 @@
+# D skeleton for Bison -*- autoconf -*-
+
+# Copyright (C) 2007-2012, 2019-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[d.m4])
+
+b4_header_if([b4_complain([%header/%defines does not make sense in D])])
+
+# parse.lac
+b4_percent_define_default([[parse.lac]], [[none]])
+b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
+b4_define_flag_if([lac])
+m4_define([b4_lac_flag],
+          [m4_if(b4_percent_define_get([[parse.lac]]),
+                 [none], [[0]], [[1]])])
+
+
+## --------------- ##
+## api.push-pull.  ##
+## --------------- ##
+
+b4_percent_define_default([[api.push-pull]], [[pull]])
+b4_percent_define_check_values([[[[api.push-pull]],
+                                 [[pull]], [[push]], [[both]]]])
+
+# Define m4 conditional macros that encode the value
+# of the api.push-pull flag.
+b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
+b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
+m4_case(b4_percent_define_get([[api.push-pull]]),
+        [pull], [m4_define([b4_push_flag], [[0]])],
+        [push], [m4_define([b4_pull_flag], [[0]])])
+
+# Define a macro to be true when api.push-pull has the value "both".
+m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
+
+# Handle BISON_USE_PUSH_FOR_PULL for the test suite.  So that push parsing
+# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
+# behavior of Bison at all when push parsing is already requested.
+b4_define_flag_if([use_push_for_pull])
+b4_use_push_for_pull_if([
+  b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
+             [m4_define([b4_push_flag], [[1]])])])
+
+
+# Define a macro to encapsulate the parse state variables.  This
+# allows them to be defined either in parse() when doing pull parsing,
+# or as class instance variable when doing push parsing.
+b4_output_begin([b4_parser_file_name])
+b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
+             [2007-2012, 2019-2021])[
+]b4_disclaimer[
+]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
+])[
+version(D_Version2) {
+} else {
+  static assert(false, "need compiler for D Version 2");
+}
+
+]b4_user_pre_prologue[
+]b4_user_post_prologue[
+]b4_percent_code_get([[imports]])[
+import std.format;
+import std.conv;
+
+/**
+ * Handle error message internationalisation.
+ */
+static if (!is(typeof(YY_))) {
+  version(YYENABLE_NLS)
+  {
+    version(ENABLE_NLS)
+    {
+      extern(C) char* dgettext(const char*, const char*);
+      string YY_(const char* s)
+      {
+        return to!string(dgettext("bison-runtime", s));
+      }
+    }
+  }
+  static if (!is(typeof(YY_)))
+  {
+    pragma(inline, true)
+    string YY_(string msg) { return msg; }
+  }
+}
+
+/**
+ * A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
+ *
+ * @@author LALR (1) parser skeleton written by Paolo Bonzini.
+ * Port to D language was done by Oliver Mangold.
+ */
+
+/**
+ * Communication interface between the scanner and the Bison-generated
+ * parser <tt>]b4_parser_class[</tt>.
+ */
+public interface Lexer
+{
+  /**
+   * Entry point for the scanner.  Returns the token identifier corresponding
+   * to the next token and prepares to return the semantic value
+   * ]b4_locations_if([and beginning/ending positions ])[of the token.
+   * @@return the token identifier corresponding to the next token. */
+  Symbol yylex ();
+
+  /**
+   * Entry point for error reporting.  Emits an error
+   * ]b4_locations_if([referring to the given location ])[in a user-defined way.
+   *]b4_locations_if([[
+   * @@param loc The location of the element to which the
+   *                error message is related]])[
+   * @@param s The string for the error message.  */
+   void yyerror (]b4_locations_if([[const Location loc, ]])[string s);
+]b4_parse_error_bmatch([custom], [[
+  /**
+   * Build and emit a "syntax error" message in a user-defined way.
+   *
+   * @@param ctx  The context of the error.
+   */
+  void reportSyntaxError(]b4_parser_class[.Context ctx);
+]])[
+}
+
+]b4_public_types_declare[
+
+]b4_locations_if([b4_position_type_if([[
+static assert(__traits(compiles,
+              (new Position[1])[0]=(new Position[1])[0]),
+              "struct/class Position must be default-constructible "
+              "and assignable");
+static assert(__traits(compiles, (new string[1])[0]=(new Position).toString()),
+              "error: struct/class Position must have toString method");
+]], [[
+  /**
+   * A struct denoting a point in the input.*/
+public struct ]b4_position_type[ {
+
+  /** The column index within the line of input.  */
+  public int column = 1;
+  /** The line number within an input file.  */
+  public int line = 1;
+  /** The name of the input file.  */
+  public string filename = null;
+
+  /**
+   * A string representation of the position. */
+  public string toString() const {
+    if (filename)
+      return format("%s:%d.%d", filename, line, column);
+    else
+      return format("%d.%d", line, column);
+  }
+}
+]])b4_location_type_if([[
+static assert(__traits(compiles, (new Location((new Position[1])[0]))) &&
+              __traits(compiles, (new Location((new Position[1])[0], (new Position[1])[0]))),
+              "error: struct/class Location must have "
+              "default constructor and constructors this(Position) and this(Position, Position).");
+static assert(__traits(compiles, (new Location[1])[0].begin=(new Location[1])[0].begin) &&
+              __traits(compiles, (new Location[1])[0].begin=(new Location[1])[0].end) &&
+              __traits(compiles, (new Location[1])[0].end=(new Location[1])[0].begin) &&
+              __traits(compiles, (new Location[1])[0].end=(new Location[1])[0].end),
+              "error: struct/class Location must have assignment-compatible "
+              "members/properties 'begin' and 'end'.");
+static assert(__traits(compiles, (new string[1])[0]=(new Location[1])[0].toString()),
+              "error: struct/class Location must have toString method.");
+
+private immutable bool yy_location_is_class = !__traits(compiles, *(new Location((new Position[1])[0])));]], [[
+/**
+ * A struct defining a pair of positions.  Positions, defined by the
+ * <code>Position</code> struct, denote a point in the input.
+ * Locations represent a part of the input through the beginning
+ * and ending positions.  */
+public struct ]b4_location_type[
+{
+  /** The first, inclusive, position in the range.  */
+  public Position begin;
+
+  /** The first position beyond the range.  */
+  public Position end;
+
+  /**
+   * Create a <code>Location</code> denoting an empty range located at
+   * a given point.
+   * @@param loc The position at which the range is anchored.  */
+  public this(Position loc)
+  {
+    this.begin = this.end = loc;
+  }
+
+  /**
+   * Create a <code>Location</code> from the endpoints of the range.
+   * @@param begin The first position included in the range.
+   * @@param end   The first position beyond the range.  */
+  public this(Position begin, Position end)
+  {
+    this.begin = begin;
+    this.end = end;
+  }
+
+  /**
+   * Reset initial location to final location.
+   */
+  public void step()
+  {
+    this.begin = this.end;
+  }
+
+  /**
+   * A representation of the location.
+   */
+  public string toString() const
+  {
+    auto end_col = 0 < end.column ? end.column - 1 : 0;
+    auto res = begin.toString ();
+    if (end.filename && begin.filename != end.filename)
+      res ~= "-" ~ format("%s:%d.%d", end.filename, end.line, end_col);
+    else if (begin.line < end.line)
+      res ~= "-" ~ format("%d.%d", end.line, end_col);
+    else if (begin.column < end_col)
+      res ~= "-" ~ format("%d", end_col);
+    return res;
+  }
+}
+
+private immutable bool yy_location_is_class = false;
+
+]])])[]b4_value_type_setup[]m4_ifdef([b4_user_union_members], [private union YYSemanticType
+{
+b4_user_union_members
+};],
+[m4_if(b4_tag_seen_flag, 0,
+[[private alias int YYSemanticType;]])])[
+]b4_token_enums[
+]b4_parser_class_declaration[
+{
+  ]b4_identification[
+
+]b4_declare_symbol_enum[
+
+]b4_locations_if([[
+  private final Location yylloc_from_stack (ref YYStack rhs, int n)
+  {
+    static if (yy_location_is_class) {
+      if (n > 0)
+        return new Location (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
+      else
+        return new Location (rhs.locationAt (0).end);
+    } else {
+      if (n > 0)
+        return Location (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
+      else
+        return Location (rhs.locationAt (0).end);
+    }
+  }]])[
+
+]b4_lexer_if([[  private class YYLexer implements Lexer {
+]b4_percent_code_get([[lexer]])[
+  }
+]])[
+  /** The object doing lexical analysis for us.  */
+  private Lexer yylexer;
+
+]b4_parse_param_vars[
+
+]b4_lexer_if([[
+  /**
+   * Instantiate the Bison-generated parser.
+   */
+  public this] (b4_parse_param_decl([b4_lex_param_decl])[) {
+]b4_percent_code_get([[init]])[]b4_lac_if([[
+    this.yylacStack = new int[];
+    this.yylacEstablished = false;]])[
+    this (new YYLexer(]b4_lex_param_call[));
+  }
+]])[
+
+  /**
+   * Instantiate the Bison-generated parser.
+   * @@param yylexer The scanner that will supply tokens to the parser.
+   */
+  ]b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) {
+    this.yylexer = yylexer;]b4_parse_trace_if([[
+    this.yyDebugStream = stderr;]])[
+]b4_parse_param_cons[
+  }
+]b4_parse_trace_if([[
+  import std.stdio;
+  private File yyDebugStream;
+
+  /**
+   * The <tt>File</tt> on which the debugging output is
+   * printed.
+   */
+  public File getDebugStream () { return yyDebugStream; }
+
+  /**
+   * Set the <tt>std.File</tt> on which the debug output is printed.
+   * @@param s The stream that is used for debugging output.
+   */
+  public final void setDebugStream(File s) { yyDebugStream = s; }
+
+  private int yydebug = 0;
+
+  /**
+   * Answer the verbosity of the debugging output; 0 means that all kinds of
+   * output from the parser are suppressed.
+   */
+  public final int getDebugLevel() { return yydebug; }
+
+  /**
+   * Set the verbosity of the debugging output; 0 means that all kinds of
+   * output from the parser are suppressed.
+   * @@param level The verbosity level for debugging output.
+   */
+  public final void setDebugLevel(int level) { yydebug = level; }
+
+  protected final void yycdebug (string s) {
+    if (0 < yydebug)
+      yyDebugStream.write (s);
+  }
+
+  protected final void yycdebugln (string s) {
+    if (0 < yydebug)
+      yyDebugStream.writeln (s);
+  }
+]])[
+  private final ]b4_parser_class[.Symbol yylex () {
+    return yylexer.yylex ();
+  }
+
+  protected final void yyerror (]b4_locations_if([[const Location loc, ]])[string s) {
+    yylexer.yyerror (]b4_locations_if([loc, ])[s);
+  }
+
+  /**
+   * The number of syntax errors so far.
+   */
+  public int numberOfErrors() const { return yynerrs_; }
+  private int yynerrs_ = 0;
+
+  /**
+   * Returned by a Bison action in order to stop the parsing process and
+   * return success (<tt>true</tt>).  */
+  public static immutable int YYACCEPT = 0;
+
+  /**
+   * Returned by a Bison action in order to stop the parsing process and
+   * return failure (<tt>false</tt>).  */
+  public static immutable int YYABORT = 1;
+]b4_push_if([
+  /**
+   * Returned by a Bison action in order to request a new token.
+   */
+  public static immutable int YYPUSH_MORE = 4;])[
+
+  /**
+   * Returned by a Bison action in order to start error recovery without
+   * printing an error message.  */
+  public static immutable int YYERROR = 2;
+
+  // Internal return codes that are not supported for user semantic
+  // actions.
+  private static immutable int YYERRLAB = 3;
+  private static immutable int YYNEWSTATE = 4;
+  private static immutable int YYDEFAULT = 5;
+  private static immutable int YYREDUCE = 6;
+  private static immutable int YYERRLAB1 = 7;
+  private static immutable int YYRETURN = 8;
+]b4_push_if([[  private static immutable int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing.  */]])[
+
+]b4_locations_if([
+  private static immutable YYSemanticType yy_semantic_null;])[
+  private int yyerrstatus_ = 0;
+
+  private void yyerrok()
+  {
+    yyerrstatus_ = 0;
+  }
+
+  // Lookahead symbol kind.
+  SymbolKind yytoken = ]b4_symbol(empty, kind)[;
+
+  /* State.  */
+  int yyn = 0;
+  int yylen = 0;
+  int yystate = 0;
+
+  YYStack yystack;
+
+  int label = YYNEWSTATE;
+
+  /* Error handling.  */
+]b4_locations_if([[
+  /// The location where the error started.
+  Location yyerrloc;
+
+  /// Location of the lookahead.
+  Location yylloc;
+
+  /// @@$.
+  Location yyloc;]])[
+
+  /// Semantic value of the lookahead.
+  Value yylval;
+
+  /**
+   * Whether error recovery is being done.  In this state, the parser
+   * reads token until it reaches a known state, and then restarts normal
+   * operation.  */
+  public final bool recovering ()
+  {
+    return yyerrstatus_ == 0;
+  }
+
+  /** Compute post-reduction state.
+   * @@param yystate   the current state
+   * @@param yysym     the nonterminal to push on the stack
+   */
+  private int yyLRGotoState(int yystate, int yysym) {
+    int yyr = yypgoto_[yysym - yyntokens_] + yystate;
+    if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
+      return yytable_[yyr];
+    else
+      return yydefgoto_[yysym - yyntokens_];
+  }
+
+  private int yyaction (int yyn, ref YYStack yystack, int yylen)
+  {
+    Value yyval;]b4_locations_if([[
+    Location yyloc = yylloc_from_stack (yystack, yylen);]])[
+
+    /* If YYLEN is nonzero, implement the default value of the action:
+       `$$ = $1'.  Otherwise, use the top of the stack.
+
+       Otherwise, the following line sets YYVAL to garbage.
+       This behavior is undocumented and Bison
+       users should not rely upon it.  */
+    if (yylen > 0)
+      yyval = yystack.valueAt (yylen - 1);
+    else
+      yyval = yystack.valueAt (0);
+
+]b4_parse_trace_if([[
+    yy_reduce_print (yyn, yystack);]])[
+
+    switch (yyn)
+    {
+]b4_user_actions[
+      default: break;
+    }
+
+]b4_parse_trace_if([[
+    yy_symbol_print ("-> $$ =", to!SymbolKind (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
+
+    yystack.pop (yylen);
+    yylen = 0;
+
+    /* Shift the result of the reduction.  */
+    int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]);
+    yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
+    return YYNEWSTATE;
+  }
+
+]b4_parse_trace_if([[
+  /*--------------------------------.
+  | Print this symbol on YYOUTPUT.  |
+  `--------------------------------*/
+
+  private final void yy_symbol_print (string s, SymbolKind yykind,
+    ref Value yyval]b4_locations_if([, ref Location yyloc])[)
+  {
+    if (0 < yydebug)
+    {
+      File yyo = yyDebugStream;
+      yyo.write(s);
+      yyo.write(yykind < yyntokens_ ? " token " : " nterm ");
+      yyo.write(format("%s", yykind));
+      yyo.write(" ("]b4_locations_if([ ~ yyloc.toString() ~ ": "])[);
+      ]b4_symbol_actions([printer])[
+      yyo.write(")\n");
+    }
+  }
+]])[
+]b4_symbol_type_define[
+]b4_push_if([[
+  /**
+   * Push Parse input from external lexer
+   *
+   * @@param yyla current Symbol
+   *
+   * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
+   */
+  public int pushParse(Symbol yyla)]], [[
+  /**
+   * Parse input from the scanner that was specified at object construction
+   * time.  Return whether the end of the input was reached successfully.
+   *
+   * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
+   *          imply that there were no syntax errors.
+   */
+  public bool parse()]])[
+  {]b4_push_if([[
+    if (!this.pushParseInitialized)
+    {
+      pushParseInitialize();
+      yyerrstatus_ = 0;
+    }
+    else
+      label = YYGETTOKEN;
+
+    bool push_token_consumed = true;
+]], [[  bool yyresult;]b4_lac_if([[
+    // Discard the LAC context in case there still is one left from a
+    // previous invocation.
+    yylacDiscard("init");]])[]b4_parse_trace_if([[
+
+    yycdebugln ("Starting parse");]])[
+    yyerrstatus_ = 0;
+
+]m4_ifdef([b4_initial_action], [
+m4_pushdef([b4_at_dollar],     [yylloc])dnl
+m4_pushdef([b4_dollar_dollar], [yylval])dnl
+    /* User initialization code.  */
+    b4_user_initial_action
+m4_popdef([b4_dollar_dollar])dnl
+m4_popdef([b4_at_dollar])])dnl
+
+  [  /* Initialize the stack.  */
+    yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
+
+    label = YYNEWSTATE;]])[
+    for (;;)
+      final switch (label)
+      {
+        /* New state.  Unlike in the C/C++ skeletons, the state is already
+           pushed when we come here.  */
+      case YYNEWSTATE:]b4_parse_trace_if([[
+        yycdebugln (format("Entering state %d", yystate));
+        if (0 < yydebug)
+          yystack.print (yyDebugStream);]])[
+
+        /* Accept?  */
+        if (yystate == yyfinal_)]b4_push_if([[
+        {
+          label = YYACCEPT;
+          break;
+        }]], [[
+          return true;]])[
+
+        /* Take a decision.  First try without lookahead.  */
+        yyn = yypact_[yystate];
+        if (yyPactValueIsDefault(yyn))
+        {
+          label = YYDEFAULT;
+          break;
+        }]b4_push_if([[
+        goto case;
+
+        case YYGETTOKEN:]])[
+
+        /* Read a lookahead token.  */
+        if (yytoken == ]b4_symbol(empty, kind)[)
+        {]b4_push_if([[
+          if (!push_token_consumed)
+            return YYPUSH_MORE;]])[]b4_parse_trace_if([[
+          yycdebugln ("Reading a token");]])[]b4_push_if([[
+          yytoken = yyla.token;
+          yylval = yyla.value;]b4_locations_if([[
+          yylloc = yyla.location;]])[
+          push_token_consumed = false;]], [[
+          Symbol yysymbol = yylex();
+          yytoken = yysymbol.token();
+          yylval = yysymbol.value();]b4_locations_if([[
+          yylloc = yysymbol.location();]])[]])[
+        }
+
+        /* Token already converted to internal form.  */]b4_parse_trace_if([[
+        yy_symbol_print ("Next token is", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
+
+        if (yytoken == ]b4_symbol(error, kind)[)
+        {
+          // The scanner already issued an error message, process directly
+          // to error recovery.  But do not keep the error token as
+          // lookahead, it is too special and may lead us to an endless
+          // loop in error recovery. */
+          yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[
+          yyerrloc = yylloc;]])[
+          label = YYERRLAB1;
+        }
+        else
+        {
+          /* If the proper action on seeing token YYTOKEN is to reduce or to
+             detect an error, take that action.  */
+          yyn += yytoken;
+          if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) {]b4_lac_if([[
+            if (!yylacEstablish(yystack, yytoken))
+              label = YYERRLAB;
+            else]])[
+              label = YYDEFAULT;
+          }
+          /* <= 0 means reduce or error.  */
+          else if ((yyn = yytable_[yyn]) <= 0)
+          {
+            if (yyTableValueIsError(yyn))
+              label = YYERRLAB;]b4_lac_if([[
+            else if (!yylacEstablish(yystack, yytoken))
+              label = YYERRLAB;]])[
+            else
+            {
+              yyn = -yyn;
+              label = YYREDUCE;
+            }
+          }
+          else
+          {
+            /* Shift the lookahead token.  */]b4_parse_trace_if([[
+            yy_symbol_print ("Shifting", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
+
+            /* Discard the token being shifted.  */
+            yytoken = ]b4_symbol(empty, kind)[;
+
+            /* Count tokens shifted since error; after three, turn off error
+             * status.  */
+            if (yyerrstatus_ > 0)
+              --yyerrstatus_;
+
+            yystate = yyn;
+            yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[
+            yylacDiscard("shift");]])[
+            label = YYNEWSTATE;
+          }
+        }
+        break;
+
+      /*-----------------------------------------------------------.
+      | yydefault -- do the default action for the current state.  |
+      `-----------------------------------------------------------*/
+      case YYDEFAULT:
+        yyn = yydefact_[yystate];
+        if (yyn == 0)
+          label = YYERRLAB;
+        else
+          label = YYREDUCE;
+        break;
+
+      /*-----------------------------.
+      | yyreduce -- Do a reduction.  |
+      `-----------------------------*/
+      case YYREDUCE:
+        yylen = yyr2_[yyn];
+        label = yyaction (yyn, yystack, yylen);
+        yystate = yystack.stateAt (0);
+        break;
+
+      /*--------------------------------------.
+      | yyerrlab -- here on detecting error.  |
+      `--------------------------------------*/
+      case YYERRLAB:
+        /* If not already recovering from an error, report this error.  */
+        if (yyerrstatus_ == 0)
+        {
+          ++yynerrs_;
+          yyreportSyntaxError(new Context(]b4_lac_if([[this, ]])[yystack, yytoken]b4_locations_if([[, yylloc]])[));
+        }
+]b4_locations_if([
+        yyerrloc = yylloc;])[
+        if (yyerrstatus_ == 3)
+        {
+          /* If just tried and failed to reuse lookahead token after an
+           * error, discard it.  */
+
+          /* Return failure if at end of input.  */
+          if (yytoken == ]b4_symbol(eof, [kind])[)]b4_push_if([[
+          {
+            label = YYABORT;
+            break;
+          }]], [[
+          return false;]])[
+          else
+            yytoken = ]b4_symbol(empty, kind)[;
+        }
+
+        /* Else will try to reuse lookahead token after shifting the error
+         * token.  */
+        label = YYERRLAB1;
+        break;
+
+      /*-------------------------------------------------.
+      | errorlab -- error raised explicitly by YYERROR.  |
+      `-------------------------------------------------*/
+      case YYERROR:]b4_locations_if([
+        yyerrloc = yystack.locationAt (yylen - 1);])[
+        /* Do not reclaim the symbols of the rule which action triggered
+           this YYERROR.  */
+        yystack.pop (yylen);
+        yylen = 0;
+        yystate = yystack.stateAt (0);
+        label = YYERRLAB1;
+        break;
+
+      /*-------------------------------------------------------------.
+      | yyerrlab1 -- common code for both syntax error and YYERROR.  |
+      `-------------------------------------------------------------*/
+      case YYERRLAB1:
+        yyerrstatus_ = 3;       /* Each real token shifted decrements this.  */
+
+        // Pop stack until we find a state that shifts the error token.
+        for (;;)
+        {
+          yyn = yypact_[yystate];
+          if (!yyPactValueIsDefault(yyn))
+          {
+            yyn += ]b4_symbol(error, kind)[;
+            if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == ]b4_symbol(error, kind)[)
+            {
+              yyn = yytable_[yyn];
+              if (0 < yyn)
+                break;
+                  }
+          }
+
+          /* Pop the current state because it cannot handle the error token.  */
+          if (yystack.height == 1)]b4_push_if([[
+          {
+            label = YYABORT;
+            break;
+          }]],[[
+            return false;]])[
+
+]b4_locations_if([          yyerrloc = yystack.locationAt (0);])[
+          yystack.pop ();
+          yystate = yystack.stateAt (0);]b4_parse_trace_if([[
+          if (0 < yydebug)
+            yystack.print (yyDebugStream);]])[
+        }]b4_push_if([[
+        if (label == YYABORT)
+          /* Leave the switch.  */
+          break;
+]])[
+]b4_locations_if([
+        /* Muck with the stack to setup for yylloc.  */
+        yystack.push (0, yy_semantic_null, yylloc);
+        yystack.push (0, yy_semantic_null, yyerrloc);
+        yyloc = yylloc_from_stack (yystack, 2);
+        yystack.pop (2);])[
+
+        /* Shift the error token.  */]b4_lac_if([[
+        yylacDiscard("error recovery");]])[]b4_parse_trace_if([[
+        yy_symbol_print ("Shifting", to!SymbolKind (yystos_[yyn]), yylval]b4_locations_if([, yyloc])[);]])[
+        yystate = yyn;
+        yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
+        label = YYNEWSTATE;
+        break;
+
+      /* Accept.  */
+      case YYACCEPT:]b4_push_if([[
+        this.pushParseInitialized = false;]b4_parse_trace_if([[
+        if (0 < yydebug)
+          yystack.print (yyDebugStream);]])[
+        return YYACCEPT;]], [[
+        yyresult = true;
+        label = YYRETURN;
+        break;]])[
+
+      /* Abort.  */
+      case YYABORT:]b4_push_if([[
+        this.pushParseInitialized = false;]b4_parse_trace_if([[
+        if (0 < yydebug)
+          yystack.print (yyDebugStream);]])[
+        return YYABORT;]], [[
+        yyresult = false;
+        label = YYRETURN;
+        break;]])[
+]b4_push_if([[]], [[      ][case YYRETURN:]b4_parse_trace_if([[
+        if (0 < yydebug)
+          yystack.print (yyDebugStream);]])[
+        return yyresult;]])[
+    }
+    assert(0);
+  }
+
+]b4_push_if([[
+  bool pushParseInitialized = false;
+
+  /**
+   * (Re-)Initialize the state of the push parser.
+   */
+  public void pushParseInitialize()
+  {
+
+    /* Lookahead and lookahead in internal form.  */
+    this.yytoken = ]b4_symbol(empty, kind)[;
+
+    /* State.  */
+    this.yyn = 0;
+    this.yylen = 0;
+    this.yystate = 0;
+    destroy(this.yystack);
+    this.label = YYNEWSTATE;
+]b4_lac_if([[
+    destroy(this.yylacStack);
+    this.yylacEstablished = false;]])[
+
+    /* Error handling.  */
+    this.yynerrs_ = 0;
+]b4_locations_if([
+    /* The location where the error started.  */
+    this.yyerrloc = Location(Position(), Position());
+    this.yylloc = Location(Position(), Position());])[
+
+    /* Semantic value of the lookahead.  */
+    //destroy(this.yylval);
+
+    /* Initialize the stack.  */
+    yystack.push(this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
+
+    this.pushParseInitialized = true;
+  }]])[]b4_both_if([[
+  /**
+   * Parse input from the scanner that was specified at object construction
+   * time.  Return whether the end of the input was reached successfully.
+   * This version of parse() is defined only when api.push-push=both.
+   *
+   * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
+   *          imply that there were no syntax errors.
+   */
+  bool parse()
+  {
+    int status = 0;
+    do {
+      status = this.pushParse(yylex());
+    } while (status == YYPUSH_MORE);
+    return status == YYACCEPT;
+  }]])[
+
+  // Generate an error message.
+  private final void yyreportSyntaxError(Context yyctx)
+  {]b4_parse_error_bmatch(
+[custom], [[
+    yylexer.reportSyntaxError(yyctx);]],
+[detailed], [[
+    if (yyctx.getToken() != ]b4_symbol(empty, kind)[)
+    {
+      // FIXME: This method of building the message is not compatible
+      // with internationalization.
+      immutable int argmax = 5;
+      SymbolKind[] yyarg = new SymbolKind[argmax];
+      int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax);
+      string res, yyformat;
+      switch (yycount)
+      {
+        case  1:
+          yyformat = YY_("syntax error, unexpected %s");
+          res = format(yyformat, yyarg[0]);
+         break;
+        case  2:
+          yyformat = YY_("syntax error, unexpected %s, expecting %s");
+          res = format(yyformat, yyarg[0], yyarg[1]);
+          break;
+        case  3:
+          yyformat = YY_("syntax error, unexpected %s, expecting %s or %s");
+          res = format(yyformat, yyarg[0], yyarg[1], yyarg[2]);
+          break;
+        case  4:
+          yyformat = YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+          res = format(yyformat, yyarg[0], yyarg[1], yyarg[2], yyarg[3]);
+          break;
+        case  5:
+          yyformat = YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+          res = format(yyformat, yyarg[0], yyarg[1], yyarg[2], yyarg[3], yyarg[4]);
+          break;
+        default:
+          res = YY_("syntax error");
+          break;
+      }
+      yyerror(]b4_locations_if([yyctx.getLocation(), ])[res);
+    }]],
+[[simple]], [[
+    yyerror(]b4_locations_if([yyctx.getLocation(), ])[YY_("syntax error"));]])[
+  }
+
+]b4_parse_error_bmatch(
+[detailed], [[
+  private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) {
+    /* There are many possibilities here to consider:
+       - If this state is a consistent state with a default action,
+         then the only way this function was invoked is if the
+         default action is an error action.  In that case, don't
+         check for expected tokens because there are none.
+       - The only way there can be no lookahead present (in tok) is
+         if this state is a consistent state with a default action.
+         Thus, detecting the absence of a lookahead is sufficient to
+         determine that there is no unexpected or expected token to
+         report.  In that case, just report a simple "syntax error".
+       - Don't assume there isn't a lookahead just because this
+         state is a consistent state with a default action.  There
+         might have been a previous inconsistent state, consistent
+         state with a non-default action, or user semantic action
+         that manipulated yychar.  (However, yychar is currently out
+         of scope during semantic actions.)
+       - Of course, the expected token list depends on states to
+         have correct lookahead information, and it depends on the
+         parser not to perform extra reductions after fetching a
+         lookahead from the scanner and before detecting a syntax
+         error.  Thus, state merging (from LALR or IELR) and default
+         reductions corrupt the expected token list.  However, the
+         list is correct for canonical LR with one exception: it
+         will still contain any token that will not be accepted due
+         to an error action in a later state.
+    */
+    int yycount = 0;
+    if (yyctx.getToken() != ]b4_symbol(empty, kind)[)
+      {
+        if (yyarg !is null)
+          yyarg[yycount] = yyctx.getToken();
+        yycount += 1;
+        yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn);
+      }
+    return yycount;
+  }
+]])[
+
+
+  /**
+   * Information needed to get the list of expected tokens and to forge
+   * a syntax error diagnostic.
+   */
+  public static final class Context
+  {]b4_lac_if([[
+    private ]b4_parser_class[ yyparser;]])[
+    private const(YYStack) yystack;
+    private SymbolKind yytoken;]b4_locations_if([[
+    private const(Location) yylocation;]])[
+
+    this(]b4_lac_if([[]b4_parser_class[ parser, ]])[YYStack stack, SymbolKind kind]b4_locations_if([[, Location loc]])[)
+    {]b4_lac_if([[
+        yyparser = parser;]])[
+      yystack = stack;
+      yytoken = kind;]b4_locations_if([[
+      yylocation = loc;]])[
+    }
+
+    final SymbolKind getToken() const
+    {
+      return yytoken;
+    }]b4_locations_if([[
+
+    final const(Location) getLocation() const
+    {
+      return yylocation;
+    }]])[
+    /**
+     * Put in YYARG at most YYARGN of the expected tokens given the
+     * current YYCTX, and return the number of tokens stored in YYARG.  If
+     * YYARG is null, return the number of expected tokens (guaranteed to
+     * be less than YYNTOKENS).
+     */
+    int getExpectedTokens(SymbolKind[] yyarg, int yyargn)]b4_lac_if([[]], [[ const]])[
+    {
+      return getExpectedTokens(yyarg, 0, yyargn);
+    }
+
+    int getExpectedTokens(SymbolKind[] yyarg, int yyoffset, int yyargn)]b4_lac_if([[]], [[ const]])[
+    {
+      int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[
+      // Execute LAC once. We don't care if it is successful, we
+      // only do it for the sake of debugging output.
+
+      if (!yyparser.yylacEstablished)
+        yyparser.yylacCheck(yystack, yytoken);
+]])[
+      for (int yyx = 0; yyx < yyntokens_; ++yyx)
+        {
+          SymbolKind yysym = SymbolKind(yyx);
+          if (yysym != ]b4_symbol(error, kind)[
+              && yysym != ]b4_symbol(undef, kind)[
+              && yyparser.yylacCheck(yystack, yysym))
+            {
+              if (yyarg == null)
+                yycount += 1;
+              else if (yycount == yyargn)
+                return 0;
+              else
+                yyarg[yycount++] = yysym;
+            }
+        }]], [[
+      int yyn = yypact_[this.yystack.stateAt(0)];
+      if (!yyPactValueIsDefault(yyn))
+      {
+        /* Start YYX at -YYN if negative to avoid negative
+           indexes in YYCHECK.  In other words, skip the first
+           -YYN actions for this state because they are default
+           actions.  */
+        int yyxbegin = yyn < 0 ? -yyn : 0;
+        /* Stay within bounds of both yycheck and yytname.  */
+        int yychecklim = yylast_ - yyn + 1;
+        int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
+        for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
+          if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
+              && !yyTableValueIsError(yytable_[yyx + yyn]))
+          {
+            if (yyarg is null)
+              ++yycount;
+            else if (yycount == yyargn)
+              return 0;
+            else
+              yyarg[yycount++] = SymbolKind(yyx);
+          }
+      }]])[
+      if (yyarg !is null && yycount == yyoffset && yyoffset < yyargn)
+        yyarg[yyoffset] = ]b4_symbol(empty, kind)[;
+      return yycount - yyoffset;
+    }
+  }
+
+]b4_lac_if([[
+  /** Check the lookahead yytoken.
+   * \returns  true iff the token will be eventually shifted.
+   */
+  bool yylacCheck(const YYStack yystack, SymbolKind yytoken)
+  {
+    // Logically, the yylacStack's lifetime is confined to this function.
+    // Clear it, to get rid of potential left-overs from previous call.
+    destroy(yylacStack);
+    // Reduce until we encounter a shift and thereby accept the token.
+]b4_parse_trace_if([[
+    yycdebug("LAC: checking lookahead " ~ format("%s", yytoken) ~ ":");]])[
+    int lacTop = 0;
+    while (true)
+    {
+      int topState = (yylacStack.length == 0
+                      ? yystack.stateAt(lacTop)
+                      : yylacStack[$ - 1]);
+      int yyrule = yypact_[topState];
+      if (yyPactValueIsDefault(yyrule)
+          || (yyrule += yytoken) < 0 || yylast_ < yyrule
+          || yycheck_[yyrule] != yytoken)
+      {
+        // Use the default action.
+        yyrule = yydefact_[+topState];
+        if (yyrule == 0)
+        {]b4_parse_trace_if([[
+          yycdebugln(" Err");]])[
+          return false;
+        }
+      }
+      else
+      {
+        // Use the action from yytable.
+        yyrule = yytable_[yyrule];
+        if (yyTableValueIsError(yyrule))
+        {]b4_parse_trace_if([[
+          yycdebugln(" Err");]])[
+          return false;
+        }
+        if (0 < yyrule)
+        {]b4_parse_trace_if([[
+          yycdebugln(" S" ~ to!string(yyrule));]])[
+          return true;
+        }
+        yyrule = -yyrule;
+      }
+      // By now we know we have to simulate a reduce.
+]b4_parse_trace_if([[
+      yycdebug(" R" ~ to!string(yyrule - 1));]])[
+      // Pop the corresponding number of values from the stack.
+      {
+        int yylen = yyr2_[yyrule];
+        // First pop from the LAC stack as many tokens as possible.
+        int lacSize = cast (int) yylacStack.length;
+        if (yylen < lacSize)
+        {
+          yylacStack.length -= yylen;
+          yylen = 0;
+        }
+        else if (lacSize != 0)
+        {
+          destroy(yylacStack);
+          yylen -= lacSize;
+        }
+        // Only afterwards look at the main stack.
+        // We simulate popping elements by incrementing lacTop.
+        lacTop += yylen;
+      }
+      // Keep topState in sync with the updated stack.
+      topState = (yylacStack.length == 0
+                  ? yystack.stateAt(lacTop)
+                  : yylacStack[$ - 1]);
+      // Push the resulting state of the reduction.
+      int state = yyLRGotoState(topState, yyr1_[yyrule]);]b4_parse_trace_if([[
+      yycdebug(" G" ~ to!string(state));]])[
+      yylacStack.length++;
+      yylacStack[$ - 1] = state;
+    }
+  }
+
+  /** Establish the initial context if no initial context currently exists.
+   * \returns  true iff the token will be eventually shifted.
+   */
+  bool yylacEstablish(YYStack yystack, SymbolKind yytoken)
+  {
+  /* Establish the initial context for the current lookahead if no initial
+     context is currently established.
+
+     We define a context as a snapshot of the parser stacks.  We define
+     the initial context for a lookahead as the context in which the
+     parser initially examines that lookahead in order to select a
+     syntactic action.  Thus, if the lookahead eventually proves
+     syntactically unacceptable (possibly in a later context reached via a
+     series of reductions), the initial context can be used to determine
+     the exact set of tokens that would be syntactically acceptable in the
+     lookahead's place.  Moreover, it is the context after which any
+     further semantic actions would be erroneous because they would be
+     determined by a syntactically unacceptable token.
+
+     yylacEstablish should be invoked when a reduction is about to be
+     performed in an inconsistent state (which, for the purposes of LAC,
+     includes consistent states that don't know they're consistent because
+     their default reductions have been disabled).
+
+     For parse.lac=full, the implementation of yylacEstablish is as
+     follows.  If no initial context is currently established for the
+     current lookahead, then check if that lookahead can eventually be
+     shifted if syntactic actions continue from the current context.  */
+    if (yylacEstablished)
+      return true;
+    else
+    {]b4_parse_trace_if([[
+        yycdebugln("LAC: initial context established for " ~ format("%s", yytoken));]])[
+        yylacEstablished = true;
+        return yylacCheck(yystack, yytoken);
+    }
+  }
+
+  /** Discard any previous initial lookahead context because of event.
+   * \param event  the event which caused the lookahead to be discarded.
+   *               Only used for debbuging output.  */
+  void yylacDiscard(string event)
+  {
+  /* Discard any previous initial lookahead context because of Event,
+     which may be a lookahead change or an invalidation of the currently
+     established initial context for the current lookahead.
+
+     The most common example of a lookahead change is a shift.  An example
+     of both cases is syntax error recovery.  That is, a syntax error
+     occurs when the lookahead is syntactically erroneous for the
+     currently established initial context, so error recovery manipulates
+     the parser stacks to try to find a new initial context in which the
+     current lookahead is syntactically acceptable.  If it fails to find
+     such a context, it discards the lookahead.  */
+    if (yylacEstablished)
+    {]b4_parse_trace_if([[
+      yycdebugln("LAC: initial context discarded due to " ~ event);]])[
+      yylacEstablished = false;
+    }
+  }
+
+  /** The stack for LAC.
+   * Logically, the yylacStack's lifetime is confined to the function
+   * yylacCheck. We just store it as a member of this class to hold
+   * on to the memory and to avoid frequent reallocations.
+   */
+  int[] yylacStack;
+  /**  Whether an initial LAC context was established. */
+  bool yylacEstablished;
+]])[
+
+  /**
+   * Whether the given <code>yypact_</code> value indicates a defaulted state.
+   * @@param yyvalue   the value to check
+   */
+  private static bool yyPactValueIsDefault(int yyvalue)
+  {
+    return yyvalue == yypact_ninf_;
+  }
+
+  /**
+   * Whether the given <code>yytable_</code> value indicates a syntax error.
+   * @@param yyvalue   the value to check
+   */
+  private static bool yyTableValueIsError(int yyvalue)
+  {
+    return yyvalue == yytable_ninf_;
+  }
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+  private static immutable ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
+
+  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule which
+     number is the opposite.  If YYTABLE_NINF_, syntax error.  */
+  private static immutable ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
+
+  ]b4_parser_tables_define[
+
+]b4_parse_trace_if([[
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+  private static immutable ]b4_int_type_for([b4_rline])[[] yyrline_ =
+  @{
+  ]b4_rline[
+  @};
+
+  // Report on the debug stream that the rule yyrule is going to be reduced.
+  private final void yy_reduce_print (int yyrule, ref YYStack yystack)
+  {
+    if (yydebug == 0)
+      return;
+
+    int yylno = yyrline_[yyrule];
+    int yynrhs = yyr2_[yyrule];
+    /* Print the symbols being reduced, and their result.  */
+    yycdebugln (format("Reducing stack by rule %d (line %d):",
+                yyrule - 1, yylno));
+
+    /* The symbols being reduced.  */
+    for (int yyi = 0; yyi < yynrhs; yyi++)
+      yy_symbol_print (format("   $%d =", yyi + 1),
+                       to!SymbolKind (yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
+                       ]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
+                       b4_rhs_location(yynrhs, yyi + 1)])[);
+  }
+]])[
+
+  private static auto yytranslate_ (int t)
+  {
+]b4_api_token_raw_if(
+[[    return SymbolKind(t);]],
+[[    /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+    immutable ]b4_int_type_for([b4_translate])[[] translate_table =
+    @{
+  ]b4_translate[
+    @};
+
+    // Last valid token kind.
+    immutable int code_max = ]b4_code_max[;
+
+    if (t <= 0)
+      return ]b4_symbol(eof, kind)[;
+    else if (t <= code_max)
+      return SymbolKind(translate_table[t]);
+    else
+      return ]b4_symbol(undef, kind)[;]])[
+  }
+
+  private static immutable int yylast_ = ]b4_last[;
+  private static immutable int yynnts_ = ]b4_nterms_number[;
+  private static immutable int yyfinal_ = ]b4_final_state_number[;
+  private static immutable int yyntokens_ = ]b4_tokens_number[;
+
+  private final struct YYStackElement {
+    int state;
+    Value value;]b4_locations_if(
+    b4_location_type[[] location;])[
+  }
+
+  private final struct YYStack {
+    private YYStackElement[] stack = [];
+
+    public final ulong height()
+    {
+      return stack.length;
+    }
+
+    public final void push (int state, Value value]dnl
+  b4_locations_if([, ref Location loc])[)
+    {
+      stack ~= YYStackElement(state, value]b4_locations_if([, loc])[);
+    }
+
+    public final void pop ()
+    {
+      pop (1);
+    }
+
+    public final void pop (int num)
+    {
+      stack.length -= num;
+    }
+
+    public final int stateAt (int i) const
+    {
+      return stack[$-i-1].state;
+    }
+
+]b4_locations_if([[
+    public final ref Location locationAt (int i)
+    {
+      return stack[$-i-1].location;
+    }]])[
+
+    public final ref Value valueAt (int i)
+    {
+      return stack[$-i-1].value;
+    }
+]b4_parse_trace_if([[
+    // Print the state stack on the debug stream.
+    public final void print (File stream)
+    {
+      stream.write ("Stack now");
+      for (int i = 0; i < stack.length; i++)
+        stream.write (" ", stack[i].state);
+      stream.writeln ();
+    }]])[
+  }
+]b4_percent_code_get[
+}
+]b4_percent_code_get([[epilogue]])[]dnl
+b4_epilogue[]dnl
+b4_output_end

+ 1303 - 0
Engine/bin/bison-flex/data/skeletons/lalr1.java

@@ -0,0 +1,1303 @@
+# Java skeleton for Bison                           -*- java -*-
+
+# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[java.m4])
+
+b4_header_if([b4_complain([%header/%defines does not make sense in Java])])
+
+m4_define([b4_symbol_no_destructor_assert],
+[b4_symbol_if([$1], [has_destructor],
+              [b4_complain_at(m4_unquote(b4_symbol([$1], [destructor_loc])),
+                              [%destructor does not make sense in Java])])])
+b4_symbol_foreach([b4_symbol_no_destructor_assert])
+
+## --------------- ##
+## api.push-pull.  ##
+## --------------- ##
+
+b4_percent_define_default([[api.push-pull]], [[pull]])
+b4_percent_define_check_values([[[[api.push-pull]],
+                                 [[pull]], [[push]], [[both]]]])
+
+# Define m4 conditional macros that encode the value
+# of the api.push-pull flag.
+b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
+b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
+m4_case(b4_percent_define_get([[api.push-pull]]),
+        [pull], [m4_define([b4_push_flag], [[0]])],
+        [push], [m4_define([b4_pull_flag], [[0]])])
+
+# Define a macro to be true when api.push-pull has the value "both".
+m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
+
+# Handle BISON_USE_PUSH_FOR_PULL for the test suite.  So that push parsing
+# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
+# behavior of Bison at all when push parsing is already requested.
+b4_define_flag_if([use_push_for_pull])
+b4_use_push_for_pull_if([
+  b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
+             [m4_define([b4_push_flag], [[1]])])])
+
+# Define a macro to encapsulate the parse state variables.  This
+# allows them to be defined either in parse() when doing pull parsing,
+# or as class instance variable when doing push parsing.
+m4_define([b4_define_state],
+[[
+    /* Lookahead token kind.  */
+    int yychar = YYEMPTY_;
+    /* Lookahead symbol kind.  */
+    SymbolKind yytoken = null;
+
+    /* State.  */
+    int yyn = 0;
+    int yylen = 0;
+    int yystate = 0;
+    YYStack yystack = new YYStack ();
+    int label = YYNEWSTATE;
+
+]b4_locations_if([[
+    /* The location where the error started.  */
+    ]b4_location_type[ yyerrloc = null;
+
+    /* Location. */
+    ]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);]])[
+
+    /* Semantic value of the lookahead.  */
+    ]b4_yystype[ yylval = null;
+]])
+
+# parse.lac
+b4_percent_define_default([[parse.lac]], [[none]])
+b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
+b4_define_flag_if([lac])
+m4_define([b4_lac_flag],
+          [m4_if(b4_percent_define_get([[parse.lac]]),
+                 [none], [[0]], [[1]])])
+
+
+## ------------- ##
+## Parser File.  ##
+## ------------- ##
+
+b4_output_begin([b4_parser_file_name])[
+]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
+              [2007-2015, 2018-2021])[
+]b4_disclaimer[
+]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[
+]])[
+]b4_user_pre_prologue[
+]b4_user_post_prologue[
+import java.text.MessageFormat;
+import java.util.ArrayList;
+]b4_percent_code_get([[imports]])[
+/**
+ * A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
+ *
+ * @@author LALR (1) parser skeleton written by Paolo Bonzini.
+ */
+]b4_parser_class_declaration[
+{
+]b4_identification[
+][
+]b4_parse_error_bmatch(
+           [detailed\|verbose], [[
+  /**
+   * True if verbose error messages are enabled.
+   */
+  private boolean yyErrorVerbose = true;
+
+  /**
+   * Whether verbose error messages are enabled.
+   */
+  public final boolean getErrorVerbose() { return yyErrorVerbose; }
+
+  /**
+   * Set the verbosity of error messages.
+   * @@param verbose True to request verbose error messages.
+   */
+  public final void setErrorVerbose(boolean verbose)
+  { yyErrorVerbose = verbose; }
+]])[
+
+]b4_locations_if([[
+  /**
+   * A class defining a pair of positions.  Positions, defined by the
+   * <code>]b4_position_type[</code> class, denote a point in the input.
+   * Locations represent a part of the input through the beginning
+   * and ending positions.
+   */
+  public static class ]b4_location_type[ {
+    /**
+     * The first, inclusive, position in the range.
+     */
+    public ]b4_position_type[ begin;
+
+    /**
+     * The first position beyond the range.
+     */
+    public ]b4_position_type[ end;
+
+    /**
+     * Create a <code>]b4_location_type[</code> denoting an empty range located at
+     * a given point.
+     * @@param loc The position at which the range is anchored.
+     */
+    public ]b4_location_type[ (]b4_position_type[ loc) {
+      this.begin = this.end = loc;
+    }
+
+    /**
+     * Create a <code>]b4_location_type[</code> from the endpoints of the range.
+     * @@param begin The first position included in the range.
+     * @@param end   The first position beyond the range.
+     */
+    public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
+      this.begin = begin;
+      this.end = end;
+    }
+
+    /**
+     * Print a representation of the location.  For this to be correct,
+     * <code>]b4_position_type[</code> should override the <code>equals</code>
+     * method.
+     */
+    public String toString() {
+      if (begin.equals (end))
+        return begin.toString();
+      else
+        return begin.toString() + "-" + end.toString();
+    }
+  }
+
+  private ]b4_location_type[ yylloc(YYStack rhs, int n)
+  {
+    if (0 < n)
+      return new ]b4_location_type[(rhs.locationAt(n-1).begin, rhs.locationAt(0).end);
+    else
+      return new ]b4_location_type[(rhs.locationAt(0).end);
+  }]])[
+
+]b4_declare_symbol_enum[
+
+  /**
+   * Communication interface between the scanner and the Bison-generated
+   * parser <tt>]b4_parser_class[</tt>.
+   */
+  public interface Lexer {
+]b4_token_enums[
+    /** Deprecated, use ]b4_symbol(eof, id)[ instead.  */
+    public static final int EOF = ]b4_symbol(eof, id)[;
+]b4_pull_if([b4_locations_if([[
+    /**
+     * Method to retrieve the beginning position of the last scanned token.
+     * @@return the position at which the last scanned token starts.
+     */
+    ]b4_position_type[ getStartPos();
+
+    /**
+     * Method to retrieve the ending position of the last scanned token.
+     * @@return the first position beyond the last scanned token.
+     */
+    ]b4_position_type[ getEndPos();]])[
+
+    /**
+     * Method to retrieve the semantic value of the last scanned token.
+     * @@return the semantic value of the last scanned token.
+     */
+    ]b4_yystype[ getLVal();
+
+    /**
+     * Entry point for the scanner.  Returns the token identifier corresponding
+     * to the next token and prepares to return the semantic value
+     * ]b4_locations_if([and beginning/ending positions ])[of the token.
+     * @@return the token identifier corresponding to the next token.
+     */
+    int yylex()]b4_maybe_throws([b4_lex_throws])[;
+]])[
+    /**
+     * Emit an error]b4_locations_if([ referring to the given location])[in a user-defined way.
+     *
+     *]b4_locations_if([[ @@param loc The location of the element to which the
+     *                error message is related.]])[
+     * @@param msg The string for the error message.
+     */
+     void yyerror(]b4_locations_if([b4_location_type[ loc, ]])[String msg);
+
+]b4_parse_error_bmatch(
+           [custom], [[
+    /**
+     * Build and emit a "syntax error" message in a user-defined way.
+     *
+     * @@param ctx  The context of the error.
+     */
+     void reportSyntaxError(Context ctx);
+]])[
+  }
+
+]b4_lexer_if([[
+  private class YYLexer implements Lexer {
+]b4_percent_code_get([[lexer]])[
+  }
+
+]])[
+  /**
+   * The object doing lexical analysis for us.
+   */
+  private Lexer yylexer;
+
+]b4_parse_param_vars[
+
+]b4_lexer_if([[
+  /**
+   * Instantiates the Bison-generated parser.
+   */
+  public ]b4_parser_class[(]b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[
+  {
+]b4_percent_code_get([[init]])[]b4_lac_if([[
+    this.yylacStack = new ArrayList<Integer>();
+    this.yylacEstablished = false;]])[
+    this.yylexer = new YYLexer(]b4_lex_param_call[);
+]b4_parse_param_cons[
+  }
+]])[
+
+  /**
+   * Instantiates the Bison-generated parser.
+   * @@param yylexer The scanner that will supply tokens to the parser.
+   */
+  ]b4_lexer_if([[protected]], [[public]]) b4_parser_class[(]b4_parse_param_decl([[Lexer yylexer]])[)]b4_maybe_throws([b4_init_throws])[
+  {
+]b4_percent_code_get([[init]])[]b4_lac_if([[
+    this.yylacStack = new ArrayList<Integer>();
+    this.yylacEstablished = false;]])[
+    this.yylexer = yylexer;
+]b4_parse_param_cons[
+  }
+
+]b4_parse_trace_if([[
+  private java.io.PrintStream yyDebugStream = System.err;
+
+  /**
+   * The <tt>PrintStream</tt> on which the debugging output is printed.
+   */
+  public final java.io.PrintStream getDebugStream() { return yyDebugStream; }
+
+  /**
+   * Set the <tt>PrintStream</tt> on which the debug output is printed.
+   * @@param s The stream that is used for debugging output.
+   */
+  public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
+
+  private int yydebug = 0;
+
+  /**
+   * Answer the verbosity of the debugging output; 0 means that all kinds of
+   * output from the parser are suppressed.
+   */
+  public final int getDebugLevel() { return yydebug; }
+
+  /**
+   * Set the verbosity of the debugging output; 0 means that all kinds of
+   * output from the parser are suppressed.
+   * @@param level The verbosity level for debugging output.
+   */
+  public final void setDebugLevel(int level) { yydebug = level; }
+]])[
+
+  private int yynerrs = 0;
+
+  /**
+   * The number of syntax errors so far.
+   */
+  public final int getNumberOfErrors() { return yynerrs; }
+
+  /**
+   * Print an error message via the lexer.
+   *]b4_locations_if([[ Use a <code>null</code> location.]])[
+   * @@param msg The error message.
+   */
+  public final void yyerror(String msg) {
+      yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
+  }
+]b4_locations_if([[
+  /**
+   * Print an error message via the lexer.
+   * @@param loc The location associated with the message.
+   * @@param msg The error message.
+   */
+  public final void yyerror(]b4_location_type[ loc, String msg) {
+      yylexer.yyerror(loc, msg);
+  }
+
+  /**
+   * Print an error message via the lexer.
+   * @@param pos The position associated with the message.
+   * @@param msg The error message.
+   */
+  public final void yyerror(]b4_position_type[ pos, String msg) {
+      yylexer.yyerror(new ]b4_location_type[ (pos), msg);
+  }]])[
+]b4_parse_trace_if([[
+  protected final void yycdebugNnl(String s) {
+    if (0 < yydebug)
+      yyDebugStream.print(s);
+  }
+
+  protected final void yycdebug(String s) {
+    if (0 < yydebug)
+      yyDebugStream.println(s);
+  }]])[
+
+  private final class YYStack {
+    private int[] stateStack = new int[16];]b4_locations_if([[
+    private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
+    private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
+
+    public int size = 16;
+    public int height = -1;
+
+    public final void push(int state, ]b4_yystype[ value]b4_locations_if([, ]b4_location_type[ loc])[) {
+      height++;
+      if (size == height) {
+        int[] newStateStack = new int[size * 2];
+        System.arraycopy(stateStack, 0, newStateStack, 0, height);
+        stateStack = newStateStack;]b4_locations_if([[
+        ]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
+        System.arraycopy(locStack, 0, newLocStack, 0, height);
+        locStack = newLocStack;]])
+
+        b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
+        System.arraycopy(valueStack, 0, newValueStack, 0, height);
+        valueStack = newValueStack;
+
+        size *= 2;
+      }
+
+      stateStack[height] = state;]b4_locations_if([[
+      locStack[height] = loc;]])[
+      valueStack[height] = value;
+    }
+
+    public final void pop() {
+      pop(1);
+    }
+
+    public final void pop(int num) {
+      // Avoid memory leaks... garbage collection is a white lie!
+      if (0 < num) {
+        java.util.Arrays.fill(valueStack, height - num + 1, height + 1, null);]b4_locations_if([[
+        java.util.Arrays.fill(locStack, height - num + 1, height + 1, null);]])[
+      }
+      height -= num;
+    }
+
+    public final int stateAt(int i) {
+      return stateStack[height - i];
+    }
+]b4_locations_if([[
+
+    public final ]b4_location_type[ locationAt(int i) {
+      return locStack[height - i];
+    }
+]])[
+    public final ]b4_yystype[ valueAt(int i) {
+      return valueStack[height - i];
+    }
+
+    // Print the state stack on the debug stream.
+    public void print(java.io.PrintStream out) {
+      out.print ("Stack now");
+
+      for (int i = 0; i <= height; i++) {
+        out.print(' ');
+        out.print(stateStack[i]);
+      }
+      out.println();
+    }
+  }
+
+  /**
+   * Returned by a Bison action in order to stop the parsing process and
+   * return success (<tt>true</tt>).
+   */
+  public static final int YYACCEPT = 0;
+
+  /**
+   * Returned by a Bison action in order to stop the parsing process and
+   * return failure (<tt>false</tt>).
+   */
+  public static final int YYABORT = 1;
+
+]b4_push_if([
+  /**
+   * Returned by a Bison action in order to request a new token.
+   */
+  public static final int YYPUSH_MORE = 4;])[
+
+  /**
+   * Returned by a Bison action in order to start error recovery without
+   * printing an error message.
+   */
+  public static final int YYERROR = 2;
+
+  /**
+   * Internal return codes that are not supported for user semantic
+   * actions.
+   */
+  private static final int YYERRLAB = 3;
+  private static final int YYNEWSTATE = 4;
+  private static final int YYDEFAULT = 5;
+  private static final int YYREDUCE = 6;
+  private static final int YYERRLAB1 = 7;
+  private static final int YYRETURN = 8;
+]b4_push_if([[  private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing.  */]])[
+
+  private int yyerrstatus_ = 0;
+
+]b4_push_if([b4_define_state])[
+  /**
+   * Whether error recovery is being done.  In this state, the parser
+   * reads token until it reaches a known state, and then restarts normal
+   * operation.
+   */
+  public final boolean recovering ()
+  {
+    return yyerrstatus_ == 0;
+  }
+
+  /** Compute post-reduction state.
+   * @@param yystate   the current state
+   * @@param yysym     the nonterminal to push on the stack
+   */
+  private int yyLRGotoState(int yystate, int yysym) {
+    int yyr = yypgoto_[yysym - YYNTOKENS_] + yystate;
+    if (0 <= yyr && yyr <= YYLAST_ && yycheck_[yyr] == yystate)
+      return yytable_[yyr];
+    else
+      return yydefgoto_[yysym - YYNTOKENS_];
+  }
+
+  private int yyaction(int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[
+  {
+    /* If YYLEN is nonzero, implement the default value of the action:
+       '$$ = $1'.  Otherwise, use the top of the stack.
+
+       Otherwise, the following line sets YYVAL to garbage.
+       This behavior is undocumented and Bison
+       users should not rely upon it.  */
+    ]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt(yylen - 1) : yystack.valueAt(0);]b4_locations_if([[
+    ]b4_location_type[ yyloc = yylloc(yystack, yylen);]])[]b4_parse_trace_if([[
+
+    yyReducePrint(yyn, yystack);]])[
+
+    switch (yyn)
+      {
+        ]b4_user_actions[
+        default: break;
+      }]b4_parse_trace_if([[
+
+    yySymbolPrint("-> $$ =", SymbolKind.get(yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
+
+    yystack.pop(yylen);
+    yylen = 0;
+    /* Shift the result of the reduction.  */
+    int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]);
+    yystack.push(yystate, yyval]b4_locations_if([, yyloc])[);
+    return YYNEWSTATE;
+  }
+
+]b4_parse_trace_if([[
+  /*--------------------------------.
+  | Print this symbol on YYOUTPUT.  |
+  `--------------------------------*/
+
+  private void yySymbolPrint(String s, SymbolKind yykind,
+                             ]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[) {
+      if (0 < yydebug) {
+          yycdebug(s
+                   + (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
+                   + yykind.getName() + " ("]b4_locations_if([
+                   + yylocation + ": "])[
+                   + (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
+      }
+  }]])[
+
+]b4_push_if([],[[
+  /**
+   * Parse input from the scanner that was specified at object construction
+   * time.  Return whether the end of the input was reached successfully.
+   *
+   * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
+   *          imply that there were no syntax errors.
+   */
+  public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
+]b4_push_if([
+  /**
+   * Push Parse input from external lexer
+   *
+   * @@param yylextoken current token
+   * @@param yylexval current lval]b4_locations_if([[
+   * @@param yylexloc current position]])[
+   *
+   * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
+   */
+  public int push_parse(int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
+  {]b4_locations_if([[
+    /* @@$.  */
+    ]b4_location_type[ yyloc;]])[
+]b4_push_if([],[[
+]b4_define_state[
+]b4_lac_if([[
+    // Discard the LAC context in case there still is one left from a
+    // previous invocation.
+    yylacDiscard("init");]])[
+]b4_parse_trace_if([[
+    yycdebug ("Starting parse");]])[
+    yyerrstatus_ = 0;
+    yynerrs = 0;
+
+    /* Initialize the stack.  */
+    yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
+    b4_user_initial_action
+b4_dollar_popdef[]dnl
+])[
+]])[
+]b4_push_if([[
+    if (!this.push_parse_initialized)
+      {
+        push_parse_initialize ();
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
+    b4_user_initial_action
+b4_dollar_popdef[]dnl
+])[]b4_parse_trace_if([[
+        yycdebug ("Starting parse");]])[
+        yyerrstatus_ = 0;
+      } else
+        label = YYGETTOKEN;
+
+    boolean push_token_consumed = true;
+]])[
+    for (;;)
+      switch (label)
+      {
+        /* New state.  Unlike in the C/C++ skeletons, the state is already
+           pushed when we come here.  */
+      case YYNEWSTATE:]b4_parse_trace_if([[
+        yycdebug ("Entering state " + yystate);
+        if (0 < yydebug)
+          yystack.print (yyDebugStream);]])[
+
+        /* Accept?  */
+        if (yystate == YYFINAL_)
+          ]b4_push_if([{label = YYACCEPT; break;}],
+                      [return true;])[
+
+        /* Take a decision.  First try without lookahead.  */
+        yyn = yypact_[yystate];
+        if (yyPactValueIsDefault (yyn))
+          {
+            label = YYDEFAULT;
+            break;
+          }
+]b4_push_if([        /* Fall Through */
+
+      case YYGETTOKEN:])[
+        /* Read a lookahead token.  */
+        if (yychar == YYEMPTY_)
+          {
+]b4_push_if([[
+            if (!push_token_consumed)
+              return YYPUSH_MORE;]b4_parse_trace_if([[
+            yycdebug ("Reading a token");]])[
+            yychar = yylextoken;
+            yylval = yylexval;]b4_locations_if([
+            yylloc = yylexloc;])[
+            push_token_consumed = false;]], [b4_parse_trace_if([[
+            yycdebug ("Reading a token");]])[
+            yychar = yylexer.yylex ();
+            yylval = yylexer.getLVal();]b4_locations_if([[
+            yylloc = new ]b4_location_type[(yylexer.getStartPos(),
+                                          yylexer.getEndPos());]])[
+]])[
+          }
+
+        /* Convert token to internal form.  */
+        yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
+        yySymbolPrint("Next token is", yytoken,
+                      yylval]b4_locations_if([, yylloc])[);]])[
+
+        if (yytoken == ]b4_symbol(error, kind)[)
+          {
+            // The scanner already issued an error message, process directly
+            // to error recovery.  But do not keep the error token as
+            // lookahead, it is too special and may lead us to an endless
+            // loop in error recovery. */
+            yychar = Lexer.]b4_symbol(undef, id)[;
+            yytoken = ]b4_symbol(undef, kind)[;]b4_locations_if([[
+            yyerrloc = yylloc;]])[
+            label = YYERRLAB1;
+          }
+        else
+          {
+            /* If the proper action on seeing token YYTOKEN is to reduce or to
+               detect an error, take that action.  */
+            yyn += yytoken.getCode();
+            if (yyn < 0 || YYLAST_ < yyn || yycheck_[yyn] != yytoken.getCode()) {]b4_lac_if([[
+              if (!yylacEstablish(yystack, yytoken)) {
+                label = YYERRLAB;
+              } else]])[
+              label = YYDEFAULT;
+            }
+
+            /* <= 0 means reduce or error.  */
+            else if ((yyn = yytable_[yyn]) <= 0)
+              {
+                if (yyTableValueIsError(yyn)) {
+                  label = YYERRLAB;
+                }]b4_lac_if([[ else if (!yylacEstablish(yystack, yytoken)) {
+                  label = YYERRLAB;
+                }]])[ else {
+                  yyn = -yyn;
+                  label = YYREDUCE;
+                }
+              }
+
+            else
+              {
+                /* Shift the lookahead token.  */]b4_parse_trace_if([[
+                yySymbolPrint("Shifting", yytoken,
+                              yylval]b4_locations_if([, yylloc])[);
+]])[
+                /* Discard the token being shifted.  */
+                yychar = YYEMPTY_;
+
+                /* Count tokens shifted since error; after three, turn off error
+                   status.  */
+                if (yyerrstatus_ > 0)
+                  --yyerrstatus_;
+
+                yystate = yyn;
+                yystack.push(yystate, yylval]b4_locations_if([, yylloc])[);]b4_lac_if([[
+                yylacDiscard("shift");]])[
+                label = YYNEWSTATE;
+              }
+          }
+        break;
+
+      /*-----------------------------------------------------------.
+      | yydefault -- do the default action for the current state.  |
+      `-----------------------------------------------------------*/
+      case YYDEFAULT:
+        yyn = yydefact_[yystate];
+        if (yyn == 0)
+          label = YYERRLAB;
+        else
+          label = YYREDUCE;
+        break;
+
+      /*-----------------------------.
+      | yyreduce -- Do a reduction.  |
+      `-----------------------------*/
+      case YYREDUCE:
+        yylen = yyr2_[yyn];
+        label = yyaction(yyn, yystack, yylen);
+        yystate = yystack.stateAt(0);
+        break;
+
+      /*------------------------------------.
+      | yyerrlab -- here on detecting error |
+      `------------------------------------*/
+      case YYERRLAB:
+        /* If not already recovering from an error, report this error.  */
+        if (yyerrstatus_ == 0)
+          {
+            ++yynerrs;
+            if (yychar == YYEMPTY_)
+              yytoken = null;
+            yyreportSyntaxError(new Context(this, yystack, yytoken]b4_locations_if([[, yylloc]])[));
+          }
+]b4_locations_if([[
+        yyerrloc = yylloc;]])[
+        if (yyerrstatus_ == 3)
+          {
+            /* If just tried and failed to reuse lookahead token after an
+               error, discard it.  */
+
+            if (yychar <= Lexer.]b4_symbol(eof, id)[)
+              {
+                /* Return failure if at end of input.  */
+                if (yychar == Lexer.]b4_symbol(eof, id)[)
+                  ]b4_push_if([{label = YYABORT; break;}], [return false;])[
+              }
+            else
+              yychar = YYEMPTY_;
+          }
+
+        /* Else will try to reuse lookahead token after shifting the error
+           token.  */
+        label = YYERRLAB1;
+        break;
+
+      /*-------------------------------------------------.
+      | errorlab -- error raised explicitly by YYERROR.  |
+      `-------------------------------------------------*/
+      case YYERROR:]b4_locations_if([[
+        yyerrloc = yystack.locationAt (yylen - 1);]])[
+        /* Do not reclaim the symbols of the rule which action triggered
+           this YYERROR.  */
+        yystack.pop (yylen);
+        yylen = 0;
+        yystate = yystack.stateAt(0);
+        label = YYERRLAB1;
+        break;
+
+      /*-------------------------------------------------------------.
+      | yyerrlab1 -- common code for both syntax error and YYERROR.  |
+      `-------------------------------------------------------------*/
+      case YYERRLAB1:
+        yyerrstatus_ = 3;       /* Each real token shifted decrements this.  */
+
+        // Pop stack until we find a state that shifts the error token.
+        for (;;)
+          {
+            yyn = yypact_[yystate];
+            if (!yyPactValueIsDefault (yyn))
+              {
+                yyn += ]b4_symbol(error, kind)[.getCode();
+                if (0 <= yyn && yyn <= YYLAST_
+                    && yycheck_[yyn] == ]b4_symbol(error, kind)[.getCode())
+                  {
+                    yyn = yytable_[yyn];
+                    if (0 < yyn)
+                      break;
+                  }
+              }
+
+            /* Pop the current state because it cannot handle the
+             * error token.  */
+            if (yystack.height == 0)
+              ]b4_push_if([{label = YYABORT; break;}],[return false;])[
+
+]b4_locations_if([[
+            yyerrloc = yystack.locationAt (0);]])[
+            yystack.pop ();
+            yystate = yystack.stateAt(0);]b4_parse_trace_if([[
+            if (0 < yydebug)
+              yystack.print (yyDebugStream);]])[
+          }
+
+        if (label == YYABORT)
+          /* Leave the switch.  */
+          break;
+
+]b4_locations_if([[
+        /* Muck with the stack to setup for yylloc.  */
+        yystack.push (0, null, yylloc);
+        yystack.push (0, null, yyerrloc);
+        yyloc = yylloc (yystack, 2);
+        yystack.pop (2);]])[
+
+        /* Shift the error token.  */]b4_lac_if([[
+        yylacDiscard("error recovery");]])[]b4_parse_trace_if([[
+        yySymbolPrint("Shifting", SymbolKind.get(yystos_[yyn]),
+                      yylval]b4_locations_if([, yyloc])[);]])[
+
+        yystate = yyn;
+        yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
+        label = YYNEWSTATE;
+        break;
+
+        /* Accept.  */
+      case YYACCEPT:
+        ]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
+                    [return true;])[
+
+        /* Abort.  */
+      case YYABORT:
+        ]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
+                    [return false;])[
+      }
+}
+]b4_push_if([[
+  boolean push_parse_initialized = false;
+
+    /**
+     * (Re-)Initialize the state of the push parser.
+     */
+  public void push_parse_initialize ()
+  {
+    /* Lookahead and lookahead in internal form.  */
+    this.yychar = YYEMPTY_;
+    this.yytoken = null;
+
+    /* State.  */
+    this.yyn = 0;
+    this.yylen = 0;
+    this.yystate = 0;
+    this.yystack = new YYStack();]b4_lac_if([[
+    this.yylacStack = new ArrayList<Integer>();
+    this.yylacEstablished = false;]])[
+    this.label = YYNEWSTATE;
+
+    /* Error handling.  */
+    this.yynerrs = 0;]b4_locations_if([[
+    /* The location where the error started.  */
+    this.yyerrloc = null;
+    this.yylloc = new ]b4_location_type[ (null, null);]])[
+
+    /* Semantic value of the lookahead.  */
+    this.yylval = null;
+
+    yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
+
+    this.push_parse_initialized = true;
+
+  }
+]b4_locations_if([[
+  /**
+   * Push parse given input from an external lexer.
+   *
+   * @@param yylextoken current token
+   * @@param yylexval current lval
+   * @@param yyylexpos current position
+   *
+   * @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
+   */
+  public int push_parse(int yylextoken, ]b4_yystype[ yylexval, ]b4_position_type[ yylexpos)]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
+      return push_parse(yylextoken, yylexval, new ]b4_location_type[(yylexpos));
+  }
+]])])[
+
+]b4_both_if([[
+  /**
+   * Parse input from the scanner that was specified at object construction
+   * time.  Return whether the end of the input was reached successfully.
+   * This version of parse() is defined only when api.push-push=both.
+   *
+   * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
+   *          imply that there were no syntax errors.
+   */
+  public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
+      if (yylexer == null)
+          throw new NullPointerException("Null Lexer");
+      int status;
+      do {
+          int token = yylexer.yylex();
+          ]b4_yystype[ lval = yylexer.getLVal();]b4_locations_if([[
+          ]b4_location_type[ yyloc = new ]b4_location_type[(yylexer.getStartPos(), yylexer.getEndPos());
+          status = push_parse(token, lval, yyloc);]], [[
+          status = push_parse(token, lval);]])[
+      } while (status == YYPUSH_MORE);
+      return status == YYACCEPT;
+  }
+]])[
+
+  /**
+   * Information needed to get the list of expected tokens and to forge
+   * a syntax error diagnostic.
+   */
+  public static final class Context {
+    Context(]b4_parser_class[ parser, YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[) {
+      yyparser = parser;
+      yystack = stack;
+      yytoken = token;]b4_locations_if([[
+      yylocation = loc;]])[
+    }
+
+    private ]b4_parser_class[ yyparser;
+    private YYStack yystack;
+
+
+    /**
+     * The symbol kind of the lookahead token.
+     */
+    public final SymbolKind getToken() {
+      return yytoken;
+    }
+
+    private SymbolKind yytoken;]b4_locations_if([[
+
+    /**
+     * The location of the lookahead.
+     */
+    public final ]b4_location_type[ getLocation() {
+      return yylocation;
+    }
+
+    private ]b4_location_type[ yylocation;]])[
+    static final int NTOKENS = ]b4_parser_class[.YYNTOKENS_;
+
+    /**
+     * Put in YYARG at most YYARGN of the expected tokens given the
+     * current YYCTX, and return the number of tokens stored in YYARG.  If
+     * YYARG is null, return the number of expected tokens (guaranteed to
+     * be less than YYNTOKENS).
+     */
+    int getExpectedTokens(SymbolKind yyarg[], int yyargn) {
+      return getExpectedTokens (yyarg, 0, yyargn);
+    }
+
+    int getExpectedTokens(SymbolKind yyarg[], int yyoffset, int yyargn) {
+      int yycount = yyoffset;]b4_lac_if([b4_parse_trace_if([[
+      // Execute LAC once. We don't care if it is successful, we
+      // only do it for the sake of debugging output.
+      if (!yyparser.yylacEstablished)
+        yyparser.yylacCheck(yystack, yytoken);
+]])[
+      for (int yyx = 0; yyx < YYNTOKENS_; ++yyx)
+        {
+          SymbolKind yysym = SymbolKind.get(yyx);
+          if (yysym != ]b4_symbol(error, kind)[
+              && yysym != ]b4_symbol(undef, kind)[
+              && yyparser.yylacCheck(yystack, yysym))
+            {
+              if (yyarg == null)
+                yycount += 1;
+              else if (yycount == yyargn)
+                return 0;
+              else
+                yyarg[yycount++] = yysym;
+            }
+        }]], [[
+      int yyn = yypact_[this.yystack.stateAt(0)];
+      if (!yyPactValueIsDefault(yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative
+             indexes in YYCHECK.  In other words, skip the first
+             -YYN actions for this state because they are default
+             actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST_ - yyn + 1;
+          int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
+          for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[.getCode()
+                && !yyTableValueIsError(yytable_[yyx + yyn]))
+              {
+                if (yyarg == null)
+                  yycount += 1;
+                else if (yycount == yyargn)
+                  return 0; // FIXME: this is incorrect.
+                else
+                  yyarg[yycount++] = SymbolKind.get(yyx);
+              }
+        }]])[
+      if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
+        yyarg[yycount] = null;
+      return yycount - yyoffset;
+    }
+  }
+
+]b4_lac_if([[
+    /** Check the lookahead yytoken.
+     * \returns  true iff the token will be eventually shifted.
+     */
+    boolean yylacCheck(YYStack yystack, SymbolKind yytoken)
+    {
+      // Logically, the yylacStack's lifetime is confined to this function.
+      // Clear it, to get rid of potential left-overs from previous call.
+      yylacStack.clear();
+      // Reduce until we encounter a shift and thereby accept the token.
+      yycdebugNnl("LAC: checking lookahead " + yytoken.getName() + ":");
+      int lacTop = 0;
+      while (true)
+        {
+          int topState = (yylacStack.isEmpty()
+                          ? yystack.stateAt(lacTop)
+                          : yylacStack.get(yylacStack.size() - 1));
+          int yyrule = yypact_[topState];
+          if (yyPactValueIsDefault(yyrule)
+              || (yyrule += yytoken.getCode()) < 0 || YYLAST_ < yyrule
+              || yycheck_[yyrule] != yytoken.getCode())
+            {
+              // Use the default action.
+              yyrule = yydefact_[+topState];
+              if (yyrule == 0) {
+                yycdebug(" Err");
+                return false;
+              }
+            }
+          else
+            {
+              // Use the action from yytable.
+              yyrule = yytable_[yyrule];
+              if (yyTableValueIsError(yyrule)) {
+                yycdebug(" Err");
+                return false;
+              }
+              if (0 < yyrule) {
+                yycdebug(" S" + yyrule);
+                return true;
+              }
+              yyrule = -yyrule;
+            }
+          // By now we know we have to simulate a reduce.
+          yycdebugNnl(" R" + (yyrule - 1));
+          // Pop the corresponding number of values from the stack.
+          {
+            int yylen = yyr2_[yyrule];
+            // First pop from the LAC stack as many tokens as possible.
+            int lacSize = yylacStack.size();
+            if (yylen < lacSize) {
+              // yylacStack.setSize(lacSize - yylen);
+              for (/* Nothing */; 0 < yylen; yylen -= 1) {
+                yylacStack.remove(yylacStack.size() - 1);
+              }
+              yylen = 0;
+            } else if (lacSize != 0) {
+              yylacStack.clear();
+              yylen -= lacSize;
+            }
+            // Only afterwards look at the main stack.
+            // We simulate popping elements by incrementing lacTop.
+            lacTop += yylen;
+          }
+          // Keep topState in sync with the updated stack.
+          topState = (yylacStack.isEmpty()
+                      ? yystack.stateAt(lacTop)
+                      : yylacStack.get(yylacStack.size() - 1));
+          // Push the resulting state of the reduction.
+          int state = yyLRGotoState(topState, yyr1_[yyrule]);
+          yycdebugNnl(" G" + state);
+          yylacStack.add(state);
+        }
+    }
+
+    /** Establish the initial context if no initial context currently exists.
+     * \returns  true iff the token will be eventually shifted.
+     */
+    boolean yylacEstablish(YYStack yystack, SymbolKind yytoken) {
+      /* Establish the initial context for the current lookahead if no initial
+         context is currently established.
+
+         We define a context as a snapshot of the parser stacks.  We define
+         the initial context for a lookahead as the context in which the
+         parser initially examines that lookahead in order to select a
+         syntactic action.  Thus, if the lookahead eventually proves
+         syntactically unacceptable (possibly in a later context reached via a
+         series of reductions), the initial context can be used to determine
+         the exact set of tokens that would be syntactically acceptable in the
+         lookahead's place.  Moreover, it is the context after which any
+         further semantic actions would be erroneous because they would be
+         determined by a syntactically unacceptable token.
+
+         yylacEstablish should be invoked when a reduction is about to be
+         performed in an inconsistent state (which, for the purposes of LAC,
+         includes consistent states that don't know they're consistent because
+         their default reductions have been disabled).
+
+         For parse.lac=full, the implementation of yylacEstablish is as
+         follows.  If no initial context is currently established for the
+         current lookahead, then check if that lookahead can eventually be
+         shifted if syntactic actions continue from the current context.  */
+      if (yylacEstablished) {
+        return true;
+      } else {
+        yycdebug("LAC: initial context established for " + yytoken.getName());
+        yylacEstablished = true;
+        return yylacCheck(yystack, yytoken);
+      }
+    }
+
+    /** Discard any previous initial lookahead context because of event.
+     * \param event  the event which caused the lookahead to be discarded.
+     *               Only used for debbuging output.  */
+    void yylacDiscard(String event) {
+     /* Discard any previous initial lookahead context because of Event,
+        which may be a lookahead change or an invalidation of the currently
+        established initial context for the current lookahead.
+
+        The most common example of a lookahead change is a shift.  An example
+        of both cases is syntax error recovery.  That is, a syntax error
+        occurs when the lookahead is syntactically erroneous for the
+        currently established initial context, so error recovery manipulates
+        the parser stacks to try to find a new initial context in which the
+        current lookahead is syntactically acceptable.  If it fails to find
+        such a context, it discards the lookahead.  */
+      if (yylacEstablished) {
+        yycdebug("LAC: initial context discarded due to " + event);
+        yylacEstablished = false;
+      }
+    }
+
+    /** The stack for LAC.
+     * Logically, the yylacStack's lifetime is confined to the function
+     * yylacCheck. We just store it as a member of this class to hold
+     * on to the memory and to avoid frequent reallocations.
+     */
+    ArrayList<Integer> yylacStack;
+    /**  Whether an initial LAC context was established. */
+    boolean yylacEstablished;
+]])[
+
+]b4_parse_error_bmatch(
+[detailed\|verbose], [[
+  private int yysyntaxErrorArguments(Context yyctx, SymbolKind[] yyarg, int yyargn) {
+    /* There are many possibilities here to consider:
+       - If this state is a consistent state with a default action,
+         then the only way this function was invoked is if the
+         default action is an error action.  In that case, don't
+         check for expected tokens because there are none.
+       - The only way there can be no lookahead present (in tok) is
+         if this state is a consistent state with a default action.
+         Thus, detecting the absence of a lookahead is sufficient to
+         determine that there is no unexpected or expected token to
+         report.  In that case, just report a simple "syntax error".
+       - Don't assume there isn't a lookahead just because this
+         state is a consistent state with a default action.  There
+         might have been a previous inconsistent state, consistent
+         state with a non-default action, or user semantic action
+         that manipulated yychar.  (However, yychar is currently out
+         of scope during semantic actions.)
+       - Of course, the expected token list depends on states to
+         have correct lookahead information, and it depends on the
+         parser not to perform extra reductions after fetching a
+         lookahead from the scanner and before detecting a syntax
+         error.  Thus, state merging (from LALR or IELR) and default
+         reductions corrupt the expected token list.  However, the
+         list is correct for canonical LR with one exception: it
+         will still contain any token that will not be accepted due
+         to an error action in a later state.
+    */
+    int yycount = 0;
+    if (yyctx.getToken() != null)
+      {
+        if (yyarg != null)
+          yyarg[yycount] = yyctx.getToken();
+        yycount += 1;
+        yycount += yyctx.getExpectedTokens(yyarg, 1, yyargn);
+      }
+    return yycount;
+  }
+]])[
+
+  /**
+   * Build and emit a "syntax error" message in a user-defined way.
+   *
+   * @@param ctx  The context of the error.
+   */
+  private void yyreportSyntaxError(Context yyctx) {]b4_parse_error_bmatch(
+[custom], [[
+      yylexer.reportSyntaxError(yyctx);]],
+[detailed\|verbose], [[
+      if (yyErrorVerbose) {
+          final int argmax = 5;
+          SymbolKind[] yyarg = new SymbolKind[argmax];
+          int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax);
+          String[] yystr = new String[yycount];
+          for (int yyi = 0; yyi < yycount; ++yyi) {
+              yystr[yyi] = yyarg[yyi].getName();
+          }
+          String yyformat;
+          switch (yycount) {
+              default:
+              case 0: yyformat = ]b4_trans(["syntax error"])[; break;
+              case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break;
+              case 2: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1}"])[; break;
+              case 3: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2}"])[; break;
+              case 4: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3}"])[; break;
+              case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break;
+          }
+          yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr));
+      } else {
+          yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);
+      }]],
+[simple], [[
+      yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);]])[
+  }
+
+  /**
+   * Whether the given <code>yypact_</code> value indicates a defaulted state.
+   * @@param yyvalue   the value to check
+   */
+  private static boolean yyPactValueIsDefault(int yyvalue) {
+    return yyvalue == yypact_ninf_;
+  }
+
+  /**
+   * Whether the given <code>yytable_</code>
+   * value indicates a syntax error.
+   * @@param yyvalue the value to check
+   */
+  private static boolean yyTableValueIsError(int yyvalue) {
+    return yyvalue == yytable_ninf_;
+  }
+
+  private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
+  private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
+
+]b4_parser_tables_define[
+
+]b4_parse_trace_if([[
+  ]b4_integral_parser_table_define([rline], [b4_rline],
+  [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
+
+
+  // Report on the debug stream that the rule yyrule is going to be reduced.
+  private void yyReducePrint (int yyrule, YYStack yystack)
+  {
+    if (yydebug == 0)
+      return;
+
+    int yylno = yyrline_[yyrule];
+    int yynrhs = yyr2_[yyrule];
+    /* Print the symbols being reduced, and their result.  */
+    yycdebug ("Reducing stack by rule " + (yyrule - 1)
+              + " (line " + yylno + "):");
+
+    /* The symbols being reduced.  */
+    for (int yyi = 0; yyi < yynrhs; yyi++)
+      yySymbolPrint("   $" + (yyi + 1) + " =",
+                    SymbolKind.get(yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
+                    ]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
+                    b4_rhs_location(yynrhs, yyi + 1)])[);
+  }]])[
+
+  /* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+     as returned by yylex, with out-of-bounds checking.  */
+  private static final SymbolKind yytranslate_(int t)
+]b4_api_token_raw_if(dnl
+[[  {
+    return SymbolKind.get(t);
+  }
+]],
+[[  {
+    // Last valid token kind.
+    int code_max = ]b4_code_max[;
+    if (t <= 0)
+      return ]b4_symbol(eof, kind)[;
+    else if (t <= code_max)
+      return SymbolKind.get(yytranslate_table_[t]);
+    else
+      return ]b4_symbol(undef, kind)[;
+  }
+  ]b4_integral_parser_table_define([translate_table], [b4_translate])[
+]])[
+
+  private static final int YYLAST_ = ]b4_last[;
+  private static final int YYEMPTY_ = -2;
+  private static final int YYFINAL_ = ]b4_final_state_number[;
+  private static final int YYNTOKENS_ = ]b4_tokens_number[;
+
+]b4_percent_code_get[
+}
+]b4_percent_code_get([[epilogue]])[]dnl
+b4_epilogue[]dnl
+b4_output_end

+ 380 - 0
Engine/bin/bison-flex/data/skeletons/location.cc

@@ -0,0 +1,380 @@
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_pushdef([b4_copyright_years],
+           [2002-2015, 2018-2021])
+
+
+# b4_location_file
+# ----------------
+# Name of the file containing the position/location class,
+# if we want this file.
+b4_percent_define_check_file([b4_location_file],
+                             [[api.location.file]],
+                             b4_header_if([[location.hh]]))
+
+# b4_location_include
+# -------------------
+# If location.hh is to be generated, the name under which should it be
+# included.
+#
+# b4_location_path
+# ----------------
+# The path to use for the CPP guard.
+m4_ifdef([b4_location_file],
+[m4_define([b4_location_include],
+           [b4_percent_define_get([[api.location.include]],
+                                  ["b4_location_file"])])
+ m4_define([b4_location_path],
+           b4_percent_define_get([[api.location.include]],
+                                 ["b4_mapped_dir_prefix[]b4_location_file"]))
+ m4_define([b4_location_path],
+           m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
+ ])
+
+
+# b4_position_file
+# ----------------
+# Name of the file containing the position class, if we want this file.
+b4_header_if(
+  [b4_required_version_if(
+    [30200], [],
+    [m4_ifdef([b4_location_file],
+              [m4_define([b4_position_file], [position.hh])])])])
+
+
+
+# b4_location_define
+# ------------------
+# Define the position and location classes.
+m4_define([b4_location_define],
+[[  /// A point in a source file.
+  class position
+  {
+  public:
+    /// Type for file name.
+    typedef ]b4_percent_define_get([[api.filename.type]])[ filename_type;
+    /// Type for line and column numbers.
+    typedef int counter_type;
+]m4_ifdef([b4_location_constructors], [[
+    /// Construct a position.
+    explicit position (filename_type* f = YY_NULLPTR,
+                       counter_type l = ]b4_location_initial_line[,
+                       counter_type c = ]b4_location_initial_column[)
+      : filename (f)
+      , line (l)
+      , column (c)
+    {}
+
+]])[
+    /// Initialization.
+    void initialize (filename_type* fn = YY_NULLPTR,
+                     counter_type l = ]b4_location_initial_line[,
+                     counter_type c = ]b4_location_initial_column[)
+    {
+      filename = fn;
+      line = l;
+      column = c;
+    }
+
+    /** \name Line and Column related manipulators
+     ** \{ */
+    /// (line related) Advance to the COUNT next lines.
+    void lines (counter_type count = 1)
+    {
+      if (count)
+        {
+          column = ]b4_location_initial_column[;
+          line = add_ (line, count, ]b4_location_initial_line[);
+        }
+    }
+
+    /// (column related) Advance to the COUNT next columns.
+    void columns (counter_type count = 1)
+    {
+      column = add_ (column, count, ]b4_location_initial_column[);
+    }
+    /** \} */
+
+    /// File name to which this position refers.
+    filename_type* filename;
+    /// Current line number.
+    counter_type line;
+    /// Current column number.
+    counter_type column;
+
+  private:
+    /// Compute max (min, lhs+rhs).
+    static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min)
+    {
+      return lhs + rhs < min ? min : lhs + rhs;
+    }
+  };
+
+  /// Add \a width columns, in place.
+  inline position&
+  operator+= (position& res, position::counter_type width)
+  {
+    res.columns (width);
+    return res;
+  }
+
+  /// Add \a width columns.
+  inline position
+  operator+ (position res, position::counter_type width)
+  {
+    return res += width;
+  }
+
+  /// Subtract \a width columns, in place.
+  inline position&
+  operator-= (position& res, position::counter_type width)
+  {
+    return res += -width;
+  }
+
+  /// Subtract \a width columns.
+  inline position
+  operator- (position res, position::counter_type width)
+  {
+    return res -= width;
+  }
+]b4_percent_define_flag_if([[define_location_comparison]], [[
+  /// Compare two position objects.
+  inline bool
+  operator== (const position& pos1, const position& pos2)
+  {
+    return (pos1.line == pos2.line
+            && pos1.column == pos2.column
+            && (pos1.filename == pos2.filename
+                || (pos1.filename && pos2.filename
+                    && *pos1.filename == *pos2.filename)));
+  }
+
+  /// Compare two position objects.
+  inline bool
+  operator!= (const position& pos1, const position& pos2)
+  {
+    return !(pos1 == pos2);
+  }
+]])[
+  /** \brief Intercept output stream redirection.
+   ** \param ostr the destination output stream
+   ** \param pos a reference to the position to redirect
+   */
+  template <typename YYChar>
+  std::basic_ostream<YYChar>&
+  operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
+  {
+    if (pos.filename)
+      ostr << *pos.filename << ':';
+    return ostr << pos.line << '.' << pos.column;
+  }
+
+  /// Two points in a source file.
+  class location
+  {
+  public:
+    /// Type for file name.
+    typedef position::filename_type filename_type;
+    /// Type for line and column numbers.
+    typedef position::counter_type counter_type;
+]m4_ifdef([b4_location_constructors], [
+    /// Construct a location from \a b to \a e.
+    location (const position& b, const position& e)
+      : begin (b)
+      , end (e)
+    {}
+
+    /// Construct a 0-width location in \a p.
+    explicit location (const position& p = position ())
+      : begin (p)
+      , end (p)
+    {}
+
+    /// Construct a 0-width location in \a f, \a l, \a c.
+    explicit location (filename_type* f,
+                       counter_type l = ]b4_location_initial_line[,
+                       counter_type c = ]b4_location_initial_column[)
+      : begin (f, l, c)
+      , end (f, l, c)
+    {}
+
+])[
+    /// Initialization.
+    void initialize (filename_type* f = YY_NULLPTR,
+                     counter_type l = ]b4_location_initial_line[,
+                     counter_type c = ]b4_location_initial_column[)
+    {
+      begin.initialize (f, l, c);
+      end = begin;
+    }
+
+    /** \name Line and Column related manipulators
+     ** \{ */
+  public:
+    /// Reset initial location to final location.
+    void step ()
+    {
+      begin = end;
+    }
+
+    /// Extend the current location to the COUNT next columns.
+    void columns (counter_type count = 1)
+    {
+      end += count;
+    }
+
+    /// Extend the current location to the COUNT next lines.
+    void lines (counter_type count = 1)
+    {
+      end.lines (count);
+    }
+    /** \} */
+
+
+  public:
+    /// Beginning of the located region.
+    position begin;
+    /// End of the located region.
+    position end;
+  };
+
+  /// Join two locations, in place.
+  inline location&
+  operator+= (location& res, const location& end)
+  {
+    res.end = end.end;
+    return res;
+  }
+
+  /// Join two locations.
+  inline location
+  operator+ (location res, const location& end)
+  {
+    return res += end;
+  }
+
+  /// Add \a width columns to the end position, in place.
+  inline location&
+  operator+= (location& res, location::counter_type width)
+  {
+    res.columns (width);
+    return res;
+  }
+
+  /// Add \a width columns to the end position.
+  inline location
+  operator+ (location res, location::counter_type width)
+  {
+    return res += width;
+  }
+
+  /// Subtract \a width columns to the end position, in place.
+  inline location&
+  operator-= (location& res, location::counter_type width)
+  {
+    return res += -width;
+  }
+
+  /// Subtract \a width columns to the end position.
+  inline location
+  operator- (location res, location::counter_type width)
+  {
+    return res -= width;
+  }
+]b4_percent_define_flag_if([[define_location_comparison]], [[
+  /// Compare two location objects.
+  inline bool
+  operator== (const location& loc1, const location& loc2)
+  {
+    return loc1.begin == loc2.begin && loc1.end == loc2.end;
+  }
+
+  /// Compare two location objects.
+  inline bool
+  operator!= (const location& loc1, const location& loc2)
+  {
+    return !(loc1 == loc2);
+  }
+]])[
+  /** \brief Intercept output stream redirection.
+   ** \param ostr the destination output stream
+   ** \param loc a reference to the location to redirect
+   **
+   ** Avoid duplicate information.
+   */
+  template <typename YYChar>
+  std::basic_ostream<YYChar>&
+  operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
+  {
+    location::counter_type end_col
+      = 0 < loc.end.column ? loc.end.column - 1 : 0;
+    ostr << loc.begin;
+    if (loc.end.filename
+        && (!loc.begin.filename
+            || *loc.begin.filename != *loc.end.filename))
+      ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
+    else if (loc.begin.line < loc.end.line)
+      ostr << '-' << loc.end.line << '.' << end_col;
+    else if (loc.begin.column < end_col)
+      ostr << '-' << end_col;
+    return ostr;
+  }
+]])
+
+
+m4_ifdef([b4_position_file], [[
+]b4_output_begin([b4_dir_prefix], [b4_position_file])[
+]b4_generated_by[
+// Starting with Bison 3.2, this file is useless: the structure it
+// used to define is now defined in "]b4_location_file[".
+//
+// To get rid of this file:
+// 1. add '%require "3.2"' (or newer) to your grammar file
+// 2. remove references to this file from your build system
+// 3. if you used to include it, include "]b4_location_file[" instead.
+
+#include ]b4_location_include[
+]b4_output_end[
+]])
+
+
+m4_ifdef([b4_location_file], [[
+]b4_output_begin([b4_dir_prefix], [b4_location_file])[
+]b4_copyright([Locations for Bison parsers in C++])[
+/**
+ ** \file ]b4_location_path[
+ ** Define the ]b4_namespace_ref[::location class.
+ */
+
+]b4_cpp_guard_open([b4_location_path])[
+
+# include <iostream>
+# include <string>
+
+]b4_null_define[
+
+]b4_namespace_open[
+]b4_location_define[
+]b4_namespace_close[
+]b4_cpp_guard_close([b4_location_path])[
+]b4_output_end[
+]])
+
+
+m4_popdef([b4_copyright_years])

+ 157 - 0
Engine/bin/bison-flex/data/skeletons/stack.hh

@@ -0,0 +1,157 @@
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+# b4_stack_file
+# -------------
+# Name of the file containing the stack class, if we want this file.
+b4_header_if([b4_required_version_if([30200], [],
+                                     [m4_define([b4_stack_file], [stack.hh])])])
+
+
+# b4_stack_define
+# ---------------
+m4_define([b4_stack_define],
+[[    /// A stack with random access from its top.
+    template <typename T, typename S = std::vector<T> >
+    class stack
+    {
+    public:
+      // Hide our reversed order.
+      typedef typename S::iterator iterator;
+      typedef typename S::const_iterator const_iterator;
+      typedef typename S::size_type size_type;
+      typedef typename std::ptrdiff_t index_type;
+
+      stack (size_type n = 200) YY_NOEXCEPT
+        : seq_ (n)
+      {}
+
+#if 201103L <= YY_CPLUSPLUS
+      /// Non copyable.
+      stack (const stack&) = delete;
+      /// Non copyable.
+      stack& operator= (const stack&) = delete;
+#endif
+
+      /// Random access.
+      ///
+      /// Index 0 returns the topmost element.
+      const T&
+      operator[] (index_type i) const
+      {
+        return seq_[size_type (size () - 1 - i)];
+      }
+
+      /// Random access.
+      ///
+      /// Index 0 returns the topmost element.
+      T&
+      operator[] (index_type i)
+      {
+        return seq_[size_type (size () - 1 - i)];
+      }
+
+      /// Steal the contents of \a t.
+      ///
+      /// Close to move-semantics.
+      void
+      push (YY_MOVE_REF (T) t)
+      {
+        seq_.push_back (T ());
+        operator[] (0).move (t);
+      }
+
+      /// Pop elements from the stack.
+      void
+      pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
+      {
+        for (; 0 < n; --n)
+          seq_.pop_back ();
+      }
+
+      /// Pop all elements from the stack.
+      void
+      clear () YY_NOEXCEPT
+      {
+        seq_.clear ();
+      }
+
+      /// Number of elements on the stack.
+      index_type
+      size () const YY_NOEXCEPT
+      {
+        return index_type (seq_.size ());
+      }
+
+      /// Iterator on top of the stack (going downwards).
+      const_iterator
+      begin () const YY_NOEXCEPT
+      {
+        return seq_.begin ();
+      }
+
+      /// Bottom of the stack.
+      const_iterator
+      end () const YY_NOEXCEPT
+      {
+        return seq_.end ();
+      }
+
+      /// Present a slice of the top of a stack.
+      class slice
+      {
+      public:
+        slice (const stack& stack, index_type range) YY_NOEXCEPT
+          : stack_ (stack)
+          , range_ (range)
+        {}
+
+        const T&
+        operator[] (index_type i) const
+        {
+          return stack_[range_ - i];
+        }
+
+      private:
+        const stack& stack_;
+        index_type range_;
+      };
+
+    private:
+#if YY_CPLUSPLUS < 201103L
+      /// Non copyable.
+      stack (const stack&);
+      /// Non copyable.
+      stack& operator= (const stack&);
+#endif
+      /// The wrapped container.
+      S seq_;
+    };
+]])
+
+m4_ifdef([b4_stack_file],
+[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
+]b4_generated_by[
+// Starting with Bison 3.2, this file is useless: the structure it
+// used to define is now defined with the parser itself.
+//
+// To get rid of this file:
+// 1. add '%require "3.2"' (or newer) to your grammar file
+// 2. remove references to this file from your build system.
+]b4_output_end[
+]])

+ 2 - 0
Engine/bin/bison-flex/data/skeletons/traceon.m4

@@ -0,0 +1,2 @@
+dnl GNU M4 treats -dV in a position-independent manner.
+m4_debugmode(V)m4_traceon()dnl

+ 525 - 0
Engine/bin/bison-flex/data/skeletons/variant.hh

@@ -0,0 +1,525 @@
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+
+## --------- ##
+## variant.  ##
+## --------- ##
+
+# b4_assert
+# ---------
+# The name of YY_ASSERT.
+m4_define([b4_assert],
+          [b4_api_PREFIX[]_ASSERT])
+
+
+# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
+# ------------------------------------------------
+# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
+# YYTYPE.
+m4_define([b4_symbol_variant],
+[m4_pushdef([b4_dollar_dollar],
+            [$2.$3< $][3 > (m4_shift3($@))])dnl
+switch ($1)
+    {
+b4_type_foreach([_b4_type_action])[]dnl
+      default:
+        break;
+    }
+m4_popdef([b4_dollar_dollar])dnl
+])
+
+
+# _b4_char_sizeof_counter
+# -----------------------
+# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
+m4_define([_b4_char_sizeof_counter],
+[0])
+
+# _b4_char_sizeof_dummy
+# ---------------------
+# At each call return a new C++ identifier.
+m4_define([_b4_char_sizeof_dummy],
+[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
+dummy[]_b4_char_sizeof_counter])
+
+
+# b4_char_sizeof(SYMBOL-NUMS)
+# ---------------------------
+# To be mapped on the list of type names to produce:
+#
+#    char dummy1[sizeof (type_name_1)];
+#    char dummy2[sizeof (type_name_2)];
+#
+# for defined type names.
+m4_define([b4_char_sizeof],
+[b4_symbol_if([$1], [has_type],
+[
+m4_map([      b4_symbol_tag_comment], [$@])dnl
+      char _b4_char_sizeof_dummy@{sizeof (b4_symbol([$1], [type]))@};
+])])
+
+
+# b4_variant_includes
+# -------------------
+# The needed includes for variants support.
+m4_define([b4_variant_includes],
+[b4_parse_assert_if([[#include <typeinfo>
+#ifndef ]b4_assert[
+# include <cassert>
+# define ]b4_assert[ assert
+#endif
+]])])
+
+
+
+## -------------------------- ##
+## Adjustments for variants.  ##
+## -------------------------- ##
+
+
+# b4_value_type_declare
+# ---------------------
+# Define value_type.
+m4_define([b4_value_type_declare],
+[[  /// A buffer to store and retrieve objects.
+  ///
+  /// Sort of a variant, but does not keep track of the nature
+  /// of the stored data, since that knowledge is available
+  /// via the current parser state.
+  class value_type
+  {
+  public:
+    /// Type of *this.
+    typedef value_type self_type;
+
+    /// Empty construction.
+    value_type () YY_NOEXCEPT
+      : yyraw_ ()]b4_parse_assert_if([
+      , yytypeid_ (YY_NULLPTR)])[
+    {}
+
+    /// Construct and fill.
+    template <typename T>
+    value_type (YY_RVREF (T) t)]b4_parse_assert_if([
+      : yytypeid_ (&typeid (T))])[
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (sizeof (T) <= size);]])[
+      new (yyas_<T> ()) T (YY_MOVE (t));
+    }
+
+#if 201103L <= YY_CPLUSPLUS
+    /// Non copyable.
+    value_type (const self_type&) = delete;
+    /// Non copyable.
+    self_type& operator= (const self_type&) = delete;
+#endif
+
+    /// Destruction, allowed only if empty.
+    ~value_type () YY_NOEXCEPT
+    {]b4_parse_assert_if([
+      ]b4_assert[ (!yytypeid_);
+    ])[}
+
+# if 201103L <= YY_CPLUSPLUS
+    /// Instantiate a \a T in here from \a t.
+    template <typename T, typename... U>
+    T&
+    emplace (U&&... u)
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (!yytypeid_);
+      ]b4_assert[ (sizeof (T) <= size);
+      yytypeid_ = & typeid (T);]])[
+      return *new (yyas_<T> ()) T (std::forward <U>(u)...);
+    }
+# else
+    /// Instantiate an empty \a T in here.
+    template <typename T>
+    T&
+    emplace ()
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (!yytypeid_);
+      ]b4_assert[ (sizeof (T) <= size);
+      yytypeid_ = & typeid (T);]])[
+      return *new (yyas_<T> ()) T ();
+    }
+
+    /// Instantiate a \a T in here from \a t.
+    template <typename T>
+    T&
+    emplace (const T& t)
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (!yytypeid_);
+      ]b4_assert[ (sizeof (T) <= size);
+      yytypeid_ = & typeid (T);]])[
+      return *new (yyas_<T> ()) T (t);
+    }
+# endif
+
+    /// Instantiate an empty \a T in here.
+    /// Obsolete, use emplace.
+    template <typename T>
+    T&
+    build ()
+    {
+      return emplace<T> ();
+    }
+
+    /// Instantiate a \a T in here from \a t.
+    /// Obsolete, use emplace.
+    template <typename T>
+    T&
+    build (const T& t)
+    {
+      return emplace<T> (t);
+    }
+
+    /// Accessor to a built \a T.
+    template <typename T>
+    T&
+    as () YY_NOEXCEPT
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (yytypeid_);
+      ]b4_assert[ (*yytypeid_ == typeid (T));
+      ]b4_assert[ (sizeof (T) <= size);]])[
+      return *yyas_<T> ();
+    }
+
+    /// Const accessor to a built \a T (for %printer).
+    template <typename T>
+    const T&
+    as () const YY_NOEXCEPT
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (yytypeid_);
+      ]b4_assert[ (*yytypeid_ == typeid (T));
+      ]b4_assert[ (sizeof (T) <= size);]])[
+      return *yyas_<T> ();
+    }
+
+    /// Swap the content with \a that, of same type.
+    ///
+    /// Both variants must be built beforehand, because swapping the actual
+    /// data requires reading it (with as()), and this is not possible on
+    /// unconstructed variants: it would require some dynamic testing, which
+    /// should not be the variant's responsibility.
+    /// Swapping between built and (possibly) non-built is done with
+    /// self_type::move ().
+    template <typename T>
+    void
+    swap (self_type& that) YY_NOEXCEPT
+    {]b4_parse_assert_if([[
+      ]b4_assert[ (yytypeid_);
+      ]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[
+      std::swap (as<T> (), that.as<T> ());
+    }
+
+    /// Move the content of \a that to this.
+    ///
+    /// Destroys \a that.
+    template <typename T>
+    void
+    move (self_type& that)
+    {
+# if 201103L <= YY_CPLUSPLUS
+      emplace<T> (std::move (that.as<T> ()));
+# else
+      emplace<T> ();
+      swap<T> (that);
+# endif
+      that.destroy<T> ();
+    }
+
+# if 201103L <= YY_CPLUSPLUS
+    /// Move the content of \a that to this.
+    template <typename T>
+    void
+    move (self_type&& that)
+    {
+      emplace<T> (std::move (that.as<T> ()));
+      that.destroy<T> ();
+    }
+#endif
+
+    /// Copy the content of \a that to this.
+    template <typename T>
+    void
+    copy (const self_type& that)
+    {
+      emplace<T> (that.as<T> ());
+    }
+
+    /// Destroy the stored \a T.
+    template <typename T>
+    void
+    destroy ()
+    {
+      as<T> ().~T ();]b4_parse_assert_if([
+      yytypeid_ = YY_NULLPTR;])[
+    }
+
+  private:
+#if YY_CPLUSPLUS < 201103L
+    /// Non copyable.
+    value_type (const self_type&);
+    /// Non copyable.
+    self_type& operator= (const self_type&);
+#endif
+
+    /// Accessor to raw memory as \a T.
+    template <typename T>
+    T*
+    yyas_ () YY_NOEXCEPT
+    {
+      void *yyp = yyraw_;
+      return static_cast<T*> (yyp);
+     }
+
+    /// Const accessor to raw memory as \a T.
+    template <typename T>
+    const T*
+    yyas_ () const YY_NOEXCEPT
+    {
+      const void *yyp = yyraw_;
+      return static_cast<const T*> (yyp);
+     }
+
+    /// An auxiliary type to compute the largest semantic type.
+    union union_type
+    {]b4_type_foreach([b4_char_sizeof])[    };
+
+    /// The size of the largest semantic type.
+    enum { size = sizeof (union_type) };
+
+    /// A buffer to store semantic values.
+    union
+    {
+      /// Strongest alignment constraints.
+      long double yyalign_me_;
+      /// A buffer large enough to store any of the semantic values.
+      char yyraw_[size];
+    };]b4_parse_assert_if([
+
+    /// Whether the content is built: if defined, the name of the stored type.
+    const std::type_info *yytypeid_;])[
+  };
+]])
+
+
+# How the semantic value is extracted when using variants.
+
+# b4_symbol_value(VAL, SYMBOL-NUM, [TYPE])
+# ----------------------------------------
+# See README.
+m4_define([b4_symbol_value],
+[m4_ifval([$3],
+          [$1.as< $3 > ()],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [$1.as < b4_symbol([$2], [type]) > ()],
+                                  [$1])],
+                    [$1])])])
+
+# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
+# -------------------------------------------------
+# Same as b4_symbol_value, but used in a template method.
+m4_define([b4_symbol_value_template],
+[m4_ifval([$3],
+          [$1.template as< $3 > ()],
+          [m4_ifval([$2],
+                    [b4_symbol_if([$2], [has_type],
+                                  [$1.template as < b4_symbol([$2], [type]) > ()],
+                                  [$1])],
+                    [$1])])])
+
+
+
+## ------------- ##
+## make_SYMBOL.  ##
+## ------------- ##
+
+
+# _b4_includes_tokens(SYMBOL-NUM...)
+# ----------------------------------
+# Expands to non-empty iff one of the SYMBOL-NUM denotes
+# a token.
+m4_define([_b4_is_token],
+          [b4_symbol_if([$1], [is_token], [1])])
+m4_define([_b4_includes_tokens],
+          [m4_map([_b4_is_token], [$@])])
+
+
+# _b4_token_maker_define(SYMBOL-NUM)
+# ----------------------------------
+# Declare make_SYMBOL for SYMBOL-NUM.  Use at class-level.
+m4_define([_b4_token_maker_define],
+[b4_token_visible_if([$1],
+[#if 201103L <= YY_CPLUSPLUS
+      static
+      symbol_type
+      make_[]_b4_symbol([$1], [id]) (b4_join(
+                 b4_symbol_if([$1], [has_type],
+                 [b4_symbol([$1], [type]) v]),
+                 b4_locations_if([location_type l])))
+      {
+        return symbol_type (b4_join([token::b4_symbol([$1], [id])],
+                                    b4_symbol_if([$1], [has_type], [std::move (v)]),
+                                    b4_locations_if([std::move (l)])));
+      }
+#else
+      static
+      symbol_type
+      make_[]_b4_symbol([$1], [id]) (b4_join(
+                 b4_symbol_if([$1], [has_type],
+                 [const b4_symbol([$1], [type])& v]),
+                 b4_locations_if([const location_type& l])))
+      {
+        return symbol_type (b4_join([token::b4_symbol([$1], [id])],
+                                    b4_symbol_if([$1], [has_type], [v]),
+                                    b4_locations_if([l])));
+      }
+#endif
+])])
+
+
+# b4_token_kind(SYMBOL-NUM)
+# -------------------------
+# Some tokens don't have an ID.
+m4_define([b4_token_kind],
+[b4_symbol_if([$1], [has_id],
+              [token::b4_symbol([$1], [id])],
+              [b4_symbol([$1], [code])])])
+
+
+# _b4_tok_in(SYMBOL-NUM, ...)
+# ---------------------------
+# See b4_tok_in below.  The SYMBOL-NUMs... are tokens only.
+#
+# We iterate over the tokens to group them by "range" of token numbers (not
+# symbols numbers!).
+#
+# b4_fst is the start of that range.
+# b4_prev is the previous value.
+# b4_val is the current value.
+# If b4_val is the successor of b4_prev in token numbers, update the latter,
+#   otherwise emit the code for range b4_fst .. b4_prev.
+# $1 is also used as a terminator in the foreach, but it will not be printed.
+#
+m4_define([_b4_tok_in],
+[m4_pushdef([b4_prev], [$1])dnl
+m4_pushdef([b4_fst], [$1])dnl
+m4_pushdef([b4_sep], [])dnl
+m4_foreach([b4_val], m4_dquote(m4_shift($@, $1)),
+           [m4_if(b4_symbol(b4_val, [code]), m4_eval(b4_symbol(b4_prev, [code]) + 1), [],
+                  [b4_sep[]m4_if(b4_fst, b4_prev,
+                         [tok == b4_token_kind(b4_fst)],
+                         [(b4_token_kind(b4_fst) <= tok && tok <= b4_token_kind(b4_prev))])[]dnl
+m4_define([b4_fst], b4_val)dnl
+m4_define([b4_sep], [
+                   || ])])dnl
+m4_define([b4_prev], b4_val)])dnl
+m4_popdef([b4_sep])dnl
+m4_popdef([b4_fst])dnl
+m4_popdef([b4_prev])dnl
+])
+
+
+# _b4_filter_tokens(SYMBOL-NUM, ...)
+# ----------------------------------
+# Expand as the list of tokens amongst SYMBOL-NUM.
+m4_define([_b4_filter_tokens],
+[m4_pushdef([b4_sep])dnl
+m4_foreach([b4_val], [$@],
+           [b4_symbol_if(b4_val, [is_token], [b4_sep[]b4_val[]m4_define([b4_sep], [,])])])dnl
+m4_popdef([b4_sep])dnl
+])
+
+
+# b4_tok_in(SYMBOL-NUM, ...)
+# ---------------------------
+# A C++ conditional that checks that `tok` is a member of this list of symbol
+# numbers.
+m4_define([b4_tok_in],
+          [_$0(_b4_filter_tokens($@))])
+
+
+
+
+# _b4_symbol_constructor_define(SYMBOL-NUM...)
+# --------------------------------------------
+# Define a symbol_type constructor common to all the SYMBOL-NUM (they
+# have the same type).  Use at class-level.
+m4_define([_b4_symbol_constructor_define],
+[m4_ifval(_b4_includes_tokens($@),
+[[#if 201103L <= YY_CPLUSPLUS
+      symbol_type (]b4_join(
+          [int tok],
+          b4_symbol_if([$1], [has_type],
+                       [b4_symbol([$1], [type]) v]),
+          b4_locations_if([location_type l]))[)
+        : super_type (]b4_join([token_kind_type (tok)],
+                               b4_symbol_if([$1], [has_type], [std::move (v)]),
+                               b4_locations_if([std::move (l)]))[)
+#else
+      symbol_type (]b4_join(
+          [int tok],
+          b4_symbol_if([$1], [has_type],
+                       [const b4_symbol([$1], [type])& v]),
+          b4_locations_if([const location_type& l]))[)
+        : super_type (]b4_join([token_kind_type (tok)],
+                               b4_symbol_if([$1], [has_type], [v]),
+                               b4_locations_if([l]))[)
+#endif
+      {]b4_parse_assert_if([[
+#if !defined _MSC_VER || defined __clang__
+        ]b4_assert[ (]b4_tok_in($@)[);
+#endif
+      ]])[}
+]])])
+
+
+# b4_basic_symbol_constructor_define(SYMBOL-NUM)
+# ----------------------------------------------
+# Generate a constructor for basic_symbol from given type.
+m4_define([b4_basic_symbol_constructor_define],
+[[#if 201103L <= YY_CPLUSPLUS
+      basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
+          b4_locations_if([location_type&& l]))[)
+        : Base (t)]b4_symbol_if([$1], [has_type], [
+        , value (std::move (v))])[]b4_locations_if([
+        , location (std::move (l))])[
+      {}
+#else
+      basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
+          b4_locations_if([const location_type& l]))[)
+        : Base (t)]b4_symbol_if([$1], [has_type], [
+        , value (v)])[]b4_locations_if([
+        , location (l)])[
+      {}
+#endif
+]])
+
+
+# b4_token_constructor_define
+# ---------------------------
+# Define the overloaded versions of make_FOO for all the token kinds.
+m4_define([b4_token_constructor_define],
+[    // Implementation of make_symbol for each token kind.
+b4_symbol_foreach([_b4_token_maker_define])])

+ 2209 - 0
Engine/bin/bison-flex/data/skeletons/yacc.c

@@ -0,0 +1,2209 @@
+#                                                            -*- C -*-
+# Yacc compatible skeleton for Bison
+
+# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
+# Foundation, Inc.
+
+m4_pushdef([b4_copyright_years],
+           [1984, 1989-1990, 2000-2015, 2018-2021])
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+m4_include(b4_skeletonsdir/[c.m4])
+
+
+## ---------- ##
+## api.pure.  ##
+## ---------- ##
+
+b4_percent_define_default([[api.pure]], [[false]])
+b4_percent_define_check_values([[[[api.pure]],
+                                 [[false]], [[true]], [[]], [[full]]]])
+
+m4_define([b4_pure_flag], [[0]])
+m4_case(b4_percent_define_get([[api.pure]]),
+        [false], [m4_define([b4_pure_flag], [[0]])],
+        [true],  [m4_define([b4_pure_flag], [[1]])],
+        [],      [m4_define([b4_pure_flag], [[1]])],
+        [full],  [m4_define([b4_pure_flag], [[2]])])
+
+m4_define([b4_pure_if],
+[m4_case(b4_pure_flag,
+         [0], [$2],
+         [1], [$1],
+         [2], [$1])])
+         [m4_fatal([invalid api.pure value: ]$1)])])
+
+## --------------- ##
+## api.push-pull.  ##
+## --------------- ##
+
+# b4_pull_if, b4_push_if
+# ----------------------
+# Whether the pull/push APIs are needed.  Both can be enabled.
+
+b4_percent_define_default([[api.push-pull]], [[pull]])
+b4_percent_define_check_values([[[[api.push-pull]],
+                                 [[pull]], [[push]], [[both]]]])
+b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
+b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
+m4_case(b4_percent_define_get([[api.push-pull]]),
+        [pull], [m4_define([b4_push_flag], [[0]])],
+        [push], [m4_define([b4_pull_flag], [[0]])])
+
+# Handle BISON_USE_PUSH_FOR_PULL for the test suite.  So that push parsing
+# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
+# behavior of Bison at all when push parsing is already requested.
+b4_define_flag_if([use_push_for_pull])
+b4_use_push_for_pull_if([
+  b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
+             [m4_define([b4_push_flag], [[1]])])])
+
+## ----------- ##
+## parse.lac.  ##
+## ----------- ##
+
+b4_percent_define_default([[parse.lac]], [[none]])
+b4_percent_define_default([[parse.lac.es-capacity-initial]], [[20]])
+b4_percent_define_default([[parse.lac.memory-trace]], [[failures]])
+b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]],
+                               [[[[parse.lac.memory-trace]],
+                                 [[failures]], [[full]]]])
+b4_define_flag_if([lac])
+m4_define([b4_lac_flag],
+          [m4_if(b4_percent_define_get([[parse.lac]]),
+                 [none], [[0]], [[1]])])
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# Stack parameters.
+m4_define_default([b4_stack_depth_max], [10000])
+m4_define_default([b4_stack_depth_init],  [200])
+
+
+# b4_yyerror_arg_loc_if(ARG)
+# --------------------------
+# Expand ARG iff yyerror is to be given a location as argument.
+m4_define([b4_yyerror_arg_loc_if],
+[b4_locations_if([m4_case(b4_pure_flag,
+                          [1], [m4_ifset([b4_parse_param], [$1])],
+                          [2], [$1])])])
+
+# b4_yyerror_formals
+# ------------------
+m4_define([b4_yyerror_formals],
+[b4_pure_if([b4_locations_if([, [[const ]b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])[]dnl
+m4_ifdef([b4_parse_param], [, b4_parse_param])[]dnl
+,])dnl
+[[const char *msg], [msg]]])
+
+
+
+# b4_yyerror_args
+# ---------------
+# Arguments passed to yyerror: user args plus yylloc.
+m4_define([b4_yyerror_args],
+[b4_yyerror_arg_loc_if([&yylloc, ])dnl
+m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
+
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_accept([SYMBOL-NUM])
+# -----------------------
+# Used in actions of the rules of accept, the initial symbol, to call
+# YYACCEPT.  If SYMBOL-NUM is specified, run "yyvalue->SLOT = $2;"
+# before, using the slot of SYMBOL-NUM.
+m4_define([b4_accept],
+[m4_ifval([$1],
+          [b4_symbol_value(yyimpl->yyvalue, [$1]) = b4_rhs_value(2, 1, [$1]); ]) YYACCEPT])
+
+
+# b4_lhs_value(SYMBOL-NUM, [TYPE])
+# --------------------------------
+# See README.
+m4_define([b4_lhs_value],
+[b4_symbol_value(yyval, [$1], [$2])])
+
+
+# b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
+# ----------------------------------------------------
+# See README.
+m4_define([b4_rhs_value],
+[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3], [$4])])
+
+
+## ----------- ##
+## Locations.  ##
+## ----------- ##
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
+m4_define([b4_lhs_location],
+[(yyloc)])
+
+
+# b4_rhs_location(RULE-LENGTH, POS)
+# ---------------------------------
+# Expansion of @POS, where the current rule has RULE-LENGTH symbols
+# on RHS.
+# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
+m4_define([b4_rhs_location],
+[(yylsp@{b4_subtract([$2], [$1])@})])
+
+
+## -------------- ##
+## Declarations.  ##
+## -------------- ##
+
+# _b4_declare_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
+# ---------------------------------------------------------------------
+# Define the return type of the parsing function for SYMBOL-NUM, and
+# declare its parsing function.
+m4_define([_b4_declare_sub_yyparse],
+[[
+// Return type when parsing one ]_b4_symbol($1, tag)[.
+typedef struct
+{]b4_symbol_if([$1], [has_type], [[
+  ]_b4_symbol($1, type)[ yyvalue;]])[
+  int yystatus;
+  int yynerrs;
+} ]b4_prefix[parse_]_b4_symbol($1, id)[_t;
+
+// Parse one ]_b4_symbol($1, tag)[.
+]b4_prefix[parse_]_b4_symbol($1, id)[_t ]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
+]])
+
+
+# _b4_first_switching_token
+# -------------------------
+m4_define([b4_first], [$1])
+m4_define([b4_second], [$2])
+m4_define([_b4_first_switching_token],
+[b4_second(b4_first(b4_start_symbols))])
+
+
+# _b4_define_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
+# --------------------------------------------------------------------
+# Define the parsing function for START-SYMBOL-NUM.
+m4_define([_b4_define_sub_yyparse],
+[[
+]b4_prefix[parse_]_b4_symbol($1, id)[_t
+]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
+{
+  ]b4_prefix[parse_]_b4_symbol($1, id)[_t yyres;
+  yy_parse_impl_t yyimpl;
+  yyres.yystatus = yy_parse_impl (]b4_symbol($2, id)[, &yyimpl]m4_ifset([b4_parse_param],
+                           [[, ]b4_args(b4_parse_param)])[);]b4_symbol_if([$1], [has_type], [[
+  yyres.yyvalue = yyimpl.yyvalue.]b4_symbol($1, slot)[;]])[
+  yyres.yynerrs = yyimpl.yynerrs;
+  return yyres;
+}
+]])
+
+
+# b4_declare_scanner_communication_variables
+# ------------------------------------------
+# Declare the variables that are global, or local to YYPARSE if
+# pure-parser.
+m4_define([b4_declare_scanner_communication_variables], [[
+]m4_ifdef([b4_start_symbols], [],
+[[/* Lookahead token kind.  */
+int yychar;
+]])[
+]b4_pure_if([[
+/* The semantic value of the lookahead symbol.  */
+/* Default value used for initialization, for pacifying older GCCs
+   or non-GCC compilers.  */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
+
+/* Location data for the lookahead symbol.  */
+static YYLTYPE yyloc_default]b4_yyloc_default[;
+YYLTYPE yylloc = yyloc_default;]])],
+[[/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;]b4_locations_if([[
+/* Location data for the lookahead symbol.  */
+YYLTYPE yylloc]b4_yyloc_default[;]])[
+/* Number of syntax errors so far.  */
+int yynerrs;]])])
+
+
+# b4_declare_parser_state_variables([INIT])
+# -----------------------------------------
+# Declare all the variables that are needed to maintain the parser state
+# between calls to yypush_parse.
+# If INIT is non-null, initialize these variables.
+m4_define([b4_declare_parser_state_variables],
+[b4_pure_if([[
+    /* Number of syntax errors so far.  */
+    int yynerrs]m4_ifval([$1], [ = 0])[;
+]])[
+    yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus]m4_ifval([$1], [ = 0])[;
+
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize]m4_ifval([$1], [ = YYINITDEPTH])[;
+
+    /* The state stack: array, bottom, top.  */
+    yy_state_t yyssa[YYINITDEPTH];
+    yy_state_t *yyss]m4_ifval([$1], [ = yyssa])[;
+    yy_state_t *yyssp]m4_ifval([$1], [ = yyss])[;
+
+    /* The semantic value stack: array, bottom, top.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs]m4_ifval([$1], [ = yyvsa])[;
+    YYSTYPE *yyvsp]m4_ifval([$1], [ = yyvs])[;]b4_locations_if([[
+
+    /* The location stack: array, bottom, top.  */
+    YYLTYPE yylsa[YYINITDEPTH];
+    YYLTYPE *yyls]m4_ifval([$1], [ = yylsa])[;
+    YYLTYPE *yylsp]m4_ifval([$1], [ = yyls])[;]])[]b4_lac_if([[
+
+    yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
+    yy_state_t *yyes]m4_ifval([$1], [ = yyesa])[;
+    YYPTRDIFF_T yyes_capacity][]m4_ifval([$1],
+            [m4_do([ = b4_percent_define_get([[parse.lac.es-capacity-initial]]) < YYMAXDEPTH],
+                   [ ? b4_percent_define_get([[parse.lac.es-capacity-initial]])],
+                   [ : YYMAXDEPTH])])[;]])])
+
+
+m4_define([b4_macro_define],
+[[#]define $1 $2])
+
+m4_define([b4_macro_undef],
+[[#]undef $1])
+
+m4_define([b4_pstate_macro_define],
+[b4_macro_define([$1], [yyps->$1])])
+
+# b4_parse_state_variable_macros(b4_macro_define|b4_macro_undef)
+# --------------------------------------------------------------
+m4_define([b4_parse_state_variable_macros],
+[b4_pure_if([$1([b4_prefix[]nerrs])])
+$1([yystate])
+$1([yyerrstatus])
+$1([yyssa])
+$1([yyss])
+$1([yyssp])
+$1([yyvsa])
+$1([yyvs])
+$1([yyvsp])[]b4_locations_if([
+$1([yylsa])
+$1([yyls])
+$1([yylsp])])
+$1([yystacksize])[]b4_lac_if([
+$1([yyesa])
+$1([yyes])
+$1([yyes_capacity])])])
+
+
+
+
+# _b4_declare_yyparse_push
+# ------------------------
+# Declaration of yyparse (and dependencies) when using the push parser
+# (including in pull mode).
+m4_define([_b4_declare_yyparse_push],
+[[#ifndef YYPUSH_MORE_DEFINED
+# define YYPUSH_MORE_DEFINED
+enum { YYPUSH_MORE = 4 };
+#endif
+
+typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
+
+]b4_pull_if([[
+int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);]])[
+int ]b4_prefix[push_parse (]b4_prefix[pstate *ps]b4_pure_if([[,
+                  int pushed_char, ]b4_api_PREFIX[STYPE const *pushed_val]b4_locations_if([[, ]b4_api_PREFIX[LTYPE *pushed_loc]])])b4_user_formals[);
+]b4_pull_if([[int ]b4_prefix[pull_parse (]b4_prefix[pstate *ps]b4_user_formals[);]])[
+]b4_prefix[pstate *]b4_prefix[pstate_new (void);
+void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps);
+]])
+
+
+# _b4_declare_yyparse
+# -------------------
+# When not the push parser.
+m4_define([_b4_declare_yyparse],
+[[int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
+]m4_ifdef([b4_start_symbols],
+          [m4_map([_b4_declare_sub_yyparse], m4_defn([b4_start_symbols]))])])
+
+
+# b4_declare_yyparse
+# ------------------
+m4_define([b4_declare_yyparse],
+[b4_push_if([_b4_declare_yyparse_push],
+            [_b4_declare_yyparse])[]dnl
+])
+
+
+# b4_declare_yyerror_and_yylex
+# ----------------------------
+# Comply with POSIX Yacc.
+# <https://austingroupbugs.net/view.php?id=1388#c5220>
+m4_define([b4_declare_yyerror_and_yylex],
+[b4_posix_if([[#if !defined ]b4_prefix[error && !defined ]b4_api_PREFIX[ERROR_IS_DECLARED
+]b4_function_declare([b4_prefix[error]], void, b4_yyerror_formals)[
+#endif
+#if !defined ]b4_prefix[lex && !defined ]b4_api_PREFIX[LEX_IS_DECLARED
+]b4_function_declare([b4_prefix[lex]], int, b4_yylex_formals)[
+#endif
+]])dnl
+])
+
+
+# b4_shared_declarations
+# ----------------------
+# Declarations that might either go into the header (if --header)
+# or into the implementation file.
+m4_define([b4_shared_declarations],
+[b4_cpp_guard_open([b4_spec_mapped_header_file])[
+]b4_declare_yydebug[
+]b4_percent_code_get([[requires]])[
+]b4_token_enums_defines[
+]b4_declare_yylstype[
+]b4_declare_yyerror_and_yylex[
+]b4_declare_yyparse[
+]b4_percent_code_get([[provides]])[
+]b4_cpp_guard_close([b4_spec_mapped_header_file])[]dnl
+])
+
+
+# b4_header_include_if(IF-TRUE, IF-FALSE)
+# ---------------------------------------
+# Run IF-TRUE if we generate an output file and api.header.include
+# is defined.
+m4_define([b4_header_include_if],
+[m4_ifval(m4_quote(b4_spec_header_file),
+          [b4_percent_define_ifdef([[api.header.include]],
+                                   [$1],
+                                   [$2])],
+          [$2])])
+
+m4_if(b4_spec_header_file, [y.tab.h], [],
+      [b4_percent_define_default([[api.header.include]],
+                                 [["@basename(]b4_spec_header_file[@)"]])])
+
+
+
+
+## -------------- ##
+## Output files.  ##
+## -------------- ##
+
+
+b4_header_if([[
+]b4_output_begin([b4_spec_header_file])[
+]b4_copyright([Bison interface for Yacc-like parsers in C])[
+]b4_disclaimer[
+]b4_shared_declarations[
+]b4_output_end[
+]])# b4_header_if
+
+b4_output_begin([b4_parser_file_name])[
+]b4_copyright([Bison implementation for Yacc-like parsers in C])[
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+]b4_disclaimer[
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+]b4_identification[
+]b4_percent_code_get([[top]])[]dnl
+m4_if(b4_api_prefix, [yy], [],
+[[/* Substitute the type names.  */
+#define YYSTYPE         ]b4_api_PREFIX[STYPE]b4_locations_if([[
+#define YYLTYPE         ]b4_api_PREFIX[LTYPE]])])[
+]m4_if(b4_prefix, [yy], [],
+[[/* Substitute the variable and function names.  */]b4_pull_if([[
+#define yyparse         ]b4_prefix[parse]])b4_push_if([[
+#define yypush_parse    ]b4_prefix[push_parse]b4_pull_if([[
+#define yypull_parse    ]b4_prefix[pull_parse]])[
+#define yypstate_new    ]b4_prefix[pstate_new
+#define yypstate_clear  ]b4_prefix[pstate_clear
+#define yypstate_delete ]b4_prefix[pstate_delete
+#define yypstate        ]b4_prefix[pstate]])[
+#define yylex           ]b4_prefix[lex
+#define yyerror         ]b4_prefix[error
+#define yydebug         ]b4_prefix[debug
+#define yynerrs         ]b4_prefix[nerrs]]b4_pure_if([], [[
+#define yylval          ]b4_prefix[lval
+#define yychar          ]b4_prefix[char]b4_locations_if([[
+#define yylloc          ]b4_prefix[lloc]])]))[
+
+]b4_user_pre_prologue[
+]b4_cast_define[
+]b4_null_define[
+
+]b4_header_include_if([[#include ]b4_percent_define_get([[api.header.include]])],
+                      [m4_ifval(m4_quote(b4_spec_header_file),
+                                [/* Use api.header.include to #include this header
+   instead of duplicating it here.  */
+])b4_shared_declarations])[
+]b4_declare_symbol_enum[
+
+]b4_user_post_prologue[
+]b4_percent_code_get[
+]b4_c99_int_type_define[
+
+]b4_sizes_types_define[
+
+/* Stored state numbers (used for stacks). */
+typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t;
+
+/* State numbers in computations.  */
+typedef int yy_state_fast_t;
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+]b4_has_translations_if([
+#ifndef N_
+# define N_(Msgid) Msgid
+#endif
+])[
+
+]b4_attribute_define[
+
+]b4_parse_assert_if([[#ifdef NDEBUG
+# define YY_ASSERT(E) ((void) (0 && (E)))
+#else
+# include <assert.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_ASSERT(E) assert (E)
+#endif
+]],
+[[#define YY_ASSERT(E) ((void) (0 && (E)))]])[
+
+#if ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */]dnl
+b4_push_if([], [b4_lac_if([], [[
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif]])])[
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif]b4_lac_if([[
+# define YYCOPY_NEEDED 1]])[
+#endif /* ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[ */
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
+             && ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yy_state_t yyss_alloc;
+  YYSTYPE yyvs_alloc;]b4_locations_if([
+  YYLTYPE yyls_alloc;])[
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+]b4_locations_if(
+[# define YYSTACK_BYTES(N) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
+             + YYSIZEOF (YYLTYPE)) \
+      + 2 * YYSTACK_GAP_MAXIMUM)],
+[# define YYSTACK_BYTES(N) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)])[
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYPTRDIFF_T yynewbytes;                                         \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
+      }                                                                 \
+    while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYPTRDIFF_T yyi;                      \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  ]b4_final_state_number[
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   ]b4_last[
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  ]b4_tokens_number[
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  ]b4_nterms_number[
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  ]b4_rules_number[
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  ]b4_states_number[
+
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   ]b4_code_max[
+
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+]b4_api_token_raw_if(dnl
+[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]],
+[[#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : ]b4_symbol_prefix[YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex.  */
+static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
+{
+  ]b4_translate[
+};]])[
+
+#if ]b4_api_PREFIX[DEBUG
+]b4_integral_parser_table_define([rline], [b4_rline],
+     [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
+#endif
+
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag], [[1]])[
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
+]b4_parse_error_bmatch([simple\|verbose],
+[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  ]b4_tname[
+};
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}]],
+[[static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  static const char *const yy_sname[] =
+  {
+  ]b4_symbol_names[
+  };]b4_has_translations_if([[
+  /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
+     internationalizable.  */
+  static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
+  {
+  ]b4_translatable[
+  };
+  return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
+          ? _(yy_sname[yysymbol])
+          : yy_sname[yysymbol]);]], [[
+  return yy_sname[yysymbol];]])[
+}]])[
+#endif
+
+#define YYPACT_NINF (]b4_pact_ninf[)
+
+#define yypact_value_is_default(Yyn) \
+  ]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
+
+#define YYTABLE_NINF (]b4_table_ninf[)
+
+#define yytable_value_is_error(Yyn) \
+  ]b4_table_value_equals([[table]], [[Yyn]], [b4_table_ninf], [YYTABLE_NINF])[
+
+]b4_parser_tables_define[
+
+enum { YYENOMEM = -2 };
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = ]b4_symbol(empty, id)[)
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+#define YYNOMEM         goto yyexhaustedlab
+
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == ]b4_symbol(empty, id)[)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \]b4_lac_if([[
+        YY_LAC_DISCARD ("YYBACKUP");                              \]])[
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
+
+/* Backward compatibility with an undocumented macro.
+   Use ]b4_symbol(error, id)[ or ]b4_symbol(undef, id)[. */
+#define YYERRCODE ]b4_symbol(undef, id)[
+]b4_locations_if([[
+]b4_yylloc_default_define[
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+]])[
+
+/* Enable debugging if requested.  */
+#if ]b4_api_PREFIX[DEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
+
+]b4_yylocation_print_define[
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Kind, Value]b4_locations_if([, Location])[]b4_user_args[); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+]b4_yy_symbol_print_define[
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,]b4_locations_if([[ YYLTYPE *yylsp,]])[
+                 int yyrule]b4_user_formals[)
+{
+  int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &]b4_rhs_value(yynrhs, yyi + 1)[]b4_locations_if([,
+                       &]b4_rhs_location(yynrhs, yyi + 1))[]b4_user_args[);
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !]b4_api_PREFIX[DEBUG */
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !]b4_api_PREFIX[DEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH ]b4_stack_depth_init[
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH ]b4_stack_depth_max[
+#endif]b4_push_if([[
+/* Parser data structure.  */
+struct yypstate
+  {]b4_declare_parser_state_variables[
+    /* Whether this instance has not started parsing yet.
+     * If 2, it corresponds to a finished parsing.  */
+    int yynew;
+  };]b4_pure_if([], [[
+
+/* Whether the only allowed instance of yypstate is allocated.  */
+static char yypstate_allocated = 0;]])])[
+]b4_lac_if([[
+
+/* Given a state stack such that *YYBOTTOM is its bottom, such that
+   *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
+   stack, and such that *YYCAPACITY is the maximum number of elements it
+   can hold without a reallocation, make sure there is enough room to
+   store YYADD more elements.  If not, allocate a new stack using
+   YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
+   *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
+   location.  If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
+   using YYSTACK_FREE.  Return 0 if successful or if no reallocation is
+   required.  Return YYENOMEM if memory is exhausted.  */
+static int
+yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
+#if ]b4_api_PREFIX[DEBUG
+                      char const *yydebug_prefix,
+                      char const *yydebug_suffix,
+#endif
+                      yy_state_t **yybottom,
+                      yy_state_t *yybottom_no_free,
+                      yy_state_t **yytop, yy_state_t *yytop_empty)
+{
+  YYPTRDIFF_T yysize_old =
+    *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
+  YYPTRDIFF_T yysize_new = yysize_old + yyadd;
+  if (*yycapacity < yysize_new)
+    {
+      YYPTRDIFF_T yyalloc = 2 * yysize_new;
+      yy_state_t *yybottom_new;
+      /* Use YYMAXDEPTH for maximum stack size given that the stack
+         should never need to grow larger than the main state stack
+         needs to grow without LAC.  */
+      if (YYMAXDEPTH < yysize_new)
+        {
+          YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix,
+                      yydebug_suffix));
+          return YYENOMEM;
+        }
+      if (YYMAXDEPTH < yyalloc)
+        yyalloc = YYMAXDEPTH;
+      yybottom_new =
+        YY_CAST (yy_state_t *,
+                 YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
+                                         yyalloc * YYSIZEOF (*yybottom_new))));
+      if (!yybottom_new)
+        {
+          YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
+                      yydebug_suffix));
+          return YYENOMEM;
+        }
+      if (*yytop != yytop_empty)
+        {
+          YYCOPY (yybottom_new, *yybottom, yysize_old);
+          *yytop = yybottom_new + (yysize_old - 1);
+        }
+      if (*yybottom != yybottom_no_free)
+        YYSTACK_FREE (*yybottom);
+      *yybottom = yybottom_new;
+      *yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
+                                   [full], [[
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
+                  YY_CAST (long, yyalloc), yydebug_suffix));
+      YY_IGNORE_USELESS_CAST_END]])[
+    }
+  return 0;
+}
+
+/* Establish the initial context for the current lookahead if no initial
+   context is currently established.
+
+   We define a context as a snapshot of the parser stacks.  We define
+   the initial context for a lookahead as the context in which the
+   parser initially examines that lookahead in order to select a
+   syntactic action.  Thus, if the lookahead eventually proves
+   syntactically unacceptable (possibly in a later context reached via a
+   series of reductions), the initial context can be used to determine
+   the exact set of tokens that would be syntactically acceptable in the
+   lookahead's place.  Moreover, it is the context after which any
+   further semantic actions would be erroneous because they would be
+   determined by a syntactically unacceptable token.
+
+   YY_LAC_ESTABLISH should be invoked when a reduction is about to be
+   performed in an inconsistent state (which, for the purposes of LAC,
+   includes consistent states that don't know they're consistent because
+   their default reductions have been disabled).  Iff there is a
+   lookahead token, it should also be invoked before reporting a syntax
+   error.  This latter case is for the sake of the debugging output.
+
+   For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
+   follows.  If no initial context is currently established for the
+   current lookahead, then check if that lookahead can eventually be
+   shifted if syntactic actions continue from the current context.
+   Report a syntax error if it cannot.  */
+#define YY_LAC_ESTABLISH                                                \
+do {                                                                    \
+  if (!yy_lac_established)                                              \
+    {                                                                   \
+      YYDPRINTF ((stderr,                                               \
+                  "LAC: initial context established for %s\n",          \
+                  yysymbol_name (yytoken)));                            \
+      yy_lac_established = 1;                                           \
+      switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken))    \
+        {                                                               \
+        case YYENOMEM:                                                  \
+          YYNOMEM;                                                      \
+        case 1:                                                         \
+          goto yyerrlab;                                                \
+        }                                                               \
+    }                                                                   \
+} while (0)
+
+/* Discard any previous initial lookahead context because of Event,
+   which may be a lookahead change or an invalidation of the currently
+   established initial context for the current lookahead.
+
+   The most common example of a lookahead change is a shift.  An example
+   of both cases is syntax error recovery.  That is, a syntax error
+   occurs when the lookahead is syntactically erroneous for the
+   currently established initial context, so error recovery manipulates
+   the parser stacks to try to find a new initial context in which the
+   current lookahead is syntactically acceptable.  If it fails to find
+   such a context, it discards the lookahead.  */
+#if ]b4_api_PREFIX[DEBUG
+# define YY_LAC_DISCARD(Event)                                           \
+do {                                                                     \
+  if (yy_lac_established)                                                \
+    {                                                                    \
+      YYDPRINTF ((stderr, "LAC: initial context discarded due to "       \
+                  Event "\n"));                                          \
+      yy_lac_established = 0;                                            \
+    }                                                                    \
+} while (0)
+#else
+# define YY_LAC_DISCARD(Event) yy_lac_established = 0
+#endif
+
+/* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
+   eventually (after perhaps some reductions) be shifted, return 1 if
+   not, or return YYENOMEM if memory is exhausted.  As preconditions and
+   postconditions: *YYES_CAPACITY is the allocated size of the array to
+   which *YYES points, and either *YYES = YYESA or *YYES points to an
+   array allocated with YYSTACK_ALLOC.  yy_lac may overwrite the
+   contents of either array, alter *YYES and *YYES_CAPACITY, and free
+   any old *YYES other than YYESA.  */
+static int
+yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
+        YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_kind_t yytoken)
+{
+  yy_state_t *yyes_prev = yyssp;
+  yy_state_t *yyesp = yyes_prev;
+  /* Reduce until we encounter a shift and thereby accept the token.  */
+  YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yysymbol_name (yytoken)));
+  if (yytoken == ]b4_symbol_prefix[YYUNDEF)
+    {
+      YYDPRINTF ((stderr, " Always Err\n"));
+      return 1;
+    }
+  while (1)
+    {
+      int yyrule = yypact[+*yyesp];
+      if (yypact_value_is_default (yyrule)
+          || (yyrule += yytoken) < 0 || YYLAST < yyrule
+          || yycheck[yyrule] != yytoken)
+        {
+          /* Use the default action.  */
+          yyrule = yydefact[+*yyesp];
+          if (yyrule == 0)
+            {
+              YYDPRINTF ((stderr, " Err\n"));
+              return 1;
+            }
+        }
+      else
+        {
+          /* Use the action from yytable.  */
+          yyrule = yytable[yyrule];
+          if (yytable_value_is_error (yyrule))
+            {
+              YYDPRINTF ((stderr, " Err\n"));
+              return 1;
+            }
+          if (0 < yyrule)
+            {
+              YYDPRINTF ((stderr, " S%d\n", yyrule));
+              return 0;
+            }
+          yyrule = -yyrule;
+        }
+      /* By now we know we have to simulate a reduce.  */
+      YYDPRINTF ((stderr, " R%d", yyrule - 1));
+      {
+        /* Pop the corresponding number of values from the stack.  */
+        YYPTRDIFF_T yylen = yyr2[yyrule];
+        /* First pop from the LAC stack as many tokens as possible.  */
+        if (yyesp != yyes_prev)
+          {
+            YYPTRDIFF_T yysize = yyesp - *yyes + 1;
+            if (yylen < yysize)
+              {
+                yyesp -= yylen;
+                yylen = 0;
+              }
+            else
+              {
+                yyesp = yyes_prev;
+                yylen -= yysize;
+              }
+          }
+        /* Only afterwards look at the main stack.  */
+        if (yylen)
+          yyesp = yyes_prev -= yylen;
+      }
+      /* Push the resulting state of the reduction.  */
+      {
+        yy_state_fast_t yystate;
+        {
+          const int yylhs = yyr1[yyrule] - YYNTOKENS;
+          const int yyi = yypgoto[yylhs] + *yyesp;
+          yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
+                     ? yytable[yyi]
+                     : yydefgoto[yylhs]);
+        }
+        if (yyesp == yyes_prev)
+          {
+            yyesp = *yyes;
+            YY_IGNORE_USELESS_CAST_BEGIN
+            *yyesp = YY_CAST (yy_state_t, yystate);
+            YY_IGNORE_USELESS_CAST_END
+          }
+        else
+          {
+            if (yy_lac_stack_realloc (yyes_capacity, 1,
+#if ]b4_api_PREFIX[DEBUG
+                                      " (", ")",
+#endif
+                                      yyes, yyesa, &yyesp, yyes_prev))
+              {
+                YYDPRINTF ((stderr, "\n"));
+                return YYENOMEM;
+              }
+            YY_IGNORE_USELESS_CAST_BEGIN
+            *++yyesp = YY_CAST (yy_state_t, yystate);
+            YY_IGNORE_USELESS_CAST_END
+          }
+        YYDPRINTF ((stderr, " G%d", yystate));
+      }
+    }
+}]])[
+
+]b4_parse_error_case([simple], [],
+[[/* Context of a parse error.  */
+typedef struct
+{]b4_push_if([[
+  yypstate* yyps;]], [[
+  yy_state_t *yyssp;]b4_lac_if([[
+  yy_state_t *yyesa;
+  yy_state_t **yyes;
+  YYPTRDIFF_T *yyes_capacity;]])])[
+  yysymbol_kind_t yytoken;]b4_locations_if([[
+  YYLTYPE *yylloc;]])[
+} yypcontext_t;
+
+/* Put in YYARG at most YYARGN of the expected tokens given the
+   current YYCTX, and return the number of tokens stored in YYARG.  If
+   YYARG is null, return the number of expected tokens (guaranteed to
+   be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
+   Return 0 if there are more than YYARGN expected tokens, yet fill
+   YYARG up to YYARGN. */]b4_push_if([[
+static int
+yypstate_expected_tokens (yypstate *yyps,
+                          yysymbol_kind_t yyarg[], int yyargn)]], [[
+static int
+yypcontext_expected_tokens (const yypcontext_t *yyctx,
+                            yysymbol_kind_t yyarg[], int yyargn)]])[
+{
+  /* Actual size of YYARG. */
+  int yycount = 0;
+]b4_lac_if([[
+  int yyx;
+  for (yyx = 0; yyx < YYNTOKENS; ++yyx)
+    {
+      yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
+      if (yysym != ]b4_symbol(error, kind)[ && yysym != ]b4_symbol_prefix[YYUNDEF)
+        switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yysym]],
+                                    [[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
+          {
+          case YYENOMEM:
+            return YYENOMEM;
+          case 1:
+            continue;
+          default:
+            if (!yyarg)
+              ++yycount;
+            else if (yycount == yyargn)
+              return 0;
+            else
+              yyarg[yycount++] = yysym;
+          }
+    }]],
+[[  int yyn = yypact@{+*]b4_push_if([yyps], [yyctx])[->yyssp@};
+  if (!yypact_value_is_default (yyn))
+    {
+      /* Start YYX at -YYN if negative to avoid negative indexes in
+         YYCHECK.  In other words, skip the first -YYN actions for
+         this state because they are default actions.  */
+      int yyxbegin = yyn < 0 ? -yyn : 0;
+      /* Stay within bounds of both yycheck and yytname.  */
+      int yychecklim = YYLAST - yyn + 1;
+      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+      int yyx;
+      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+        if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
+            && !yytable_value_is_error (yytable[yyx + yyn]))
+          {
+            if (!yyarg)
+              ++yycount;
+            else if (yycount == yyargn)
+              return 0;
+            else
+              yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
+          }
+    }]])[
+  if (yyarg && yycount == 0 && 0 < yyargn)
+    yyarg[0] = ]b4_symbol(empty, kind)[;
+  return yycount;
+}
+
+]b4_push_if([[
+/* Similar to the previous function.  */
+static int
+yypcontext_expected_tokens (const yypcontext_t *yyctx,
+                            yysymbol_kind_t yyarg[], int yyargn)
+{
+  return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
+}]])[
+]])[
+
+]b4_parse_error_bmatch(
+         [custom],
+[[/* The kind of the lookahead of this context.  */
+static yysymbol_kind_t
+yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
+
+static yysymbol_kind_t
+yypcontext_token (const yypcontext_t *yyctx)
+{
+  return yyctx->yytoken;
+}
+
+]b4_locations_if([[/* The location of the lookahead of this context.  */
+static YYLTYPE *
+yypcontext_location (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
+
+static YYLTYPE *
+yypcontext_location (const yypcontext_t *yyctx)
+{
+  return yyctx->yylloc;
+}]])[
+
+/* User defined function to report a syntax error.  */
+static int
+yyreport_syntax_error (const yypcontext_t *yyctx]b4_user_formals[);]],
+         [detailed\|verbose],
+[[#ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+#  define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
+# else
+/* Return the length of YYSTR.  */
+static YYPTRDIFF_T
+yystrlen (const char *yystr)
+{
+  YYPTRDIFF_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+# endif
+#endif
+
+#ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#  define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+# endif
+#endif
+
+]b4_parse_error_case(
+         [verbose],
+[[#ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYPTRDIFF_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYPTRDIFF_T yyn = 0;
+      char const *yyp = yystr;
+      for (;;)
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            else
+              goto append;
+
+          append:
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
+    do_not_strip_quotes: ;
+    }
+
+  if (yyres)
+    return yystpcpy (yyres, yystr) - yyres;
+  else
+    return yystrlen (yystr);
+}
+#endif
+]])[
+
+static int
+yy_syntax_error_arguments (const yypcontext_t *yyctx,
+                           yysymbol_kind_t yyarg[], int yyargn)
+{
+  /* Actual size of YYARG. */
+  int yycount = 0;
+  /* There are many possibilities here to consider:
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.]b4_lac_if([[
+       In the first two cases, it might appear that the current syntax
+       error should have been detected in the previous state when yy_lac
+       was invoked.  However, at that time, there might have been a
+       different syntax error that discarded a different initial context
+       during error recovery, leaving behind the current lookahead.]], [[
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.]])[
+  */
+  if (yyctx->yytoken != ]b4_symbol(empty, kind)[)
+    {
+      int yyn;]b4_lac_if([[
+      YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
+      if (yyarg)
+        yyarg[yycount] = yyctx->yytoken;
+      ++yycount;
+      yyn = yypcontext_expected_tokens (yyctx,
+                                        yyarg ? yyarg + 1 : yyarg, yyargn - 1);
+      if (yyn == YYENOMEM)
+        return YYENOMEM;]b4_lac_if([[
+      else if (yyn == 0)
+        YYDPRINTF ((stderr, "No expected tokens.\n"));]])[
+      else
+        yycount += yyn;
+    }
+  return yycount;
+}
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.]b4_lac_if([[  In order to see if a particular token T is a
+   valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).]])[
+
+   Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
+   required number of bytes is too large to store]b4_lac_if([[ or if
+   yy_lac returned YYENOMEM]])[.  */
+static int
+yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
+                const yypcontext_t *yyctx)
+{
+  enum { YYARGS_MAX = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* Arguments of yyformat: reported tokens (one for the "unexpected",
+     one per "expected"). */
+  yysymbol_kind_t yyarg[YYARGS_MAX];
+  /* Cumulated lengths of YYARG.  */
+  YYPTRDIFF_T yysize = 0;
+
+  /* Actual size of YYARG. */
+  int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
+  if (yycount == YYENOMEM)
+    return YYENOMEM;
+
+  switch (yycount)
+    {
+#define YYCASE_(N, S)                       \
+      case N:                               \
+        yyformat = S;                       \
+        break
+    default: /* Avoid compiler warnings. */
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+#undef YYCASE_
+    }
+
+  /* Compute error message size.  Don't count the "%s"s, but reserve
+     room for the terminator.  */
+  yysize = yystrlen (yyformat) - 2 * yycount + 1;
+  {
+    int yyi;
+    for (yyi = 0; yyi < yycount; ++yyi)
+      {
+        YYPTRDIFF_T yysize1
+          = yysize + ]b4_parse_error_case(
+                              [verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]],
+                              [[yystrlen (yysymbol_name (yyarg[yyi]))]]);[
+        if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+          yysize = yysize1;
+        else
+          return YYENOMEM;
+      }
+  }
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return -1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {]b4_parse_error_case([verbose], [[
+          yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);]], [[
+          yyp = yystpcpy (yyp, yysymbol_name (yyarg[yyi++]));]])[
+          yyformat += 2;
+        }
+      else
+        {
+          ++yyp;
+          ++yyformat;
+        }
+  }
+  return 0;
+}
+]])[
+
+]b4_yydestruct_define[
+
+]b4_pure_if([], [b4_declare_scanner_communication_variables])[
+
+]b4_push_if([b4_pull_if([[
+
+int
+yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
+{
+  yypstate *yyps = yypstate_new ();
+  if (!yyps)
+    {]b4_pure_if([b4_locations_if([[
+      static YYLTYPE yyloc_default][]b4_yyloc_default[;
+      YYLTYPE yylloc = yyloc_default;]])[
+      yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
+      if (!yypstate_allocated)
+        yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
+      return 2;
+    }
+  int yystatus = yypull_parse (yyps]b4_user_args[);
+  yypstate_delete (yyps);
+  return yystatus;
+}
+
+int
+yypull_parse (yypstate *yyps]b4_user_formals[)
+{
+  YY_ASSERT (yyps);]b4_pure_if([b4_locations_if([[
+  static YYLTYPE yyloc_default][]b4_yyloc_default[;
+  YYLTYPE yylloc = yyloc_default;]])])[
+  int yystatus;
+  do {
+]b4_pure_if([[    YYSTYPE yylval;
+    int ]])[yychar = ]b4_yylex[;
+    yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
+  } while (yystatus == YYPUSH_MORE);
+  return yystatus;
+}]])[
+
+]b4_parse_state_variable_macros([b4_pstate_macro_define])[
+
+/* Initialize the parser data structure.  */
+static void
+yypstate_clear (yypstate *yyps)
+{
+  yynerrs = 0;
+  yystate = 0;
+  yyerrstatus = 0;
+
+  yyssp = yyss;
+  yyvsp = yyvs;]b4_locations_if([[
+  yylsp = yyls;]])[
+
+  /* Initialize the state stack, in case yypcontext_expected_tokens is
+     called before the first call to yyparse. */
+  *yyssp = 0;
+  yyps->yynew = 1;
+}
+
+/* Initialize the parser data structure.  */
+yypstate *
+yypstate_new (void)
+{
+  yypstate *yyps;]b4_pure_if([], [[
+  if (yypstate_allocated)
+    return YY_NULLPTR;]])[
+  yyps = YY_CAST (yypstate *, YYMALLOC (sizeof *yyps));
+  if (!yyps)
+    return YY_NULLPTR;]b4_pure_if([], [[
+  yypstate_allocated = 1;]])[
+  yystacksize = YYINITDEPTH;
+  yyss = yyssa;
+  yyvs = yyvsa;]b4_locations_if([[
+  yyls = yylsa;]])[]b4_lac_if([[
+  yyes = yyesa;
+  yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
+  if (YYMAXDEPTH < yyes_capacity)
+    yyes_capacity = YYMAXDEPTH;]])[
+  yypstate_clear (yyps);
+  return yyps;
+}
+
+void
+yypstate_delete (yypstate *yyps)
+{
+  if (yyps)
+    {
+#ifndef yyoverflow
+      /* If the stack was reallocated but the parse did not complete, then the
+         stack still needs to be freed.  */
+      if (yyss != yyssa)
+        YYSTACK_FREE (yyss);
+#endif]b4_lac_if([[
+      if (yyes != yyesa)
+        YYSTACK_FREE (yyes);]])[
+      YYFREE (yyps);]b4_pure_if([], [[
+      yypstate_allocated = 0;]])[
+    }
+}
+]])[
+
+]b4_push_if([[
+/*---------------.
+| yypush_parse.  |
+`---------------*/
+
+int
+yypush_parse (yypstate *yyps]b4_pure_if([[,
+              int yypushed_char, YYSTYPE const *yypushed_val]b4_locations_if([[, YYLTYPE *yypushed_loc]])])b4_user_formals[)]],
+[[
+/*----------.
+| yyparse.  |
+`----------*/
+
+]m4_ifdef([b4_start_symbols],
+[[// Extract data from the parser.
+typedef struct
+{
+  YYSTYPE yyvalue;
+  int yynerrs;
+} yy_parse_impl_t;
+
+// Run a full parse, using YYCHAR as switching token.
+static int
+yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[);
+
+]m4_map([_b4_define_sub_yyparse], m4_defn([b4_start_symbols]))[
+
+int
+yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
+{
+  return yy_parse_impl (]b4_symbol(_b4_first_switching_token, id)[, YY_NULLPTR]m4_ifset([b4_parse_param],
+                                                    [[, ]b4_args(b4_parse_param)])[);
+}
+
+static int
+yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[)]],
+[[int
+yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])])[
+{]b4_pure_if([b4_declare_scanner_communication_variables
+])b4_push_if([b4_pure_if([], [[
+  int yypushed_char = yychar;
+  YYSTYPE yypushed_val = yylval;]b4_locations_if([[
+  YYLTYPE yypushed_loc = yylloc;]])
+])],
+  [b4_declare_parser_state_variables([init])
+])b4_lac_if([[
+  /* Whether LAC context is established.  A Boolean.  */
+  int yy_lac_established = 0;]])[
+  int yyn;
+  /* The return value of yyparse.  */
+  int yyresult;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = ]b4_symbol(empty, kind)[;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;]b4_locations_if([[
+  YYLTYPE yyloc;
+
+  /* The locations where the error started and ended.  */
+  YYLTYPE yyerror_range[3];]])[
+
+]b4_parse_error_bmatch([detailed\|verbose],
+[[  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;]])[
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;]b4_push_if([[
+
+  switch (yyps->yynew)
+    {
+    case 0:
+      yyn = yypact[yystate];
+      goto yyread_pushed_token;
+
+    case 2:
+      yypstate_clear (yyps);
+      break;
+
+    default:
+      break;
+    }]])[
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+]m4_ifdef([b4_start_symbols], [],
+[[  yychar = ]b4_symbol(empty, id)[; /* Cause a token to be read.  */
+]])[
+]m4_ifdef([b4_initial_action], [
+b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [],
+                  [b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
+b4_user_initial_action
+b4_dollar_popdef[]dnl
+m4_ifdef([b4_dollar_dollar_used],[[  yyvsp[0] = yylval;
+]])])dnl
+b4_locations_if([[  yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
+]])dnl
+[  goto yysetstate;
+
+
+/*------------------------------------------------------------.
+| yynewstate -- push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
+
+  if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    YYNOMEM;
+#else
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+
+# if defined yyoverflow
+      {
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        yy_state_t *yyss1 = yyss;
+        YYSTYPE *yyvs1 = yyvs;]b4_locations_if([
+        YYLTYPE *yyls1 = yyls;])[
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),]b4_locations_if([
+                    &yyls1, yysize * YYSIZEOF (*yylsp),])[
+                    &yystacksize);
+        yyss = yyss1;
+        yyvs = yyvs1;]b4_locations_if([
+        yyls = yyls1;])[
+      }
+# else /* defined YYSTACK_RELOCATE */
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        YYNOMEM;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yy_state_t *yyss1 = yyss;
+        union yyalloc *yyptr =
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+        if (! yyptr)
+          YYNOMEM;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
+        YYSTACK_RELOCATE (yyls_alloc, yyls);])[
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;]b4_locations_if([
+      yylsp = yyls + yysize - 1;])[
+
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
+    }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
+
+]m4_ifdef([b4_start_symbols], [], [[
+  if (yystate == YYFINAL)
+    YYACCEPT;]])[
+
+  goto yybackup;
+
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+  if (yychar == ]b4_symbol(empty, id)[)
+    {]b4_push_if([[
+      if (!yyps->yynew)
+        {]b4_use_push_for_pull_if([], [[
+          YYDPRINTF ((stderr, "Return for a new token:\n"));]])[
+          yyresult = YYPUSH_MORE;
+          goto yypushreturn;
+        }
+      yyps->yynew = 0;]b4_pure_if([], [[
+      /* Restoring the pushed token is only necessary for the first
+         yypush_parse invocation since subsequent invocations don't overwrite
+         it before jumping to yyread_pushed_token.  */
+      yychar = yypushed_char;
+      yylval = yypushed_val;]b4_locations_if([[
+      yylloc = yypushed_loc;]])])[
+yyread_pushed_token:]])[
+      YYDPRINTF ((stderr, "Reading a token\n"));]b4_push_if([b4_pure_if([[
+      yychar = yypushed_char;
+      if (yypushed_val)
+        yylval = *yypushed_val;]b4_locations_if([[
+      if (yypushed_loc)
+        yylloc = *yypushed_loc;]])])], [[
+      yychar = ]b4_yylex[;]])[
+    }
+
+  if (yychar <= ]b4_symbol(eof, [id])[)
+    {
+      yychar = ]b4_symbol(eof, [id])[;
+      yytoken = ]b4_symbol(eof, [kind])[;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else if (yychar == ]b4_symbol(error, [id])[)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = ]b4_symbol(undef, [id])[;
+      yytoken = ]b4_symbol(error, [kind])[;]b4_locations_if([[
+      yyerror_range[1] = yylloc;]])[
+      goto yyerrlab1;
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)]b4_lac_if([[
+    {
+      YY_LAC_ESTABLISH;
+      goto yydefault;
+    }]], [[
+    goto yydefault;]])[
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;]b4_lac_if([[
+      YY_LAC_ESTABLISH;]])[
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END]b4_locations_if([
+  *++yylsp = yylloc;])[
+
+  /* Discard the shifted token.  */
+  yychar = ]b4_symbol(empty, id)[;]b4_lac_if([[
+  YY_LAC_DISCARD ("shift");]])[
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     '$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+]b4_locations_if(
+[[  /* Default location. */
+  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+  yyerror_range[1] = yyloc;]])[
+  YY_REDUCE_PRINT (yyn);]b4_lac_if([[
+  {
+    int yychar_backup = yychar;
+    switch (yyn)
+      {
+]b4_user_actions[
+        default: break;
+      }
+    if (yychar_backup != yychar)
+      YY_LAC_DISCARD ("yychar change");
+  }]], [[
+  switch (yyn)
+    {
+]b4_user_actions[
+      default: break;
+    }]])[
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+
+  *++yyvsp = yyval;]b4_locations_if([
+  *++yylsp = yyloc;])[
+
+  /* Now 'shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+]b4_parse_error_case(
+         [custom],
+[[      {
+        yypcontext_t yyctx
+          = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
+        if (yychar != ]b4_symbol(empty, id)[)
+          YY_LAC_ESTABLISH;]])[
+        if (yyreport_syntax_error (&yyctx]m4_ifset([b4_parse_param],
+                                   [[, ]b4_args(b4_parse_param)])[) == 2)
+          YYNOMEM;
+      }]],
+         [simple],
+[[      yyerror (]b4_yyerror_args[YY_("syntax error"));]],
+[[      {
+        yypcontext_t yyctx
+          = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;]b4_lac_if([[
+        if (yychar != ]b4_symbol(empty, id)[)
+          YY_LAC_ESTABLISH;]])[
+        yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == -1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = YY_CAST (char *,
+                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
+            if (yymsg)
+              {
+                yysyntax_error_status
+                  = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
+                yymsgp = yymsg;
+              }
+            else
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = YYENOMEM;
+              }
+          }
+        yyerror (]b4_yyerror_args[yymsgp);
+        if (yysyntax_error_status == YYENOMEM)
+          YYNOMEM;
+      }]])[
+    }
+]b4_locations_if([[
+  yyerror_range[1] = yylloc;]])[
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
+
+      if (yychar <= ]b4_symbol(eof, [id])[)
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == ]b4_symbol(eof, [id])[)
+            YYABORT;
+        }
+      else
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
+          yychar = ]b4_symbol(empty, id)[;
+        }
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+  ++yynerrs;
+
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+
+  /* Pop stack until we find a state that shifts the error token.  */
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += ]b4_symbol(error, kind)[;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == ]b4_symbol(error, kind)[)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+        YYABORT;
+
+]b4_locations_if([[      yyerror_range[1] = *yylsp;]])[
+      yydestruct ("Error: popping",
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }]b4_lac_if([[
+
+  /* If the stack popping above didn't lose the initial context for the
+     current lookahead token, the shift below will for sure.  */
+  YY_LAC_DISCARD ("error recovery");]])[
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+]b4_locations_if([[
+  yyerror_range[2] = yylloc;
+  ++yylsp;
+  YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);]])[
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturnlab;
+
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturnlab;
+
+
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
+`-----------------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (]b4_yyerror_args[YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturnlab;
+
+
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return.  |
+`----------------------------------------------------------*/
+yyreturnlab:
+  if (yychar != ]b4_symbol(empty, id)[)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
+      YYPOPSTACK (1);
+    }]b4_push_if([[
+  yyps->yynew = 2;
+  goto yypushreturn;
+
+
+/*-------------------------.
+| yypushreturn -- return.  |
+`-------------------------*/
+yypushreturn:]], [[
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif]b4_lac_if([[
+  if (yyes != yyesa)
+    YYSTACK_FREE (yyes);]])])[
+]b4_parse_error_bmatch([detailed\|verbose],
+[[  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);]])[]m4_ifdef([b4_start_symbols], [[
+  if (yyimpl)
+    yyimpl->yynerrs = yynerrs;]])[
+  return yyresult;
+}
+]b4_push_if([b4_parse_state_variable_macros([b4_macro_undef])])[
+]b4_percent_code_get([[epilogue]])[]dnl
+b4_epilogue[]dnl
+b4_output_end

+ 105 - 0
Engine/bin/bison-flex/data/xslt/bison.xsl

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    bison.xsl - common templates for Bison XSLT.
+
+    Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+    This file is part of Bison, the GNU Compiler Compiler.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+  -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:bison="https://www.gnu.org/software/bison/">
+
+<xsl:key
+  name="bison:symbolByName"
+  match="/bison-xml-report/grammar/nonterminals/nonterminal"
+  use="@name"
+/>
+<xsl:key
+  name="bison:symbolByName"
+  match="/bison-xml-report/grammar/terminals/terminal"
+  use="@name"
+/>
+<xsl:key
+  name="bison:ruleByNumber"
+  match="/bison-xml-report/grammar/rules/rule"
+  use="@number"
+/>
+<xsl:key
+  name="bison:ruleByLhs"
+  match="/bison-xml-report/grammar/rules/rule[
+         @usefulness != 'useless-in-grammar']"
+  use="lhs"
+/>
+<xsl:key
+  name="bison:ruleByRhs"
+  match="/bison-xml-report/grammar/rules/rule[
+         @usefulness != 'useless-in-grammar']"
+  use="rhs/symbol"
+/>
+
+<!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
+<xsl:template match="state" mode="bison:count-conflicts">
+  <xsl:variable name="transitions" select="actions/transitions"/>
+  <xsl:variable name="reductions" select="actions/reductions"/>
+  <xsl:variable
+    name="terminals"
+    select="
+      $transitions/transition[@type='shift']/@symbol
+      | $reductions/reduction/@symbol
+    "
+  />
+  <xsl:variable name="conflict-data">
+    <xsl:for-each select="$terminals">
+      <xsl:variable name="name" select="."/>
+      <xsl:if test="generate-id($terminals[. = $name][1]) = generate-id(.)">
+        <xsl:variable
+          name="shift-count"
+          select="count($transitions/transition[@symbol=$name])"
+        />
+        <xsl:variable
+          name="reduce-count"
+          select="count($reductions/reduction[@symbol=$name])"
+        />
+        <xsl:if test="$shift-count > 0 and $reduce-count > 0">
+          <xsl:text>s</xsl:text>
+        </xsl:if>
+        <xsl:if test="$reduce-count > 1">
+          <xsl:text>r</xsl:text>
+        </xsl:if>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:variable>
+  <xsl:value-of select="string-length(translate($conflict-data, 'r', ''))"/>
+  <xsl:text>,</xsl:text>
+  <xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
+</xsl:template>
+
+<xsl:template name="space">
+  <xsl:param name="repeat">0</xsl:param>
+  <xsl:param name="fill" select="' '"/>
+  <xsl:if test="number($repeat) &gt;= 1">
+    <xsl:call-template name="space">
+      <xsl:with-param name="repeat" select="$repeat - 1"/>
+      <xsl:with-param name="fill" select="$fill"/>
+    </xsl:call-template>
+    <xsl:value-of select="$fill"/>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>

+ 401 - 0
Engine/bin/bison-flex/data/xslt/xml2dot.xsl

@@ -0,0 +1,401 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    xml2dot.xsl - transform Bison XML Report into DOT.
+
+    Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+    This file is part of Bison, the GNU Compiler Compiler.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+    Written by Wojciech Polak <[email protected]>.
+  -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:bison="https://www.gnu.org/software/bison/">
+
+<xsl:import href="bison.xsl"/>
+<xsl:output method="text" encoding="UTF-8" indent="no"/>
+
+<xsl:template match="/">
+  <xsl:apply-templates select="bison-xml-report"/>
+</xsl:template>
+
+<xsl:template match="bison-xml-report">
+  <xsl:text>// Generated by GNU Bison </xsl:text>
+  <xsl:value-of select="@version"/>
+  <xsl:text>.&#10;</xsl:text>
+  <xsl:text>// Report bugs to &lt;</xsl:text>
+  <xsl:value-of select="@bug-report"/>
+  <xsl:text>&gt;.&#10;</xsl:text>
+  <xsl:text>// Home page: &lt;</xsl:text>
+  <xsl:value-of select="@url"/>
+  <xsl:text>&gt;.&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="automaton">
+    <xsl:with-param name="filename" select="filename"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="automaton">
+  <xsl:param name="filename"/>
+  <xsl:text>digraph "</xsl:text>
+  <xsl:call-template name="escape">
+    <xsl:with-param name="subject" select="$filename"/>
+  </xsl:call-template>
+  <xsl:text>"&#10;{
+  node [fontname = courier, shape = box, colorscheme = paired6]
+  edge [fontname = courier]
+
+</xsl:text>
+  <xsl:apply-templates select="state"/>
+  <xsl:text>}&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="automaton/state">
+  <xsl:call-template name="output-node">
+    <xsl:with-param name="number" select="@number"/>
+    <xsl:with-param name="label">
+      <xsl:apply-templates select="itemset/item"/>
+    </xsl:with-param>
+  </xsl:call-template>
+  <xsl:apply-templates select="actions/transitions"/>
+  <xsl:apply-templates select="actions/reductions">
+    <xsl:with-param name="staten">
+      <xsl:value-of select="@number"/>
+    </xsl:with-param>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="actions/reductions">
+  <xsl:param name="staten"/>
+  <xsl:for-each select='reduction'>
+    <!-- These variables are needed because the current context can't be
+         referred to directly in XPath expressions. -->
+    <xsl:variable name="rul">
+      <xsl:value-of select="@rule"/>
+    </xsl:variable>
+    <xsl:variable name="ena">
+      <xsl:value-of select="@enabled"/>
+    </xsl:variable>
+    <!-- The foreach's body is protected by this, so that we are actually
+         going to iterate once per reduction rule, and not per lookahead. -->
+    <xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
+      <xsl:variable name="rule">
+        <xsl:choose>
+          <!-- The acceptation state is referred to as 'accept' in the XML, but
+               just as '0' in the DOT. -->
+          <xsl:when test="@rule='accept'">
+            <xsl:text>0</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@rule"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <!-- The edge's beginning -->
+      <xsl:call-template name="reduction-edge-start">
+        <xsl:with-param name="state" select="$staten"/>
+        <xsl:with-param name="rule" select="$rule"/>
+        <xsl:with-param name="enabled" select="@enabled"/>
+      </xsl:call-template>
+
+      <!-- The edge's tokens -->
+      <!-- Don't show labels for the default action. In other cases, there will
+           always be at least one token, so 'label="[]"' will not occur. -->
+      <xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
+        <xsl:text>label="[</xsl:text>
+        <xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
+          <xsl:call-template name="escape">
+            <xsl:with-param name="subject" select="@symbol"/>
+          </xsl:call-template>
+          <xsl:if test="position() != last ()">
+            <xsl:text>, </xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+        <xsl:text>]", </xsl:text>
+      </xsl:if>
+
+      <!-- The edge's end -->
+      <xsl:text>style=solid]&#10;</xsl:text>
+
+      <!-- The diamond representing the reduction -->
+      <xsl:call-template name="reduction-node">
+        <xsl:with-param name="state" select="$staten"/>
+        <xsl:with-param name="rule" select="$rule"/>
+        <xsl:with-param name="color">
+          <xsl:choose>
+            <xsl:when test='@enabled="true"'>
+              <xsl:text>3</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>5</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="actions/transitions">
+  <xsl:apply-templates select="transition"/>
+</xsl:template>
+
+<xsl:template match="item">
+  <xsl:param name="prev-rule-number"
+    select="preceding-sibling::item[1]/@rule-number"/>
+  <xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
+    <xsl:with-param name="dot" select="@dot"/>
+    <xsl:with-param name="num" select="@rule-number"/>
+    <xsl:with-param name="prev-lhs"
+      select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
+   />
+  </xsl:apply-templates>
+  <xsl:apply-templates select="lookaheads"/>
+</xsl:template>
+
+<xsl:template match="rule">
+  <xsl:param name="dot"/>
+  <xsl:param name="num"/>
+  <xsl:param name="prev-lhs"/>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:choose>
+    <xsl:when test="$num &lt; 10">
+      <xsl:text>  </xsl:text>
+    </xsl:when>
+    <xsl:when test="$num &lt; 100">
+      <xsl:text> </xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text></xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:value-of select="$num"/>
+  <xsl:text> </xsl:text>
+  <xsl:choose>
+  <xsl:when test="$prev-lhs = lhs[text()]">
+      <xsl:call-template name="lpad">
+        <xsl:with-param name="str" select="'|'"/>
+        <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="lhs"/>
+      <xsl:text>:</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:if test="$dot = 0">
+    <xsl:text> .</xsl:text>
+  </xsl:if>
+
+  <!-- RHS -->
+  <xsl:for-each select="rhs/symbol|rhs/empty">
+    <xsl:apply-templates select="."/>
+    <xsl:if test="$dot = position()">
+      <xsl:text> .</xsl:text>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="symbol">
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="empty">
+  <xsl:text> %empty</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads">
+  <xsl:text>  [</xsl:text>
+  <xsl:apply-templates select="symbol"/>
+  <xsl:text>]</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads/symbol">
+  <xsl:value-of select="."/>
+  <xsl:if test="position() != last()">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="reduction-edge-start">
+  <xsl:param name="state"/>
+  <xsl:param name="rule"/>
+  <xsl:param name="enabled"/>
+
+  <xsl:text>  </xsl:text>
+  <xsl:value-of select="$state"/>
+  <xsl:text> -> "</xsl:text>
+  <xsl:value-of select="$state"/>
+  <xsl:text>R</xsl:text>
+  <xsl:value-of select="$rule"/>
+  <xsl:if test='$enabled = "false"'>
+    <xsl:text>d</xsl:text>
+  </xsl:if>
+  <xsl:text>" [</xsl:text>
+</xsl:template>
+
+<xsl:template name="reduction-node">
+  <xsl:param name="state"/>
+  <xsl:param name="rule"/>
+  <xsl:param name="color"/>
+
+  <xsl:text> "</xsl:text>
+  <xsl:value-of select="$state"/>
+  <xsl:text>R</xsl:text>
+  <xsl:value-of select="$rule"/>
+  <xsl:if test="$color = 5">
+    <xsl:text>d</xsl:text>
+  </xsl:if>
+  <xsl:text>" [label="</xsl:text>
+  <xsl:choose>
+  <xsl:when test="$rule = 0">
+    <xsl:text>Acc", fillcolor=1</xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:text>R</xsl:text>
+    <xsl:value-of select="$rule"/>
+    <xsl:text>", fillcolor=</xsl:text>
+    <xsl:value-of select="$color"/>
+  </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text>, shape=diamond, style=filled]&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="transition">
+  <xsl:call-template name="output-edge">
+    <xsl:with-param name="src" select="../../../@number"/>
+    <xsl:with-param name="dst" select="@state"/>
+    <xsl:with-param name="style">
+      <xsl:choose>
+        <xsl:when test="@symbol = 'error'">
+          <xsl:text>dotted</xsl:text>
+        </xsl:when>
+        <xsl:when test="@type = 'shift'">
+          <xsl:text>solid</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>dashed</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:with-param>
+    <xsl:with-param name="label">
+      <xsl:if test="not(@symbol = 'error')">
+        <xsl:value-of select="@symbol"/>
+      </xsl:if>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="output-node">
+  <xsl:param name="number"/>
+  <xsl:param name="label"/>
+  <xsl:text>  </xsl:text>
+  <xsl:value-of select="$number"/>
+  <xsl:text> [label="</xsl:text>
+  <xsl:text>State </xsl:text>
+  <xsl:value-of select="$number"/>
+  <xsl:text>\n</xsl:text>
+  <xsl:call-template name="escape">
+    <xsl:with-param name="subject" select="$label"/>
+  </xsl:call-template>
+  <xsl:text>\l"]&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="output-edge">
+  <xsl:param name="src"/>
+  <xsl:param name="dst"/>
+  <xsl:param name="style"/>
+  <xsl:param name="label"/>
+  <xsl:text>  </xsl:text>
+  <xsl:value-of select="$src"/>
+  <xsl:text> -> </xsl:text>
+  <xsl:value-of select="$dst"/>
+  <xsl:text> [style=</xsl:text>
+  <xsl:value-of select="$style"/>
+  <xsl:if test="$label and $label != ''">
+    <xsl:text> label="</xsl:text>
+    <xsl:call-template name="escape">
+      <xsl:with-param name="subject" select="$label"/>
+    </xsl:call-template>
+    <xsl:text>"</xsl:text>
+  </xsl:if>
+  <xsl:text>]&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="escape">
+  <xsl:param name="subject"/> <!-- required -->
+  <xsl:call-template name="string-replace">
+    <xsl:with-param name="subject">
+      <xsl:call-template name="string-replace">
+        <xsl:with-param name="subject">
+          <xsl:call-template name="string-replace">
+            <xsl:with-param name="subject" select="$subject"/>
+            <xsl:with-param name="search" select="'\'"/>
+            <xsl:with-param name="replace" select="'\\'"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="search" select="'&quot;'"/>
+        <xsl:with-param name="replace" select="'\&quot;'"/>
+      </xsl:call-template>
+    </xsl:with-param>
+    <xsl:with-param name="search" select="'&#10;'"/>
+    <xsl:with-param name="replace" select="'\l'"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="string-replace">
+  <xsl:param name="subject"/>
+  <xsl:param name="search"/>
+  <xsl:param name="replace"/>
+  <xsl:choose>
+    <xsl:when test="contains($subject, $search)">
+      <xsl:variable name="before" select="substring-before($subject, $search)"/>
+      <xsl:variable name="after" select="substring-after($subject, $search)"/>
+      <xsl:value-of select="$before"/>
+      <xsl:value-of select="$replace"/>
+      <xsl:call-template name="string-replace">
+        <xsl:with-param name="subject" select="$after"/>
+        <xsl:with-param name="search" select="$search"/>
+        <xsl:with-param name="replace" select="$replace"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$subject"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="lpad">
+  <xsl:param name="str" select="''"/>
+  <xsl:param name="pad" select="0"/>
+  <xsl:variable name="diff" select="$pad - string-length($str)" />
+  <xsl:choose>
+    <xsl:when test="$diff &lt; 0">
+      <xsl:value-of select="$str"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="space">
+        <xsl:with-param name="repeat" select="$diff"/>
+      </xsl:call-template>
+      <xsl:value-of select="$str"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

+ 572 - 0
Engine/bin/bison-flex/data/xslt/xml2text.xsl

@@ -0,0 +1,572 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    xml2text.xsl - transform Bison XML Report into plain text.
+
+    Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+    This file is part of Bison, the GNU Compiler Compiler.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+    Written by Wojciech Polak <[email protected]>.
+  -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:bison="https://www.gnu.org/software/bison/">
+
+<xsl:import href="bison.xsl"/>
+<xsl:output method="text" encoding="UTF-8" indent="no"/>
+
+<xsl:template match="/">
+  <xsl:apply-templates select="bison-xml-report"/>
+</xsl:template>
+
+<xsl:template match="bison-xml-report">
+  <xsl:apply-templates select="grammar" mode="reductions"/>
+  <xsl:apply-templates select="grammar" mode="useless-in-parser"/>
+  <xsl:apply-templates select="automaton" mode="conflicts"/>
+  <xsl:apply-templates select="grammar"/>
+  <xsl:apply-templates select="automaton"/>
+</xsl:template>
+
+<xsl:template match="grammar" mode="reductions">
+  <xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/>
+  <xsl:apply-templates select="terminals" mode="unused-in-grammar"/>
+  <xsl:apply-templates select="rules" mode="useless-in-grammar"/>
+</xsl:template>
+
+<xsl:template match="nonterminals" mode="useless-in-grammar">
+  <xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
+    <xsl:text>Nonterminals useless in grammar&#10;&#10;</xsl:text>
+    <xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
+      <xsl:text>    </xsl:text>
+      <xsl:value-of select="@name"/>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="terminals" mode="unused-in-grammar">
+  <xsl:if test="terminal[@usefulness='unused-in-grammar']">
+    <xsl:text>Terminals unused in grammar&#10;&#10;</xsl:text>
+    <xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
+      <xsl:sort select="@symbol-number" data-type="number"/>
+      <xsl:text>    </xsl:text>
+      <xsl:value-of select="@name"/>
+      <xsl:text>&#10;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="rules" mode="useless-in-grammar">
+  <xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/>
+  <xsl:if test="$set">
+    <xsl:text>Rules useless in grammar&#10;</xsl:text>
+    <xsl:call-template name="style-rule-set">
+      <xsl:with-param name="rule-set" select="$set"/>
+    </xsl:call-template>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="grammar" mode="useless-in-parser">
+  <xsl:variable
+    name="set" select="rules/rule[@usefulness='useless-in-parser']"
+  />
+  <xsl:if test="$set">
+    <xsl:text>Rules useless in parser due to conflicts&#10;</xsl:text>
+    <xsl:call-template name="style-rule-set">
+      <xsl:with-param name="rule-set" select="$set"/>
+    </xsl:call-template>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="grammar">
+  <xsl:text>Grammar&#10;</xsl:text>
+  <xsl:call-template name="style-rule-set">
+    <xsl:with-param
+      name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
+    />
+  </xsl:call-template>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="terminals"/>
+  <xsl:apply-templates select="nonterminals"/>
+</xsl:template>
+
+<xsl:template name="style-rule-set">
+  <xsl:param name="rule-set"/>
+  <xsl:for-each select="$rule-set">
+    <xsl:apply-templates select=".">
+      <xsl:with-param name="pad" select="'3'"/>
+      <xsl:with-param name="prev-lhs">
+        <xsl:if test="position()>1">
+          <xsl:variable name="position" select="position()"/>
+          <xsl:value-of select="$rule-set[$position - 1]/lhs"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="grammar/terminals">
+  <xsl:text>Terminals, with rules where they appear&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="terminal"/>
+  <xsl:text>&#10;&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="grammar/nonterminals">
+  <xsl:text>Nonterminals, with rules where they appear&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="nonterminal[@usefulness!='useless-in-grammar']"/>
+</xsl:template>
+
+<xsl:template match="terminal">
+  <xsl:text>    </xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:call-template name="line-wrap">
+    <xsl:with-param name="first-line-length">
+      <xsl:choose>
+        <xsl:when test="string-length(@name) &gt; 66">0</xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="66 - string-length(@name)" />
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:with-param>
+    <xsl:with-param name="line-length" select="66" />
+    <xsl:with-param name="text">
+      <xsl:if test="string-length(@type) != 0">
+        <xsl:value-of select="concat(' &lt;', @type, '&gt;')"/>
+      </xsl:if>
+      <xsl:value-of select="concat(' (', @token-number, ')')"/>
+      <xsl:for-each select="key('bison:ruleByRhs', @name)">
+        <xsl:value-of select="concat(' ', @number)"/>
+      </xsl:for-each>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="nonterminal">
+  <xsl:text>    </xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:if test="string-length(@type) != 0">
+    <xsl:value-of select="concat(' &lt;', @type, '&gt;')"/>
+  </xsl:if>
+  <xsl:value-of select="concat(' (', @symbol-number, ')')"/>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:variable name="output">
+    <xsl:call-template name="line-wrap">
+      <xsl:with-param name="line-length" select="66" />
+      <xsl:with-param name="text">
+        <xsl:text>        </xsl:text>
+        <xsl:if test="key('bison:ruleByLhs', @name)">
+          <xsl:text>on@left:</xsl:text>
+          <xsl:for-each select="key('bison:ruleByLhs', @name)">
+            <xsl:value-of select="concat(' ', @number)"/>
+          </xsl:for-each>
+        </xsl:if>
+        <xsl:if test="key('bison:ruleByRhs', @name)">
+          <xsl:if test="key('bison:ruleByLhs', @name)">
+            <xsl:text>&#10;        </xsl:text>
+          </xsl:if>
+          <xsl:text>on@right:</xsl:text>
+          <xsl:for-each select="key('bison:ruleByRhs', @name)">
+            <xsl:value-of select="concat(' ', @number)"/>
+          </xsl:for-each>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:value-of select="translate($output, '@', ' ')" />
+</xsl:template>
+
+<xsl:template match="automaton" mode="conflicts">
+  <xsl:variable name="conflict-report">
+    <xsl:apply-templates select="state" mode="conflicts"/>
+  </xsl:variable>
+  <xsl:if test="string-length($conflict-report) != 0">
+    <xsl:value-of select="$conflict-report"/>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="state" mode="conflicts">
+  <xsl:variable name="conflict-counts">
+    <xsl:apply-templates select="." mode="bison:count-conflicts" />
+  </xsl:variable>
+  <xsl:variable
+    name="sr-count" select="substring-before($conflict-counts, ',')"
+  />
+  <xsl:variable
+    name="rr-count" select="substring-after($conflict-counts, ',')"
+  />
+  <xsl:if test="$sr-count > 0 or $rr-count > 0">
+    <xsl:value-of select="concat('State ', @number, ' conflicts:')"/>
+    <xsl:if test="$sr-count > 0">
+      <xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
+      <xsl:if test="$rr-count > 0">
+        <xsl:value-of select="(',')"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$rr-count > 0">
+      <xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
+    </xsl:if>
+    <xsl:value-of select="'&#10;'"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="automaton">
+  <xsl:apply-templates select="state">
+    <xsl:with-param name="pad" select="'3'"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="automaton/state">
+  <xsl:param name="pad"/>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:text>State </xsl:text>
+  <xsl:value-of select="@number"/>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="itemset/item">
+    <xsl:with-param name="pad" select="$pad"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates select="actions/transitions">
+    <xsl:with-param name="type" select="'shift'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates select="actions/errors"/>
+  <xsl:apply-templates select="actions/reductions"/>
+  <xsl:apply-templates select="actions/transitions">
+    <xsl:with-param name="type" select="'goto'"/>
+  </xsl:apply-templates>
+  <xsl:apply-templates select="solved-conflicts"/>
+</xsl:template>
+
+<xsl:template match="actions/transitions">
+  <xsl:param name="type"/>
+  <xsl:if test="transition[@type = $type]">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="transition[@type = $type]">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="transition[@type = $type]"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="actions/errors">
+  <xsl:if test="error">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="error">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="error"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="actions/reductions">
+  <xsl:if test="reduction">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="reduction">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="reduction"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="item">
+  <xsl:param name="pad"/>
+  <xsl:param name="prev-rule-number"
+             select="preceding-sibling::item[1]/@rule-number"/>
+  <xsl:apply-templates
+    select="key('bison:ruleByNumber', current()/@rule-number)"
+  >
+    <xsl:with-param name="itemset" select="'true'"/>
+    <xsl:with-param name="pad" select="$pad"/>
+    <xsl:with-param
+      name="prev-lhs"
+      select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
+   />
+    <xsl:with-param name="dot" select="@dot"/>
+    <xsl:with-param name="lookaheads">
+      <xsl:apply-templates select="lookaheads"/>
+    </xsl:with-param>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="rule">
+  <xsl:param name="itemset"/>
+  <xsl:param name="pad"/>
+  <xsl:param name="prev-lhs"/>
+  <xsl:param name="dot"/>
+  <xsl:param name="lookaheads"/>
+
+  <xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
+    <xsl:text>&#10;</xsl:text>
+  </xsl:if>
+
+  <xsl:text>  </xsl:text>
+  <xsl:call-template name="lpad">
+    <xsl:with-param name="str" select="string(@number)"/>
+    <xsl:with-param name="pad" select="number($pad)"/>
+  </xsl:call-template>
+  <xsl:text> </xsl:text>
+
+  <!-- LHS -->
+  <xsl:choose>
+    <xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
+      <xsl:call-template name="lpad">
+        <xsl:with-param name="str" select="'|'"/>
+        <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
+      <xsl:call-template name="lpad">
+        <xsl:with-param name="str" select="'|'"/>
+        <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="lhs"/>
+      <xsl:text>:</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <!-- RHS -->
+  <xsl:for-each select="rhs/*">
+    <xsl:if test="position() = $dot + 1">
+      <xsl:text> •</xsl:text>
+    </xsl:if>
+    <xsl:apply-templates select="."/>
+    <xsl:if test="position() = last() and position() = $dot">
+      <xsl:text> •</xsl:text>
+    </xsl:if>
+  </xsl:for-each>
+  <xsl:if test="$lookaheads">
+    <xsl:value-of select="$lookaheads"/>
+  </xsl:if>
+
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="symbol">
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="empty">
+  <xsl:text> %empty</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads">
+  <xsl:text>  [</xsl:text>
+  <xsl:apply-templates select="symbol"/>
+  <xsl:text>]</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads/symbol">
+  <xsl:value-of select="."/>
+  <xsl:if test="position() != last()">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="transition">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:choose>
+    <xsl:when test="@type = 'shift'">
+      <xsl:text>shift, and go to state </xsl:text>
+      <xsl:value-of select="@state"/>
+    </xsl:when>
+    <xsl:when test="@type = 'goto'">
+      <xsl:text>go to state </xsl:text>
+      <xsl:value-of select="@state"/>
+    </xsl:when>
+  </xsl:choose>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="error">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:text>error</xsl:text>
+  <xsl:text> (</xsl:text>
+  <xsl:value-of select="text()"/>
+  <xsl:text>)</xsl:text>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="reduction">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:if test="@enabled = 'false'">
+    <xsl:text>[</xsl:text>
+  </xsl:if>
+  <xsl:choose>
+    <xsl:when test="@rule = 'accept'">
+      <xsl:text>accept</xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>reduce using rule </xsl:text>
+      <xsl:value-of select="@rule"/>
+      <xsl:text> (</xsl:text>
+      <xsl:value-of
+          select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
+      <xsl:text>)</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:if test="@enabled = 'false'">
+    <xsl:text>]</xsl:text>
+  </xsl:if>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="solved-conflicts">
+  <xsl:if test="resolution">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="resolution"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="resolution">
+  <xsl:text>    Conflict between rule </xsl:text>
+  <xsl:value-of select="@rule"/>
+  <xsl:text> and token </xsl:text>
+  <xsl:value-of select="@symbol"/>
+  <xsl:text> resolved as </xsl:text>
+  <xsl:if test="@type = 'error'">
+    <xsl:text>an </xsl:text>
+  </xsl:if>
+  <xsl:value-of select="@type"/>
+  <xsl:text> (</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>).&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="max-width-symbol">
+  <xsl:param name="node"/>
+  <xsl:variable name="longest">
+    <xsl:for-each select="$node">
+      <xsl:sort data-type="number" select="string-length(@symbol)"
+                order="descending"/>
+      <xsl:if test="position() = 1">
+        <xsl:value-of select="string-length(@symbol)"/>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:variable>
+  <xsl:value-of select="$longest"/>
+</xsl:template>
+
+<xsl:template name="lpad">
+  <xsl:param name="str" select="''"/>
+  <xsl:param name="pad" select="0"/>
+  <xsl:variable name="diff" select="$pad - string-length($str)" />
+  <xsl:choose>
+    <xsl:when test="$diff &lt; 0">
+      <xsl:value-of select="$str"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="space">
+        <xsl:with-param name="repeat" select="$diff"/>
+      </xsl:call-template>
+      <xsl:value-of select="$str"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="rpad">
+  <xsl:param name="str" select="''"/>
+  <xsl:param name="pad" select="0"/>
+  <xsl:variable name="diff" select="$pad - string-length($str)"/>
+  <xsl:choose>
+    <xsl:when test="$diff &lt; 0">
+      <xsl:value-of select="$str"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$str"/>
+      <xsl:call-template name="space">
+        <xsl:with-param name="repeat" select="$diff"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="line-wrap">
+  <xsl:param name="line-length"/> <!-- required -->
+  <xsl:param name="first-line-length" select="$line-length"/>
+  <xsl:param name="text"/> <!-- required -->
+  <xsl:choose>
+    <xsl:when test="normalize-space($text) = ''" />
+    <xsl:when test="string-length($text) &lt;= $first-line-length">
+      <xsl:value-of select="concat($text, '&#10;')" />
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="break-pos">
+        <xsl:call-template name="ws-search">
+          <xsl:with-param name="text" select="$text" />
+          <xsl:with-param name="start" select="$first-line-length+1" />
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="substring($text, 1, $break-pos - 1)" />
+      <xsl:text>&#10;</xsl:text>
+      <xsl:call-template name="line-wrap">
+        <xsl:with-param name="line-length" select="$line-length" />
+        <xsl:with-param
+          name="text" select="concat('    ', substring($text, $break-pos+1))"
+        />
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="ws-search">
+  <xsl:param name="text"/> <!-- required -->
+  <xsl:param name="start"/> <!-- required -->
+  <xsl:variable name="search-text" select="substring($text, $start)" />
+  <xsl:choose>
+    <xsl:when test="not(contains($search-text, ' '))">
+      <xsl:value-of select="string-length($text)+1" />
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of
+        select="$start + string-length(substring-before($search-text, ' '))"
+      />
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

+ 765 - 0
Engine/bin/bison-flex/data/xslt/xml2xhtml.xsl

@@ -0,0 +1,765 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    xml2html.xsl - transform Bison XML Report into XHTML.
+
+    Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
+
+    This file is part of Bison, the GNU Compiler Compiler.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+    Written by Wojciech Polak <[email protected]>.
+  -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:bison="https://www.gnu.org/software/bison/">
+
+<xsl:import href="bison.xsl"/>
+
+<xsl:output method="xml" encoding="UTF-8"
+            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+            indent="yes"/>
+
+<xsl:template match="/">
+  <html>
+    <head>
+      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+      <title>
+        <xsl:value-of select="bison-xml-report/filename"/>
+        <xsl:text> - GNU Bison XML Automaton Report</xsl:text>
+      </title>
+      <style type="text/css"><![CDATA[
+      body {
+        font-family: "Nimbus Sans L", Arial, sans-serif;
+        font-size: 9pt;
+      }
+      a:link {
+        color: #1f00ff;
+        text-decoration: none;
+      }
+      a:visited {
+        color: #1f00ff;
+        text-decoration: none;
+      }
+      a:hover {
+        color: red;
+      }
+      #menu a {
+        text-decoration: underline;
+      }
+      .i {
+        font-style: italic;
+      }
+      .pre {
+        font-family: monospace;
+        white-space: pre;
+      }
+      ol.decimal {
+        list-style-type: decimal;
+      }
+      ol.lower-alpha {
+        list-style-type: lower-alpha;
+      }
+      .dot {
+        color: #cc0000;
+      }
+      #footer {
+        margin-top: 3.5em;
+        font-size: 7pt;
+      }
+      ]]></style>
+    </head>
+    <body>
+      <xsl:apply-templates select="bison-xml-report"/>
+      <xsl:text>&#10;&#10;</xsl:text>
+      <div id="footer"><hr />This document was generated using
+      <a href="https://www.gnu.org/software/bison/" title="GNU Bison">
+      GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
+      XML Automaton Report.<br />
+      <!-- default copying notice -->
+      Verbatim copying and distribution of this entire page is
+      permitted in any medium, provided this notice is preserved.</div>
+    </body>
+  </html>
+</xsl:template>
+
+<xsl:template match="bison-xml-report">
+  <h1>GNU Bison XML Automaton Report</h1>
+  <p>
+    input grammar: <span class="i"><xsl:value-of select="filename"/></span>
+  </p>
+
+  <xsl:text>&#10;&#10;</xsl:text>
+  <h3>Table of Contents</h3>
+  <ul id="menu">
+    <li>
+      <a href="#reductions">Reductions</a>
+      <ul class="lower-alpha">
+        <li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
+        <li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
+        <li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
+        <xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
+          <li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
+        </xsl:if>
+      </ul>
+    </li>
+    <li><a href="#conflicts">Conflicts</a></li>
+    <li>
+      <a href="#grammar">Grammar</a>
+      <ul class="lower-alpha">
+        <li><a href="#grammar">Itemset</a></li>
+        <li><a href="#terminals">Terminal symbols</a></li>
+        <li><a href="#nonterminals">Nonterminal symbols</a></li>
+      </ul>
+    </li>
+    <li><a href="#automaton">Automaton</a></li>
+  </ul>
+  <xsl:apply-templates select="grammar" mode="reductions"/>
+  <xsl:apply-templates select="grammar" mode="useless-in-parser"/>
+  <xsl:apply-templates select="automaton" mode="conflicts"/>
+  <xsl:apply-templates select="grammar"/>
+  <xsl:apply-templates select="automaton"/>
+</xsl:template>
+
+<xsl:template match="grammar" mode="reductions">
+  <h2>
+    <a name="reductions"/>
+    <xsl:text> Reductions</xsl:text>
+  </h2>
+  <xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/>
+  <xsl:apply-templates select="terminals" mode="unused-in-grammar"/>
+  <xsl:apply-templates select="rules" mode="useless-in-grammar"/>
+</xsl:template>
+
+<xsl:template match="nonterminals" mode="useless-in-grammar">
+  <h3>
+    <a name="nonterminals_useless_in_grammar"/>
+    <xsl:text> Nonterminals useless in grammar</xsl:text>
+  </h3>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
+    <p class="pre">
+      <xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
+        <xsl:text>   </xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:for-each>
+      <xsl:text>&#10;&#10;</xsl:text>
+    </p>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="terminals" mode="unused-in-grammar">
+  <h3>
+    <a name="terminals_unused_in_grammar"/>
+    <xsl:text> Terminals unused in grammar</xsl:text>
+  </h3>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:if test="terminal[@usefulness='unused-in-grammar']">
+    <p class="pre">
+      <xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
+        <xsl:sort select="@symbol-number" data-type="number"/>
+        <xsl:text>   </xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:for-each>
+      <xsl:text>&#10;&#10;</xsl:text>
+    </p>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="rules" mode="useless-in-grammar">
+  <h3>
+    <a name="rules_useless_in_grammar"/>
+    <xsl:text> Rules useless in grammar</xsl:text>
+  </h3>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/>
+  <xsl:if test="$set">
+    <p class="pre">
+      <xsl:call-template name="style-rule-set">
+        <xsl:with-param name="rule-set" select="$set"/>
+      </xsl:call-template>
+      <xsl:text>&#10;&#10;</xsl:text>
+    </p>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="grammar" mode="useless-in-parser">
+  <xsl:variable
+    name="set" select="rules/rule[@usefulness='useless-in-parser']"
+  />
+  <xsl:if test="$set">
+    <h2>
+      <a name="rules_useless_in_parser"/>
+      <xsl:text> Rules useless in parser due to conflicts</xsl:text>
+    </h2>
+    <xsl:text>&#10;</xsl:text>
+    <p class="pre">
+      <xsl:call-template name="style-rule-set">
+        <xsl:with-param name="rule-set" select="$set"/>
+      </xsl:call-template>
+    </p>
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="grammar">
+  <h2>
+    <a name="grammar"/>
+    <xsl:text> Grammar</xsl:text>
+  </h2>
+  <xsl:text>&#10;</xsl:text>
+  <p class="pre">
+    <xsl:call-template name="style-rule-set">
+      <xsl:with-param name="anchor" select="'true'" />
+      <xsl:with-param
+        name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
+      />
+    </xsl:call-template>
+  </p>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:apply-templates select="terminals"/>
+  <xsl:apply-templates select="nonterminals"/>
+</xsl:template>
+
+<xsl:template name="style-rule-set">
+  <xsl:param name="anchor"/>
+  <xsl:param name="rule-set"/>
+  <xsl:for-each select="$rule-set">
+    <xsl:apply-templates select=".">
+      <xsl:with-param name="anchor" select="$anchor"/>
+      <xsl:with-param name="pad" select="'3'"/>
+      <xsl:with-param name="prev-lhs">
+        <xsl:if test="position()>1">
+          <xsl:variable name="position" select="position()"/>
+          <xsl:value-of select="$rule-set[$position - 1]/lhs"/>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="automaton" mode="conflicts">
+  <h2>
+    <a name="conflicts"/>
+    <xsl:text> Conflicts</xsl:text>
+  </h2>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <xsl:variable name="conflict-report">
+    <xsl:apply-templates select="state" mode="conflicts"/>
+  </xsl:variable>
+  <xsl:if test="string-length($conflict-report) != 0">
+    <p class="pre">
+      <xsl:copy-of select="$conflict-report"/>
+      <xsl:text>&#10;&#10;</xsl:text>
+    </p>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="state" mode="conflicts">
+  <xsl:variable name="conflict-counts">
+    <xsl:apply-templates select="." mode="bison:count-conflicts" />
+  </xsl:variable>
+  <xsl:variable
+    name="sr-count" select="substring-before($conflict-counts, ',')"
+  />
+  <xsl:variable
+    name="rr-count" select="substring-after($conflict-counts, ',')"
+  />
+  <xsl:if test="$sr-count > 0 or $rr-count > 0">
+    <a>
+      <xsl:attribute name="href">
+        <xsl:value-of select="concat('#state_', @number)"/>
+      </xsl:attribute>
+      <xsl:value-of select="concat('State ', @number)"/>
+    </a>
+    <xsl:text> conflicts:</xsl:text>
+    <xsl:if test="$sr-count > 0">
+      <xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
+      <xsl:if test="$rr-count > 0">
+        <xsl:value-of select="(',')"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$rr-count > 0">
+      <xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
+    </xsl:if>
+    <xsl:value-of select="'&#10;'"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="grammar/terminals">
+  <h3>
+    <a name="terminals"/>
+    <xsl:text> Terminals, with rules where they appear</xsl:text>
+  </h3>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <ul>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="terminal"/>
+  </ul>
+  <xsl:text>&#10;&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="grammar/nonterminals">
+  <h3>
+    <a name="nonterminals"/>
+    <xsl:text> Nonterminals, with rules where they appear</xsl:text>
+  </h3>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <ul>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates
+      select="nonterminal[@usefulness!='useless-in-grammar']"
+    />
+  </ul>
+</xsl:template>
+
+<xsl:template match="terminal">
+  <xsl:text>  </xsl:text>
+  <li>
+    <b><xsl:value-of select="@name"/></b>
+    <xsl:if test="string-length(@type) != 0">
+      <xsl:value-of select="concat(' &lt;', @type, '&gt;')"/>
+    </xsl:if>
+    <xsl:value-of select="concat(' (', @token-number, ')')"/>
+    <xsl:for-each select="key('bison:ruleByRhs', @name)">
+      <xsl:apply-templates select="." mode="number-link"/>
+    </xsl:for-each>
+  </li>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="nonterminal">
+  <xsl:text>  </xsl:text>
+  <li>
+    <b><xsl:value-of select="@name"/></b>
+    <xsl:if test="string-length(@type) != 0">
+      <xsl:value-of select="concat(' &lt;', @type, '&gt;')"/>
+    </xsl:if>
+    <xsl:value-of select="concat(' (', @symbol-number, ')')"/>
+    <xsl:text>&#10;    </xsl:text>
+    <ul>
+      <xsl:text>&#10;</xsl:text>
+      <xsl:if test="key('bison:ruleByLhs', @name)">
+        <xsl:text>      </xsl:text>
+        <li>
+          <xsl:text>on left:</xsl:text>
+          <xsl:for-each select="key('bison:ruleByLhs', @name)">
+            <xsl:apply-templates select="." mode="number-link"/>
+          </xsl:for-each>
+        </li>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+      <xsl:if test="key('bison:ruleByRhs', @name)">
+        <xsl:text>      </xsl:text>
+        <li>
+          <xsl:text>on right:</xsl:text>
+          <xsl:for-each select="key('bison:ruleByRhs', @name)">
+            <xsl:apply-templates select="." mode="number-link"/>
+          </xsl:for-each>
+        </li>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+    <xsl:text>    </xsl:text>
+    </ul>
+    <xsl:text>&#10;  </xsl:text>
+  </li>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="rule" mode="number-link">
+  <xsl:text> </xsl:text>
+  <a>
+    <xsl:attribute name="href">
+      <xsl:value-of select="concat('#rule_', @number)"/>
+    </xsl:attribute>
+    <xsl:value-of select="@number"/>
+  </a>
+</xsl:template>
+
+<xsl:template match="automaton">
+  <h2>
+    <a name="automaton"/>
+    <xsl:text> Automaton</xsl:text>
+  </h2>
+  <xsl:apply-templates select="state">
+    <xsl:with-param name="pad" select="'3'"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="automaton/state">
+  <xsl:param name="pad"/>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <h3>
+    <a>
+      <xsl:attribute name="name">
+        <xsl:value-of select="concat('state_', @number)"/>
+      </xsl:attribute>
+    </a>
+    <xsl:text>State </xsl:text>
+    <xsl:value-of select="@number"/>
+  </h3>
+  <xsl:text>&#10;&#10;</xsl:text>
+  <p class="pre">
+    <xsl:apply-templates select="itemset/item">
+      <xsl:with-param name="pad" select="$pad"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="actions/transitions">
+      <xsl:with-param name="type" select="'shift'"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="actions/errors"/>
+    <xsl:apply-templates select="actions/reductions"/>
+    <xsl:apply-templates select="actions/transitions">
+      <xsl:with-param name="type" select="'goto'"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="solved-conflicts"/>
+  </p>
+</xsl:template>
+
+<xsl:template match="actions/transitions">
+  <xsl:param name="type"/>
+  <xsl:if test="transition[@type = $type]">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="transition[@type = $type]">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="transition[@type = $type]"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="actions/errors">
+  <xsl:if test="error">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="error">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="error"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="actions/reductions">
+  <xsl:if test="reduction">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="reduction">
+      <xsl:with-param name="pad">
+        <xsl:call-template name="max-width-symbol">
+          <xsl:with-param name="node" select="reduction"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="item">
+  <xsl:param name="pad"/>
+  <xsl:param name="prev-rule-number"
+             select="preceding-sibling::item[1]/@rule-number"/>
+  <xsl:apply-templates
+    select="key('bison:ruleByNumber', current()/@rule-number)"
+  >
+    <xsl:with-param name="itemset" select="'true'"/>
+    <xsl:with-param name="pad" select="$pad"/>
+    <xsl:with-param name="prev-lhs"
+      select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
+   />
+    <xsl:with-param name="dot" select="@dot"/>
+    <xsl:with-param name="lookaheads">
+      <xsl:apply-templates select="lookaheads"/>
+    </xsl:with-param>
+  </xsl:apply-templates>
+</xsl:template>
+
+<!--
+anchor = 'true': define as an <a> anchor.
+itemset = 'true': show the items.
+ -->
+<xsl:template match="rule">
+  <xsl:param name="anchor"/>
+  <xsl:param name="itemset"/>
+  <xsl:param name="pad"/>
+  <xsl:param name="prev-lhs"/>
+  <xsl:param name="dot"/>
+  <xsl:param name="lookaheads"/>
+
+  <xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
+    <xsl:text>&#10;</xsl:text>
+  </xsl:if>
+
+  <xsl:text>  </xsl:text>
+
+  <xsl:choose>
+    <xsl:when test="$anchor = 'true'">
+      <a>
+        <xsl:attribute name="name">
+          <xsl:value-of select="concat('rule_', @number)"/>
+        </xsl:attribute>
+        <xsl:call-template name="lpad">
+          <xsl:with-param name="str" select="string(@number)"/>
+          <xsl:with-param name="pad" select="number($pad)"/>
+        </xsl:call-template>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:value-of select="concat('#rule_', @number)"/>
+        </xsl:attribute>
+        <xsl:call-template name="lpad">
+          <xsl:with-param name="str" select="string(@number)"/>
+          <xsl:with-param name="pad" select="number($pad)"/>
+        </xsl:call-template>
+      </a>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text> </xsl:text>
+
+  <!-- LHS -->
+  <xsl:choose>
+    <xsl:when test="$prev-lhs = lhs[text()]">
+      <xsl:call-template name="lpad">
+        <xsl:with-param name="str" select="'|'"/>
+        <xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <span class="i">
+        <xsl:value-of select="lhs"/>
+      </span>
+      <xsl:text> &#8594;</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <!-- RHS -->
+  <xsl:for-each select="rhs/*">
+    <xsl:if test="position() = $dot + 1">
+      <xsl:text> </xsl:text>
+      <span class="dot">&#x2022;</span>
+    </xsl:if>
+    <xsl:apply-templates select="."/>
+    <xsl:if test="position() = last() and position() = $dot">
+      <xsl:text> </xsl:text>
+      <span class="dot">&#x2022;</span>
+    </xsl:if>
+  </xsl:for-each>
+  <xsl:if test="$lookaheads">
+    <xsl:value-of select="$lookaheads"/>
+  </xsl:if>
+
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="symbol">
+  <xsl:text> </xsl:text>
+  <xsl:choose>
+    <xsl:when test="name(key('bison:symbolByName', .)) = 'nonterminal'">
+      <span class="i"><xsl:value-of select="."/></span>
+    </xsl:when>
+    <xsl:otherwise>
+      <b><xsl:value-of select="."/></b>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="empty">
+  <xsl:text> %empty</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads">
+  <xsl:text>  [</xsl:text>
+  <xsl:apply-templates select="symbol"/>
+  <xsl:text>]</xsl:text>
+</xsl:template>
+
+<xsl:template match="lookaheads/symbol">
+  <xsl:value-of select="."/>
+  <xsl:if test="position() != last()">
+    <xsl:text>, </xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="transition">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:choose>
+    <xsl:when test="@type = 'shift'">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:value-of select="concat('#state_', @state)"/>
+        </xsl:attribute>
+        <xsl:value-of select="concat('shift, and go to state ', @state)"/>
+      </a>
+    </xsl:when>
+    <xsl:when test="@type = 'goto'">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:value-of select="concat('#state_', @state)"/>
+        </xsl:attribute>
+        <xsl:value-of select="concat('go to state ', @state)"/>
+      </a>
+    </xsl:when>
+  </xsl:choose>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="error">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:text>error</xsl:text>
+  <xsl:text> (</xsl:text>
+  <xsl:value-of select="text()"/>
+  <xsl:text>)</xsl:text>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="reduction">
+  <xsl:param name="pad"/>
+  <xsl:text>    </xsl:text>
+  <xsl:call-template name="rpad">
+    <xsl:with-param name="str" select="string(@symbol)"/>
+    <xsl:with-param name="pad" select="number($pad) + 2"/>
+  </xsl:call-template>
+  <xsl:if test="@enabled = 'false'">
+    <xsl:text>[</xsl:text>
+  </xsl:if>
+  <xsl:choose>
+    <xsl:when test="@rule = 'accept'">
+      <xsl:text>accept</xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:value-of select="concat('#rule_', @rule)"/>
+        </xsl:attribute>
+        <xsl:value-of select="concat('reduce using rule ', @rule)"/>
+      </a>
+      <xsl:text> (</xsl:text>
+      <xsl:value-of
+        select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"
+      />
+      <xsl:text>)</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:if test="@enabled = 'false'">
+    <xsl:text>]</xsl:text>
+  </xsl:if>
+  <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="solved-conflicts">
+  <xsl:if test="resolution">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:apply-templates select="resolution"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="resolution">
+  <xsl:text>    Conflict between </xsl:text>
+  <a>
+    <xsl:attribute name="href">
+      <xsl:value-of select="concat('#rule_', @rule)"/>
+    </xsl:attribute>
+    <xsl:value-of select="concat('rule ',@rule)"/>
+  </a>
+  <xsl:text> and token </xsl:text>
+  <xsl:value-of select="@symbol"/>
+  <xsl:text> resolved as </xsl:text>
+  <xsl:if test="@type = 'error'">
+    <xsl:text>an </xsl:text>
+  </xsl:if>
+  <xsl:value-of select="@type"/>
+  <xsl:text> (</xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>).&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="max-width-symbol">
+  <xsl:param name="node"/>
+  <xsl:variable name="longest">
+    <xsl:for-each select="$node">
+      <xsl:sort data-type="number" select="string-length(@symbol)"
+                order="descending"/>
+      <xsl:if test="position() = 1">
+        <xsl:value-of select="string-length(@symbol)"/>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:variable>
+  <xsl:value-of select="$longest"/>
+</xsl:template>
+
+<xsl:template name="lpad">
+  <xsl:param name="str" select="''"/>
+  <xsl:param name="pad" select="0"/>
+  <xsl:variable name="diff" select="$pad - string-length($str)" />
+  <xsl:choose>
+    <xsl:when test="$diff &lt; 0">
+      <xsl:value-of select="$str"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="space">
+        <xsl:with-param name="repeat" select="$diff"/>
+      </xsl:call-template>
+      <xsl:value-of select="$str"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="rpad">
+  <xsl:param name="str" select="''"/>
+  <xsl:param name="pad" select="0"/>
+  <xsl:variable name="diff" select="$pad - string-length($str)"/>
+  <xsl:choose>
+    <xsl:when test="$diff &lt; 0">
+      <xsl:value-of select="$str"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$str"/>
+      <xsl:call-template name="space">
+        <xsl:with-param name="repeat" select="$diff"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="space">
+  <xsl:param name="repeat">0</xsl:param>
+  <xsl:param name="fill" select="' '"/>
+  <xsl:if test="number($repeat) &gt;= 1">
+    <xsl:call-template name="space">
+      <xsl:with-param name="repeat" select="$repeat - 1"/>
+      <xsl:with-param name="fill" select="$fill"/>
+    </xsl:call-template>
+    <xsl:value-of select="$fill"/>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>

BIN
Engine/bin/bison/bison.exe


+ 0 - 4501
Engine/bin/bison/bison.html

@@ -1,4501 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.52
-     from bison.texinfo on 2 October 1998 -->
-<TITLE>Bison 1.24
-</TITLE>
-</HEAD>
-<BODY>
-<H1>Bison
-</H1>
-<H2>The YACC-compatible Parser Generator
-</H2>
-<H2>May 1995, Bison Version 1.24
-</H2>
-<ADDRESS>by Charles Donnelly and Richard Stallman
-</ADDRESS>
-<P>
-<P><HR><P>
-<H1>Table of Contents</H1>
-<UL>
-<LI><A NAME="TOC1" HREF="bison.html#SEC1">Introduction</A>
-<LI><A NAME="TOC2" HREF="bison.html#SEC2">Conditions for Using Bison</A>
-<LI><A NAME="TOC3" HREF="bison.html#SEC3">GNU GENERAL PUBLIC LICENSE</A>
-<UL>
-<LI><A NAME="TOC4" HREF="bison.html#SEC4">Preamble</A>
-<LI><A NAME="TOC5" HREF="bison.html#SEC5">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</A>
-<LI><A NAME="TOC6" HREF="bison.html#SEC6">How to Apply These Terms to Your New Programs</A>
-</UL>
-<LI><A NAME="TOC7" HREF="bison.html#SEC7">The Concepts of Bison</A>
-<UL>
-<LI><A NAME="TOC8" HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>
-<LI><A NAME="TOC9" HREF="bison.html#SEC9">From Formal Rules to Bison Input</A>
-<LI><A NAME="TOC10" HREF="bison.html#SEC10">Semantic Values</A>
-<LI><A NAME="TOC11" HREF="bison.html#SEC11">Semantic Actions</A>
-<LI><A NAME="TOC12" HREF="bison.html#SEC12">Bison Output: the Parser File</A>
-<LI><A NAME="TOC13" HREF="bison.html#SEC13">Stages in Using Bison</A>
-<LI><A NAME="TOC14" HREF="bison.html#SEC14">The Overall Layout of a Bison Grammar</A>
-</UL>
-<LI><A NAME="TOC15" HREF="bison.html#SEC15">Examples</A>
-<UL>
-<LI><A NAME="TOC16" HREF="bison.html#SEC16">Reverse Polish Notation Calculator</A>
-<UL>
-<LI><A NAME="TOC17" HREF="bison.html#SEC17">Declarations for <CODE>rpcalc</CODE></A>
-<LI><A NAME="TOC18" HREF="bison.html#SEC18">Grammar Rules for <CODE>rpcalc</CODE></A>
-<UL>
-<LI><A NAME="TOC19" HREF="bison.html#SEC19">Explanation of <CODE>input</CODE></A>
-<LI><A NAME="TOC20" HREF="bison.html#SEC20">Explanation of <CODE>line</CODE></A>
-<LI><A NAME="TOC21" HREF="bison.html#SEC21">Explanation of <CODE>expr</CODE></A>
-</UL>
-<LI><A NAME="TOC22" HREF="bison.html#SEC22">The <CODE>rpcalc</CODE> Lexical Analyzer</A>
-<LI><A NAME="TOC23" HREF="bison.html#SEC23">The Controlling Function</A>
-<LI><A NAME="TOC24" HREF="bison.html#SEC24">The Error Reporting Routine</A>
-<LI><A NAME="TOC25" HREF="bison.html#SEC25">Running Bison to Make the Parser</A>
-<LI><A NAME="TOC26" HREF="bison.html#SEC26">Compiling the Parser File</A>
-</UL>
-<LI><A NAME="TOC27" HREF="bison.html#SEC27">Infix Notation Calculator: <CODE>calc</CODE></A>
-<LI><A NAME="TOC28" HREF="bison.html#SEC28">Simple Error Recovery</A>
-<LI><A NAME="TOC29" HREF="bison.html#SEC29">Multi-Function Calculator: <CODE>mfcalc</CODE></A>
-<UL>
-<LI><A NAME="TOC30" HREF="bison.html#SEC30">Declarations for <CODE>mfcalc</CODE></A>
-<LI><A NAME="TOC31" HREF="bison.html#SEC31">Grammar Rules for <CODE>mfcalc</CODE></A>
-<LI><A NAME="TOC32" HREF="bison.html#SEC32">The <CODE>mfcalc</CODE> Symbol Table</A>
-</UL>
-<LI><A NAME="TOC33" HREF="bison.html#SEC33">Exercises</A>
-</UL>
-<LI><A NAME="TOC34" HREF="bison.html#SEC34">Bison Grammar Files</A>
-<UL>
-<LI><A NAME="TOC35" HREF="bison.html#SEC35">Outline of a Bison Grammar</A>
-<UL>
-<LI><A NAME="TOC36" HREF="bison.html#SEC36">The C Declarations Section</A>
-<LI><A NAME="TOC37" HREF="bison.html#SEC37">The Bison Declarations Section</A>
-<LI><A NAME="TOC38" HREF="bison.html#SEC38">The Grammar Rules Section</A>
-<LI><A NAME="TOC39" HREF="bison.html#SEC39">The Additional C Code Section</A>
-</UL>
-<LI><A NAME="TOC40" HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>
-<LI><A NAME="TOC41" HREF="bison.html#SEC41">Syntax of Grammar Rules</A>
-<LI><A NAME="TOC42" HREF="bison.html#SEC42">Recursive Rules</A>
-<LI><A NAME="TOC43" HREF="bison.html#SEC43">Defining Language Semantics</A>
-<UL>
-<LI><A NAME="TOC44" HREF="bison.html#SEC44">Data Types of Semantic Values</A>
-<LI><A NAME="TOC45" HREF="bison.html#SEC45">More Than One Value Type</A>
-<LI><A NAME="TOC46" HREF="bison.html#SEC46">Actions</A>
-<LI><A NAME="TOC47" HREF="bison.html#SEC47">Data Types of Values in Actions</A>
-<LI><A NAME="TOC48" HREF="bison.html#SEC48">Actions in Mid-Rule</A>
-</UL>
-<LI><A NAME="TOC49" HREF="bison.html#SEC49">Bison Declarations</A>
-<UL>
-<LI><A NAME="TOC50" HREF="bison.html#SEC50">Token Type Names</A>
-<LI><A NAME="TOC51" HREF="bison.html#SEC51">Operator Precedence</A>
-<LI><A NAME="TOC52" HREF="bison.html#SEC52">The Collection of Value Types</A>
-<LI><A NAME="TOC53" HREF="bison.html#SEC53">Nonterminal Symbols</A>
-<LI><A NAME="TOC54" HREF="bison.html#SEC54">Suppressing Conflict Warnings</A>
-<LI><A NAME="TOC55" HREF="bison.html#SEC55">The Start-Symbol</A>
-<LI><A NAME="TOC56" HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>
-<LI><A NAME="TOC57" HREF="bison.html#SEC57">Bison Declaration Summary</A>
-</UL>
-<LI><A NAME="TOC58" HREF="bison.html#SEC58">Multiple Parsers in the Same Program</A>
-</UL>
-<LI><A NAME="TOC59" HREF="bison.html#SEC59">Parser C-Language Interface</A>
-<UL>
-<LI><A NAME="TOC60" HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>
-<LI><A NAME="TOC61" HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>
-<UL>
-<LI><A NAME="TOC62" HREF="bison.html#SEC62">Calling Convention for <CODE>yylex</CODE></A>
-<LI><A NAME="TOC63" HREF="bison.html#SEC63">Semantic Values of Tokens</A>
-<LI><A NAME="TOC64" HREF="bison.html#SEC64">Textual Positions of Tokens</A>
-<LI><A NAME="TOC65" HREF="bison.html#SEC65">Calling Conventions for Pure Parsers</A>
-</UL>
-<LI><A NAME="TOC66" HREF="bison.html#SEC66">The Error Reporting Function <CODE>yyerror</CODE></A>
-<LI><A NAME="TOC67" HREF="bison.html#SEC67">Special Features for Use in Actions</A>
-</UL>
-<LI><A NAME="TOC68" HREF="bison.html#SEC68">The Bison Parser Algorithm</A>
-<UL>
-<LI><A NAME="TOC69" HREF="bison.html#SEC69">Look-Ahead Tokens</A>
-<LI><A NAME="TOC70" HREF="bison.html#SEC70">Shift/Reduce Conflicts</A>
-<LI><A NAME="TOC71" HREF="bison.html#SEC71">Operator Precedence</A>
-<UL>
-<LI><A NAME="TOC72" HREF="bison.html#SEC72">When Precedence is Needed</A>
-<LI><A NAME="TOC73" HREF="bison.html#SEC73">Specifying Operator Precedence</A>
-<LI><A NAME="TOC74" HREF="bison.html#SEC74">Precedence Examples</A>
-<LI><A NAME="TOC75" HREF="bison.html#SEC75">How Precedence Works</A>
-</UL>
-<LI><A NAME="TOC76" HREF="bison.html#SEC76">Context-Dependent Precedence</A>
-<LI><A NAME="TOC77" HREF="bison.html#SEC77">Parser States</A>
-<LI><A NAME="TOC78" HREF="bison.html#SEC78">Reduce/Reduce Conflicts</A>
-<LI><A NAME="TOC79" HREF="bison.html#SEC79">Mysterious Reduce/Reduce Conflicts</A>
-<LI><A NAME="TOC80" HREF="bison.html#SEC80">Stack Overflow, and How to Avoid It</A>
-</UL>
-<LI><A NAME="TOC81" HREF="bison.html#SEC81">Error Recovery</A>
-<LI><A NAME="TOC82" HREF="bison.html#SEC82">Handling Context Dependencies</A>
-<UL>
-<LI><A NAME="TOC83" HREF="bison.html#SEC83">Semantic Info in Token Types</A>
-<LI><A NAME="TOC84" HREF="bison.html#SEC84">Lexical Tie-ins</A>
-<LI><A NAME="TOC85" HREF="bison.html#SEC85">Lexical Tie-ins and Error Recovery</A>
-</UL>
-<LI><A NAME="TOC86" HREF="bison.html#SEC86">Debugging Your Parser</A>
-<LI><A NAME="TOC87" HREF="bison.html#SEC87">Invoking Bison</A>
-<UL>
-<LI><A NAME="TOC88" HREF="bison.html#SEC88">Bison Options</A>
-<LI><A NAME="TOC89" HREF="bison.html#SEC89">Option Cross Key</A>
-<LI><A NAME="TOC90" HREF="bison.html#SEC90">Invoking Bison under VMS</A>
-</UL>
-<LI><A NAME="TOC91" HREF="bison.html#SEC91">Bison Symbols</A>
-<LI><A NAME="TOC92" HREF="bison.html#SEC92">Glossary</A>
-<LI><A NAME="TOC93" HREF="bison.html#SEC93">Index</A>
-</UL>
-<P><HR><P>
-<ul>
-<H1><A NAME="SEC1" HREF="bison.html#TOC1">Introduction</A></H1>
-<P>
-<A NAME="IDX1"></A>
-<EM>Bison</EM> is a general-purpose parser generator that converts a
-grammar description for an LALR(1) context-free grammar into a C
-program to parse that grammar.  Once you are proficient with Bison,
-you may use it to develop a wide range of language parsers, from those
-used in simple desk calculators to complex programming languages.
-<p>
-Bison is upward compatible with Yacc: all properly-written Yacc grammars
-ought to work with Bison with no change.  Anyone familiar with Yacc
-should be able to use Bison with little trouble.  You need to be fluent in
-C programming in order to use Bison or to understand this manual.
-<p>
-We begin with tutorial chapters that explain the basic concepts of using
-Bison and show three explained examples, each building on the last.  If you
-don't know Bison or Yacc, start by reading these chapters.  Reference
-chapters follow which describe specific aspects of Bison in detail.
-<p>
-Bison was written primarily by Robert Corbett; Richard Stallman made
-it Yacc-compatible.  This edition corresponds to version 1.24 of Bison.
-<p>
-<H1><A NAME="SEC2" HREF="bison.html#TOC2">Conditions for Using Bison</A></H1>
-<P>
-As of Bison version 1.24, we have changed the distribution terms for
-<CODE>yyparse</CODE> to permit using Bison's output in non-free programs.
-Formerly, Bison parsers could be used only in programs that were free
-software.
-<p>
-The other GNU programming tools, such as the GNU C compiler, have never
-had such a requirement.  They could always be used for non-free
-software.  The reason Bison was different was not due to a special
-policy decision; it resulted from applying the usual General Public
-License to all of the Bison source code.
-<p>
-The output of the Bison utility--the Bison parser file--contains a
-verbatim copy of a sizable piece of Bison, which is the code for the
-<CODE>yyparse</CODE> function.  (The actions from your grammar are inserted
-into this function at one point, but the rest of the function is not
-changed.)  When we applied the GPL terms to the code for <CODE>yyparse</CODE>,
-the effect was to restrict the use of Bison output to free software.
-<p>
-We didn't change the terms because of sympathy for people who want to
-make software proprietary.  <STRONG>Software should be free.</STRONG>  But we
-concluded that limiting Bison's use to free software was doing little to
-encourage people to make other software free.  So we decided to make the
-practical conditions for using Bison match the practical conditions for
-using the other GNU tools.
-<p>
-<H1><A NAME="SEC3" HREF="bison.html#TOC3">GNU GENERAL PUBLIC LICENSE</A></H1>
-<P>
-Version 2, June 1991
-<PRE>
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-675 Mass Ave, Cambridge, MA 02139, USA
-<p>
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-</PRE>
-<P>
-<H2><A NAME="SEC4" HREF="bison.html#TOC4">Preamble</A></H2>
-<P>
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-<p>
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-<p>
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-<p>
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-<p>
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-<p>
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-<p>
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-<p>
-  The precise terms and conditions for copying, distribution and
-modification follow.
-<p>
-<H2><A NAME="SEC5" HREF="bison.html#TOC5">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</A></H2>
-<P>
-<OL>
-<LI>
-This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-<p>
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-<p>
-<LI>
-You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-<p>
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-<p>
-<LI>
-You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-<p>
-<OL>
-<LI>
-You must cause the modified files to carry prominent notices
-stating that you changed the files and the date of any change.
-<p>
-<LI>
-You must cause any work that you distribute or publish, that in
-whole or in part contains or is derived from the Program or any
-part thereof, to be licensed as a whole at no charge to all third
-parties under the terms of this License.
-<p>
-<LI>
-If the modified program normally reads commands interactively
-when run, you must cause it, when started running for such
-interactive use in the most ordinary way, to print or display an
-announcement including an appropriate copyright notice and a
-notice that there is no warranty (or else, saying that you provide
-a warranty) and that users may redistribute the program under
-these conditions, and telling the user how to view a copy of this
-License.  (Exception: if the Program itself is interactive but
-does not normally print such an announcement, your work based on
-the Program is not required to print an announcement.)
-<p>
-</OL>
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-<p>
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-<p>
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-<p>
-<LI>
-You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-<p>
-<OL>
-<LI>
-Accompany it with the complete corresponding machine-readable
-source code, which must be distributed under the terms of Sections
-1 and 2 above on a medium customarily used for software interchange; or,
-<p>
-<LI>
-Accompany it with a written offer, valid for at least three
-years, to give any third party, for a charge no more than your
-cost of physically performing source distribution, a complete
-machine-readable copy of the corresponding source code, to be
-distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-<p>
-<LI>
-Accompany it with the information you received as to the offer
-to distribute corresponding source code.  (This alternative is
-allowed only for noncommercial distribution and only if you
-received the program in object code or executable form with such
-an offer, in accord with Subsection b above.)
-<p>
-</OL>
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-<p>
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-<p>
-<LI>
-You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-<p>
-<LI>
-You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-<p>
-<LI>
-Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-<p>
-<LI>
-If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-<p>
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-<p>
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-<p>
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-<p>
-<LI>
-If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-<p>
-<LI>
-The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-<p>
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-<p>
-<LI>
-If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-<p>
-<P><STRONG>NO WARRANTY</STRONG></P>
-<LI>
-BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-<p>
-<LI>
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-<p>
-</OL>
-<P>
-<P><STRONG>END OF TERMS AND CONDITIONS</STRONG></P>
-<p>
-<H2><A NAME="SEC6" HREF="bison.html#TOC6">How to Apply These Terms to Your New Programs</A></H2>
-<P>
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-<p>
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-<p>
-<ul><pre>
-<VAR>one line to give the program's name and a brief idea of what it does.</VAR>
-Copyright (C) 19<VAR>yy</VAR>  <VAR>name of author</VAR>
-<p>
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-<p>
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-<p>
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-</PRE>
-</ul>
-<P>
-Also add information on how to contact you by electronic and paper mail.
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-<ul>
-<PRE>
-Gnomovision version 69, Copyright (C) 19<VAR>yy</VAR> <VAR>name of author</VAR>
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 
-type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-</PRE>
-</ul>
-<P>
-The hypothetical commands <SAMP>`show w'</SAMP> and <SAMP>`show c'</SAMP> should show
-the appropriate parts of the General Public License.  Of course, the
-commands you use may be called something other than <SAMP>`show w'</SAMP> and
-<SAMP>`show c'</SAMP>; they could even be mouse-clicks or menu items--whatever
-suits your program.
-<p>
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-<p>
-<ul>
-<PRE>
-Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-`Gnomovision' (which makes passes at compilers) written by James Hacker.
-<p>
-<VAR>signature of Ty Coon</VAR>, 1 April 1989
-Ty Coon, President of Vice
-</PRE>
-</ul>
-<P>
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-<p>
-<H1><A NAME="SEC7" HREF="bison.html#TOC7">The Concepts of Bison</A></H1>
-<P>
-This chapter introduces many of the basic concepts without which the
-details of Bison will not make sense.  If you do not already know how to
-use Bison or Yacc, we suggest you start by reading this chapter carefully.
-<H2><A NAME="SEC8" HREF="bison.html#TOC8">Languages and Context-Free Grammars</A></H2>
-<P>
-<A NAME="IDX2"></A>
-<A NAME="IDX3"></A>
-<BOL>In order for Bison to parse a language, it must be described by a
-<EM>context-free grammar</EM>.  This means that you specify one or more
-<EM>syntactic groupings</EM> and give rules for constructing them from their
-parts.  For example, in the C language, one kind of grouping is called an
-`expression'.  One rule for making an expression might be, "An expression
-can be made of a minus sign and another expression".  Another would be,
-"An expression can be an integer".  As you can see, rules are often
-recursive, but there must be at least one rule which leads out of the
-recursion.
-<p>
-<A NAME="IDX4"></A>
-<A NAME="IDX5"></A>
-The most common formal system for presenting such rules for humans to read
-is <EM>Backus-Naur Form</EM> or "BNF", which was developed in order to
-specify the language Algol 60.  Any grammar expressed in BNF is a
-context-free grammar.  The input to Bison is essentially machine-readable
-BNF.
-<p>
-Not all context-free languages can be handled by Bison, only those
-that are LALR(1).  In brief, this means that it must be possible to
-tell how to parse any portion of an input string with just a single
-token of look-ahead.  Strictly speaking, that is a description of an
-LR(1) grammar, and LALR(1) involves additional restrictions that are
-hard to explain simply; but it is rare in actual practice to find an
-LR(1) grammar that fails to be LALR(1).  See section <A HREF="bison.html#SEC79">Mysterious Reduce/Reduce Conflicts</A>, for more information on this.
-<p>
-<A NAME="IDX6"></A>
-<A NAME="IDX7"></A>
-<A NAME="IDX8"></A>
-<A NAME="IDX9"></A>
-In the formal grammatical rules for a language, each kind of syntactic unit
-or grouping is named by a <EM>symbol</EM>.  Those which are built by grouping
-smaller constructs according to grammatical rules are called
-<EM>nonterminal symbols</EM>; those which can't be subdivided are called
-<EM>terminal symbols</EM> or <EM>token types</EM>.  We call a piece of input
-corresponding to a single terminal symbol a <EM>token</EM>, and a piece
-corresponding to a single nonterminal symbol a <EM>grouping</EM>.
-We can use the C language as an example of what symbols, terminal and
-nonterminal, mean.  The tokens of C are identifiers, constants (numeric and
-string), and the various keywords, arithmetic operators and punctuation
-marks.  So the terminal symbols of a grammar for C include `identifier',
-`number', `string', plus one symbol for each keyword, operator or
-punctuation mark: `if', `return', `const', `static', `int', `char',
-`plus-sign', `open-brace', `close-brace', `comma' and many more.  (These
-tokens can be subdivided into characters, but that is a matter of
-lexicography, not grammar.)
-<p>
-Here is a simple C function subdivided into tokens:
-<p>
-<BLOCKQUOTE>
-<PRE>
-int             /* keyword `int' */
-square (x)      /* identifier, open-paren, */
-                /* identifier, close-paren */
-     int x;     /* keyword `int', identifier, semicolon */
-{               /* open-brace */
-  return x * x; /* keyword `return', identifier, */
-                /* asterisk, identifier, semicolon */
-}               /* close-brace */
-</PRE>
-</BLOCKQUOTE>
-<P>
-The syntactic groupings of C include the expression, the statement, the
-declaration, and the function definition.  These are represented in the
-grammar of C by nonterminal symbols `expression', `statement',
-`declaration' and `function definition'.  The full grammar uses dozens of
-additional language constructs, each with its own nonterminal symbol, in
-order to express the meanings of these four.  The example above is a
-function definition; it contains one declaration, and one statement.  In
-the statement, each <SAMP>`x'</SAMP> is an expression and so is <SAMP>`x * x'</SAMP>.
-Each nonterminal symbol must have grammatical rules showing how it is made
-out of simpler constructs.  For example, one kind of C statement is the
-<CODE>return</CODE> statement; this would be described with a grammar rule which
-reads informally as follows:
-<BLOCKQUOTE>
-<P>
-A `statement' can be made of a `return' keyword, an `expression' and a
-`semicolon'.
-</BLOCKQUOTE>
-<P>
-There would be many other rules for `statement', one for each kind of
-statement in C.
-<p>
-<A NAME="IDX10"></A>
-One nonterminal symbol must be distinguished as the special one which
-defines a complete utterance in the language.  It is called the <EM>start
-symbol</EM>.  In a compiler, this means a complete input program.  In the C
-language, the nonterminal symbol `sequence of definitions and declarations'
-plays this role.
-<p>
-For example, <SAMP>`1 + 2'</SAMP> is a valid C expression--a valid part of a C
-program--but it is not valid as an <EM>entire</EM> C program.  In the
-context-free grammar of C, this follows from the fact that `expression' is
-not the start symbol.
-<p>
-The Bison parser reads a sequence of tokens as its input, and groups the
-tokens using the grammar rules.  If the input is valid, the end result is
-that the entire token sequence reduces to a single grouping whose symbol is
-the grammar's start symbol.  If we use a grammar for C, the entire input
-must be a `sequence of definitions and declarations'.  If not, the parser
-reports a syntax error.
-<p>
-<H2><A NAME="SEC9" HREF="bison.html#TOC9">From Formal Rules to Bison Input</A></H2>
-<P>
-<A NAME="IDX11"></A>
-<A NAME="IDX12"></A>
-<A NAME="IDX13"></A>
-A formal grammar is a mathematical construct.  To define the language
-for Bison, you must write a file expressing the grammar in Bison syntax:
-a <EM>Bison grammar</EM> file.  See section <A HREF="bison.html#SEC34">Bison Grammar Files</A>.
-A nonterminal symbol in the formal grammar is represented in Bison input
-as an identifier, like an identifier in C.  By convention, it should be
-in lower case, such as <CODE>expr</CODE>, <CODE>stmt</CODE> or <CODE>declaration</CODE>.
-The Bison representation for a terminal symbol is also called a <EM>token
-type</EM>.  Token types as well can be represented as C-like identifiers.  By
-convention, these identifiers should be upper case to distinguish them from
-nonterminals: for example, <CODE>INTEGER</CODE>, <CODE>IDENTIFIER</CODE>, <CODE>IF</CODE> or
-<CODE>RETURN</CODE>.  A terminal symbol that stands for a particular keyword in
-the language should be named after that keyword converted to upper case.
-The terminal symbol <CODE>error</CODE> is reserved for error recovery.
-<p>
-See section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>.
-A terminal symbol can also be represented as a character literal, just like
-a C character constant.  You should do this whenever a token is just a
-single character (parenthesis, plus-sign, etc.): use that same character in
-a literal as the terminal symbol for that token.
-<p>
-The grammar rules also have an expression in Bison syntax.  For example,
-here is the Bison rule for a C <CODE>return</CODE> statement.  The semicolon in
-quotes is a literal character token, representing part of the C syntax for
-the statement; the naked semicolon, and the colon, are Bison punctuation
-used in every rule.
-<p>
-<BLOCKQUOTE>
-<PRE>
-stmt:   RETURN expr ';'
-        ;
-</PRE>
-</BLOCKQUOTE>
-<P>
-See section <A HREF="bison.html#SEC41">Syntax of Grammar Rules</A>.
-<p>
-<H2><A NAME="SEC10" HREF="bison.html#TOC10">Semantic Values</A></H2>
-<P>
-<A NAME="IDX14"></A>
-<A NAME="IDX15"></A>
-A formal grammar selects tokens only by their classifications: for example,
-if a rule mentions the terminal symbol `integer constant', it means that
-<EM>any</EM> integer constant is grammatically valid in that position.  The
-precise value of the constant is irrelevant to how to parse the input: if
-<SAMP>`x+4'</SAMP> is grammatical then <SAMP>`x+1'</SAMP> or <SAMP>`x+3989'</SAMP> is equally
-grammatical.
-<p>
-But the precise value is very important for what the input means once it is
-parsed.  A compiler is useless if it fails to distinguish between 4, 1 and
-3989 as constants in the program!  Therefore, each token in a Bison grammar
-has both a token type and a <EM>semantic value</EM>.  See section <A HREF="bison.html#SEC43">Defining Language Semantics</A>,
-for details.
-<p>
-The token type is a terminal symbol defined in the grammar, such as
-<CODE>INTEGER</CODE>, <CODE>IDENTIFIER</CODE> or <CODE>','</CODE>.  It tells everything
-you need to know to decide where the token may validly appear and how to
-group it with other tokens.  The grammar rules know nothing about tokens
-except their types.
-<p>
-The semantic value has all the rest of the information about the
-meaning of the token, such as the value of an integer, or the name of an
-identifier.  (A token such as <CODE>','</CODE> which is just punctuation doesn't
-need to have any semantic value.)
-<p>
-For example, an input token might be classified as token type
-<CODE>INTEGER</CODE> and have the semantic value 4.  Another input token might
-have the same token type <CODE>INTEGER</CODE> but value 3989.  When a grammar
-rule says that <CODE>INTEGER</CODE> is allowed, either of these tokens is
-acceptable because each is an <CODE>INTEGER</CODE>.  When the parser accepts the
-token, it keeps track of the token's semantic value.
-<p>
-Each grouping can also have a semantic value as well as its nonterminal
-symbol.  For example, in a calculator, an expression typically has a
-semantic value that is a number.  In a compiler for a programming
-language, an expression typically has a semantic value that is a tree
-structure describing the meaning of the expression.
-<p>
-<H2><A NAME="SEC11" HREF="bison.html#TOC11">Semantic Actions</A></H2>
-<P>
-<A NAME="IDX16"></A>
-<A NAME="IDX17"></A>
-In order to be useful, a program must do more than parse input; it must
-also produce some output based on the input.  In a Bison grammar, a grammar
-rule can have an <EM>action</EM> made up of C statements.  Each time the
-parser recognizes a match for that rule, the action is executed.
-See section <A HREF="bison.html#SEC46">Actions</A>.
-<p>
-Most of the time, the purpose of an action is to compute the semantic value
-of the whole construct from the semantic values of its parts.  For example,
-suppose we have a rule which says an expression can be the sum of two
-expressions.  When the parser recognizes such a sum, each of the
-subexpressions has a semantic value which describes how it was built up.
-The action for this rule should create a similar sort of value for the
-newly recognized larger expression.
-For example, here is a rule that says an expression can be the sum of
-two subexpressions:
-<p>
-<BLOCKQUOTE>
-<PRE>
-expr: expr '+' expr   { $$ = $1 + $3; }
-        ;
-</PRE>
-</BLOCKQUOTE>
-<P>
-The action says how to produce the semantic value of the sum expression
-from the values of the two subexpressions.
-<H2><A NAME="SEC12" HREF="bison.html#TOC12">Bison Output: the Parser File</A></H2>
-<P>
-<A NAME="IDX18"></A>
-<A NAME="IDX19"></A>
-<A NAME="IDX20"></A>
-<A NAME="IDX21"></A>
-When you run Bison, you give it a Bison grammar file as input.  The output
-is a C source file that parses the language described by the grammar.
-This file is called a <EM>Bison parser</EM>.  Keep in mind that the Bison
-utility and the Bison parser are two distinct programs: the Bison utility
-is a program whose output is the Bison parser that becomes part of your
-program.
-<p>
-The job of the Bison parser is to group tokens into groupings according to
-the grammar rules--for example, to build identifiers and operators into
-expressions.  As it does this, it runs the actions for the grammar rules it
-uses.
-<p>
-The tokens come from a function called the <EM>lexical analyzer</EM> that you
-must supply in some fashion (such as by writing it in C).  The Bison parser
-calls the lexical analyzer each time it wants a new token.  It doesn't know
-what is "inside" the tokens (though their semantic values may reflect
-this).  Typically the lexical analyzer makes the tokens by parsing
-characters of text, but Bison does not depend on this.  See section <A HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>.
-The Bison parser file is C code which defines a function named
-<CODE>yyparse</CODE> which implements that grammar.  This function does not make
-a complete C program: you must supply some additional functions.  One is
-the lexical analyzer.  Another is an error-reporting function which the
-parser calls to report an error.  In addition, a complete C program must
-start with a function called <CODE>main</CODE>; you have to provide this, and
-arrange for it to call <CODE>yyparse</CODE> or the parser will never run.
-See section <A HREF="bison.html#SEC59">Parser C-Language Interface</A>.
-Aside from the token type names and the symbols in the actions you
-write, all variable and function names used in the Bison parser file
-begin with <SAMP>`yy'</SAMP> or <SAMP>`YY'</SAMP>.  This includes interface functions
-such as the lexical analyzer function <CODE>yylex</CODE>, the error reporting
-function <CODE>yyerror</CODE> and the parser function <CODE>yyparse</CODE> itself.
-This also includes numerous identifiers used for internal purposes.
-Therefore, you should avoid using C identifiers starting with <SAMP>`yy'</SAMP>
-or <SAMP>`YY'</SAMP> in the Bison grammar file except for the ones defined in
-this manual.
-<H2><A NAME="SEC13" HREF="bison.html#TOC13">Stages in Using Bison</A></H2>
-<P>
-<A NAME="IDX22"></A>
-<A NAME="IDX23"></A>
-The actual language-design process using Bison, from grammar specification
-to a working compiler or interpreter, has these parts:
-<OL>
-<LI>
-Formally specify the grammar in a form recognized by Bison
-(see section <A HREF="bison.html#SEC34">Bison Grammar Files</A>).  For each grammatical rule in the language,
-describe the action that is to be taken when an instance of that rule
-is recognized.  The action is described by a sequence of C statements.
-<LI>
-Write a lexical analyzer to process input and pass tokens to the
-parser.  The lexical analyzer may be written by hand in C
-(see section <A HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>).  It could also be produced using Lex, but the use
-of Lex is not discussed in this manual.
-<LI>
-Write a controlling function that calls the Bison-produced parser.
-<LI>
-Write error-reporting routines.
-</OL>
-<P>
-To turn this source code as written into a runnable program, you
-must follow these steps:
-<OL>
-<LI>
-Run Bison on the grammar to produce the parser.
-<LI>
-Compile the code output by Bison, as well as any other source files.
-<LI>
-Link the object files to produce the finished product.
-</OL>
-<P>
-<H2><A NAME="SEC14" HREF="bison.html#TOC14">The Overall Layout of a Bison Grammar</A></H2>
-<P>
-<A NAME="IDX24"></A>
-<A NAME="IDX25"></A>
-<A NAME="IDX26"></A>
-<A NAME="IDX27"></A>
-The input file for the Bison utility is a <EM>Bison grammar file</EM>.  The
-general form of a Bison grammar file is as follows:
-<PRE>
-%{
-<VAR>C declarations</VAR>
-%}
-<VAR>Bison declarations</VAR>
-%%
-<VAR>Grammar rules</VAR>
-%%
-<VAR>Additional C code</VAR>
-</PRE>
-<P>
-The <SAMP>`%%'</SAMP>, <SAMP>`%{'</SAMP> and <SAMP>`%}'</SAMP> are punctuation that appears
-in every Bison grammar file to separate the sections.
-The C declarations may define types and variables used in the actions.
-You can also use preprocessor commands to define macros used there, and use
-<CODE>#include</CODE> to include header files that do any of these things.
-The Bison declarations declare the names of the terminal and nonterminal
-symbols, and may also describe operator precedence and the data types of
-semantic values of various symbols.
-<P>
-The grammar rules define how to construct each nonterminal symbol from its
-parts.
-<P>
-The additional C code can contain any C code you want to use.  Often the
-definition of the lexical analyzer <CODE>yylex</CODE> goes here, plus subroutines
-called by the actions in the grammar rules.  In a simple program, all the
-rest of the program can go here.
-<P>
-<H1><A NAME="SEC15" HREF="bison.html#TOC15">Examples</A></H1>
-<P>
-<A NAME="IDX28"></A>
-<A NAME="IDX29"></A>
-Now we show and explain three sample programs written using Bison: a
-reverse polish notation calculator, an algebraic (infix) notation
-calculator, and a multi-function calculator.  All three have been tested
-under BSD Unix 4.3; each produces a usable, though limited, interactive
-desk-top calculator.
-<P>
-These examples are simple, but Bison grammars for real programming
-languages are written the same way.
-<P>
-<H2><A NAME="SEC16" HREF="bison.html#TOC16">Reverse Polish Notation Calculator</A></H2>
-<P>
-<A NAME="IDX30"></A>
-<A NAME="IDX31"></A>
-<A NAME="IDX32"></A>
-<A NAME="IDX33"></A>
-The first example is that of a simple double-precision <EM>reverse polish
-notation</EM> calculator (a calculator using postfix operators).  This example
-provides a good starting point, since operator precedence is not an issue.
-<P>
-The second example will illustrate how operator precedence is handled.
-The source code for this calculator is named <TT>`rpcalc.y'</TT>.  The
-<SAMP>`.y'</SAMP> extension is a convention used for Bison input files.
-<H3><A NAME="SEC17" HREF="bison.html#TOC17">Declarations for <CODE>rpcalc</CODE></A></H3>
-<P>
-Here are the C and Bison declarations for the reverse polish notation
-calculator.  As in C, comments are placed between <SAMP>`/*...*/'</SAMP>.
-<P>
-<PRE>
-/* Reverse polish notation calculator. */
-%{
-#define YYSTYPE double
-#include &#60;math.h&#62;
-%}
-%token NUM
-%% /* Grammar rules and actions follow */
-</PRE>
-<P>
-The C declarations section (see section <A HREF="bison.html#SEC36">The C Declarations Section</A>) contains two
-preprocessor directives.
-<P>
-The <CODE>#define</CODE> directive defines the macro <CODE>YYSTYPE</CODE>, thus
-specifying the C data type for semantic values of both tokens and groupings
-(see section <A HREF="bison.html#SEC44">Data Types of Semantic Values</A>).  The Bison parser will use whatever type
-<CODE>YYSTYPE</CODE> is defined as; if you don't define it, <CODE>int</CODE> is the
-default.  Because we specify <CODE>double</CODE>, each token and each expression
-has an associated value, which is a floating point number.
-<P>
-The <CODE>#include</CODE> directive is used to declare the exponentiation
-function <CODE>pow</CODE>.
-<P>
-The second section, Bison declarations, provides information to Bison about
-the token types (see section <A HREF="bison.html#SEC37">The Bison Declarations Section</A>).  Each terminal symbol that is
-not a single-character literal must be declared here.  (Single-character
-literals normally don't need to be declared.)  In this example, all the
-arithmetic operators are designated by single-character literals, so the
-only terminal symbol that needs to be declared is <CODE>NUM</CODE>, the token
-type for numeric constants.
-<P>
-<H3><A NAME="SEC18" HREF="bison.html#TOC18">Grammar Rules for <CODE>rpcalc</CODE></A></H3>
-<P>
-Here are the grammar rules for the reverse polish notation calculator.
-<P>
-<BLOCKQUOTE>
-<PRE>
-input:    /* empty */
-        | input line
-;
-line:     '\n'
-        | exp '\n'  { printf ("\t%.10g\n", $1); }
-;
-exp:      NUM             { $$ = $1;         }
-        | exp exp '+'     { $$ = $1 + $2;    }
-        | exp exp '-'     { $$ = $1 - $2;    }
-        | exp exp '*'     { $$ = $1 * $2;    }
-        | exp exp '/'     { $$ = $1 / $2;    }
-      /* Exponentiation */
-        | exp exp '^'     { $$ = pow ($1, $2); }
-      /* Unary minus    */
-        | exp 'n'         { $$ = -$1;        }
-;
-%%
-</PRE>
-</BLOCKQUOTE>
-<P>
-The groupings of the rpcalc "language" defined here are the expression
-(given the name <CODE>exp</CODE>), the line of input (<CODE>line</CODE>), and the
-complete input transcript (<CODE>input</CODE>).  Each of these nonterminal
-symbols has several alternate rules, joined by the <SAMP>`|'</SAMP> punctuator
-which is read as "or".  The following sections explain what these rules
-mean.
-<P>
-The semantics of the language is determined by the actions taken when a
-grouping is recognized.  The actions are the C code that appears inside
-braces.  See section <A HREF="bison.html#SEC46">Actions</A>.
-<P>
-You must specify these actions in C, but Bison provides the means for
-passing semantic values between the rules.  In each action, the
-pseudo-variable <CODE>$$</CODE> stands for the semantic value for the grouping
-that the rule is going to construct.  Assigning a value to <CODE>$$</CODE> is the
-main job of most actions.  The semantic values of the components of the
-rule are referred to as <CODE>$1</CODE>, <CODE>$2</CODE>, and so on.
-<P>
-<H4><A NAME="SEC19" HREF="bison.html#TOC19">Explanation of <CODE>input</CODE></A></H4>
-<P>
-Consider the definition of <CODE>input</CODE>:
-<P>
-<BLOCKQUOTE>
-<PRE>
-input:    /* empty */
-        | input line
-;
-</PRE>
-</BLOCKQUOTE>
-<P>
-This definition reads as follows: "A complete input is either an empty
-string, or a complete input followed by an input line".  Notice that
-"complete input" is defined in terms of itself.  This definition is said
-to be <EM>left recursive</EM> since <CODE>input</CODE> appears always as the
-leftmost symbol in the sequence.  See section <A HREF="bison.html#SEC42">Recursive Rules</A>.
-<P>
-The first alternative is empty because there are no symbols between the
-colon and the first <SAMP>`|'</SAMP>; this means that <CODE>input</CODE> can match an
-empty string of input (no tokens).  We write the rules this way because it
-is legitimate to type <KBD>Ctrl-d</KBD> right after you start the calculator.
-<P>
-It's conventional to put an empty alternative first and write the comment
-<SAMP>`/* empty */'</SAMP> in it.
-<P>
-The second alternate rule (<CODE>input line</CODE>) handles all nontrivial input.
-It means, "After reading any number of lines, read one more line if
-possible."  The left recursion makes this rule into a loop.  Since the
-first alternative matches empty input, the loop can be executed zero or
-more times.
-<P>
-The parser function <CODE>yyparse</CODE> continues to process input until a
-grammatical error is seen or the lexical analyzer says there are no more
-input tokens; we will arrange for the latter to happen at end of file.
-<H4><A NAME="SEC20" HREF="bison.html#TOC20">Explanation of <CODE>line</CODE></A></H4>
-<P>
-Now consider the definition of <CODE>line</CODE>:
-<PRE>
-<BLOCKQUOTE>
-line:     '\n'
-        | exp '\n'  { printf ("\t%.10g\n", $1); }
-;
-</PRE>
-</BLOCKQUOTE>
-<P>
-The first alternative is a token which is a newline character; this means
-that rpcalc accepts a blank line (and ignores it, since there is no
-action).  The second alternative is an expression followed by a newline.
-This is the alternative that makes rpcalc useful.  The semantic value of
-the <CODE>exp</CODE> grouping is the value of <CODE>$1</CODE> because the <CODE>exp</CODE> in
-question is the first symbol in the alternative.  The action prints this
-value, which is the result of the computation the user asked for.
-This action is unusual because it does not assign a value to <CODE>$$</CODE>.  As
-a consequence, the semantic value associated with the <CODE>line</CODE> is
-uninitialized (its value will be unpredictable).  This would be a bug if
-that value were ever used, but we don't use it: once rpcalc has printed the
-value of the user's input line, that value is no longer needed.
-<H4><A NAME="SEC21" HREF="bison.html#TOC21">Explanation of <CODE>expr</CODE></A></H4>
-<P>
-The <CODE>exp</CODE> grouping has several rules, one for each kind of expression.
-The first rule handles the simplest expressions: those that are just numbers.
-The second handles an addition-expression, which looks like two expressions
-followed by a plus-sign.  The third handles subtraction, and so on.
-<BLOCKQUOTE>
-<PRE>
-exp:      NUM
-        | exp exp '+'     { $$ = $1 + $2;    }
-        | exp exp '-'     { $$ = $1 - $2;    }
-        ...
-        ;
-</PRE>
-</BLOCKQUOTE>
-<P>
-We have used <SAMP>`|'</SAMP> to join all the rules for <CODE>exp</CODE>, but we could
-equally well have written them separately:
-<BLOCKQUOTE>
-<PRE>
-exp:      NUM ;
-exp:      exp exp '+'     { $$ = $1 + $2;    } ;
-exp:      exp exp '-'     { $$ = $1 - $2;    } ;
-        ...
-</PRE>
-</BLOCKQUOTE>
-<P>
-Most of the rules have actions that compute the value of the expression in
-terms of the value of its parts.  For example, in the rule for addition,
-<CODE>$1</CODE> refers to the first component <CODE>exp</CODE> and <CODE>$2</CODE> refers to
-the second one.  The third component, <CODE>'+'</CODE>, has no meaningful
-associated semantic value, but if it had one you could refer to it as
-<CODE>$3</CODE>.  When <CODE>yyparse</CODE> recognizes a sum expression using this
-rule, the sum of the two subexpressions' values is produced as the value of
-the entire expression.  See section <A HREF="bison.html#SEC46">Actions</A>.
-You don't have to give an action for every rule.  When a rule has no
-action, Bison by default copies the value of <CODE>$1</CODE> into <CODE>$$</CODE>.
-This is what happens in the first rule (the one that uses <CODE>NUM</CODE>).
-The formatting shown here is the recommended convention, but Bison does
-not require it.  You can add or change whitespace as much as you wish.
-For example, this:
-<PRE>
-exp   : NUM | exp exp '+' {$$ = $1 + $2; } | ...
-</PRE>
-<P>
-means the same thing as this:
-<PRE>
-exp:      NUM
-        | exp exp '+'    { $$ = $1 + $2; }
-        | ...
-</PRE>
-<P>
-The latter, however, is much more readable.
-<H3><A NAME="SEC22" HREF="bison.html#TOC22">The <CODE>rpcalc</CODE> Lexical Analyzer</A></H3>
-<P>
-<A NAME="IDX34"></A>
-<A NAME="IDX35"></A>
-The lexical analyzer's job is low-level parsing: converting characters or
-sequences of characters into tokens.  The Bison parser gets its tokens by
-calling the lexical analyzer.  See section <A HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>.
-Only a simple lexical analyzer is needed for the RPN calculator.  This
-lexical analyzer skips blanks and tabs, then reads in numbers as
-<CODE>double</CODE> and returns them as <CODE>NUM</CODE> tokens.  Any other character
-that isn't part of a number is a separate token.  Note that the token-code
-for such a single-character token is the character itself.
-The return value of the lexical analyzer function is a numeric code which
-represents a token type.  The same text used in Bison rules to stand for
-this token type is also a C expression for the numeric code for the type.
-This works in two ways.  If the token type is a character literal, then its
-numeric code is the ASCII code for that character; you can use the same
-character literal in the lexical analyzer to express the number.  If the
-token type is an identifier, that identifier is defined by Bison as a C
-macro whose definition is the appropriate number.  In this example,
-therefore, <CODE>NUM</CODE> becomes a macro for <CODE>yylex</CODE> to use.
-The semantic value of the token (if it has one) is stored into the global
-variable <CODE>yylval</CODE>, which is where the Bison parser will look for it.
-(The C data type of <CODE>yylval</CODE> is <CODE>YYSTYPE</CODE>, which was defined
-at the beginning of the grammar; see section <A HREF="bison.html#SEC17">Declarations for <CODE>rpcalc</CODE></A>.)
-A token type code of zero is returned if the end-of-file is encountered.
-(Bison recognizes any nonpositive value as indicating the end of the
-input.)
-Here is the code for the lexical analyzer:
-<PRE>
-/* Lexical analyzer returns a double floating point 
-   number on the stack and the token NUM, or the ASCII
-   character read if not a number.  Skips all blanks
-   and tabs, returns 0 for EOF. */
-#include &#60;ctype.h&#62;
-yylex ()
-{
-  int c;
-  /* skip white space  */
-  while ((c = getchar ()) == ' ' || c == '\t')  
-    ;
-  /* process numbers   */
-  if (c == '.' || isdigit (c))                
-    {
-      ungetc (c, stdin);
-      scanf ("%lf", &#38;yylval);
-      return NUM;
-    }
-  /* return end-of-file  */
-  if (c == EOF)                            
-    return 0;
-  /* return single chars */
-  return c;                                
-}
-</PRE>
-<P>
-<H3><A NAME="SEC23" HREF="bison.html#TOC23">The Controlling Function</A></H3>
-<P>
-<A NAME="IDX36"></A>
-<A NAME="IDX37"></A>
-In keeping with the spirit of this example, the controlling function is
-kept to the bare minimum.  The only requirement is that it call
-<CODE>yyparse</CODE> to start the process of parsing.
-<PRE>
-main ()
-{
-  yyparse ();
-}
-</PRE>
-<P>
-<H3><A NAME="SEC24" HREF="bison.html#TOC24">The Error Reporting Routine</A></H3>
-<P>
-<A NAME="IDX38"></A>
-When <CODE>yyparse</CODE> detects a syntax error, it calls the error reporting
-function <CODE>yyerror</CODE> to print an error message (usually but not always
-<CODE>"parse error"</CODE>).  It is up to the programmer to supply <CODE>yyerror</CODE>
-(see section <A HREF="bison.html#SEC59">Parser C-Language Interface</A>), so here is the definition we will use:
-<PRE>
-#include &#60;stdio.h&#62;
-yyerror (s)  /* Called by yyparse on error */
-     char *s;
-{
-  printf ("%s\n", s);
-}
-</PRE>
-<P>
-After <CODE>yyerror</CODE> returns, the Bison parser may recover from the error
-and continue parsing if the grammar contains a suitable error rule
-(see section <A HREF="bison.html#SEC81">Error Recovery</A>).  Otherwise, <CODE>yyparse</CODE> returns nonzero.  We
-have not written any error rules in this example, so any invalid input will
-cause the calculator program to exit.  This is not clean behavior for a
-real calculator, but it is adequate in the first example.
-<H3><A NAME="SEC25" HREF="bison.html#TOC25">Running Bison to Make the Parser</A></H3>
-<P>
-<A NAME="IDX39"></A>
-Before running Bison to produce a parser, we need to decide how to arrange
-all the source code in one or more source files.  For such a simple example,
-the easiest thing is to put everything in one file.  The definitions of
-<CODE>yylex</CODE>, <CODE>yyerror</CODE> and <CODE>main</CODE> go at the end, in the
-"additional C code" section of the file (see section <A HREF="bison.html#SEC14">The Overall Layout of a Bison Grammar</A>).
-For a large project, you would probably have several source files, and use
-<CODE>make</CODE> to arrange to recompile them.
-With all the source in a single file, you use the following command to
-convert it into a parser file:
-<PRE>
-bison <VAR>file_name</VAR>.y
-</PRE>
-<P>
-In this example the file was called <TT>`rpcalc.y'</TT> (for "Reverse Polish
-CALCulator").  Bison produces a file named <TT>`<VAR>file_name</VAR>.tab.c'</TT>,
-removing the <SAMP>`.y'</SAMP> from the original file name. The file output by
-Bison contains the source code for <CODE>yyparse</CODE>.  The additional
-functions in the input file (<CODE>yylex</CODE>, <CODE>yyerror</CODE> and <CODE>main</CODE>)
-are copied verbatim to the output.
-<H3><A NAME="SEC26" HREF="bison.html#TOC26">Compiling the Parser File</A></H3>
-<P>
-<A NAME="IDX40"></A>
-Here is how to compile and run the parser file:
-<PRE>
-# List files in current directory.
-% ls
-rpcalc.tab.c  rpcalc.y
-# Compile the Bison parser.
-# <SAMP>`-lm'</SAMP> tells compiler to search math library for <CODE>pow</CODE>.
-% cc rpcalc.tab.c -lm -o rpcalc
-# List files again.
-% ls
-rpcalc  rpcalc.tab.c  rpcalc.y
-</PRE>
-<P>
-The file <TT>`rpcalc'</TT> now contains the executable code.  Here is an
-example session using <CODE>rpcalc</CODE>.
-<PRE>
-% rpcalc
-4 9 +
-13
-3 7 + 3 4 5 *+-
--13
-3 7 + 3 4 5 * + - n              Note the unary minus, <SAMP>`n'</SAMP>
-13
-5 6 / 4 n +
--3.166666667
-3 4 ^                            Exponentiation
-81
-^D                               End-of-file indicator
-%
-</PRE>
-<P>
-<H2><A NAME="SEC27" HREF="bison.html#TOC27">Infix Notation Calculator: <CODE>calc</CODE></A></H2>
-<P>
-<A NAME="IDX41"></A>
-<A NAME="IDX42"></A>
-<A NAME="IDX43"></A>
-We now modify rpcalc to handle infix operators instead of postfix.  Infix
-notation involves the concept of operator precedence and the need for
-parentheses nested to arbitrary depth.  Here is the Bison code for
-<TT>`calc.y'</TT>, an infix desk-top calculator.
-<PRE>
-/* Infix notation calculator--calc */
-%{
-#define YYSTYPE double
-#include &#60;math.h&#62;
-%}
-/* BISON Declarations */
-%token NUM
-%left '-' '+'
-%left '*' '/'
-%left NEG     /* negation--unary minus */
-%right '^'    /* exponentiation        */
-/* Grammar follows */
-%%
-input:    /* empty string */
-        | input line
-;
-line:     '\n'
-        | exp '\n'  { printf ("\t%.10g\n", $1); }
-;
-exp:      NUM                { $$ = $1;         }
-        | exp '+' exp        { $$ = $1 + $3;    }
-        | exp '-' exp        { $$ = $1 - $3;    }
-        | exp '*' exp        { $$ = $1 * $3;    }
-        | exp '/' exp        { $$ = $1 / $3;    }
-        | '-' exp  %prec NEG { $$ = -$2;        }
-        | exp '^' exp        { $$ = pow ($1, $3); }
-        | '(' exp ')'        { $$ = $2;         }
-;
-%%
-</PRE>
-<P>
-The functions <CODE>yylex</CODE>, <CODE>yyerror</CODE> and <CODE>main</CODE> can be the same
-as before.
-There are two important new features shown in this code.
-In the second section (Bison declarations), <CODE>%left</CODE> declares token
-types and says they are left-associative operators.  The declarations
-<CODE>%left</CODE> and <CODE>%right</CODE> (right associativity) take the place of
-<CODE>%token</CODE> which is used to declare a token type name without
-associativity.  (These tokens are single-character literals, which
-ordinarily don't need to be declared.  We declare them here to specify
-the associativity.)
-Operator precedence is determined by the line ordering of the
-declarations; the higher the line number of the declaration (lower on
-the page or screen), the higher the precedence.  Hence, exponentiation
-has the highest precedence, unary minus (<CODE>NEG</CODE>) is next, followed
-by <SAMP>`*'</SAMP> and <SAMP>`/'</SAMP>, and so on.  See section <A HREF="bison.html#SEC71">Operator Precedence</A>.
-The other important new feature is the <CODE>%prec</CODE> in the grammar section
-for the unary minus operator.  The <CODE>%prec</CODE> simply instructs Bison that
-the rule <SAMP>`| '-' exp'</SAMP> has the same precedence as <CODE>NEG</CODE>---in this
-case the next-to-highest.  See section <A HREF="bison.html#SEC76">Context-Dependent Precedence</A>.
-Here is a sample run of <TT>`calc.y'</TT>:
-<PRE>
-% calc
-4 + 4.5 - (34/(8*3+-3))
-6.880952381
--56 + 2
--54
-3 ^ 2
-9
-</PRE>
-<P>
-<H2><A NAME="SEC28" HREF="bison.html#TOC28">Simple Error Recovery</A></H2>
-<P>
-<A NAME="IDX44"></A>
-Up to this point, this manual has not addressed the issue of <EM>error
-recovery</EM>---how to continue parsing after the parser detects a syntax
-error.  All we have handled is error reporting with <CODE>yyerror</CODE>.  Recall
-that by default <CODE>yyparse</CODE> returns after calling <CODE>yyerror</CODE>.  This
-means that an erroneous input line causes the calculator program to exit.
-Now we show how to rectify this deficiency.
-The Bison language itself includes the reserved word <CODE>error</CODE>, which
-may be included in the grammar rules.  In the example below it has
-been added to one of the alternatives for <CODE>line</CODE>:
-<PRE>
-line:     '\n'
-        | exp '\n'   { printf ("\t%.10g\n", $1); }
-        | error '\n' { yyerrok;                  }
-;
-</PRE>
-<P>
-This addition to the grammar allows for simple error recovery in the event
-of a parse error.  If an expression that cannot be evaluated is read, the
-error will be recognized by the third rule for <CODE>line</CODE>, and parsing
-will continue.  (The <CODE>yyerror</CODE> function is still called upon to print
-its message as well.)  The action executes the statement <CODE>yyerrok</CODE>, a
-macro defined automatically by Bison; its meaning is that error recovery is
-complete (see section <A HREF="bison.html#SEC81">Error Recovery</A>).  Note the difference between
-<CODE>yyerrok</CODE> and <CODE>yyerror</CODE>; neither one is a misprint.
-This form of error recovery deals with syntax errors.  There are other
-kinds of errors; for example, division by zero, which raises an exception
-signal that is normally fatal.  A real calculator program must handle this
-signal and use <CODE>longjmp</CODE> to return to <CODE>main</CODE> and resume parsing
-input lines; it would also have to discard the rest of the current line of
-input.  We won't discuss this issue further because it is not specific to
-Bison programs.
-<H2><A NAME="SEC29" HREF="bison.html#TOC29">Multi-Function Calculator: <CODE>mfcalc</CODE></A></H2>
-<P>
-<A NAME="IDX45"></A>
-<A NAME="IDX46"></A>
-<A NAME="IDX47"></A>
-Now that the basics of Bison have been discussed, it is time to move on to
-a more advanced problem.  The above calculators provided only five
-functions, <SAMP>`+'</SAMP>, <SAMP>`-'</SAMP>, <SAMP>`*'</SAMP>, <SAMP>`/'</SAMP> and <SAMP>`^'</SAMP>.  It would
-be nice to have a calculator that provides other mathematical functions such
-as <CODE>sin</CODE>, <CODE>cos</CODE>, etc.
-It is easy to add new operators to the infix calculator as long as they are
-only single-character literals.  The lexical analyzer <CODE>yylex</CODE> passes
-back all non-number characters as tokens, so new grammar rules suffice for
-adding a new operator.  But we want something more flexible: built-in
-functions whose syntax has this form:
-<PRE>
-<VAR>function_name</VAR> (<VAR>argument</VAR>)
-</PRE>
-<P>
-At the same time, we will add memory to the calculator, by allowing you
-to create named variables, store values in them, and use them later.
-Here is a sample session with the multi-function calculator:
-<PRE>
-% mfcalc
-pi = 3.141592653589
-3.1415926536
-sin(pi)
-0.0000000000
-alpha = beta1 = 2.3
-2.3000000000
-alpha
-2.3000000000
-ln(alpha)
-0.8329091229
-exp(ln(beta1))
-2.3000000000
-%
-</PRE>
-<P>
-Note that multiple assignment and nested function calls are permitted.
-<H3><A NAME="SEC30" HREF="bison.html#TOC30">Declarations for <CODE>mfcalc</CODE></A></H3>
-<P>
-Here are the C and Bison declarations for the multi-function calculator.
-<PRE>
-%{
-#include &#60;math.h&#62;  /* For math functions, cos(), sin(), etc. */
-#include "calc.h"  /* Contains definition of `symrec'        */
-%}
-%union {
-double     val;  /* For returning numbers.                   */
-symrec  *tptr;   /* For returning symbol-table pointers      */
-}
-%token &#60;val&#62;  NUM        /* Simple double precision number   */
-%token &#60;tptr&#62; VAR FNCT   /* Variable and Function            */
-%type  &#60;val&#62;  exp
-%right '='
-%left '-' '+'
-%left '*' '/'
-%left NEG     /* Negation--unary minus */
-%right '^'    /* Exponentiation        */
-/* Grammar follows */
-%%
-</PRE>
-<P>
-The above grammar introduces only two new features of the Bison language.
-These features allow semantic values to have various data types
-(see section <A HREF="bison.html#SEC45">More Than One Value Type</A>).
-The <CODE>%union</CODE> declaration specifies the entire list of possible types;
-this is instead of defining <CODE>YYSTYPE</CODE>.  The allowable types are now
-double-floats (for <CODE>exp</CODE> and <CODE>NUM</CODE>) and pointers to entries in
-the symbol table.  See section <A HREF="bison.html#SEC52">The Collection of Value Types</A>.
-Since values can now have various types, it is necessary to associate a
-type with each grammar symbol whose semantic value is used.  These symbols
-are <CODE>NUM</CODE>, <CODE>VAR</CODE>, <CODE>FNCT</CODE>, and <CODE>exp</CODE>.  Their
-declarations are augmented with information about their data type (placed
-between angle brackets).
-The Bison construct <CODE>%type</CODE> is used for declaring nonterminal symbols,
-just as <CODE>%token</CODE> is used for declaring token types.  We have not used
-<CODE>%type</CODE> before because nonterminal symbols are normally declared
-implicitly by the rules that define them.  But <CODE>exp</CODE> must be declared
-explicitly so we can specify its value type.  See section <A HREF="bison.html#SEC53">Nonterminal Symbols</A>.
-<H3><A NAME="SEC31" HREF="bison.html#TOC31">Grammar Rules for <CODE>mfcalc</CODE></A></H3>
-<P>
-Here are the grammar rules for the multi-function calculator.
-Most of them are copied directly from <CODE>calc</CODE>; three rules,
-those which mention <CODE>VAR</CODE> or <CODE>FNCT</CODE>, are new.
-<PRE>
-input:   /* empty */
-        | input line
-;
-line:
-          '\n'
-        | exp '\n'   { printf ("\t%.10g\n", $1); }
-        | error '\n' { yyerrok;                  }
-;
-exp:      NUM                { $$ = $1;                         }
-        | VAR                { $$ = $1-&#62;value.var;              }
-        | VAR '=' exp        { $$ = $3; $1-&#62;value.var = $3;     }
-        | FNCT '(' exp ')'   { $$ = (*($1-&#62;value.fnctptr))($3); }
-        | exp '+' exp        { $$ = $1 + $3;                    }
-        | exp '-' exp        { $$ = $1 - $3;                    }
-        | exp '*' exp        { $$ = $1 * $3;                    }
-        | exp '/' exp        { $$ = $1 / $3;                    }
-        | '-' exp  %prec NEG { $$ = -$2;                        }
-        | exp '^' exp        { $$ = pow ($1, $3);               }
-        | '(' exp ')'        { $$ = $2;                         }
-;
-/* End of grammar */
-%%
-</PRE>
-<P>
-<H3><A NAME="SEC32" HREF="bison.html#TOC32">The <CODE>mfcalc</CODE> Symbol Table</A></H3>
-<P>
-<A NAME="IDX48"></A>
-The multi-function calculator requires a symbol table to keep track of the
-names and meanings of variables and functions.  This doesn't affect the
-grammar rules (except for the actions) or the Bison declarations, but it
-requires some additional C functions for support.
-The symbol table itself consists of a linked list of records.  Its
-definition, which is kept in the header <TT>`calc.h'</TT>, is as follows.  It
-provides for either functions or variables to be placed in the table.
-<PRE>
-/* Data type for links in the chain of symbols.      */
-struct symrec
-{
-  char *name;  /* name of symbol                     */
-  int type;    /* type of symbol: either VAR or FNCT */
-  union {
-    double var;           /* value of a VAR          */
-    double (*fnctptr)();  /* value of a FNCT         */
-  } value;
-  struct symrec *next;    /* link field              */
-};
-typedef struct symrec symrec;
-/* The symbol table: a chain of `struct symrec'.     */
-extern symrec *sym_table;
-symrec *putsym ();
-symrec *getsym ();
-</PRE>
-<P>
-The new version of <CODE>main</CODE> includes a call to <CODE>init_table</CODE>, a
-function that initializes the symbol table.  Here it is, and
-<CODE>init_table</CODE> as well:
-<PRE>
-#include &#60;stdio.h&#62;
-main ()
-{
-  init_table ();
-  yyparse ();
-}
-yyerror (s)  /* Called by yyparse on error */
-     char *s;
-{
-  printf ("%s\n", s);
-}
-struct init
-{
-  char *fname;
-  double (*fnct)();
-};
-struct init arith_fncts[]
-  = {
-      "sin", sin,
-      "cos", cos,
-      "atan", atan,
-      "ln", log,
-      "exp", exp,
-      "sqrt", sqrt,
-      0, 0
-    };
-/* The symbol table: a chain of `struct symrec'.  */
-symrec *sym_table = (symrec *)0;
-init_table ()  /* puts arithmetic functions in table. */
-{
-  int i;
-  symrec *ptr;
-  for (i = 0; arith_fncts[i].fname != 0; i++)
-    {
-      ptr = putsym (arith_fncts[i].fname, FNCT);
-      ptr-&#62;value.fnctptr = arith_fncts[i].fnct;
-    }
-}
-</PRE>
-<P>
-By simply editing the initialization list and adding the necessary include
-files, you can add additional functions to the calculator.
-Two important functions allow look-up and installation of symbols in the
-symbol table.  The function <CODE>putsym</CODE> is passed a name and the type
-(<CODE>VAR</CODE> or <CODE>FNCT</CODE>) of the object to be installed.  The object is
-linked to the front of the list, and a pointer to the object is returned.
-The function <CODE>getsym</CODE> is passed the name of the symbol to look up.  If
-found, a pointer to that symbol is returned; otherwise zero is returned.
-<PRE>
-symrec *
-putsym (sym_name,sym_type)
-     char *sym_name;
-     int sym_type;
-{
-  symrec *ptr;
-  ptr = (symrec *) malloc (sizeof (symrec));
-  ptr-&#62;name = (char *) malloc (strlen (sym_name) + 1);
-  strcpy (ptr-&#62;name,sym_name);
-  ptr-&#62;type = sym_type;
-  ptr-&#62;value.var = 0; /* set value to 0 even if fctn.  */
-  ptr-&#62;next = (struct symrec *)sym_table;
-  sym_table = ptr;
-  return ptr;
-}
-symrec *
-getsym (sym_name)
-     char *sym_name;
-{
-  symrec *ptr;
-  for (ptr = sym_table; ptr != (symrec *) 0;
-       ptr = (symrec *)ptr-&#62;next)
-    if (strcmp (ptr-&#62;name,sym_name) == 0)
-      return ptr;
-  return 0;
-}
-</PRE>
-<P>
-The function <CODE>yylex</CODE> must now recognize variables, numeric values, and
-the single-character arithmetic operators.  Strings of alphanumeric
-characters with a leading nondigit are recognized as either variables or
-functions depending on what the symbol table says about them.
-The string is passed to <CODE>getsym</CODE> for look up in the symbol table.  If
-the name appears in the table, a pointer to its location and its type
-(<CODE>VAR</CODE> or <CODE>FNCT</CODE>) is returned to <CODE>yyparse</CODE>.  If it is not
-already in the table, then it is installed as a <CODE>VAR</CODE> using
-<CODE>putsym</CODE>.  Again, a pointer and its type (which must be <CODE>VAR</CODE>) is
-returned to <CODE>yyparse</CODE>.
-No change is needed in the handling of numeric values and arithmetic
-operators in <CODE>yylex</CODE>.
-<PRE>
-#include &#60;ctype.h&#62;
-yylex ()
-{
-  int c;
-  /* Ignore whitespace, get first nonwhite character.  */
-  while ((c = getchar ()) == ' ' || c == '\t');
-  if (c == EOF)
-    return 0;
-  /* Char starts a number =&#62; parse the number.         */
-  if (c == '.' || isdigit (c))
-    {
-      ungetc (c, stdin);
-      scanf ("%lf", &#38;yylval.val);
-      return NUM;
-    }
-  /* Char starts an identifier =&#62; read the name.       */
-  if (isalpha (c))
-    {
-      symrec *s;
-      static char *symbuf = 0;
-      static int length = 0;
-      int i;
-      /* Initially make the buffer long enough
-         for a 40-character symbol name.  */
-      if (length == 0)
-        length = 40, symbuf = (char *)malloc (length + 1);
-      i = 0;
-      do
-        {
-          /* If buffer is full, make it bigger.        */
-          if (i == length)
-            {
-              length *= 2;
-              symbuf = (char *)realloc (symbuf, length + 1);
-            }
-          /* Add this character to the buffer.         */
-          symbuf[i++] = c;
-          /* Get another character.                    */
-          c = getchar ();
-        }
-      while (c != EOF &#38;&#38; isalnum (c));
-      ungetc (c, stdin);
-      symbuf[i] = '\0';
-      s = getsym (symbuf);
-      if (s == 0)
-        s = putsym (symbuf, VAR);
-      yylval.tptr = s;
-      return s-&#62;type;
-    }
-  /* Any other character is a token by itself.        */
-  return c;
-}
-</PRE>
-<P>
-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 predefined
-variables such as <CODE>pi</CODE> or <CODE>e</CODE> as well.
-<H2><A NAME="SEC33" HREF="bison.html#TOC33">Exercises</A></H2>
-<P>
-<A NAME="IDX49"></A>
-<OL>
-<LI>
-Add some new functions from <TT>`math.h'</TT> to the initialization list.
-<LI>
-Add another array that contains constants and their values.  Then
-modify <CODE>init_table</CODE> to add these constants to the symbol table.
-It will be easiest to give the constants type <CODE>VAR</CODE>.
-<LI>
-Make the program report an error if the user refers to an
-uninitialized variable in any way except to store a value in it.
-</OL>
-<P>
-<H1><A NAME="SEC34" HREF="bison.html#TOC34">Bison Grammar Files</A></H1>
-<P>
-Bison takes as input a context-free grammar specification and produces a
-C-language function that recognizes correct instances of the grammar.
-The Bison grammar input file conventionally has a name ending in <SAMP>`.y'</SAMP>.
-<H2><A NAME="SEC35" HREF="bison.html#TOC35">Outline of a Bison Grammar</A></H2>
-<P>
-A Bison grammar file has four main sections, shown here with the
-appropriate delimiters:
-<PRE>
-%{
-<VAR>C declarations</VAR>
-%}
-<VAR>Bison declarations</VAR>
-%%
-<VAR>Grammar rules</VAR>
-%%
-<VAR>Additional C code</VAR>
-</PRE>
-<P>
-Comments enclosed in <SAMP>`/* ... */'</SAMP> may appear in any of the sections.
-<H3><A NAME="SEC36" HREF="bison.html#TOC36">The C Declarations Section</A></H3>
-<P>
-<A NAME="IDX50"></A>
-<A NAME="IDX51"></A>
-The <VAR>C declarations</VAR> section contains macro definitions and
-declarations of functions and variables that are used in the actions in the
-grammar rules.  These are copied to the beginning of the parser file so
-that they precede the definition of <CODE>yyparse</CODE>.  You can use
-<SAMP>`#include'</SAMP> to get the declarations from a header file.  If you don't
-need any C declarations, you may omit the <SAMP>`%{'</SAMP> and <SAMP>`%}'</SAMP>
-delimiters that bracket this section.
-<H3><A NAME="SEC37" HREF="bison.html#TOC37">The Bison Declarations Section</A></H3>
-<P>
-<A NAME="IDX52"></A>
-<A NAME="IDX53"></A>
-The <VAR>Bison declarations</VAR> section contains declarations that define
-terminal and nonterminal symbols, specify precedence, and so on.
-In some simple grammars you may not need any declarations.
-See section <A HREF="bison.html#SEC49">Bison Declarations</A>.
-<H3><A NAME="SEC38" HREF="bison.html#TOC38">The Grammar Rules Section</A></H3>
-<P>
-<A NAME="IDX54"></A>
-<A NAME="IDX55"></A>
-The <EM>grammar rules</EM> section contains one or more Bison grammar
-rules, and nothing else.  See section <A HREF="bison.html#SEC41">Syntax of Grammar Rules</A>.
-There must always be at least one grammar rule, and the first
-<SAMP>`%%'</SAMP> (which precedes the grammar rules) may never be omitted even
-if it is the first thing in the file.
-<H3><A NAME="SEC39" HREF="bison.html#TOC39">The Additional C Code Section</A></H3>
-<P>
-<A NAME="IDX56"></A>
-<A NAME="IDX57"></A>
-The <VAR>additional C code</VAR> section is copied verbatim to the end of
-the parser file, just as the <VAR>C declarations</VAR> section is copied to
-the beginning.  This is the most convenient place to put anything
-that you want to have in the parser file but which need not come before
-the definition of <CODE>yyparse</CODE>.  For example, the definitions of
-<CODE>yylex</CODE> and <CODE>yyerror</CODE> often go here.  See section <A HREF="bison.html#SEC59">Parser C-Language Interface</A>.
-If the last section is empty, you may omit the <SAMP>`%%'</SAMP> that separates it
-from the grammar rules.
-The Bison parser itself contains many static variables whose names start
-with <SAMP>`yy'</SAMP> and many macros whose names start with <SAMP>`YY'</SAMP>.  It is a
-good idea to avoid using any such names (except those documented in this
-manual) in the additional C code section of the grammar file.
-<H2><A NAME="SEC40" HREF="bison.html#TOC40">Symbols, Terminal and Nonterminal</A></H2>
-<P>
-<A NAME="IDX58"></A>
-<A NAME="IDX59"></A>
-<A NAME="IDX60"></A>
-<A NAME="IDX61"></A>
-<EM>Symbols</EM> in Bison grammars represent the grammatical classifications
-of the language.
-A <EM>terminal symbol</EM> (also known as a <EM>token type</EM>) represents a
-class of syntactically equivalent tokens.  You use the symbol in grammar
-rules to mean that a token in that class is allowed.  The symbol is
-represented in the Bison parser by a numeric code, and the <CODE>yylex</CODE>
-function returns a token type code to indicate what kind of token has been
-read.  You don't need to know what the code value is; you can use the
-symbol to stand for it.
-A <EM>nonterminal symbol</EM> stands for a class of syntactically equivalent
-groupings.  The symbol name is used in writing grammar rules.  By convention,
-it should be all lower case.
-Symbol names can contain letters, digits (not at the beginning),
-underscores and periods.  Periods make sense only in nonterminals.
-There are two ways of writing terminal symbols in the grammar:
-<UL>
-<LI>
-A <EM>named token type</EM> is written with an identifier, like an
-identifier in C.  By convention, it should be all upper case.  Each
-such name must be defined with a Bison declaration such as
-<CODE>%token</CODE>.  See section <A HREF="bison.html#SEC50">Token Type Names</A>.
-<LI>
-<A NAME="IDX62"></A>
-<A NAME="IDX63"></A>
-<A NAME="IDX64"></A>
-A <EM>character token type</EM> (or <EM>literal token</EM>) is written in
-the grammar using the same syntax used in C for character constants;
-for example, <CODE>'+'</CODE> is a character token type.  A character token
-type doesn't need to be declared unless you need to specify its
-semantic value data type (see section <A HREF="bison.html#SEC44">Data Types of Semantic Values</A>), associativity, or
-precedence (see section <A HREF="bison.html#SEC71">Operator Precedence</A>).
-By convention, a character token type is used only to represent a
-token that consists of that particular character.  Thus, the token
-type <CODE>'+'</CODE> is used to represent the character <SAMP>`+'</SAMP> as a
-token.  Nothing enforces this convention, but if you depart from it,
-your program will confuse other readers.
-All the usual escape sequences used in character literals in C can be
-used in Bison as well, but you must not use the null character as a
-character literal because its ASCII code, zero, is the code
-<CODE>yylex</CODE> returns for end-of-input (see section <A HREF="bison.html#SEC62">Calling Convention for <CODE>yylex</CODE></A>).
-</UL>
-<P>
-How you choose to write a terminal symbol has no effect on its
-grammatical meaning.  That depends only on where it appears in rules and
-on when the parser function returns that symbol.
-The value returned by <CODE>yylex</CODE> is always one of the terminal symbols
-(or 0 for end-of-input).  Whichever way you write the token type in the
-grammar rules, you write it the same way in the definition of <CODE>yylex</CODE>.
-The numeric code for a character token type is simply the ASCII code for
-the character, so <CODE>yylex</CODE> can use the identical character constant to
-generate the requisite code.  Each named token type becomes a C macro in
-the parser file, so <CODE>yylex</CODE> can use the name to stand for the code.
-(This is why periods don't make sense in terminal symbols.)  
-See section <A HREF="bison.html#SEC62">Calling Convention for <CODE>yylex</CODE></A>.
-If <CODE>yylex</CODE> is defined in a separate file, you need to arrange for the
-token-type macro definitions to be available there.  Use the <SAMP>`-d'</SAMP>
-option when you run Bison, so that it will write these macro definitions
-into a separate header file <TT>`<VAR>name</VAR>.tab.h'</TT> which you can include
-in the other source files that need it.  See section <A HREF="bison.html#SEC87">Invoking Bison</A>.
-The symbol <CODE>error</CODE> is a terminal symbol reserved for error recovery
-(see section <A HREF="bison.html#SEC81">Error Recovery</A>); you shouldn't use it for any other purpose.
-In particular, <CODE>yylex</CODE> should never return this value.
-<H2><A NAME="SEC41" HREF="bison.html#TOC41">Syntax of Grammar Rules</A></H2>
-<P>
-<A NAME="IDX65"></A>
-<A NAME="IDX66"></A>
-<A NAME="IDX67"></A>
-A Bison grammar rule has the following general form:
-<PRE>
-<VAR>result</VAR>: <VAR>components</VAR>...
-        ;
-</PRE>
-<P>
-where <VAR>result</VAR> is the nonterminal symbol that this rule describes
-and <VAR>components</VAR> are various terminal and nonterminal symbols that
-are put together by this rule (see section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>).  
-For example,
-<PRE>
-exp:      exp '+' exp
-        ;
-</PRE>
-<P>
-says that two groupings of type <CODE>exp</CODE>, with a <SAMP>`+'</SAMP> token in between,
-can be combined into a larger grouping of type <CODE>exp</CODE>.
-Whitespace in rules is significant only to separate symbols.  You can add
-extra whitespace as you wish.
-Scattered among the components can be <VAR>actions</VAR> that determine
-the semantics of the rule.  An action looks like this:
-<PRE>
-{<VAR>C statements</VAR>}
-</PRE>
-<P>
-Usually there is only one action and it follows the components.
-See section <A HREF="bison.html#SEC46">Actions</A>.
-<A NAME="IDX68"></A>
-Multiple rules for the same <VAR>result</VAR> can be written separately or can
-be joined with the vertical-bar character <SAMP>`|'</SAMP> as follows:
-<PRE>
-<VAR>result</VAR>:    <VAR>rule1-components</VAR>...
-        | <VAR>rule2-components</VAR>...
-        ...
-        ;
-</PRE>
-<P>
-They are still considered distinct rules even when joined in this way.
-If <VAR>components</VAR> in a rule is empty, it means that <VAR>result</VAR> can
-match the empty string.  For example, here is how to define a
-comma-separated sequence of zero or more <CODE>exp</CODE> groupings:
-<PRE>
-expseq:   /* empty */
-        | expseq1
-        ;
-expseq1:  exp
-        | expseq1 ',' exp
-        ;
-</PRE>
-<P>
-It is customary to write a comment <SAMP>`/* empty */'</SAMP> in each rule
-with no components.
-<H2><A NAME="SEC42" HREF="bison.html#TOC42">Recursive Rules</A></H2>
-<P>
-<A NAME="IDX69"></A>
-A rule is called <EM>recursive</EM> when its <VAR>result</VAR> nonterminal appears
-also on its right hand side.  Nearly all Bison grammars need to use
-recursion, because that is the only way to define a sequence of any number
-of somethings.  Consider this recursive definition of a comma-separated
-sequence of one or more expressions:
-<PRE>
-expseq1:  exp
-        | expseq1 ',' exp
-        ;
-</PRE>
-<P>
-<A NAME="IDX70"></A>
-<A NAME="IDX71"></A>
-Since the recursive use of <CODE>expseq1</CODE> is the leftmost symbol in the
-right hand side, we call this <EM>left recursion</EM>.  By contrast, here
-the same construct is defined using <EM>right recursion</EM>:
-<PRE>
-expseq1:  exp
-        | exp ',' expseq1
-        ;
-</PRE>
-<P>
-Any kind of sequence can be defined using either left recursion or
-right recursion, but you should always use left recursion, because it
-can parse a sequence of any number of elements with bounded stack
-space.  Right recursion uses up space on the Bison stack in proportion
-to the number of elements in the sequence, because all the elements
-must be shifted onto the stack before the rule can be applied even
-once.  See section <A HREF="bison.html#SEC68">The Bison Parser Algorithm</A>, for
-further explanation of this.
-<A NAME="IDX72"></A>
-<EM>Indirect</EM> or <EM>mutual</EM> recursion occurs when the result of the
-rule does not appear directly on its right hand side, but does appear
-in rules for other nonterminals which do appear on its right hand
-side.  
-For example:
-<PRE>
-expr:     primary
-        | primary '+' primary
-        ;
-primary:  constant
-        | '(' expr ')'
-        ;
-</PRE>
-<P>
-defines two mutually-recursive nonterminals, since each refers to the
-other.
-<H2><A NAME="SEC43" HREF="bison.html#TOC43">Defining Language Semantics</A></H2>
-<P>
-<A NAME="IDX73"></A>
-<A NAME="IDX74"></A>
-The grammar rules for a language determine only the syntax.  The semantics
-are determined by the semantic values associated with various tokens and
-groupings, and by the actions taken when various groupings are recognized.
-For example, the calculator calculates properly because the value
-associated with each expression is the proper number; it adds properly
-because the action for the grouping <SAMP>`<VAR>x</VAR> + <VAR>y</VAR>'</SAMP> is to add
-the numbers associated with <VAR>x</VAR> and <VAR>y</VAR>.
-<H3><A NAME="SEC44" HREF="bison.html#TOC44">Data Types of Semantic Values</A></H3>
-<P>
-<A NAME="IDX75"></A>
-<A NAME="IDX76"></A>
-<A NAME="IDX77"></A>
-<A NAME="IDX78"></A>
-In a simple program it may be sufficient to use the same data type for
-the semantic values of all language constructs.  This was true in the
-RPN and infix calculator examples (see section <A HREF="bison.html#SEC16">Reverse Polish Notation Calculator</A>).
-Bison's default is to use type <CODE>int</CODE> for all semantic values.  To
-specify some other type, define <CODE>YYSTYPE</CODE> as a macro, like this:
-<PRE>
-#define YYSTYPE double
-</PRE>
-<P>
-This macro definition must go in the C declarations section of the grammar
-file (see section <A HREF="bison.html#SEC35">Outline of a Bison Grammar</A>).
-<H3><A NAME="SEC45" HREF="bison.html#TOC45">More Than One Value Type</A></H3>
-<P>
-In most programs, you will need different data types for different kinds
-of tokens and groupings.  For example, a numeric constant may need type
-<CODE>int</CODE> or <CODE>long</CODE>, while a string constant needs type <CODE>char *</CODE>,
-and an identifier might need a pointer to an entry in the symbol table.
-To use more than one data type for semantic values in one parser, Bison
-requires you to do two things:
-<UL>
-<LI>
-Specify the entire collection of possible data types, with the
-<CODE>%union</CODE> Bison declaration (see section <A HREF="bison.html#SEC52">The Collection of Value Types</A>).
-<LI>
-Choose one of those types for each symbol (terminal or nonterminal)
-for which semantic values are used.  This is done for tokens with the
-<CODE>%token</CODE> Bison declaration (see section <A HREF="bison.html#SEC50">Token Type Names</A>) and for groupings
-with the <CODE>%type</CODE> Bison declaration (see section <A HREF="bison.html#SEC53">Nonterminal Symbols</A>).
-</UL>
-<P>
-<H3><A NAME="SEC46" HREF="bison.html#TOC46">Actions</A></H3>
-<P>
-<A NAME="IDX79"></A>
-<A NAME="IDX80"></A>
-<A NAME="IDX81"></A>
-An action accompanies a syntactic rule and contains C code to be executed
-each time an instance of that rule is recognized.  The task of most actions
-is to compute a semantic value for the grouping built by the rule from the
-semantic values associated with tokens or smaller groupings.
-An action consists of C statements surrounded by braces, much like a
-compound statement in C.  It can be placed at any position in the rule; it
-is executed at that position.  Most rules have just one action at the end
-of the rule, following all the components.  Actions in the middle of a rule
-are tricky and used only for special purposes (see section <A HREF="bison.html#SEC48">Actions in Mid-Rule</A>).
-The C code in an action can refer to the semantic values of the components
-matched by the rule with the construct <CODE>$<VAR>n</VAR></CODE>, which stands for
-the value of the <VAR>n</VAR>th component.  The semantic value for the grouping
-being constructed is <CODE>$$</CODE>.  (Bison translates both of these constructs
-into array element references when it copies the actions into the parser
-file.)
-Here is a typical example:
-<PRE>
-exp:    ...
-        | exp '+' exp
-            { $$ = $1 + $3; }
-</PRE>
-<P>
-This rule constructs an <CODE>exp</CODE> from two smaller <CODE>exp</CODE> groupings
-connected by a plus-sign token.  In the action, <CODE>$1</CODE> and <CODE>$3</CODE>
-refer to the semantic values of the two component <CODE>exp</CODE> groupings,
-which are the first and third symbols on the right hand side of the rule.
-The sum is stored into <CODE>$$</CODE> so that it becomes the semantic value of
-the addition-expression just recognized by the rule.  If there were a
-useful semantic value associated with the <SAMP>`+'</SAMP> token, it could be
-referred to as <CODE>$2</CODE>.
-<A NAME="IDX82"></A>
-If you don't specify an action for a rule, Bison supplies a default:
-<CODE>$$ = $1</CODE>.  Thus, the value of the first symbol in the rule becomes
-the value of the whole rule.  Of course, the default rule is valid only
-if the two data types match.  There is no meaningful default action for
-an empty rule; every empty rule must have an explicit action unless the
-rule's value does not matter.
-<CODE>$<VAR>n</VAR></CODE> with <VAR>n</VAR> zero or negative is allowed for reference
-to tokens and groupings on the stack <EM>before</EM> those that match the
-current rule.  This is a very risky practice, and to use it reliably
-you must be certain of the context in which the rule is applied.  Here
-is a case in which you can use this reliably:
-<PRE>
-foo:      expr bar '+' expr  { ... }
-        | expr bar '-' expr  { ... }
-        ;
-bar:      /* empty */
-        { previous_expr = $0; }
-        ;
-</PRE>
-<P>
-As long as <CODE>bar</CODE> is used only in the fashion shown here, <CODE>$0</CODE>
-always refers to the <CODE>expr</CODE> which precedes <CODE>bar</CODE> in the
-definition of <CODE>foo</CODE>.
-<H3><A NAME="SEC47" HREF="bison.html#TOC47">Data Types of Values in Actions</A></H3>
-<P>
-<A NAME="IDX83"></A>
-<A NAME="IDX84"></A>
-If you have chosen a single data type for semantic values, the <CODE>$$</CODE>
-and <CODE>$<VAR>n</VAR></CODE> constructs always have that data type.
-If you have used <CODE>%union</CODE> to specify a variety of data types, then you
-must declare a choice among these types for each terminal or nonterminal
-symbol that can have a semantic value.  Then each time you use <CODE>$$</CODE> or
-<CODE>$<VAR>n</VAR></CODE>, its data type is determined by which symbol it refers to
-in the rule.  In this example,
-<PRE>
-exp:    ...
-        | exp '+' exp
-            { $$ = $1 + $3; }
-</PRE>
-<P>
-<CODE>$1</CODE> and <CODE>$3</CODE> refer to instances of <CODE>exp</CODE>, so they all
-have the data type declared for the nonterminal symbol <CODE>exp</CODE>.  If
-<CODE>$2</CODE> were used, it would have the data type declared for the
-terminal symbol <CODE>'+'</CODE>, whatever that might be.
-Alternatively, you can specify the data type when you refer to the value,
-by inserting <SAMP>`&#60;<VAR>type</VAR>&#62;'</SAMP> after the <SAMP>`$'</SAMP> at the beginning of the
-reference.  For example, if you have defined types as shown here:
-<PRE>
-%union {
-  int itype;
-  double dtype;
-}
-</PRE>
-<P>
-then you can write <CODE>$&#60;itype&#62;1</CODE> to refer to the first subunit of the
-rule as an integer, or <CODE>$&#60;dtype&#62;1</CODE> to refer to it as a double.
-<H3><A NAME="SEC48" HREF="bison.html#TOC48">Actions in Mid-Rule</A></H3>
-<P>
-<A NAME="IDX85"></A>
-<A NAME="IDX86"></A>
-Occasionally it is useful to put an action in the middle of a rule.
-These actions are written just like usual end-of-rule actions, but they
-are executed before the parser even recognizes the following components.
-A mid-rule action may refer to the components preceding it using
-<CODE>$<VAR>n</VAR></CODE>, but it may not refer to subsequent components because
-it is run before they are parsed.
-The mid-rule action itself counts as one of the components of the rule.
-This makes a difference when there is another action later in the same rule
-(and usually there is another at the end): you have to count the actions
-along with the symbols when working out which number <VAR>n</VAR> to use in
-<CODE>$<VAR>n</VAR></CODE>.
-The mid-rule action can also have a semantic value.  The action can set
-its value with an assignment to <CODE>$$</CODE>, and actions later in the rule
-can refer to the value using <CODE>$<VAR>n</VAR></CODE>.  Since there is no symbol
-to name the action, there is no way to declare a data type for the value
-in advance, so you must use the <SAMP>`$&#60;...&#62;'</SAMP> construct to specify a
-data type each time you refer to this value.
-There is no way to set the value of the entire rule with a mid-rule
-action, because assignments to <CODE>$$</CODE> do not have that effect.  The
-only way to set the value for the entire rule is with an ordinary action
-at the end of the rule.
-Here is an example from a hypothetical compiler, handling a <CODE>let</CODE>
-statement that looks like <SAMP>`let (<VAR>variable</VAR>) <VAR>statement</VAR>'</SAMP> and
-serves to create a variable named <VAR>variable</VAR> temporarily for the
-duration of <VAR>statement</VAR>.  To parse this construct, we must put
-<VAR>variable</VAR> into the symbol table while <VAR>statement</VAR> is parsed, then
-remove it afterward.  Here is how it is done:
-<PRE>
-stmt:   LET '(' var ')'
-                { $&#60;context&#62;$ = push_context ();
-                  declare_variable ($3); }
-        stmt    { $$ = $6;
-                  pop_context ($&#60;context&#62;5); }
-</PRE>
-<P>
-As soon as <SAMP>`let (<VAR>variable</VAR>)'</SAMP> has been recognized, the first
-action is run.  It saves a copy of the current semantic context (the
-list of accessible variables) as its semantic value, using alternative
-<CODE>context</CODE> in the data-type union.  Then it calls
-<CODE>declare_variable</CODE> to add the new variable to that list.  Once the
-first action is finished, the embedded statement <CODE>stmt</CODE> can be
-parsed.  Note that the mid-rule action is component number 5, so the
-<SAMP>`stmt'</SAMP> is component number 6.
-After the embedded statement is parsed, its semantic value becomes the
-value of the entire <CODE>let</CODE>-statement.  Then the semantic value from the
-earlier action is used to restore the prior list of variables.  This
-removes the temporary <CODE>let</CODE>-variable from the list so that it won't
-appear to exist while the rest of the program is parsed.
-Taking action before a rule is completely recognized often leads to
-conflicts since the parser must commit to a parse in order to execute the
-action.  For example, the following two rules, without mid-rule actions,
-can coexist in a working parser because the parser can shift the open-brace
-token and look at what follows before deciding whether there is a
-declaration or not:
-<PRE>
-compound: '{' declarations statements '}'
-        | '{' statements '}'
-        ;
-</PRE>
-<P>
-But when we add a mid-rule action as follows, the rules become nonfunctional:
-<PRE>
-compound: { prepare_for_local_variables (); }
-          '{' declarations statements '}'
-        | '{' statements '}'
-        ;
-</PRE>
-<P>
-Now the parser is forced to decide whether to run the mid-rule action
-when it has read no farther than the open-brace.  In other words, it
-must commit to using one rule or the other, without sufficient
-information to do it correctly.  (The open-brace token is what is called
-the <EM>look-ahead</EM> token at this time, since the parser is still
-deciding what to do about it.  See section <A HREF="bison.html#SEC69">Look-Ahead Tokens</A>.)
-You might think that you could correct the problem by putting identical
-actions into the two rules, like this:
-<PRE>
-compound: { prepare_for_local_variables (); }
-          '{' declarations statements '}'
-        | { prepare_for_local_variables (); }
-          '{' statements '}'
-        ;
-</PRE>
-<P>
-But this does not help, because Bison does not realize that the two actions
-are identical.  (Bison never tries to understand the C code in an action.)
-If the grammar is such that a declaration can be distinguished from a
-statement by the first token (which is true in C), then one solution which
-does work is to put the action after the open-brace, like this:
-<PRE>
-compound: '{' { prepare_for_local_variables (); }
-          declarations statements '}'
-        | '{' statements '}'
-        ;
-</PRE>
-<P>
-Now the first token of the following declaration or statement,
-which would in any case tell Bison which rule to use, can still do so.
-Another solution is to bury the action inside a nonterminal symbol which
-serves as a subroutine:
-<PRE>
-subroutine: /* empty */
-          { prepare_for_local_variables (); }
-        ;
-compound: subroutine
-          '{' declarations statements '}'
-        | subroutine
-          '{' statements '}'
-        ;
-</PRE>
-<P>
-Now Bison can execute the action in the rule for <CODE>subroutine</CODE> without
-deciding which rule for <CODE>compound</CODE> it will eventually use.  Note that
-the action is now at the end of its rule.  Any mid-rule action can be
-converted to an end-of-rule action in this way, and this is what Bison
-actually does to implement mid-rule actions.
-<H2><A NAME="SEC49" HREF="bison.html#TOC49">Bison Declarations</A></H2>
-<P>
-<A NAME="IDX87"></A>
-<A NAME="IDX88"></A>
-The <EM>Bison declarations</EM> section of a Bison grammar defines the symbols
-used in formulating the grammar and the data types of semantic values.
-See section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>.
-All token type names (but not single-character literal tokens such as
-<CODE>'+'</CODE> and <CODE>'*'</CODE>) must be declared.  Nonterminal symbols must be
-declared if you need to specify which data type to use for the semantic
-value (see section <A HREF="bison.html#SEC45">More Than One Value Type</A>).
-The first rule in the file also specifies the start symbol, by default.
-If you want some other symbol to be the start symbol, you must declare
-it explicitly (see section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>).
-<H3><A NAME="SEC50" HREF="bison.html#TOC50">Token Type Names</A></H3>
-<P>
-<A NAME="IDX89"></A>
-<A NAME="IDX90"></A>
-<A NAME="IDX91"></A>
-The basic way to declare a token type name (terminal symbol) is as follows:
-<PRE>
-%token <VAR>name</VAR>
-</PRE>
-<P>
-Bison will convert this into a <CODE>#define</CODE> directive in
-the parser, so that the function <CODE>yylex</CODE> (if it is in this file)
-can use the name <VAR>name</VAR> to stand for this token type's code.
-Alternatively, you can use <CODE>%left</CODE>, <CODE>%right</CODE>, or <CODE>%nonassoc</CODE>
-instead of <CODE>%token</CODE>, if you wish to specify precedence.
-See section <A HREF="bison.html#SEC51">Operator Precedence</A>.
-You can explicitly specify the numeric code for a token type by appending
-an integer value in the field immediately following the token name:
-<PRE>
-%token NUM 300
-</PRE>
-<P>
-It is generally best, however, to let Bison choose the numeric codes for
-all token types.  Bison will automatically select codes that don't conflict
-with each other or with ASCII characters.
-In the event that the stack type is a union, you must augment the
-<CODE>%token</CODE> or other token declaration to include the data type
-alternative delimited by angle-brackets (see section <A HREF="bison.html#SEC45">More Than One Value Type</A>).  
-For example:
-<PRE>
-%union {              /* define stack type */
-  double val;
-  symrec *tptr;
-}
-%token &#60;val&#62; NUM      /* define token NUM and its type */
-</PRE>
-<P>
-<H3><A NAME="SEC51" HREF="bison.html#TOC51">Operator Precedence</A></H3>
-<P>
-<A NAME="IDX92"></A>
-<A NAME="IDX93"></A>
-<A NAME="IDX94"></A>
-Use the <CODE>%left</CODE>, <CODE>%right</CODE> or <CODE>%nonassoc</CODE> declaration to
-declare a token and specify its precedence and associativity, all at
-once.  These are called <EM>precedence declarations</EM>.
-See section <A HREF="bison.html#SEC71">Operator Precedence</A>, for general information on operator precedence.
-The syntax of a precedence declaration is the same as that of
-<CODE>%token</CODE>: either
-<PRE>
-%left <VAR>symbols</VAR>...
-</PRE>
-<P>
-or
-<PRE>
-%left &#60;<VAR>type</VAR>&#62; <VAR>symbols</VAR>...
-</PRE>
-<P>
-And indeed any of these declarations serves the purposes of <CODE>%token</CODE>.
-But in addition, they specify the associativity and relative precedence for
-all the <VAR>symbols</VAR>:
-<UL>
-<LI>
-The associativity of an operator <VAR>op</VAR> determines how repeated uses
-of the operator nest: whether <SAMP>`<VAR>x</VAR> <VAR>op</VAR> <VAR>y</VAR> <VAR>op</VAR>
-<VAR>z</VAR>'</SAMP> is parsed by grouping <VAR>x</VAR> with <VAR>y</VAR> first or by
-grouping <VAR>y</VAR> with <VAR>z</VAR> first.  <CODE>%left</CODE> specifies
-left-associativity (grouping <VAR>x</VAR> with <VAR>y</VAR> first) and
-<CODE>%right</CODE> specifies right-associativity (grouping <VAR>y</VAR> with
-<VAR>z</VAR> first).  <CODE>%nonassoc</CODE> specifies no associativity, which
-means that <SAMP>`<VAR>x</VAR> <VAR>op</VAR> <VAR>y</VAR> <VAR>op</VAR> <VAR>z</VAR>'</SAMP> is
-considered a syntax error.
-<LI>
-The precedence of an operator determines how it nests with other operators.
-All the tokens declared in a single precedence declaration have equal
-precedence and nest together according to their associativity.
-When two tokens declared in different precedence declarations associate,
-the one declared later has the higher precedence and is grouped first.
-</UL>
-<P>
-<H3><A NAME="SEC52" HREF="bison.html#TOC52">The Collection of Value Types</A></H3>
-<P>
-<A NAME="IDX95"></A>
-<A NAME="IDX96"></A>
-<A NAME="IDX97"></A>
-The <CODE>%union</CODE> declaration specifies the entire collection of possible
-data types for semantic values.  The keyword <CODE>%union</CODE> is followed by a
-pair of braces containing the same thing that goes inside a <CODE>union</CODE> in
-C.  
-For example:
-<PRE>
-%union {
-  double val;
-  symrec *tptr;
-}
-</PRE>
-<P>
-This says that the two alternative types are <CODE>double</CODE> and <CODE>symrec
-*</CODE>.  They are given names <CODE>val</CODE> and <CODE>tptr</CODE>; these names are used
-in the <CODE>%token</CODE> and <CODE>%type</CODE> declarations to pick one of the types
-for a terminal or nonterminal symbol (see section <A HREF="bison.html#SEC53">Nonterminal Symbols</A>).
-Note that, unlike making a <CODE>union</CODE> declaration in C, you do not write
-a semicolon after the closing brace.
-<H3><A NAME="SEC53" HREF="bison.html#TOC53">Nonterminal Symbols</A></H3>
-<P>
-<A NAME="IDX98"></A>
-<A NAME="IDX99"></A>
-<A NAME="IDX100"></A>
-When you use <CODE>%union</CODE> to specify multiple value types, you must
-declare the value type of each nonterminal symbol for which values are
-used.  This is done with a <CODE>%type</CODE> declaration, like this:
-<PRE>
-%type &#60;<VAR>type</VAR>&#62; <VAR>nonterminal</VAR>...
-</PRE>
-<P>
-Here <VAR>nonterminal</VAR> is the name of a nonterminal symbol, and <VAR>type</VAR>
-is the name given in the <CODE>%union</CODE> to the alternative that you want
-(see section <A HREF="bison.html#SEC52">The Collection of Value Types</A>).  You can give any number of nonterminal symbols in
-the same <CODE>%type</CODE> declaration, if they have the same value type.  Use
-spaces to separate the symbol names.
-<H3><A NAME="SEC54" HREF="bison.html#TOC54">Suppressing Conflict Warnings</A></H3>
-<P>
-<A NAME="IDX101"></A>
-<A NAME="IDX102"></A>
-<A NAME="IDX103"></A>
-<A NAME="IDX104"></A>
-<A NAME="IDX105"></A>
-Bison normally warns if there are any conflicts in the grammar
-(see section <A HREF="bison.html#SEC70">Shift/Reduce Conflicts</A>), but most real grammars have harmless shift/reduce
-conflicts which are resolved in a predictable way and would be difficult to
-eliminate.  It is desirable to suppress the warning about these conflicts
-unless the number of conflicts changes.  You can do this with the
-<CODE>%expect</CODE> declaration.
-The declaration looks like this:
-<PRE>
-%expect <VAR>n</VAR>
-</PRE>
-<P>
-Here <VAR>n</VAR> is a decimal integer.  The declaration says there should be no
-warning if there are <VAR>n</VAR> shift/reduce conflicts and no reduce/reduce
-conflicts.  The usual warning is given if there are either more or fewer
-conflicts, or if there are any reduce/reduce conflicts.
-In general, using <CODE>%expect</CODE> involves these steps:
-<UL>
-<LI>
-Compile your grammar without <CODE>%expect</CODE>.  Use the <SAMP>`-v'</SAMP> option
-to get a verbose list of where the conflicts occur.  Bison will also
-print the number of conflicts.
-<LI>
-Check each of the conflicts to make sure that Bison's default
-resolution is what you really want.  If not, rewrite the grammar and
-go back to the beginning.
-<LI>
-Add an <CODE>%expect</CODE> declaration, copying the number <VAR>n</VAR> from the
-number which Bison printed.
-</UL>
-<P>
-Now Bison will stop annoying you about the conflicts you have checked, but
-it will warn you again if changes in the grammar result in additional
-conflicts.
-<H3><A NAME="SEC55" HREF="bison.html#TOC55">The Start-Symbol</A></H3>
-<P>
-<A NAME="IDX106"></A>
-<A NAME="IDX107"></A>
-<A NAME="IDX108"></A>
-<A NAME="IDX109"></A>
-Bison assumes by default that the start symbol for the grammar is the first
-nonterminal specified in the grammar specification section.  The programmer
-may override this restriction with the <CODE>%start</CODE> declaration as follows:
-<PRE>
-%start <VAR>symbol</VAR>
-</PRE>
-<P>
-<H3><A NAME="SEC56" HREF="bison.html#TOC56">A Pure (Reentrant) Parser</A></H3>
-<P>
-<A NAME="IDX110"></A>
-<A NAME="IDX111"></A>
-<A NAME="IDX112"></A>
-A <EM>reentrant</EM> program is one which does not alter in the course of
-execution; in other words, it consists entirely of <EM>pure</EM> (read-only)
-code.  Reentrancy is important whenever asynchronous execution is possible;
-for example, a nonreentrant program may not be safe to call from a signal
-handler.  In systems with multiple threads of control, a nonreentrant
-program must be called only within interlocks.
-The Bison parser is not normally a reentrant program, because it uses
-statically allocated variables for communication with <CODE>yylex</CODE>.  These
-variables include <CODE>yylval</CODE> and <CODE>yylloc</CODE>.
-The Bison declaration <CODE>%pure_parser</CODE> says that you want the parser
-to be reentrant.  It looks like this:
-<PRE>
-%pure_parser
-</PRE>
-<P>
-The effect is that the two communication variables become local
-variables in <CODE>yyparse</CODE>, and a different calling convention is used
-for the lexical analyzer function <CODE>yylex</CODE>.  See section <A HREF="bison.html#SEC65">Calling Conventions for Pure Parsers</A>, for the details of this.  The
-variable <CODE>yynerrs</CODE> also becomes local in <CODE>yyparse</CODE>
-(see section <A HREF="bison.html#SEC66">The Error Reporting Function <CODE>yyerror</CODE></A>).
-The convention for calling <CODE>yyparse</CODE> itself is unchanged.
-<H3><A NAME="SEC57" HREF="bison.html#TOC57">Bison Declaration Summary</A></H3>
-<P>
-<A NAME="IDX113"></A>
-<A NAME="IDX114"></A>
-<A NAME="IDX115"></A>
-Here is a summary of all Bison declarations:
-<DL COMPACT>
-<DT><CODE>%union</CODE>
-<DD>
-Declare the collection of data types that semantic values may have
-(see section <A HREF="bison.html#SEC52">The Collection of Value Types</A>).
-<DT><CODE>%token</CODE>
-<DD>
-Declare a terminal symbol (token type name) with no precedence
-or associativity specified (see section <A HREF="bison.html#SEC50">Token Type Names</A>).
-<DT><CODE>%right</CODE>
-<DD>
-Declare a terminal symbol (token type name) that is right-associative
-(see section <A HREF="bison.html#SEC51">Operator Precedence</A>).
-<DT><CODE>%left</CODE>
-<DD>
-Declare a terminal symbol (token type name) that is left-associative
-(see section <A HREF="bison.html#SEC51">Operator Precedence</A>).
-<DT><CODE>%nonassoc</CODE>
-<DD>
-Declare a terminal symbol (token type name) that is nonassociative
-(using it in a way that would be associative is a syntax error)
-(see section <A HREF="bison.html#SEC51">Operator Precedence</A>).
-<DT><CODE>%type</CODE>
-<DD>
-Declare the type of semantic values for a nonterminal symbol
-(see section <A HREF="bison.html#SEC53">Nonterminal Symbols</A>).
-<DT><CODE>%start</CODE>
-<DD>
-Specify the grammar's start symbol (see section <A HREF="bison.html#SEC55">The Start-Symbol</A>).
-<DT><CODE>%expect</CODE>
-<DD>
-Declare the expected number of shift-reduce conflicts
-(see section <A HREF="bison.html#SEC54">Suppressing Conflict Warnings</A>).
-<DT><CODE>%pure_parser</CODE>
-<DD>
-Request a pure (reentrant) parser program (see section <A HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>).
-</DL>
-<P>
-<H2><A NAME="SEC58" HREF="bison.html#TOC58">Multiple Parsers in the Same Program</A></H2>
-<P>
-Most programs that use Bison parse only one language and therefore contain
-only one Bison parser.  But what if you want to parse more than one
-language with the same program?  Then you need to avoid a name conflict
-between different definitions of <CODE>yyparse</CODE>, <CODE>yylval</CODE>, and so on.
-The easy way to do this is to use the option <SAMP>`-p <VAR>prefix</VAR>'</SAMP>
-(see section <A HREF="bison.html#SEC87">Invoking Bison</A>).  This renames the interface functions and
-variables of the Bison parser to start with <VAR>prefix</VAR> instead of
-<SAMP>`yy'</SAMP>.  You can use this to give each parser distinct names that do
-not conflict.
-The precise list of symbols renamed is <CODE>yyparse</CODE>, <CODE>yylex</CODE>,
-<CODE>yyerror</CODE>, <CODE>yynerrs</CODE>, <CODE>yylval</CODE>, <CODE>yychar</CODE> and
-<CODE>yydebug</CODE>.  For example, if you use <SAMP>`-p c'</SAMP>, the names become
-<CODE>cparse</CODE>, <CODE>clex</CODE>, and so on.
-<STRONG>All the other variables and macros associated with Bison are not
-renamed.</STRONG> These others are not global; there is no conflict if the same
-name is used in different parsers.  For example, <CODE>YYSTYPE</CODE> is not
-renamed, but defining this in different ways in different parsers causes
-no trouble (see section <A HREF="bison.html#SEC44">Data Types of Semantic Values</A>).
-The <SAMP>`-p'</SAMP> option works by adding macro definitions to the beginning
-of the parser source file, defining <CODE>yyparse</CODE> as
-<CODE><VAR>prefix</VAR>parse</CODE>, and so on.  This effectively substitutes one
-name for the other in the entire parser file.
-<H1><A NAME="SEC59" HREF="bison.html#TOC59">Parser C-Language Interface</A></H1>
-<P>
-<A NAME="IDX116"></A>
-<A NAME="IDX117"></A>
-The Bison parser is actually a C function named <CODE>yyparse</CODE>.  Here we
-describe the interface conventions of <CODE>yyparse</CODE> and the other
-functions that it needs to use.
-Keep in mind that the parser uses many C identifiers starting with
-<SAMP>`yy'</SAMP> and <SAMP>`YY'</SAMP> for internal purposes.  If you use such an
-identifier (aside from those in this manual) in an action or in additional
-C code in the grammar file, you are likely to run into trouble.
-<H2><A NAME="SEC60" HREF="bison.html#TOC60">The Parser Function <CODE>yyparse</CODE></A></H2>
-<P>
-<A NAME="IDX118"></A>
-You call the function <CODE>yyparse</CODE> to cause parsing to occur.  This
-function reads tokens, executes actions, and ultimately returns when it
-encounters end-of-input or an unrecoverable syntax error.  You can also
-write an action which directs <CODE>yyparse</CODE> to return immediately without
-reading further.
-The value returned by <CODE>yyparse</CODE> is 0 if parsing was successful (return
-is due to end-of-input).
-The value is 1 if parsing failed (return is due to a syntax error).
-In an action, you can cause immediate return from <CODE>yyparse</CODE> by using
-these macros:
-<DL COMPACT>
-<DT><CODE>YYACCEPT</CODE>
-<DD>
-<A NAME="IDX119"></A>
-Return immediately with value 0 (to report success).
-<DT><CODE>YYABORT</CODE>
-<DD>
-<A NAME="IDX120"></A>
-Return immediately with value 1 (to report failure).
-</DL>
-<P>
-<H2><A NAME="SEC61" HREF="bison.html#TOC61">The Lexical Analyzer Function <CODE>yylex</CODE></A></H2>
-<P>
-<A NAME="IDX121"></A>
-<A NAME="IDX122"></A>
-The <EM>lexical analyzer</EM> function, <CODE>yylex</CODE>, recognizes tokens from
-the input stream and returns them to the parser.  Bison does not create
-this function automatically; you must write it so that <CODE>yyparse</CODE> can
-call it.  The function is sometimes referred to as a lexical scanner.
-In simple programs, <CODE>yylex</CODE> is often defined at the end of the Bison
-grammar file.  If <CODE>yylex</CODE> is defined in a separate source file, you
-need to arrange for the token-type macro definitions to be available there.
-To do this, use the <SAMP>`-d'</SAMP> option when you run Bison, so that it will
-write these macro definitions into a separate header file
-<TT>`<VAR>name</VAR>.tab.h'</TT> which you can include in the other source files
-that need it.  See section <A HREF="bison.html#SEC87">Invoking Bison</A>.
-<H3><A NAME="SEC62" HREF="bison.html#TOC62">Calling Convention for <CODE>yylex</CODE></A></H3>
-<P>
-The value that <CODE>yylex</CODE> returns must be the numeric code for the type
-of token it has just found, or 0 for end-of-input.
-When a token is referred to in the grammar rules by a name, that name
-in the parser file becomes a C macro whose definition is the proper
-numeric code for that token type.  So <CODE>yylex</CODE> can use the name
-to indicate that type.  See section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>.
-When a token is referred to in the grammar rules by a character literal,
-the numeric code for that character is also the code for the token type.
-So <CODE>yylex</CODE> can simply return that character code.  The null character
-must not be used this way, because its code is zero and that is what
-signifies end-of-input.
-Here is an example showing these things:
-<PRE>
-yylex ()
-{
-  ...
-  if (c == EOF)     /* Detect end of file. */
-    return 0;
-  ...
-  if (c == '+' || c == '-')
-    return c;      /* Assume token type for `+' is '+'. */
-  ...
-  return INT;      /* Return the type of the token. */
-  ...
-}
-</PRE>
-<P>
-This interface has been designed so that the output from the <CODE>lex</CODE>
-utility can be used without change as the definition of <CODE>yylex</CODE>.
-<H3><A NAME="SEC63" HREF="bison.html#TOC63">Semantic Values of Tokens</A></H3>
-<P>
-<A NAME="IDX123"></A>
-In an ordinary (nonreentrant) parser, the semantic value of the token must
-be stored into the global variable <CODE>yylval</CODE>.  When you are using
-just one data type for semantic values, <CODE>yylval</CODE> has that type.
-Thus, if the type is <CODE>int</CODE> (the default), you might write this in
-<CODE>yylex</CODE>:
-<PRE>
-  ...
-  yylval = value;  /* Put value onto Bison stack. */
-  return INT;      /* Return the type of the token. */
-  ...
-</PRE>
-<P>
-When you are using multiple data types, <CODE>yylval</CODE>'s type is a union
-made from the <CODE>%union</CODE> declaration (see section <A HREF="bison.html#SEC52">The Collection of Value Types</A>).  So when
-you store a token's value, you must use the proper member of the union.
-If the <CODE>%union</CODE> declaration looks like this:
-<PRE>
-%union {
-  int intval;
-  double val;
-  symrec *tptr;
-}
-</PRE>
-<P>
-then the code in <CODE>yylex</CODE> might look like this:
-<PRE>
-  ...
-  yylval.intval = value; /* Put value onto Bison stack. */
-  return INT;          /* Return the type of the token. */
-  ...
-</PRE>
-<P>
-<H3><A NAME="SEC64" HREF="bison.html#TOC64">Textual Positions of Tokens</A></H3>
-<P>
-<A NAME="IDX124"></A>
-If you are using the <SAMP>`@<VAR>n</VAR>'</SAMP>-feature (see section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>) in
-actions to keep track of the textual locations of tokens and groupings,
-then you must provide this information in <CODE>yylex</CODE>.  The function
-<CODE>yyparse</CODE> expects to find the textual location of a token just parsed
-in the global variable <CODE>yylloc</CODE>.  So <CODE>yylex</CODE> must store the
-proper data in that variable.  The value of <CODE>yylloc</CODE> is a structure
-and you need only initialize the members that are going to be used by the
-actions.  The four members are called <CODE>first_line</CODE>,
-<CODE>first_column</CODE>, <CODE>last_line</CODE> and <CODE>last_column</CODE>.  Note that
-the use of this feature makes the parser noticeably slower.
-<A NAME="IDX125"></A>
-The data type of <CODE>yylloc</CODE> has the name <CODE>YYLTYPE</CODE>.
-<H3><A NAME="SEC65" HREF="bison.html#TOC65">Calling Conventions for Pure Parsers</A></H3>
-<P>
-When you use the Bison declaration <CODE>%pure_parser</CODE> to request a
-pure, reentrant parser, the global communication variables <CODE>yylval</CODE>
-and <CODE>yylloc</CODE> cannot be used.  (See section <A HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>.)  In such parsers the two global variables are replaced by
-pointers passed as arguments to <CODE>yylex</CODE>.  You must declare them as
-shown here, and pass the information back by storing it through those
-pointers.
-<PRE>
-yylex (lvalp, llocp)
-     YYSTYPE *lvalp;
-     YYLTYPE *llocp;
-{
-  ...
-  *lvalp = value;  /* Put value onto Bison stack.  */
-  return INT;      /* Return the type of the token.  */
-  ...
-}
-</PRE>
-<P>
-If the grammar file does not use the <SAMP>`@'</SAMP> constructs to refer to
-textual positions, then the type <CODE>YYLTYPE</CODE> will not be defined.  In
-this case, omit the second argument; <CODE>yylex</CODE> will be called with
-only one argument.
-<A NAME="IDX126"></A>
-You can pass parameter information to a reentrant parser in a reentrant
-way.  Define the macro <CODE>YYPARSE_PARAM</CODE> as a variable name.  The
-resulting <CODE>yyparse</CODE> function then accepts one argument, of type
-<CODE>void *</CODE>, with that name.
-When you call <CODE>yyparse</CODE>, pass the address of an object, casting the
-address to <CODE>void *</CODE>.  The grammar actions can refer to the contents
-of the object by casting the pointer value back to its proper type and
-then dereferencing it.  Here's an example.  Write this in the parser:
-<PRE>
-%{
-struct parser_control
-{
-  int nastiness;
-  int randomness;
-};
-#define YYPARSE_PARAM parm
-%}
-</PRE>
-<P>
-Then call the parser like this:
-<PRE>
-struct parser_control
-{
-  int nastiness;
-  int randomness;
-};
-...
-{
-  struct parser_control foo;
-  ...  /* Store proper data in <CODE>foo</CODE>.  */
-  value = yyparse ((void *) &#38;foo);
-  ...
-}
-</PRE>
-<P>
-In the grammar actions, use expressions like this to refer to the data:
-<PRE>
-((struct parser_control *) parm)-&#62;randomness
-</PRE>
-<P>
-<A NAME="IDX127"></A>
-If you wish to pass the additional parameter data to <CODE>yylex</CODE>,
-define the macro <CODE>YYLEX_PARAM</CODE> just like <CODE>YYPARSE_PARAM</CODE>, as
-shown here:
-<PRE>
-%{
-struct parser_control
-{
-  int nastiness;
-  int randomness;
-};
-#define YYPARSE_PARAM parm
-#define YYLEX_PARAM parm
-%}
-</PRE>
-<P>
-You should then define <CODE>yylex</CODE> to accept one additional
-argument--the value of <CODE>parm</CODE>.  (This makes either two or three
-arguments in total, depending on whether an argument of type
-<CODE>YYLTYPE</CODE> is passed.)  You can declare the argument as a pointer to
-the proper object type, or you can declare it as <CODE>void *</CODE> and
-access the contents as shown above.
-<H2><A NAME="SEC66" HREF="bison.html#TOC66">The Error Reporting Function <CODE>yyerror</CODE></A></H2>
-<P>
-<A NAME="IDX128"></A>
-<A NAME="IDX129"></A>
-<A NAME="IDX130"></A>
-<A NAME="IDX131"></A>
-The Bison parser detects a <EM>parse error</EM> or <EM>syntax error</EM>
-whenever it reads a token which cannot satisfy any syntax rule.  A
-action in the grammar can also explicitly proclaim an error, using the
-macro <CODE>YYERROR</CODE> (see section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>).
-The Bison parser expects to report the error by calling an error
-reporting function named <CODE>yyerror</CODE>, which you must supply.  It is
-called by <CODE>yyparse</CODE> whenever a syntax error is found, and it
-receives one argument.  For a parse error, the string is normally
-<CODE>"parse error"</CODE>.
-<A NAME="IDX132"></A>
-If you define the macro <CODE>YYERROR_VERBOSE</CODE> in the Bison declarations
-section (see section <A HREF="bison.html#SEC37">The Bison Declarations Section</A>), then Bison provides a more verbose
-and specific error message string instead of just plain <CODE>"parse
-error"</CODE>.  It doesn't matter what definition you use for
-<CODE>YYERROR_VERBOSE</CODE>, just whether you define it.
-The parser can detect one other kind of error: stack overflow.  This
-happens when the input contains constructions that are very deeply
-nested.  It isn't likely you will encounter this, since the Bison
-parser extends its stack automatically up to a very large limit.  But
-if overflow happens, <CODE>yyparse</CODE> calls <CODE>yyerror</CODE> in the usual
-fashion, except that the argument string is <CODE>"parser stack
-overflow"</CODE>.
-The following definition suffices in simple programs:
-<PRE>
-yyerror (s)
-     char *s;
-{
-  fprintf (stderr, "%s\n", s);
-}
-</PRE>
-<P>
-After <CODE>yyerror</CODE> returns to <CODE>yyparse</CODE>, the latter will attempt
-error recovery if you have written suitable error recovery grammar rules
-(see section <A HREF="bison.html#SEC81">Error Recovery</A>).  If recovery is impossible, <CODE>yyparse</CODE> will
-immediately return 1.
-<A NAME="IDX133"></A>
-The variable <CODE>yynerrs</CODE> contains the number of syntax errors
-encountered so far.  Normally this variable is global; but if you
-request a pure parser (see section <A HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>) then it is a local variable
-which only the actions can access.
-<H2><A NAME="SEC67" HREF="bison.html#TOC67">Special Features for Use in Actions</A></H2>
-<P>
-<A NAME="IDX134"></A>
-<A NAME="IDX135"></A>
-Here is a table of Bison constructs, variables and macros that
-are useful in actions.
-<DL COMPACT>
-<DT><SAMP>`$$'</SAMP>
-<DD>
-Acts like a variable that contains the semantic value for the
-grouping made by the current rule.  See section <A HREF="bison.html#SEC46">Actions</A>.
-<DT><SAMP>`$<VAR>n</VAR>'</SAMP>
-<DD>
-Acts like a variable that contains the semantic value for the
-<VAR>n</VAR>th component of the current rule.  See section <A HREF="bison.html#SEC46">Actions</A>.
-<DT><SAMP>`$&#60;<VAR>typealt</VAR>&#62;$'</SAMP>
-<DD>
-Like <CODE>$$</CODE> but specifies alternative <VAR>typealt</VAR> in the union
-specified by the <CODE>%union</CODE> declaration.  See section <A HREF="bison.html#SEC47">Data Types of Values in Actions</A>.
-<DT><SAMP>`$&#60;<VAR>typealt</VAR>&#62;<VAR>n</VAR>'</SAMP>
-<DD>
-Like <CODE>$<VAR>n</VAR></CODE> but specifies alternative <VAR>typealt</VAR> in the
-union specified by the <CODE>%union</CODE> declaration.  
-See section <A HREF="bison.html#SEC47">Data Types of Values in Actions</A>.
-<DT><SAMP>`YYABORT;'</SAMP>
-<DD>
-Return immediately from <CODE>yyparse</CODE>, indicating failure.
-See section <A HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>.
-<DT><SAMP>`YYACCEPT;'</SAMP>
-<DD>
-Return immediately from <CODE>yyparse</CODE>, indicating success.
-See section <A HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>.
-<DT><SAMP>`YYBACKUP (<VAR>token</VAR>, <VAR>value</VAR>);'</SAMP>
-<DD>
-<A NAME="IDX136"></A>
-Unshift a token.  This macro is allowed only for rules that reduce
-a single value, and only when there is no look-ahead token.
-It installs a look-ahead token with token type <VAR>token</VAR> and
-semantic value <VAR>value</VAR>; then it discards the value that was
-going to be reduced by this rule.
-If the macro is used when it is not valid, such as when there is
-a look-ahead token already, then it reports a syntax error with
-a message <SAMP>`cannot back up'</SAMP> and performs ordinary error
-recovery.
-In either case, the rest of the action is not executed.
-<DT><SAMP>`YYEMPTY'</SAMP>
-<DD>
-<A NAME="IDX137"></A>
-Value stored in <CODE>yychar</CODE> when there is no look-ahead token.
-<DT><SAMP>`YYERROR;'</SAMP>
-<DD>
-<A NAME="IDX138"></A>
-Cause an immediate syntax error.  This statement initiates error
-recovery just as if the parser itself had detected an error; however, it
-does not call <CODE>yyerror</CODE>, and does not print any message.  If you
-want to print an error message, call <CODE>yyerror</CODE> explicitly before
-the <SAMP>`YYERROR;'</SAMP> statement.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><SAMP>`YYRECOVERING'</SAMP>
-<DD>
-This macro stands for an expression that has the value 1 when the parser
-is recovering from a syntax error, and 0 the rest of the time.
-See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><SAMP>`yychar'</SAMP>
-<DD>
-Variable containing the current look-ahead token.  (In a pure parser,
-this is actually a local variable within <CODE>yyparse</CODE>.)  When there is
-no look-ahead token, the value <CODE>YYEMPTY</CODE> is stored in the variable.
-See section <A HREF="bison.html#SEC69">Look-Ahead Tokens</A>.
-<DT><SAMP>`yyclearin;'</SAMP>
-<DD>
-Discard the current look-ahead token.  This is useful primarily in
-error rules.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><SAMP>`yyerrok;'</SAMP>
-<DD>
-Resume generating error messages immediately for subsequent syntax
-errors.  This is useful primarily in error rules.  
-See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><SAMP>`@<VAR>n</VAR>'</SAMP>
-<DD>
-<A NAME="IDX139"></A>
-Acts like a structure variable containing information on the line
-numbers and column numbers of the <VAR>n</VAR>th component of the current
-rule.  The structure has four members, like this:
-<PRE>
-struct {
-  int first_line, last_line;
-  int first_column, last_column;
-};
-</PRE>
-Thus, to get the starting line number of the third component, use
-<SAMP>`@3.first_line'</SAMP>.
-In order for the members of this structure to contain valid information,
-you must make <CODE>yylex</CODE> supply this information about each token.
-If you need only certain members, then <CODE>yylex</CODE> need only fill in
-those members.
-The use of this feature makes the parser noticeably slower.
-</DL>
-<P>
-<H1><A NAME="SEC68" HREF="bison.html#TOC68">The Bison Parser Algorithm</A></H1>
-<P>
-<A NAME="IDX140"></A>
-<A NAME="IDX141"></A>
-<A NAME="IDX142"></A>
-<A NAME="IDX143"></A>
-<A NAME="IDX144"></A>
-<A NAME="IDX145"></A>
-As Bison reads tokens, it pushes them onto a stack along with their
-semantic values.  The stack is called the <EM>parser stack</EM>.  Pushing a
-token is traditionally called <EM>shifting</EM>.
-For example, suppose the infix calculator has read <SAMP>`1 + 5 *'</SAMP>, with a
-<SAMP>`3'</SAMP> to come.  The stack will have four elements, one for each token
-that was shifted.
-But the stack does not always have an element for each token read.  When
-the last <VAR>n</VAR> tokens and groupings shifted match the components of a
-grammar rule, they can be combined according to that rule.  This is called
-<EM>reduction</EM>.  Those tokens and groupings are replaced on the stack by a
-single grouping whose symbol is the result (left hand side) of that rule.
-Running the rule's action is part of the process of reduction, because this
-is what computes the semantic value of the resulting grouping.
-For example, if the infix calculator's parser stack contains this:
-<PRE>
-1 + 5 * 3
-</PRE>
-<P>
-and the next input token is a newline character, then the last three
-elements can be reduced to 15 via the rule:
-<PRE>
-expr: expr '*' expr;
-</PRE>
-<P>
-Then the stack contains just these three elements:
-<PRE>
-1 + 15
-</PRE>
-<P>
-At this point, another reduction can be made, resulting in the single value
-16.  Then the newline token can be shifted.
-The parser tries, by shifts and reductions, to reduce the entire input down
-to a single grouping whose symbol is the grammar's start-symbol
-(see section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>).
-This kind of parser is known in the literature as a bottom-up parser.
-<H2><A NAME="SEC69" HREF="bison.html#TOC69">Look-Ahead Tokens</A></H2>
-<P>
-<A NAME="IDX146"></A>
-The Bison parser does <EM>not</EM> always reduce immediately as soon as the
-last <VAR>n</VAR> tokens and groupings match a rule.  This is because such a
-simple strategy is inadequate to handle most languages.  Instead, when a
-reduction is possible, the parser sometimes "looks ahead" at the next
-token in order to decide what to do.
-When a token is read, it is not immediately shifted; first it becomes the
-<EM>look-ahead token</EM>, which is not on the stack.  Now the parser can
-perform one or more reductions of tokens and groupings on the stack, while
-the look-ahead token remains off to the side.  When no more reductions
-should take place, the look-ahead token is shifted onto the stack.  This
-does not mean that all possible reductions have been done; depending on the
-token type of the look-ahead token, some rules may choose to delay their
-application.
-Here is a simple case where look-ahead is needed.  These three rules define
-expressions which contain binary addition operators and postfix unary
-factorial operators (<SAMP>`!'</SAMP>), and allow parentheses for grouping.
-<PRE>
-expr:     term '+' expr
-        | term
-        ;
-term:     '(' expr ')'
-        | term '!'
-        | NUMBER
-        ;
-</PRE>
-<P>
-Suppose that the tokens <SAMP>`1 + 2'</SAMP> have been read and shifted; what
-should be done?  If the following token is <SAMP>`)'</SAMP>, then the first three
-tokens must be reduced to form an <CODE>expr</CODE>.  This is the only valid
-course, because shifting the <SAMP>`)'</SAMP> would produce a sequence of symbols
-<CODE>term ')'</CODE>, and no rule allows this.
-If the following token is <SAMP>`!'</SAMP>, then it must be shifted immediately so
-that <SAMP>`2 !'</SAMP> can be reduced to make a <CODE>term</CODE>.  If instead the
-parser were to reduce before shifting, <SAMP>`1 + 2'</SAMP> would become an
-<CODE>expr</CODE>.  It would then be impossible to shift the <SAMP>`!'</SAMP> because
-doing so would produce on the stack the sequence of symbols <CODE>expr
-'!'</CODE>.  No rule allows that sequence.
-<A NAME="IDX147"></A>
-The current look-ahead token is stored in the variable <CODE>yychar</CODE>.
-See section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>.
-<H2><A NAME="SEC70" HREF="bison.html#TOC70">Shift/Reduce Conflicts</A></H2>
-<P>
-<A NAME="IDX148"></A>
-<A NAME="IDX149"></A>
-<A NAME="IDX150"></A>
-<A NAME="IDX151"></A>
-Suppose we are parsing a language which has if-then and if-then-else
-statements, with a pair of rules like this:
-<PRE>
-if_stmt:
-          IF expr THEN stmt
-        | IF expr THEN stmt ELSE stmt
-        ;
-</PRE>
-<P>
-Here we assume that <CODE>IF</CODE>, <CODE>THEN</CODE> and <CODE>ELSE</CODE> are
-terminal symbols for specific keyword tokens.
-When the <CODE>ELSE</CODE> token is read and becomes the look-ahead token, the
-contents of the stack (assuming the input is valid) are just right for
-reduction by the first rule.  But it is also legitimate to shift the
-<CODE>ELSE</CODE>, because that would lead to eventual reduction by the second
-rule.
-This situation, where either a shift or a reduction would be valid, is
-called a <EM>shift/reduce conflict</EM>.  Bison is designed to resolve
-these conflicts by choosing to shift, unless otherwise directed by
-operator precedence declarations.  To see the reason for this, let's
-contrast it with the other alternative.
-Since the parser prefers to shift the <CODE>ELSE</CODE>, the result is to attach
-the else-clause to the innermost if-statement, making these two inputs
-equivalent:
-<PRE>
-if x then if y then win (); else lose;
-if x then do; if y then win (); else lose; end;
-</PRE>
-<P>
-But if the parser chose to reduce when possible rather than shift, the
-result would be to attach the else-clause to the outermost if-statement,
-making these two inputs equivalent:
-<PRE>
-if x then if y then win (); else lose;
-if x then do; if y then win (); end; else lose;
-</PRE>
-<P>
-The conflict exists because the grammar as written is ambiguous: either
-parsing of the simple nested if-statement is legitimate.  The established
-convention is that these ambiguities are resolved by attaching the
-else-clause to the innermost if-statement; this is what Bison accomplishes
-by choosing to shift rather than reduce.  (It would ideally be cleaner to
-write an unambiguous grammar, but that is very hard to do in this case.)
-This particular ambiguity was first encountered in the specifications of
-Algol 60 and is called the "dangling <CODE>else</CODE>" ambiguity.
-To avoid warnings from Bison about predictable, legitimate shift/reduce
-conflicts, use the <CODE>%expect <VAR>n</VAR></CODE> declaration.  There will be no
-warning as long as the number of shift/reduce conflicts is exactly <VAR>n</VAR>.
-See section <A HREF="bison.html#SEC54">Suppressing Conflict Warnings</A>.
-The definition of <CODE>if_stmt</CODE> above is solely to blame for the
-conflict, but the conflict does not actually appear without additional
-rules.  Here is a complete Bison input file that actually manifests the
-conflict:
-<PRE>
-%token IF THEN ELSE variable
-%%
-stmt:     expr
-        | if_stmt
-        ;
-if_stmt:
-          IF expr THEN stmt
-        | IF expr THEN stmt ELSE stmt
-        ;
-expr:     variable
-        ;
-</PRE>
-<P>
-<H2><A NAME="SEC71" HREF="bison.html#TOC71">Operator Precedence</A></H2>
-<P>
-<A NAME="IDX152"></A>
-<A NAME="IDX153"></A>
-Another situation where shift/reduce conflicts appear is in arithmetic
-expressions.  Here shifting is not always the preferred resolution; the
-Bison declarations for operator precedence allow you to specify when to
-shift and when to reduce.
-<H3><A NAME="SEC72" HREF="bison.html#TOC72">When Precedence is Needed</A></H3>
-<P>
-Consider the following ambiguous grammar fragment (ambiguous because the
-input <SAMP>`1 - 2 * 3'</SAMP> can be parsed in two different ways):
-<PRE>
-expr:     expr '-' expr
-        | expr '*' expr
-        | expr '&#60;' expr
-        | '(' expr ')'
-        ...
-        ;
-</PRE>
-<P>
-Suppose the parser has seen the tokens <SAMP>`1'</SAMP>, <SAMP>`-'</SAMP> and <SAMP>`2'</SAMP>;
-should it reduce them via the rule for the addition operator?  It depends
-on the next token.  Of course, if the next token is <SAMP>`)'</SAMP>, we must
-reduce; shifting is invalid because no single rule can reduce the token
-sequence <SAMP>`- 2 )'</SAMP> or anything starting with that.  But if the next
-token is <SAMP>`*'</SAMP> or <SAMP>`&#60;'</SAMP>, we have a choice: either shifting or
-reduction would allow the parse to complete, but with different
-results.
-To decide which one Bison should do, we must consider the
-results.  If the next operator token <VAR>op</VAR> is shifted, then it
-must be reduced first in order to permit another opportunity to
-reduce the sum.  The result is (in effect) <SAMP>`1 - (2
-<VAR>op</VAR> 3)'</SAMP>.  On the other hand, if the subtraction is reduced
-before shifting <VAR>op</VAR>, the result is <SAMP>`(1 - 2) <VAR>op</VAR>
-3'</SAMP>.  Clearly, then, the choice of shift or reduce should depend
-on the relative precedence of the operators <SAMP>`-'</SAMP> and
-<VAR>op</VAR>: <SAMP>`*'</SAMP> should be shifted first, but not <SAMP>`&#60;'</SAMP>.
-<A NAME="IDX154"></A>
-What about input such as <SAMP>`1 - 2 - 5'</SAMP>; should this be
-<SAMP>`(1 - 2) - 5'</SAMP> or should it be <SAMP>`1 - (2 - 5)'</SAMP>?  For
-most operators we prefer the former, which is called <EM>left
-association</EM>.  The latter alternative, <EM>right association</EM>, is
-desirable for assignment operators.  The choice of left or right
-association is a matter of whether the parser chooses to shift or
-reduce when the stack contains <SAMP>`1 - 2'</SAMP> and the look-ahead
-token is <SAMP>`-'</SAMP>: shifting makes right-associativity.
-<H3><A NAME="SEC73" HREF="bison.html#TOC73">Specifying Operator Precedence</A></H3>
-<P>
-<A NAME="IDX155"></A>
-<A NAME="IDX156"></A>
-<A NAME="IDX157"></A>
-Bison allows you to specify these choices with the operator precedence
-declarations <CODE>%left</CODE> and <CODE>%right</CODE>.  Each such declaration
-contains a list of tokens, which are operators whose precedence and
-associativity is being declared.  The <CODE>%left</CODE> declaration makes all
-those operators left-associative and the <CODE>%right</CODE> declaration makes
-them right-associative.  A third alternative is <CODE>%nonassoc</CODE>, which
-declares that it is a syntax error to find the same operator twice "in a
-row".
-The relative precedence of different operators is controlled by the
-order in which they are declared.  The first <CODE>%left</CODE> or
-<CODE>%right</CODE> declaration in the file declares the operators whose
-precedence is lowest, the next such declaration declares the operators
-whose precedence is a little higher, and so on.
-<H3><A NAME="SEC74" HREF="bison.html#TOC74">Precedence Examples</A></H3>
-<P>
-In our example, we would want the following declarations:
-<PRE>
-%left '&#60;'
-%left '-'
-%left '*'
-</PRE>
-<P>
-In a more complete example, which supports other operators as well, we
-would declare them in groups of equal precedence.  For example, <CODE>'+'</CODE> is
-declared with <CODE>'-'</CODE>:
-<PRE>
-%left '&#60;' '&#62;' '=' NE LE GE
-%left '+' '-'
-%left '*' '/'
-</PRE>
-<P>
-(Here <CODE>NE</CODE> and so on stand for the operators for "not equal"
-and so on.  We assume that these tokens are more than one character long
-and therefore are represented by names, not character literals.)
-<H3><A NAME="SEC75" HREF="bison.html#TOC75">How Precedence Works</A></H3>
-<P>
-The first effect of the precedence declarations is to assign precedence
-levels to the terminal symbols declared.  The second effect is to assign
-precedence levels to certain rules: each rule gets its precedence from the
-last terminal symbol mentioned in the components.  (You can also specify
-explicitly the precedence of a rule.  See section <A HREF="bison.html#SEC76">Context-Dependent Precedence</A>.)
-Finally, the resolution of conflicts works by comparing the
-precedence of the rule being considered with that of the
-look-ahead token.  If the token's precedence is higher, the
-choice is to shift.  If the rule's precedence is higher, the
-choice is to reduce.  If they have equal precedence, the choice
-is made based on the associativity of that precedence level.  The
-verbose output file made by <SAMP>`-v'</SAMP> (see section <A HREF="bison.html#SEC87">Invoking Bison</A>) says
-how each conflict was resolved.
-Not all rules and not all tokens have precedence.  If either the rule or
-the look-ahead token has no precedence, then the default is to shift.
-<H2><A NAME="SEC76" HREF="bison.html#TOC76">Context-Dependent Precedence</A></H2>
-<P>
-<A NAME="IDX158"></A>
-<A NAME="IDX159"></A>
-<A NAME="IDX160"></A>
-<A NAME="IDX161"></A>
-<A NAME="IDX162"></A>
-Often the precedence of an operator depends on the context.  This sounds
-outlandish at first, but it is really very common.  For example, a minus
-sign typically has a very high precedence as a unary operator, and a
-somewhat lower precedence (lower than multiplication) as a binary operator.
-The Bison precedence declarations, <CODE>%left</CODE>, <CODE>%right</CODE> and
-<CODE>%nonassoc</CODE>, can only be used once for a given token; so a token has
-only one precedence declared in this way.  For context-dependent
-precedence, you need to use an additional mechanism: the <CODE>%prec</CODE>
-modifier for rules.
-The <CODE>%prec</CODE> modifier declares the precedence of a particular rule by
-specifying a terminal symbol whose precedence should be used for that rule.
-It's not necessary for that symbol to appear otherwise in the rule.  The
-modifier's syntax is:
-<PRE>
-%prec <VAR>terminal-symbol</VAR>
-</PRE>
-<P>
-and it is written after the components of the rule.  Its effect is to
-assign the rule the precedence of <VAR>terminal-symbol</VAR>, overriding
-the precedence that would be deduced for it in the ordinary way.  The
-altered rule precedence then affects how conflicts involving that rule
-are resolved (see section <A HREF="bison.html#SEC71">Operator Precedence</A>).
-Here is how <CODE>%prec</CODE> solves the problem of unary minus.  First, declare
-a precedence for a fictitious terminal symbol named <CODE>UMINUS</CODE>.  There
-are no tokens of this type, but the symbol serves to stand for its
-precedence:
-<PRE>
-...
-%left '+' '-'
-%left '*'
-%left UMINUS
-</PRE>
-<P>
-Now the precedence of <CODE>UMINUS</CODE> can be used in specific rules:
-<PRE>
-exp:    ...
-        | exp '-' exp
-        ...
-        | '-' exp %prec UMINUS
-</PRE>
-<P>
-<H2><A NAME="SEC77" HREF="bison.html#TOC77">Parser States</A></H2>
-<P>
-<A NAME="IDX163"></A>
-<A NAME="IDX164"></A>
-<A NAME="IDX165"></A>
-The function <CODE>yyparse</CODE> is implemented using a finite-state machine.
-The values pushed on the parser stack are not simply token type codes; they
-represent the entire sequence of terminal and nonterminal symbols at or
-near the top of the stack.  The current state collects all the information
-about previous input which is relevant to deciding what to do next.
-Each time a look-ahead token is read, the current parser state together
-with the type of look-ahead token are looked up in a table.  This table
-entry can say, "Shift the look-ahead token."  In this case, it also
-specifies the new parser state, which is pushed onto the top of the
-parser stack.  Or it can say, "Reduce using rule number <VAR>n</VAR>."
-This means that a certain number of tokens or groupings are taken off
-the top of the stack, and replaced by one grouping.  In other words,
-that number of states are popped from the stack, and one new state is
-pushed.
-There is one other alternative: the table can say that the look-ahead token
-is erroneous in the current state.  This causes error processing to begin
-(see section <A HREF="bison.html#SEC81">Error Recovery</A>).
-<H2><A NAME="SEC78" HREF="bison.html#TOC78">Reduce/Reduce Conflicts</A></H2>
-<P>
-<A NAME="IDX166"></A>
-<A NAME="IDX167"></A>
-A reduce/reduce conflict occurs if there are two or more rules that apply
-to the same sequence of input.  This usually indicates a serious error
-in the grammar.
-For example, here is an erroneous attempt to define a sequence
-of zero or more <CODE>word</CODE> groupings.
-<PRE>
-sequence: /* empty */
-                { printf ("empty sequence\n"); }
-        | maybeword
-        | sequence word
-                { printf ("added word %s\n", $2); }
-        ;
-maybeword: /* empty */
-                { printf ("empty maybeword\n"); }
-        | word
-                { printf ("single word %s\n", $1); }
-        ;
-</PRE>
-<P>
-The error is an ambiguity: there is more than one way to parse a single
-<CODE>word</CODE> into a <CODE>sequence</CODE>.  It could be reduced to a
-<CODE>maybeword</CODE> and then into a <CODE>sequence</CODE> via the second rule.
-Alternatively, nothing-at-all could be reduced into a <CODE>sequence</CODE>
-via the first rule, and this could be combined with the <CODE>word</CODE>
-using the third rule for <CODE>sequence</CODE>.
-There is also more than one way to reduce nothing-at-all into a
-<CODE>sequence</CODE>.  This can be done directly via the first rule,
-or indirectly via <CODE>maybeword</CODE> and then the second rule.
-You might think that this is a distinction without a difference, because it
-does not change whether any particular input is valid or not.  But it does
-affect which actions are run.  One parsing order runs the second rule's
-action; the other runs the first rule's action and the third rule's action.
-In this example, the output of the program changes.
-Bison resolves a reduce/reduce conflict by choosing to use the rule that
-appears first in the grammar, but it is very risky to rely on this.  Every
-reduce/reduce conflict must be studied and usually eliminated.  Here is the
-proper way to define <CODE>sequence</CODE>:
-<PRE>
-sequence: /* empty */
-                { printf ("empty sequence\n"); }
-        | sequence word
-                { printf ("added word %s\n", $2); }
-        ;
-</PRE>
-<P>
-Here is another common error that yields a reduce/reduce conflict:
-<PRE>
-sequence: /* empty */
-        | sequence words
-        | sequence redirects
-        ;
-words:    /* empty */
-        | words word
-        ;
-redirects:/* empty */
-        | redirects redirect
-        ;
-</PRE>
-<P>
-The intention here is to define a sequence which can contain either
-<CODE>word</CODE> or <CODE>redirect</CODE> groupings.  The individual definitions of
-<CODE>sequence</CODE>, <CODE>words</CODE> and <CODE>redirects</CODE> are error-free, but the
-three together make a subtle ambiguity: even an empty input can be parsed
-in infinitely many ways!
-Consider: nothing-at-all could be a <CODE>words</CODE>.  Or it could be two
-<CODE>words</CODE> in a row, or three, or any number.  It could equally well be a
-<CODE>redirects</CODE>, or two, or any number.  Or it could be a <CODE>words</CODE>
-followed by three <CODE>redirects</CODE> and another <CODE>words</CODE>.  And so on.
-Here are two ways to correct these rules.  First, to make it a single level
-of sequence:
-<PRE>
-sequence: /* empty */
-        | sequence word
-        | sequence redirect
-        ;
-</PRE>
-<P>
-Second, to prevent either a <CODE>words</CODE> or a <CODE>redirects</CODE>
-from being empty:
-<PRE>
-sequence: /* empty */
-        | sequence words
-        | sequence redirects
-        ;
-words:    word
-        | words word
-        ;
-redirects:redirect
-        | redirects redirect
-        ;
-</PRE>
-<P>
-<H2><A NAME="SEC79" HREF="bison.html#TOC79">Mysterious Reduce/Reduce Conflicts</A></H2>
-<P>
-Sometimes reduce/reduce conflicts can occur that don't look warranted.
-Here is an example:
-<PRE>
-%token ID
-%%
-def:    param_spec return_spec ','
-        ;
-param_spec:
-             type
-        |    name_list ':' type
-        ;
-return_spec:
-             type
-        |    name ':' type
-        ;
-type:        ID
-        ;
-name:        ID
-        ;
-name_list:
-             name
-        |    name ',' name_list
-        ;
-</PRE>
-<P>
-It would seem that this grammar can be parsed with only a single token
-of look-ahead: when a <CODE>param_spec</CODE> is being read, an <CODE>ID</CODE> is 
-a <CODE>name</CODE> if a comma or colon follows, or a <CODE>type</CODE> if another
-<CODE>ID</CODE> follows.  In other words, this grammar is LR(1).
-<A NAME="IDX168"></A>
-<A NAME="IDX169"></A>
-However, Bison, like most parser generators, cannot actually handle all
-LR(1) grammars.  In this grammar, two contexts, that after an <CODE>ID</CODE>
-at the beginning of a <CODE>param_spec</CODE> and likewise at the beginning of
-a <CODE>return_spec</CODE>, are similar enough that Bison assumes they are the
-same.  They appear similar because the same set of rules would be
-active--the rule for reducing to a <CODE>name</CODE> and that for reducing to
-a <CODE>type</CODE>.  Bison is unable to determine at that stage of processing
-that the rules would require different look-ahead tokens in the two
-contexts, so it makes a single parser state for them both.  Combining
-the two contexts causes a conflict later.  In parser terminology, this
-occurrence means that the grammar is not LALR(1).
-In general, it is better to fix deficiencies than to document them.  But
-this particular deficiency is intrinsically hard to fix; parser
-generators that can handle LR(1) grammars are hard to write and tend to
-produce parsers that are very large.  In practice, Bison is more useful
-as it is now.
-When the problem arises, you can often fix it by identifying the two
-parser states that are being confused, and adding something to make them
-look distinct.  In the above example, adding one rule to
-<CODE>return_spec</CODE> as follows makes the problem go away:
-<PRE>
-%token BOGUS
-...
-%%
-...
-return_spec:
-             type
-        |    name ':' type
-        /* This rule is never used.  */
-        |    ID BOGUS
-        ;
-</PRE>
-<P>
-This corrects the problem because it introduces the possibility of an
-additional active rule in the context after the <CODE>ID</CODE> at the beginning of
-<CODE>return_spec</CODE>.  This rule is not active in the corresponding context
-in a <CODE>param_spec</CODE>, so the two contexts receive distinct parser states.
-As long as the token <CODE>BOGUS</CODE> is never generated by <CODE>yylex</CODE>,
-the added rule cannot alter the way actual input is parsed.
-In this particular example, there is another way to solve the problem:
-rewrite the rule for <CODE>return_spec</CODE> to use <CODE>ID</CODE> directly
-instead of via <CODE>name</CODE>.  This also causes the two confusing
-contexts to have different sets of active rules, because the one for
-<CODE>return_spec</CODE> activates the altered rule for <CODE>return_spec</CODE>
-rather than the one for <CODE>name</CODE>.
-<PRE>
-param_spec:
-             type
-        |    name_list ':' type
-        ;
-return_spec:
-             type
-        |    ID ':' type
-        ;
-</PRE>
-<P>
-<H2><A NAME="SEC80" HREF="bison.html#TOC80">Stack Overflow, and How to Avoid It</A></H2>
-<P>
-<A NAME="IDX170"></A>
-<A NAME="IDX171"></A>
-<A NAME="IDX172"></A>
-The Bison parser stack can overflow if too many tokens are shifted and
-not reduced.  When this happens, the parser function <CODE>yyparse</CODE>
-returns a nonzero value, pausing only to call <CODE>yyerror</CODE> to report
-the overflow.
-<A NAME="IDX173"></A>
-By defining the macro <CODE>YYMAXDEPTH</CODE>, you can control how deep the
-parser stack can become before a stack overflow occurs.  Define the
-macro with a value that is an integer.  This value is the maximum number
-of tokens that can be shifted (and not reduced) before overflow.
-It must be a constant expression whose value is known at compile time.
-The stack space allowed is not necessarily allocated.  If you specify a
-large value for <CODE>YYMAXDEPTH</CODE>, the parser actually allocates a small
-stack at first, and then makes it bigger by stages as needed.  This
-increasing allocation happens automatically and silently.  Therefore,
-you do not need to make <CODE>YYMAXDEPTH</CODE> painfully small merely to save
-space for ordinary inputs that do not need much stack.
-<A NAME="IDX174"></A>
-The default value of <CODE>YYMAXDEPTH</CODE>, if you do not define it, is
-10000.
-<A NAME="IDX175"></A>
-You can control how much stack is allocated initially by defining the
-macro <CODE>YYINITDEPTH</CODE>.  This value too must be a compile-time
-constant integer.  The default is 200.
-<H1><A NAME="SEC81" HREF="bison.html#TOC81">Error Recovery</A></H1>
-<P>
-<A NAME="IDX176"></A>
-<A NAME="IDX177"></A>
-It is not usually acceptable to have a program terminate on a parse
-error.  For example, a compiler should recover sufficiently to parse the
-rest of the input file and check it for errors; a calculator should accept
-another expression.
-In a simple interactive command parser where each input is one line, it may
-be sufficient to allow <CODE>yyparse</CODE> to return 1 on error and have the
-caller ignore the rest of the input line when that happens (and then call
-<CODE>yyparse</CODE> again).  But this is inadequate for a compiler, because it
-forgets all the syntactic context leading up to the error.  A syntax error
-deep within a function in the compiler input should not cause the compiler
-to treat the following line like the beginning of a source file.
-<A NAME="IDX178"></A>
-You can define how to recover from a syntax error by writing rules to
-recognize the special token <CODE>error</CODE>.  This is a terminal symbol that
-is always defined (you need not declare it) and reserved for error
-handling.  The Bison parser generates an <CODE>error</CODE> token whenever a
-syntax error happens; if you have provided a rule to recognize this token
-in the current context, the parse can continue.  
-For example:
-<PRE>
-stmnts:  /* empty string */
-        | stmnts '\n'
-        | stmnts exp '\n'
-        | stmnts error '\n'
-</PRE>
-<P>
-The fourth rule in this example says that an error followed by a newline
-makes a valid addition to any <CODE>stmnts</CODE>.
-What happens if a syntax error occurs in the middle of an <CODE>exp</CODE>?  The
-error recovery rule, interpreted strictly, applies to the precise sequence
-of a <CODE>stmnts</CODE>, an <CODE>error</CODE> and a newline.  If an error occurs in
-the middle of an <CODE>exp</CODE>, there will probably be some additional tokens
-and subexpressions on the stack after the last <CODE>stmnts</CODE>, and there
-will be tokens to read before the next newline.  So the rule is not
-applicable in the ordinary way.
-But Bison can force the situation to fit the rule, by discarding part of
-the semantic context and part of the input.  First it discards states and
-objects from the stack until it gets back to a state in which the
-<CODE>error</CODE> token is acceptable.  (This means that the subexpressions
-already parsed are discarded, back to the last complete <CODE>stmnts</CODE>.)  At
-this point the <CODE>error</CODE> token can be shifted.  Then, if the old
-look-ahead token is not acceptable to be shifted next, the parser reads
-tokens and discards them until it finds a token which is acceptable.  In
-this example, Bison reads and discards input until the next newline
-so that the fourth rule can apply.
-The choice of error rules in the grammar is a choice of strategies for
-error recovery.  A simple and useful strategy is simply to skip the rest of
-the current input line or current statement if an error is detected:
-<PRE>
-stmnt: error ';'  /* on error, skip until ';' is read */
-</PRE>
-<P>
-It is also useful to recover to the matching close-delimiter of an
-opening-delimiter that has already been parsed.  Otherwise the
-close-delimiter will probably appear to be unmatched, and generate another,
-spurious error message:
-<PRE>
-primary:  '(' expr ')'
-        | '(' error ')'
-        ...
-        ;
-</PRE>
-<P>
-Error recovery strategies are necessarily guesses.  When they guess wrong,
-one syntax error often leads to another.  In the above example, the error
-recovery rule guesses that an error is due to bad input within one
-<CODE>stmnt</CODE>.  Suppose that instead a spurious semicolon is inserted in the
-middle of a valid <CODE>stmnt</CODE>.  After the error recovery rule recovers
-from the first error, another syntax error will be found straightaway,
-since the text following the spurious semicolon is also an invalid
-<CODE>stmnt</CODE>.
-To prevent an outpouring of error messages, the parser will output no error
-message for another syntax error that happens shortly after the first; only
-after three consecutive input tokens have been successfully shifted will
-error messages resume.
-Note that rules which accept the <CODE>error</CODE> token may have actions, just
-as any other rules can.
-<A NAME="IDX179"></A>
-You can make error messages resume immediately by using the macro
-<CODE>yyerrok</CODE> in an action.  If you do this in the error rule's action, no
-error messages will be suppressed.  This macro requires no arguments;
-<SAMP>`yyerrok;'</SAMP> is a valid C statement.
-<A NAME="IDX180"></A>
-The previous look-ahead token is reanalyzed immediately after an error.  If
-this is unacceptable, then the macro <CODE>yyclearin</CODE> may be used to clear
-this token.  Write the statement <SAMP>`yyclearin;'</SAMP> in the error rule's
-action.
-For example, suppose that on a parse error, an error handling routine is
-called that advances the input stream to some point where parsing should
-once again commence.  The next symbol returned by the lexical scanner is
-probably correct.  The previous look-ahead token ought to be discarded
-with <SAMP>`yyclearin;'</SAMP>.
-<A NAME="IDX181"></A>
-The macro <CODE>YYRECOVERING</CODE> stands for an expression that has the
-value 1 when the parser is recovering from a syntax error, and 0 the
-rest of the time.  A value of 1 indicates that error messages are
-currently suppressed for new syntax errors.
-<H1><A NAME="SEC82" HREF="bison.html#TOC82">Handling Context Dependencies</A></H1>
-<P>
-The Bison paradigm is to parse tokens first, then group them into larger
-syntactic units.  In many languages, the meaning of a token is affected by
-its context.  Although this violates the Bison paradigm, certain techniques
-(known as <EM>kludges</EM>) may enable you to write Bison parsers for such
-languages.
-(Actually, "kludge" means any technique that gets its job done but is
-neither clean nor robust.)
-<H2><A NAME="SEC83" HREF="bison.html#TOC83">Semantic Info in Token Types</A></H2>
-<P>
-The C language has a context dependency: the way an identifier is used
-depends on what its current meaning is.  For example, consider this:
-<PRE>
-foo (x);
-</PRE>
-<P>
-This looks like a function call statement, but if <CODE>foo</CODE> is a typedef
-name, then this is actually a declaration of <CODE>x</CODE>.  How can a Bison
-parser for C decide how to parse this input?
-The method used in GNU C is to have two different token types,
-<CODE>IDENTIFIER</CODE> and <CODE>TYPENAME</CODE>.  When <CODE>yylex</CODE> finds an
-identifier, it looks up the current declaration of the identifier in order
-to decide which token type to return: <CODE>TYPENAME</CODE> if the identifier is
-declared as a typedef, <CODE>IDENTIFIER</CODE> otherwise.
-The grammar rules can then express the context dependency by the choice of
-token type to recognize.  <CODE>IDENTIFIER</CODE> is accepted as an expression,
-but <CODE>TYPENAME</CODE> is not.  <CODE>TYPENAME</CODE> can start a declaration, but
-<CODE>IDENTIFIER</CODE> cannot.  In contexts where the meaning of the identifier
-is <EM>not</EM> significant, such as in declarations that can shadow a
-typedef name, either <CODE>TYPENAME</CODE> or <CODE>IDENTIFIER</CODE> is
-accepted--there is one rule for each of the two token types.
-This technique is simple to use if the decision of which kinds of
-identifiers to allow is made at a place close to where the identifier is
-parsed.  But in C this is not always so: C allows a declaration to
-redeclare a typedef name provided an explicit type has been specified
-earlier:
-<PRE>
-typedef int foo, bar, lose;
-static foo (bar);        /* redeclare <CODE>bar</CODE> as static variable */
-static int foo (lose);   /* redeclare <CODE>foo</CODE> as function */
-</PRE>
-<P>
-Unfortunately, the name being declared is separated from the declaration
-construct itself by a complicated syntactic structure--the "declarator".
-As a result, the part of Bison parser for C needs to be duplicated, with
-all the nonterminal names changed: once for parsing a declaration in which
-a typedef name can be redefined, and once for parsing a declaration in
-which that can't be done.  Here is a part of the duplication, with actions
-omitted for brevity:
-<PRE>
-initdcl:
-          declarator maybeasm '='
-          init
-        | declarator maybeasm
-        ;
-notype_initdcl:
-          notype_declarator maybeasm '='
-          init
-        | notype_declarator maybeasm
-        ;
-</PRE>
-<P>
-Here <CODE>initdcl</CODE> can redeclare a typedef name, but <CODE>notype_initdcl</CODE>
-cannot.  The distinction between <CODE>declarator</CODE> and
-<CODE>notype_declarator</CODE> is the same sort of thing.
-There is some similarity between this technique and a lexical tie-in
-(described next), in that information which alters the lexical analysis is
-changed during parsing by other parts of the program.  The difference is
-here the information is global, and is used for other purposes in the
-program.  A true lexical tie-in has a special-purpose flag controlled by
-the syntactic context.
-<H2><A NAME="SEC84" HREF="bison.html#TOC84">Lexical Tie-ins</A></H2>
-<P>
-<A NAME="IDX182"></A>
-One way to handle context-dependency is the <EM>lexical tie-in</EM>: a flag
-which is set by Bison actions, whose purpose is to alter the way tokens are
-parsed.
-For example, suppose we have a language vaguely like C, but with a special
-construct <SAMP>`hex (<VAR>hex-expr</VAR>)'</SAMP>.  After the keyword <CODE>hex</CODE> comes
-an expression in parentheses in which all integers are hexadecimal.  In
-particular, the token <SAMP>`a1b'</SAMP> must be treated as an integer rather than
-as an identifier if it appears in that context.  Here is how you can do it:
-<PRE>
-%{
-int hexflag;
-%}
-%%
-...
-expr:   IDENTIFIER
-        | constant
-        | HEX '('
-                { hexflag = 1; }
-          expr ')'
-                { hexflag = 0;
-                   $$ = $4; }
-        | expr '+' expr
-                { $$ = make_sum ($1, $3); }
-        ...
-        ;
-constant:
-          INTEGER
-        | STRING
-        ;
-</PRE>
-<P>
-Here we assume that <CODE>yylex</CODE> looks at the value of <CODE>hexflag</CODE>; when
-it is nonzero, all integers are parsed in hexadecimal, and tokens starting
-with letters are parsed as integers if possible.
-The declaration of <CODE>hexflag</CODE> shown in the C declarations section of
-the parser file is needed to make it accessible to the actions 
-(see section <A HREF="bison.html#SEC36">The C Declarations Section</A>).  You must also write the code in <CODE>yylex</CODE>
-to obey the flag.
-<H2><A NAME="SEC85" HREF="bison.html#TOC85">Lexical Tie-ins and Error Recovery</A></H2>
-<P>
-Lexical tie-ins make strict demands on any error recovery rules you have.
-See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-The reason for this is that the purpose of an error recovery rule is to
-abort the parsing of one construct and resume in some larger construct.
-For example, in C-like languages, a typical error recovery rule is to skip
-tokens until the next semicolon, and then start a new statement, like this:
-<PRE>
-stmt:   expr ';'
-        | IF '(' expr ')' stmt { ... }
-        ...
-        error ';'
-                { hexflag = 0; }
-        ;
-</PRE>
-<P>
-If there is a syntax error in the middle of a <SAMP>`hex (<VAR>expr</VAR>)'</SAMP>
-construct, this error rule will apply, and then the action for the
-completed <SAMP>`hex (<VAR>expr</VAR>)'</SAMP> will never run.  So <CODE>hexflag</CODE> would
-remain set for the entire rest of the input, or until the next <CODE>hex</CODE>
-keyword, causing identifiers to be misinterpreted as integers.
-To avoid this problem the error recovery rule itself clears <CODE>hexflag</CODE>.
-There may also be an error recovery rule that works within expressions.
-For example, there could be a rule which applies within parentheses
-and skips to the close-parenthesis:
-<PRE>
-expr:   ...
-        | '(' expr ')'
-                { $$ = $2; }
-        | '(' error ')'
-        ...
-</PRE>
-<P>
-If this rule acts within the <CODE>hex</CODE> construct, it is not going to abort
-that construct (since it applies to an inner level of parentheses within
-the construct).  Therefore, it should not clear the flag: the rest of
-the <CODE>hex</CODE> construct should be parsed with the flag still in effect.
-What if there is an error recovery rule which might abort out of the
-<CODE>hex</CODE> construct or might not, depending on circumstances?  There is no
-way you can write the action to determine whether a <CODE>hex</CODE> construct is
-being aborted or not.  So if you are using a lexical tie-in, you had better
-make sure your error recovery rules are not of this kind.  Each rule must
-be such that you can be sure that it always will, or always won't, have to
-clear the flag.
-<H1><A NAME="SEC86" HREF="bison.html#TOC86">Debugging Your Parser</A></H1>
-<P>
-<A NAME="IDX183"></A>
-<A NAME="IDX184"></A>
-<A NAME="IDX185"></A>
-<A NAME="IDX186"></A>
-If a Bison grammar compiles properly but doesn't do what you want when it
-runs, the <CODE>yydebug</CODE> parser-trace feature can help you figure out why.
-To enable compilation of trace facilities, you must define the macro
-<CODE>YYDEBUG</CODE> when you compile the parser.  You could use
-<SAMP>`-DYYDEBUG=1'</SAMP> as a compiler option or you could put <SAMP>`#define
-YYDEBUG 1'</SAMP> in the C declarations section of the grammar file 
-(see section <A HREF="bison.html#SEC36">The C Declarations Section</A>).  Alternatively, use the <SAMP>`-t'</SAMP> option when
-you run Bison (see section <A HREF="bison.html#SEC87">Invoking Bison</A>).  We always define <CODE>YYDEBUG</CODE> so that
-debugging is always possible.
-The trace facility uses <CODE>stderr</CODE>, so you must add <CODE>#include
-&#60;stdio.h&#62;</CODE> to the C declarations section unless it is already there.
-Once you have compiled the program with trace facilities, the way to
-request a trace is to store a nonzero value in the variable <CODE>yydebug</CODE>.
-You can do this by making the C code do it (in <CODE>main</CODE>, perhaps), or
-you can alter the value with a C debugger.
-Each step taken by the parser when <CODE>yydebug</CODE> is nonzero produces a
-line or two of trace information, written on <CODE>stderr</CODE>.  The trace
-messages tell you these things:
-<UL>
-<LI>
-Each time the parser calls <CODE>yylex</CODE>, what kind of token was read.
-<LI>
-Each time a token is shifted, the depth and complete contents of the
-state stack (see section <A HREF="bison.html#SEC77">Parser States</A>).
-<LI>
-Each time a rule is reduced, which rule it is, and the complete contents
-of the state stack afterward.
-</UL>
-<P>
-To make sense of this information, it helps to refer to the listing file
-produced by the Bison <SAMP>`-v'</SAMP> option (see section <A HREF="bison.html#SEC87">Invoking Bison</A>).  This file
-shows the meaning of each state in terms of positions in various rules, and
-also what each state will do with each possible input token.  As you read
-the successive trace messages, you can see that the parser is functioning
-according to its specification in the listing file.  Eventually you will
-arrive at the place where something undesirable happens, and you will see
-which parts of the grammar are to blame.
-The parser file is a C program and you can use C debuggers on it, but it's
-not easy to interpret what it is doing.  The parser function is a
-finite-state machine interpreter, and aside from the actions it executes
-the same code over and over.  Only the values of variables show where in
-the grammar it is working.
-<A NAME="IDX187"></A>
-The debugging information normally gives the token type of each token
-read, but not its semantic value.  You can optionally define a macro
-named <CODE>YYPRINT</CODE> to provide a way to print the value.  If you define
-<CODE>YYPRINT</CODE>, it should take three arguments.  The parser will pass a
-standard I/O stream, the numeric code for the token type, and the token
-value (from <CODE>yylval</CODE>).
-Here is an example of <CODE>YYPRINT</CODE> suitable for the multi-function
-calculator (see section <A HREF="bison.html#SEC30">Declarations for <CODE>mfcalc</CODE></A>):
-<PRE>
-#define YYPRINT(file, type, value)   yyprint (file, type, value)
-static void
-yyprint (file, type, value)
-     FILE *file;
-     int type;
-     YYSTYPE value;
-{
-  if (type == VAR)
-    fprintf (file, " %s", value.tptr-&#62;name);
-  else if (type == NUM)
-    fprintf (file, " %d", value.val);
-}
-</PRE>
-<P>
-<H1><A NAME="SEC87" HREF="bison.html#TOC87">Invoking Bison</A></H1>
-<P>
-<A NAME="IDX188"></A>
-<A NAME="IDX189"></A>
-<A NAME="IDX190"></A>
-The usual way to invoke Bison is as follows:
-<PRE>
-bison <VAR>infile</VAR>
-</PRE>
-<P>
-Here <VAR>infile</VAR> is the grammar file name, which usually ends in
-<SAMP>`.y'</SAMP>.  The parser file's name is made by replacing the <SAMP>`.y'</SAMP>
-with <SAMP>`.tab.c'</SAMP>.  Thus, the <SAMP>`bison foo.y'</SAMP> filename yields
-<TT>`foo.tab.c'</TT>, and the <SAMP>`bison hack/foo.y'</SAMP> filename yields
-<TT>`hack/foo.tab.c'</TT>.
-<H2><A NAME="SEC88" HREF="bison.html#TOC88">Bison Options</A></H2>
-<P>
-Bison supports both traditional single-letter options and mnemonic long
-option names.  Long option names are indicated with <SAMP>`--'</SAMP> instead of
-<SAMP>`-'</SAMP>.  Abbreviations for option names are allowed as long as they
-are unique.  When a long option takes an argument, like
-<SAMP>`--file-prefix'</SAMP>, connect the option name and the argument with
-<SAMP>`='</SAMP>.
-Here is a list of options that can be used with Bison, alphabetized by
-short option.  It is followed by a cross key alphabetized by long
-option.
-<DL COMPACT>
-<DT><SAMP>`-b <VAR>file-prefix</VAR>'</SAMP>
-<DD>
-<DT><SAMP>`--file-prefix=<VAR>prefix</VAR>'</SAMP>
-<DD>
-Specify a prefix to use for all Bison output file names.  The names are
-chosen as if the input file were named <TT>`<VAR>prefix</VAR>.c'</TT>.
-<DT><SAMP>`-d'</SAMP>
-<DD>
-<DT><SAMP>`--defines'</SAMP>
-<DD>
-Write an extra output file containing macro definitions for the token
-type names defined in the grammar and the semantic value type
-<CODE>YYSTYPE</CODE>, as well as a few <CODE>extern</CODE> variable declarations.
-If the parser output file is named <TT>`<VAR>name</VAR>.c'</TT> then this file
-is named <TT>`<VAR>name</VAR>.h'</TT>.
-This output file is essential if you wish to put the definition of
-<CODE>yylex</CODE> in a separate source file, because <CODE>yylex</CODE> needs to
-be able to refer to token type codes and the variable
-<CODE>yylval</CODE>.  See section <A HREF="bison.html#SEC63">Semantic Values of Tokens</A>.
-<DT><SAMP>`-l'</SAMP>
-<DD>
-<DT><SAMP>`--no-lines'</SAMP>
-<DD>
-Don't put any <CODE>#line</CODE> preprocessor commands in the parser file.
-Ordinarily Bison puts them in the parser file so that the C compiler
-and debuggers will associate errors with your source file, the
-grammar file.  This option causes them to associate errors with the
-parser file, treating it an independent source file in its own right.
-<DT><SAMP>`-o <VAR>outfile</VAR>'</SAMP>
-<DD>
-<DT><SAMP>`--output-file=<VAR>outfile</VAR>'</SAMP>
-<DD>
-Specify the name <VAR>outfile</VAR> for the parser file.
-The other output files' names are constructed from <VAR>outfile</VAR>
-as described under the <SAMP>`-v'</SAMP> and <SAMP>`-d'</SAMP> switches.
-<DT><SAMP>`-p <VAR>prefix</VAR>'</SAMP>
-<DD>
-<DT><SAMP>`--name-prefix=<VAR>prefix</VAR>'</SAMP>
-<DD>
-Rename the external symbols used in the parser so that they start with
-<VAR>prefix</VAR> instead of <SAMP>`yy'</SAMP>.  The precise list of symbols renamed
-is <CODE>yyparse</CODE>, <CODE>yylex</CODE>, <CODE>yyerror</CODE>, <CODE>yynerrs</CODE>,
-<CODE>yylval</CODE>, <CODE>yychar</CODE> and <CODE>yydebug</CODE>.
-For example, if you use <SAMP>`-p c'</SAMP>, the names become <CODE>cparse</CODE>,
-<CODE>clex</CODE>, and so on.
-See section <A HREF="bison.html#SEC58">Multiple Parsers in the Same Program</A>.
-<DT><SAMP>`-t'</SAMP>
-<DD>
-<DT><SAMP>`--debug'</SAMP>
-<DD>
-Output a definition of the macro <CODE>YYDEBUG</CODE> into the parser file,
-so that the debugging facilities are compiled.  See section <A HREF="bison.html#SEC86">Debugging Your Parser</A>.
-<DT><SAMP>`-v'</SAMP>
-<DD>
-<DT><SAMP>`--verbose'</SAMP>
-<DD>
-Write an extra output file containing verbose descriptions of the
-parser states and what is done for each type of look-ahead token in
-that state.
-This file also describes all the conflicts, both those resolved by
-operator precedence and the unresolved ones.
-The file's name is made by removing <SAMP>`.tab.c'</SAMP> or <SAMP>`.c'</SAMP> from
-the parser output file name, and adding <SAMP>`.output'</SAMP> instead.
-Therefore, if the input file is <TT>`foo.y'</TT>, then the parser file is
-called <TT>`foo.tab.c'</TT> by default.  As a consequence, the verbose
-output file is called <TT>`foo.output'</TT>.
-<DT><SAMP>`-V'</SAMP>
-<DD>
-<DT><SAMP>`--version'</SAMP>
-<DD>
-Print the version number of Bison and exit.
-<DT><SAMP>`-h'</SAMP>
-<DD>
-<DT><SAMP>`--help'</SAMP>
-<DD>
-Print a summary of the command-line options to Bison and exit.
-<DT><SAMP>`-y'</SAMP>
-<DD>
-<DT><SAMP>`--yacc'</SAMP>
-<DD>
-<DT><SAMP>`--fixed-output-files'</SAMP>
-<DD>
-Equivalent to <SAMP>`-o y.tab.c'</SAMP>; the parser output file is called
-<TT>`y.tab.c'</TT>, and the other outputs are called <TT>`y.output'</TT> and
-<TT>`y.tab.h'</TT>.  The purpose of this switch is to imitate Yacc's output
-file name conventions.  Thus, the following shell script can substitute
-for Yacc:
-<PRE>
-bison -y $*
-</PRE>
-</DL>
-<P>
-<H2><A NAME="SEC89" HREF="bison.html#TOC89">Option Cross Key</A></H2>
-<P>
-Here is a list of options, alphabetized by long option, to help you find
-the corresponding short option.
-<H2><A NAME="SEC90" HREF="bison.html#TOC90">Invoking Bison under VMS</A></H2>
-<P>
-<A NAME="IDX191"></A>
-<A NAME="IDX192"></A>
-The command line syntax for Bison on VMS is a variant of the usual
-Bison command syntax--adapted to fit VMS conventions.
-To find the VMS equivalent for any Bison option, start with the long
-option, and substitute a <SAMP>`/'</SAMP> for the leading <SAMP>`--'</SAMP>, and
-substitute a <SAMP>`_'</SAMP> for each <SAMP>`-'</SAMP> in the name of the long option.
-For example, the following invocation under VMS:
-<PRE>
-bison /debug/name_prefix=bar foo.y
-</PRE>
-<P>
-is equivalent to the following command under POSIX.
-<PRE>
-bison --debug --name-prefix=bar foo.y
-</PRE>
-<P>
-The VMS file system does not permit filenames such as
-<TT>`foo.tab.c'</TT>.  In the above example, the output file
-would instead be named <TT>`foo_tab.c'</TT>.
-<H1><A NAME="SEC91" HREF="bison.html#TOC91">Bison Symbols</A></H1>
-<P>
-<A NAME="IDX193"></A>
-<A NAME="IDX194"></A>
-<DL COMPACT>
-<DT><CODE>error</CODE>
-<DD>
-A token name reserved for error recovery.  This token may be used in
-grammar rules so as to allow the Bison parser to recognize an error in
-the grammar without halting the process.  In effect, a sentence
-containing an error may be recognized as valid.  On a parse error, the
-token <CODE>error</CODE> becomes the current look-ahead token.  Actions
-corresponding to <CODE>error</CODE> are then executed, and the look-ahead
-token is reset to the token that originally caused the violation.
-See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><CODE>YYABORT</CODE>
-<DD>
-Macro to pretend that an unrecoverable syntax error has occurred, by
-making <CODE>yyparse</CODE> return 1 immediately.  The error reporting
-function <CODE>yyerror</CODE> is not called.  See section <A HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>.
-<DT><CODE>YYACCEPT</CODE>
-<DD>
-Macro to pretend that a complete utterance of the language has been
-read, by making <CODE>yyparse</CODE> return 0 immediately.  
-See section <A HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>.
-<DT><CODE>YYBACKUP</CODE>
-<DD>
-Macro to discard a value from the parser stack and fake a look-ahead
-token.  See section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>.
-<DT><CODE>YYERROR</CODE>
-<DD>
-Macro to pretend that a syntax error has just been detected: call
-<CODE>yyerror</CODE> and then perform normal error recovery if possible
-(see section <A HREF="bison.html#SEC81">Error Recovery</A>), or (if recovery is impossible) make
-<CODE>yyparse</CODE> return 1.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><CODE>YYERROR_VERBOSE</CODE>
-<DD>
-Macro that you define with <CODE>#define</CODE> in the Bison declarations
-section to request verbose, specific error message strings when
-<CODE>yyerror</CODE> is called.
-<DT><CODE>YYINITDEPTH</CODE>
-<DD>
-Macro for specifying the initial size of the parser stack.
-See section <A HREF="bison.html#SEC80">Stack Overflow, and How to Avoid It</A>.
-<DT><CODE>YYLEX_PARAM</CODE>
-<DD>
-Macro for specifying an extra argument (or list of extra arguments) for
-<CODE>yyparse</CODE> to pass to <CODE>yylex</CODE>.  See section <A HREF="bison.html#SEC65">Calling Conventions for Pure Parsers</A>.
-<DT><CODE>YYLTYPE</CODE>
-<DD>
-Macro for the data type of <CODE>yylloc</CODE>; a structure with four
-members.  See section <A HREF="bison.html#SEC64">Textual Positions of Tokens</A>.
-<DT><CODE>YYMAXDEPTH</CODE>
-<DD>
-Macro for specifying the maximum size of the parser stack.
-See section <A HREF="bison.html#SEC80">Stack Overflow, and How to Avoid It</A>.
-<DT><CODE>YYPARSE_PARAM</CODE>
-<DD>
-Macro for specifying the name of a parameter that <CODE>yyparse</CODE> should
-accept.  See section <A HREF="bison.html#SEC65">Calling Conventions for Pure Parsers</A>.
-<DT><CODE>YYRECOVERING</CODE>
-<DD>
-Macro whose value indicates whether the parser is recovering from a
-syntax error.  See section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>.
-<DT><CODE>YYSTYPE</CODE>
-<DD>
-Macro for the data type of semantic values; <CODE>int</CODE> by default.
-See section <A HREF="bison.html#SEC44">Data Types of Semantic Values</A>.
-<DT><CODE>yychar</CODE>
-<DD>
-External integer variable that contains the integer value of the
-current look-ahead token.  (In a pure parser, it is a local variable
-within <CODE>yyparse</CODE>.)  Error-recovery rule actions may examine this
-variable.  See section <A HREF="bison.html#SEC67">Special Features for Use in Actions</A>.
-<DT><CODE>yyclearin</CODE>
-<DD>
-Macro used in error-recovery rule actions.  It clears the previous
-look-ahead token.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><CODE>yydebug</CODE>
-<DD>
-External integer variable set to zero by default.  If <CODE>yydebug</CODE>
-is given a nonzero value, the parser will output information on input
-symbols and parser action.  See section <A HREF="bison.html#SEC86">Debugging Your Parser</A>.
-<DT><CODE>yyerrok</CODE>
-<DD>
-Macro to cause parser to recover immediately to its normal mode
-after a parse error.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT><CODE>yyerror</CODE>
-<DD>
-User-supplied function to be called by <CODE>yyparse</CODE> on error.  The
-function receives one argument, a pointer to a character string
-containing an error message.  See section <A HREF="bison.html#SEC66">The Error Reporting Function <CODE>yyerror</CODE></A>.
-<DT><CODE>yylex</CODE>
-<DD>
-User-supplied lexical analyzer function, called with no arguments
-to get the next token.  See section <A HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>.
-<DT><CODE>yylval</CODE>
-<DD>
-External variable in which <CODE>yylex</CODE> should place the semantic
-value associated with a token.  (In a pure parser, it is a local
-variable within <CODE>yyparse</CODE>, and its address is passed to
-<CODE>yylex</CODE>.)  See section <A HREF="bison.html#SEC63">Semantic Values of Tokens</A>.
-<DT><CODE>yylloc</CODE>
-<DD>
-External variable in which <CODE>yylex</CODE> should place the line and
-column numbers associated with a token.  (In a pure parser, it is a
-local variable within <CODE>yyparse</CODE>, and its address is passed to
-<CODE>yylex</CODE>.)  You can ignore this variable if you don't use the
-<SAMP>`@'</SAMP> feature in the grammar actions.  See section <A HREF="bison.html#SEC64">Textual Positions of Tokens</A>.
-<DT><CODE>yynerrs</CODE>
-<DD>
-Global variable which Bison increments each time there is a parse
-error.  (In a pure parser, it is a local variable within
-<CODE>yyparse</CODE>.)  See section <A HREF="bison.html#SEC66">The Error Reporting Function <CODE>yyerror</CODE></A>.
-<DT><CODE>yyparse</CODE>
-<DD>
-The parser function produced by Bison; call this function to start
-parsing.  See section <A HREF="bison.html#SEC60">The Parser Function <CODE>yyparse</CODE></A>.
-<DT><CODE>%left</CODE>
-<DD>
-Bison declaration to assign left associativity to token(s).
-See section <A HREF="bison.html#SEC51">Operator Precedence</A>.
-<DT><CODE>%nonassoc</CODE>
-<DD>
-Bison declaration to assign nonassociativity to token(s).
-See section <A HREF="bison.html#SEC51">Operator Precedence</A>.
-<DT><CODE>%prec</CODE>
-<DD>
-Bison declaration to assign a precedence to a specific rule.
-See section <A HREF="bison.html#SEC76">Context-Dependent Precedence</A>.
-<DT><CODE>%pure_parser</CODE>
-<DD>
-Bison declaration to request a pure (reentrant) parser.
-See section <A HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>.
-<DT><CODE>%right</CODE>
-<DD>
-Bison declaration to assign right associativity to token(s).
-See section <A HREF="bison.html#SEC51">Operator Precedence</A>.
-<DT><CODE>%start</CODE>
-<DD>
-Bison declaration to specify the start symbol.  See section <A HREF="bison.html#SEC55">The Start-Symbol</A>.
-<DT><CODE>%token</CODE>
-<DD>
-Bison declaration to declare token(s) without specifying precedence.
-See section <A HREF="bison.html#SEC50">Token Type Names</A>.
-<DT><CODE>%type</CODE>
-<DD>
-Bison declaration to declare nonterminals.  See section <A HREF="bison.html#SEC53">Nonterminal Symbols</A>.
-<DT><CODE>%union</CODE>
-<DD>
-Bison declaration to specify several possible data types for semantic
-values.  See section <A HREF="bison.html#SEC52">The Collection of Value Types</A>.
-</DL>
-<P>
-These are the punctuation and delimiters used in Bison input:
-<DL COMPACT>
-<DT><SAMP>`%%'</SAMP>
-<DD>
-Delimiter used to separate the grammar rule section from the
-Bison declarations section or the additional C code section.
-See section <A HREF="bison.html#SEC14">The Overall Layout of a Bison Grammar</A>.
-<DT><SAMP>`%{ %}'</SAMP>
-<DD>
-All code listed between <SAMP>`%{'</SAMP> and <SAMP>`%}'</SAMP> is copied directly
-to the output file uninterpreted.  Such code forms the "C
-declarations" section of the input file.  See section <A HREF="bison.html#SEC35">Outline of a Bison Grammar</A>.
-<DT><SAMP>`/*...*/'</SAMP>
-<DD>
-Comment delimiters, as in C.
-<DT><SAMP>`:'</SAMP>
-<DD>
-Separates a rule's result from its components.  See section <A HREF="bison.html#SEC41">Syntax of Grammar Rules</A>.
-<DT><SAMP>`;'</SAMP>
-<DD>
-Terminates a rule.  See section <A HREF="bison.html#SEC41">Syntax of Grammar Rules</A>.
-<DT><SAMP>`|'</SAMP>
-<DD>
-Separates alternate rules for the same result nonterminal.
-See section <A HREF="bison.html#SEC41">Syntax of Grammar Rules</A>.
-</DL>
-<P>
-<H1><A NAME="SEC92" HREF="bison.html#TOC92">Glossary</A></H1>
-<P>
-<A NAME="IDX195"></A>
-<DL COMPACT>
-<DT>Backus-Naur Form (BNF)
-<DD>
-Formal method of specifying context-free grammars.  BNF was first used
-in the <CITE>ALGOL-60</CITE> report, 1963.  See section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>.
-<DT>Context-free grammars
-<DD>
-Grammars specified as rules that can be applied regardless of context.
-Thus, if there is a rule which says that an integer can be used as an
-expression, integers are allowed <EM>anywhere</EM> an expression is
-permitted.  See section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>.
-<DT>Dynamic allocation
-<DD>
-Allocation of memory that occurs during execution, rather than at
-compile time or on entry to a function.
-<DT>Empty string
-<DD>
-Analogous to the empty set in set theory, the empty string is a
-character string of length zero.
-<DT>Finite-state stack machine
-<DD>
-A "machine" that has discrete states in which it is said to exist at
-each instant in time.  As input to the machine is processed, the
-machine moves from state to state as specified by the logic of the
-machine.  In the case of the parser, the input is the language being
-parsed, and the states correspond to various stages in the grammar
-rules.  See section <A HREF="bison.html#SEC68">The Bison Parser Algorithm</A>.
-<DT>Grouping
-<DD>
-A language construct that is (in general) grammatically divisible;
-for example, `expression' or `declaration' in C.  
-See section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>.
-<DT>Infix operator
-<DD>
-An arithmetic operator that is placed between the operands on which it
-performs some operation.
-<DT>Input stream
-<DD>
-A continuous flow of data between devices or programs.
-<DT>Language construct
-<DD>
-One of the typical usage schemas of the language.  For example, one of
-the constructs of the C language is the <CODE>if</CODE> statement.
-See section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>.
-<DT>Left associativity
-<DD>
-Operators having left associativity are analyzed from left to right:
-<SAMP>`a+b+c'</SAMP> first computes <SAMP>`a+b'</SAMP> and then combines with
-<SAMP>`c'</SAMP>.  See section <A HREF="bison.html#SEC71">Operator Precedence</A>.
-<DT>Left recursion
-<DD>
-A rule whose result symbol is also its first component symbol;
-for example, <SAMP>`expseq1 : expseq1 ',' exp;'</SAMP>.  See section <A HREF="bison.html#SEC42">Recursive Rules</A>.
-<DT>Left-to-right parsing
-<DD>
-Parsing a sentence of a language by analyzing it token by token from
-left to right.  See section <A HREF="bison.html#SEC68">The Bison Parser Algorithm</A>.
-<DT>Lexical analyzer (scanner)
-<DD>
-A function that reads an input stream and returns tokens one by one.
-See section <A HREF="bison.html#SEC61">The Lexical Analyzer Function <CODE>yylex</CODE></A>.
-<DT>Lexical tie-in
-<DD>
-A flag, set by actions in the grammar rules, which alters the way
-tokens are parsed.  See section <A HREF="bison.html#SEC84">Lexical Tie-ins</A>.
-<DT>Look-ahead token
-<DD>
-A token already read but not yet shifted.  See section <A HREF="bison.html#SEC69">Look-Ahead Tokens</A>.
-<DT>LALR(1)
-<DD>
-The class of context-free grammars that Bison (like most other parser
-generators) can handle; a subset of LR(1).  See section <A HREF="bison.html#SEC79">Mysterious Reduce/Reduce Conflicts</A>.
-<DT>LR(1)
-<DD>
-The class of context-free grammars in which at most one token of
-look-ahead is needed to disambiguate the parsing of any piece of input.
-<DT>Nonterminal symbol
-<DD>
-A grammar symbol standing for a grammatical construct that can
-be expressed through rules in terms of smaller constructs; in other
-words, a construct that is not a token.  See section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>.
-<DT>Parse error
-<DD>
-An error encountered during parsing of an input stream due to invalid
-syntax.  See section <A HREF="bison.html#SEC81">Error Recovery</A>.
-<DT>Parser
-<DD>
-A function that recognizes valid sentences of a language by analyzing
-the syntax structure of a set of tokens passed to it from a lexical
-analyzer.
-<DT>Postfix operator
-<DD>
-An arithmetic operator that is placed after the operands upon which it
-performs some operation.
-<DT>Reduction
-<DD>
-Replacing a string of nonterminals and/or terminals with a single
-nonterminal, according to a grammar rule.  See section <A HREF="bison.html#SEC68">The Bison Parser Algorithm</A>.
-<DT>Reentrant
-<DD>
-A reentrant subprogram is a subprogram which can be in invoked any
-number of times in parallel, without interference between the various
-invocations.  See section <A HREF="bison.html#SEC56">A Pure (Reentrant) Parser</A>.
-<DT>Reverse polish notation
-<DD>
-A language in which all operators are postfix operators.
-<DT>Right recursion
-<DD>
-A rule whose result symbol is also its last component symbol;
-for example, <SAMP>`expseq1: exp ',' expseq1;'</SAMP>.  See section <A HREF="bison.html#SEC42">Recursive Rules</A>.
-<DT>Semantics
-<DD>
-In computer languages, the semantics are specified by the actions
-taken for each instance of the language, i.e., the meaning of
-each statement.  See section <A HREF="bison.html#SEC43">Defining Language Semantics</A>.
-<DT>Shift
-<DD>
-A parser is said to shift when it makes the choice of analyzing
-further input from the stream rather than reducing immediately some
-already-recognized rule.  See section <A HREF="bison.html#SEC68">The Bison Parser Algorithm</A>.
-<DT>Single-character literal
-<DD>
-A single character that is recognized and interpreted as is.
-See section <A HREF="bison.html#SEC9">From Formal Rules to Bison Input</A>.
-<DT>Start symbol
-<DD>
-The nonterminal symbol that stands for a complete valid utterance in
-the language being parsed.  The start symbol is usually listed as the
-first nonterminal symbol in a language specification.  
-See section <A HREF="bison.html#SEC55">The Start-Symbol</A>.
-<DT>Symbol table
-<DD>
-A data structure where symbol names and associated data are stored
-during parsing to allow for recognition and use of existing
-information in repeated uses of a symbol.  See section <A HREF="bison.html#SEC29">Multi-Function Calculator: <CODE>mfcalc</CODE></A>.
-<DT>Token
-<DD>
-A basic, grammatically indivisible unit of a language.  The symbol
-that describes a token in the grammar is a terminal symbol.
-The input of the Bison parser is a stream of tokens which comes from
-the lexical analyzer.  See section <A HREF="bison.html#SEC40">Symbols, Terminal and Nonterminal</A>.
-<DT>Terminal symbol
-<DD>
-A grammar symbol that has no rules in the grammar and therefore
-is grammatically indivisible.  The piece of text it represents
-is a token.  See section <A HREF="bison.html#SEC8">Languages and Context-Free Grammars</A>.
-</DL>
-<P>
-<H1><A NAME="SEC93" HREF="bison.html#TOC93">Index</A></H1>
-<P>
-Jump to:
-<A HREF="#$">$</A>
--
-<A HREF="#%">%</A>
--
-<A HREF="#@">@</A>
--
-<A HREF="#a">a</A>
--
-<A HREF="#b">b</A>
--
-<A HREF="#c">c</A>
--
-<A HREF="#d">d</A>
--
-<A HREF="#e">e</A>
--
-<A HREF="#f">f</A>
--
-<A HREF="#g">g</A>
--
-<A HREF="#i">i</A>
--
-<A HREF="#l">l</A>
--
-<A HREF="#m">m</A>
--
-<A HREF="#n">n</A>
--
-<A HREF="#o">o</A>
--
-<A HREF="#p">p</A>
--
-<A HREF="#r">r</A>
--
-<A HREF="#s">s</A>
--
-<A HREF="#t">t</A>
--
-<A HREF="#u">u</A>
--
-<A HREF="#v">v</A>
--
-<A HREF="#w">w</A>
--
-<A HREF="#y">y</A>
--
-<A HREF="#|">|</A>
-<P>
-<H2><A NAME="$">$</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX80">$$</A>
-<LI><A HREF="bison.html#IDX81">$<VAR>n</VAR></A>
-</DIR>
-<H2><A NAME="%">%</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX105">%expect</A>
-<LI><A HREF="bison.html#IDX155">%left</A>
-<LI><A HREF="bison.html#IDX157">%nonassoc</A>
-<LI><A HREF="bison.html#IDX162">%prec</A>
-<LI><A HREF="bison.html#IDX112">%pure_parser</A>
-<LI><A HREF="bison.html#IDX156">%right</A>
-<LI><A HREF="bison.html#IDX109">%start</A>
-<LI><A HREF="bison.html#IDX91">%token</A>
-<LI><A HREF="bison.html#IDX100">%type</A>
-<LI><A HREF="bison.html#IDX97">%union</A>
-</DIR>
-<H2><A NAME="@">@</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX139">@<VAR>n</VAR></A>
-</DIR>
-<H2><A NAME="a">a</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX79">action</A>
-<LI><A HREF="bison.html#IDX83">action data types</A>
-<LI><A HREF="bison.html#IDX135">action features summary</A>
-<LI><A HREF="bison.html#IDX85">actions in mid-rule</A>
-<LI><A HREF="bison.html#IDX17">actions, semantic</A>
-<LI><A HREF="bison.html#IDX56">additional C code section</A>
-<LI><A HREF="bison.html#IDX141">algorithm of parser</A>
-<LI><A HREF="bison.html#IDX154">associativity</A>
-</DIR>
-<H2><A NAME="b">b</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX5">Backus-Naur form</A>
-<LI><A HREF="bison.html#IDX113">Bison declaration summary</A>
-<LI><A HREF="bison.html#IDX88">Bison declarations</A>
-<LI><A HREF="bison.html#IDX52">Bison declarations (introduction)</A>
-<LI><A HREF="bison.html#IDX11">Bison grammar</A>
-<LI><A HREF="bison.html#IDX189">Bison invocation</A>
-<LI><A HREF="bison.html#IDX18">Bison parser</A>
-<LI><A HREF="bison.html#IDX140">Bison parser algorithm</A>
-<LI><A HREF="bison.html#IDX193">Bison symbols, table of</A>
-<LI><A HREF="bison.html#IDX19">Bison utility</A>
-<LI><A HREF="bison.html#IDX4">BNF</A>
-</DIR>
-<H2><A NAME="c">c</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX57">C code, section for additional</A>
-<LI><A HREF="bison.html#IDX50">C declarations section</A>
-<LI><A HREF="bison.html#IDX116">C-language interface</A>
-<LI><A HREF="bison.html#IDX42"><CODE>calc</CODE></A>
-<LI><A HREF="bison.html#IDX43">calculator, infix notation</A>
-<LI><A HREF="bison.html#IDX47">calculator, multi-function</A>
-<LI><A HREF="bison.html#IDX33">calculator, simple</A>
-<LI><A HREF="bison.html#IDX62">character token</A>
-<LI><A HREF="bison.html#IDX40">compiling the parser</A>
-<LI><A HREF="bison.html#IDX148">conflicts</A>
-<LI><A HREF="bison.html#IDX167">conflicts, reduce/reduce</A>
-<LI><A HREF="bison.html#IDX104">conflicts, suppressing warnings of</A>
-<LI><A HREF="bison.html#IDX158">context-dependent precedence</A>
-<LI><A HREF="bison.html#IDX2">context-free grammar</A>
-<LI><A HREF="bison.html#IDX36">controlling function</A>
-</DIR>
-<H2><A NAME="d">d</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX150">dangling <CODE>else</CODE></A>
-<LI><A HREF="bison.html#IDX84">data types in actions</A>
-<LI><A HREF="bison.html#IDX77">data types of semantic values</A>
-<LI><A HREF="bison.html#IDX185">debugging</A>
-<LI><A HREF="bison.html#IDX114">declaration summary</A>
-<LI><A HREF="bison.html#IDX87">declarations, Bison</A>
-<LI><A HREF="bison.html#IDX53">declarations, Bison (introduction)</A>
-<LI><A HREF="bison.html#IDX51">declarations, C</A>
-<LI><A HREF="bison.html#IDX93">declaring operator precedence</A>
-<LI><A HREF="bison.html#IDX106">declaring the start symbol</A>
-<LI><A HREF="bison.html#IDX89">declaring token type names</A>
-<LI><A HREF="bison.html#IDX95">declaring value types</A>
-<LI><A HREF="bison.html#IDX98">declaring value types, nonterminals</A>
-<LI><A HREF="bison.html#IDX82">default action</A>
-<LI><A HREF="bison.html#IDX78">default data type</A>
-<LI><A HREF="bison.html#IDX174">default stack limit</A>
-<LI><A HREF="bison.html#IDX108">default start symbol</A>
-<LI><A HREF="bison.html#IDX73">defining language semantics</A>
-</DIR>
-<H2><A NAME="e">e</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX151"><CODE>else</CODE>, dangling</A>
-<LI><A HREF="bison.html#IDX178">error</A>
-<LI><A HREF="bison.html#IDX176">error recovery</A>
-<LI><A HREF="bison.html#IDX44">error recovery, simple</A>
-<LI><A HREF="bison.html#IDX128">error reporting function</A>
-<LI><A HREF="bison.html#IDX38">error reporting routine</A>
-<LI><A HREF="bison.html#IDX29">examples, simple</A>
-<LI><A HREF="bison.html#IDX49">exercises</A>
-</DIR>
-<H2><A NAME="f">f</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX25">file format</A>
-<LI><A HREF="bison.html#IDX163">finite-state machine</A>
-<LI><A HREF="bison.html#IDX13">formal grammar</A>
-<LI><A HREF="bison.html#IDX26">format of grammar file</A>
-</DIR>
-<H2><A NAME="g">g</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX195">glossary</A>
-<LI><A HREF="bison.html#IDX24">grammar file</A>
-<LI><A HREF="bison.html#IDX66">grammar rule syntax</A>
-<LI><A HREF="bison.html#IDX54">grammar rules section</A>
-<LI><A HREF="bison.html#IDX12">grammar, Bison</A>
-<LI><A HREF="bison.html#IDX3">grammar, context-free</A>
-<LI><A HREF="bison.html#IDX9">grouping, syntactic</A>
-</DIR>
-<H2><A NAME="i">i</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX41">infix notation calculator</A>
-<LI><A HREF="bison.html#IDX117">interface</A>
-<LI><A HREF="bison.html#IDX1">introduction</A>
-<LI><A HREF="bison.html#IDX188">invoking Bison</A>
-<LI><A HREF="bison.html#IDX191">invoking Bison under VMS</A>
-</DIR>
-<H2><A NAME="l">l</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX169">LALR(1)</A>
-<LI><A HREF="bison.html#IDX74">language semantics, defining</A>
-<LI><A HREF="bison.html#IDX27">layout of Bison grammar</A>
-<LI><A HREF="bison.html#IDX70">left recursion</A>
-<LI><A HREF="bison.html#IDX122">lexical analyzer</A>
-<LI><A HREF="bison.html#IDX20">lexical analyzer, purpose</A>
-<LI><A HREF="bison.html#IDX35">lexical analyzer, writing</A>
-<LI><A HREF="bison.html#IDX182">lexical tie-in</A>
-<LI><A HREF="bison.html#IDX63">literal token</A>
-<LI><A HREF="bison.html#IDX146">look-ahead token</A>
-<LI><A HREF="bison.html#IDX168">LR(1)</A>
-</DIR>
-<H2><A NAME="m">m</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX37">main function in simple example</A>
-<LI><A HREF="bison.html#IDX46"><CODE>mfcalc</CODE></A>
-<LI><A HREF="bison.html#IDX86">mid-rule actions</A>
-<LI><A HREF="bison.html#IDX45">multi-function calculator</A>
-<LI><A HREF="bison.html#IDX72">mutual recursion</A>
-</DIR>
-<H2><A NAME="n">n</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX58">nonterminal symbol</A>
-</DIR>
-<H2><A NAME="o">o</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX152">operator precedence</A>
-<LI><A HREF="bison.html#IDX94">operator precedence, declaring</A>
-<LI><A HREF="bison.html#IDX190">options for invoking Bison</A>
-<LI><A HREF="bison.html#IDX172">overflow of parser stack</A>
-</DIR>
-<H2><A NAME="p">p</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX130">parse error</A>
-<LI><A HREF="bison.html#IDX21">parser</A>
-<LI><A HREF="bison.html#IDX144">parser stack</A>
-<LI><A HREF="bison.html#IDX171">parser stack overflow</A>
-<LI><A HREF="bison.html#IDX164">parser state</A>
-<LI><A HREF="bison.html#IDX31">polish notation calculator</A>
-<LI><A HREF="bison.html#IDX92">precedence declarations</A>
-<LI><A HREF="bison.html#IDX153">precedence of operators</A>
-<LI><A HREF="bison.html#IDX160">precedence, context-dependent</A>
-<LI><A HREF="bison.html#IDX161">precedence, unary operator</A>
-<LI><A HREF="bison.html#IDX102">preventing warnings about conflicts</A>
-<LI><A HREF="bison.html#IDX111">pure parser</A>
-</DIR>
-<H2><A NAME="r">r</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX177">recovery from errors</A>
-<LI><A HREF="bison.html#IDX69">recursive rule</A>
-<LI><A HREF="bison.html#IDX166">reduce/reduce conflict</A>
-<LI><A HREF="bison.html#IDX143">reduction</A>
-<LI><A HREF="bison.html#IDX110">reentrant parser</A>
-<LI><A HREF="bison.html#IDX30">reverse polish notation</A>
-<LI><A HREF="bison.html#IDX71">right recursion</A>
-<LI><A HREF="bison.html#IDX32"><CODE>rpcalc</CODE></A>
-<LI><A HREF="bison.html#IDX65">rule syntax</A>
-<LI><A HREF="bison.html#IDX55">rules section for grammar</A>
-<LI><A HREF="bison.html#IDX39">running Bison (introduction)</A>
-</DIR>
-<H2><A NAME="s">s</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX16">semantic actions</A>
-<LI><A HREF="bison.html#IDX14">semantic value</A>
-<LI><A HREF="bison.html#IDX75">semantic value type</A>
-<LI><A HREF="bison.html#IDX149">shift/reduce conflicts</A>
-<LI><A HREF="bison.html#IDX142">shifting</A>
-<LI><A HREF="bison.html#IDX28">simple examples</A>
-<LI><A HREF="bison.html#IDX64">single-character literal</A>
-<LI><A HREF="bison.html#IDX170">stack overflow</A>
-<LI><A HREF="bison.html#IDX145">stack, parser</A>
-<LI><A HREF="bison.html#IDX22">stages in using Bison</A>
-<LI><A HREF="bison.html#IDX10">start symbol</A>
-<LI><A HREF="bison.html#IDX107">start symbol, declaring</A>
-<LI><A HREF="bison.html#IDX165">state (of parser)</A>
-<LI><A HREF="bison.html#IDX134">summary, action features</A>
-<LI><A HREF="bison.html#IDX115">summary, Bison declaration</A>
-<LI><A HREF="bison.html#IDX101">suppressing conflict warnings</A>
-<LI><A HREF="bison.html#IDX61">symbol</A>
-<LI><A HREF="bison.html#IDX48">symbol table example</A>
-<LI><A HREF="bison.html#IDX6">symbols (abstract)</A>
-<LI><A HREF="bison.html#IDX194">symbols in Bison, table of</A>
-<LI><A HREF="bison.html#IDX8">syntactic grouping</A>
-<LI><A HREF="bison.html#IDX131">syntax error</A>
-<LI><A HREF="bison.html#IDX67">syntax of grammar rules</A>
-</DIR>
-<H2><A NAME="t">t</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX59">terminal symbol</A>
-<LI><A HREF="bison.html#IDX7">token</A>
-<LI><A HREF="bison.html#IDX60">token type</A>
-<LI><A HREF="bison.html#IDX90">token type names, declaring</A>
-<LI><A HREF="bison.html#IDX186">tracing the parser</A>
-</DIR>
-<H2><A NAME="u">u</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX159">unary operator precedence</A>
-<LI><A HREF="bison.html#IDX23">using Bison</A>
-</DIR>
-<H2><A NAME="v">v</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX76">value type, semantic</A>
-<LI><A HREF="bison.html#IDX96">value types, declaring</A>
-<LI><A HREF="bison.html#IDX99">value types, nonterminals, declaring</A>
-<LI><A HREF="bison.html#IDX15">value, semantic</A>
-<LI><A HREF="bison.html#IDX192">VMS</A>
-</DIR>
-<H2><A NAME="w">w</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX103">warnings, preventing</A>
-<LI><A HREF="bison.html#IDX34">writing a lexical analyzer</A>
-</DIR>
-<H2><A NAME="y">y</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX120">YYABORT</A>
-<LI><A HREF="bison.html#IDX119">YYACCEPT</A>
-<LI><A HREF="bison.html#IDX136">YYBACKUP</A>
-<LI><A HREF="bison.html#IDX147">yychar</A>
-<LI><A HREF="bison.html#IDX180">yyclearin</A>
-<LI><A HREF="bison.html#IDX183">YYDEBUG</A>
-<LI><A HREF="bison.html#IDX184">yydebug</A>
-<LI><A HREF="bison.html#IDX137">YYEMPTY</A>
-<LI><A HREF="bison.html#IDX179">yyerrok</A>
-<LI><A HREF="bison.html#IDX129">yyerror</A>
-<LI><A HREF="bison.html#IDX138">YYERROR</A>
-<LI><A HREF="bison.html#IDX132">YYERROR_VERBOSE</A>
-<LI><A HREF="bison.html#IDX175">YYINITDEPTH</A>
-<LI><A HREF="bison.html#IDX121">yylex</A>
-<LI><A HREF="bison.html#IDX127">YYLEX_PARAM</A>
-<LI><A HREF="bison.html#IDX124">yylloc</A>
-<LI><A HREF="bison.html#IDX125">YYLTYPE</A>
-<LI><A HREF="bison.html#IDX123">yylval</A>
-<LI><A HREF="bison.html#IDX173">YYMAXDEPTH</A>
-<LI><A HREF="bison.html#IDX133">yynerrs</A>
-<LI><A HREF="bison.html#IDX118">yyparse</A>
-<LI><A HREF="bison.html#IDX126">YYPARSE_PARAM</A>
-<LI><A HREF="bison.html#IDX187">YYPRINT</A>
-<LI><A HREF="bison.html#IDX181">YYRECOVERING</A>
-</DIR>
-<H2><A NAME="|">|</A></H2>
-<DIR>
-<LI><A HREF="bison.html#IDX68">|</A>
-</DIR>
-<P><HR><P>
-This document was generated on 2 October 1998 using the
-<A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A>
-translator version 1.52.</P>
-</BODY>
-</HTML>

BIN
Engine/bin/flex/flex.exe


+ 0 - 4079
Engine/bin/flex/flex_1.html

@@ -1,4079 +0,0 @@
-<html><head><title>flex</title></head><body>
-<ul>
-</ul><H2>NAME </H2><ul>
-
-flex - fast lexical analyzer generator
-
-</ul><H2>SYNOPSIS </H2><ul>
-
-<b>flex</b> 
-<b>[-bcdfhilnpstvwBFILTV78+?</b> <b>-C[aefFmr]</b> <b>-ooutput</b> <b>-Pprefix</b> <b>-Sskeleton]</b> 
-<b>[--help</b> <b>--version]</b> 
-<i>[filename</i> <i>...]</i> 
-
-</ul><H2>OVERVIEW </H2><ul>
-
-This manual describes
-<i>flex,</i> 
-a tool for generating programs that perform pattern-matching on text.  The
-manual includes both tutorial and reference sections:
-<pre>
-
-<p><br>    Description
-<br>        a brief overview of the tool
-<br>
-<p><br>    Some Simple Examples
-<br>
-<p><br>    Format Of The Input File
-<br>
-<p><br>    Patterns
-<br>        the extended regular expressions used by flex
-<br>
-<p><br>    How The Input Is Matched
-<br>        the rules for determining what has been matched
-<br>
-<p><br>    Actions
-<br>        how to specify what to do when a pattern is matched
-<br>
-<p><br>    The Generated Scanner
-<br>        details regarding the scanner that flex produces;
-<br>        how to control the input source
-<br>
-<p><br>    Start Conditions
-<br>        introducing context into your scanners, and
-<br>        managing "mini-scanners"
-<br>
-<p><br>    Multiple Input Buffers
-<br>        how to manipulate multiple input sources; how to
-<br>        scan from strings instead of files
-<br>
-<p><br>    End-of-file Rules
-<br>        special rules for matching the end of the input
-<br>
-<p><br>    Miscellaneous Macros
-<br>        a summary of macros available to the actions
-<br>
-<p><br>    Values Available To The User
-<br>        a summary of values available to the actions
-<br>
-<p><br>    Interfacing With Yacc
-<br>        connecting flex scanners together with yacc parsers
-<br>
-<p><br>    Options
-<br>        flex command-line options, and the "%option"
-<br>        directive
-<br>
-<p><br>    Performance Considerations
-<br>        how to make your scanner go as fast as possible
-<br>
-<p><br>    Generating C++ Scanners
-<br>        the (experimental) facility for generating C++
-<br>        scanner classes
-<br>
-<p><br>    Incompatibilities With Lex And POSIX
-<br>        how flex differs from AT&amp;T lex and the POSIX lex
-<br>        standard
-<br>
-<p><br>    Diagnostics
-<br>        those error messages produced by flex (or scanners
-<br>        it generates) whose meanings might not be apparent
-<br>
-<p><br>    Files
-<br>        files used by flex
-<br>
-<p><br>    Deficiencies / Bugs
-<br>        known problems with flex
-<br>
-<p><br>    See Also
-<br>        other documentation, related tools
-<br>
-<p><br>    Author
-<br>        includes contact information
-<br>
-<p><br></pre>
-
-</ul><H2>DESCRIPTION </H2><ul>
-
-<i>flex</i> 
-is a tool for generating
-<i>scanners:</i> 
-programs which recognized lexical patterns in text.
-<i>flex</i> 
-reads
-the given input files, or its standard input if no file names are given,
-for a description of a scanner to generate.  The description is in
-the form of pairs
-of regular expressions and C code, called
-<i>rules.</i> <i>flex</i> 
-generates as output a C source file,
-<b>lex.yy.c,</b> 
-which defines a routine
-<b>yylex().</b> 
-This file is compiled and linked with the
-<b>-lfl</b> 
-library to produce an executable.  When the executable is run,
-it analyzes its input for occurrences
-of the regular expressions.  Whenever it finds one, it executes
-the corresponding C code.
-
-</ul><H2>SOME SIMPLE EXAMPLES </H2><ul>
-
-
-<p>
-First some simple examples to get the flavor of how one uses
-<i>flex.</i> 
-The following
-<i>flex</i> 
-input specifies a scanner which whenever it encounters the string
-"username" will replace it with the user's login name:
-<pre>
-
-<p><br>    %%
-<br>    username    printf( "%s", getlogin() );
-<br>
-<p><br></pre>
-By default, any text not matched by a
-<i>flex</i> 
-scanner
-is copied to the output, so the net effect of this scanner is
-to copy its input file to its output with each occurrence
-of "username" expanded.
-In this input, there is just one rule.  "username" is the
-<i>pattern</i> 
-and the "printf" is the
-<i>action.</i> 
-The "%%" marks the beginning of the rules.
-
-<p>
-Here's another simple example:
-<pre>
-
-<p><br>            int num_lines = 0, num_chars = 0;
-<br>
-<p><br>    %%
-<br>    \n      ++num_lines; ++num_chars;
-<br>    .       ++num_chars;
-<br>
-<p><br>    %%
-<br>    main()
-<br>            {
-<br>            yylex();
-<br>            printf( "# of lines = %d, # of chars = %d\n",
-<br>                    num_lines, num_chars );
-<br>            }
-<br>
-<p><br></pre>
-This scanner counts the number of characters and the number
-of lines in its input (it produces no output other than the
-final report on the counts).  The first line
-declares two globals, "num_lines" and "num_chars", which are accessible
-both inside
-<b>yylex()</b> 
-and in the
-<b>main()</b> 
-routine declared after the second "%%".  There are two rules, one
-which matches a newline ("\n") and increments both the line count and
-the character count, and one which matches any character other than
-a newline (indicated by the "." regular expression).
-
-<p>
-A somewhat more complicated example:
-<pre>
-
-<p><br>    /* scanner for a toy Pascal-like language */
-<br>
-<p><br>    %{
-<br>    /* need this for the call to atof() below */
-<br>    #include &lt;math.h&gt;
-<br>    %}
-<br>
-<p><br>    DIGIT    [0-9]
-<br>    ID       [a-z][a-z0-9]*
-<br>
-<p><br>    %%
-<br>
-<p><br>    {DIGIT}+    {
-<br>                printf( "An integer: %s (%d)\n", yytext,
-<br>                        atoi( yytext ) );
-<br>                }
-<br>
-<p><br>    {DIGIT}+"."{DIGIT}*        {
-<br>                printf( "A float: %s (%g)\n", yytext,
-<br>                        atof( yytext ) );
-<br>                }
-<br>
-<p><br>    if|then|begin|end|procedure|function        {
-<br>                printf( "A keyword: %s\n", yytext );
-<br>                }
-<br>
-<p><br>    {ID}        printf( "An identifier: %s\n", yytext );
-<br>
-<p><br>    "+"|"-"|"*"|"/"   printf( "An operator: %s\n", yytext );
-<br>
-<p><br>    "{"[^}\n]*"}"     /* eat up one-line comments */
-<br>
-<p><br>    [ \t\n]+          /* eat up whitespace */
-<br>
-<p><br>    .           printf( "Unrecognized character: %s\n", yytext );
-<br>
-<p><br>    %%
-<br>
-<p><br>    main( argc, argv )
-<br>    int argc;
-<br>    char **argv;
-<br>        {
-<br>        ++argv, --argc;  /* skip over program name */
-<br>        if ( argc &gt; 0 )
-<br>                yyin = fopen( argv[0], "r" );
-<br>        else
-<br>                yyin = stdin;
-<br>        
-<br>        yylex();
-<br>        }
-<br>
-<p><br></pre>
-This is the beginnings of a simple scanner for a language like
-Pascal.  It identifies different types of
-<i>tokens</i> 
-and reports on what it has seen.
-
-<p>
-The details of this example will be explained in the following
-sections.
-
-</ul><H2>FORMAT OF THE INPUT FILE </H2><ul>
-
-The
-<i>flex</i> 
-input file consists of three sections, separated by a line with just
-<b>%%</b> 
-in it:
-<pre>
-
-<p><br>    definitions
-<br>    %%
-<br>    rules
-<br>    %%
-<br>    user code
-<br>
-<p><br></pre>
-The
-<i>definitions</i> 
-section contains declarations of simple
-<i>name</i> 
-definitions to simplify the scanner specification, and declarations of
-<i>start</i> <i>conditions,</i> 
-which are explained in a later section.
-
-<p>
-Name definitions have the form:
-<pre>
-
-<p><br>    name definition
-<br>
-<p><br></pre>
-The "name" is a word beginning with a letter or an underscore ('_')
-followed by zero or more letters, digits, '_', or '-' (dash).
-The definition is taken to begin at the first non-white-space character
-following the name and continuing to the end of the line.
-The definition can subsequently be referred to using "{name}", which
-will expand to "(definition)".  For example,
-<pre>
-
-<p><br>    DIGIT    [0-9]
-<br>    ID       [a-z][a-z0-9]*
-<br>
-<p><br></pre>
-defines "DIGIT" to be a regular expression which matches a
-single digit, and
-"ID" to be a regular expression which matches a letter
-followed by zero-or-more letters-or-digits.
-A subsequent reference to
-<pre>
-
-<p><br>    {DIGIT}+"."{DIGIT}*
-<br>
-<p><br></pre>
-is identical to
-<pre>
-
-<p><br>    ([0-9])+"."([0-9])*
-<br>
-<p><br></pre>
-and matches one-or-more digits followed by a '.' followed
-by zero-or-more digits.
-
-<p>
-The
-<i>rules</i> 
-section of the
-<i>flex</i> 
-input contains a series of rules of the form:
-<pre>
-
-<p><br>    pattern   action
-<br>
-<p><br></pre>
-where the pattern must be unindented and the action must begin
-on the same line.
-
-<p>
-See below for a further description of patterns and actions.
-
-<p>
-Finally, the user code section is simply copied to
-<b>lex.yy.c</b> 
-verbatim.
-It is used for companion routines which call or are called
-by the scanner.  The presence of this section is optional;
-if it is missing, the second
-<b>%%</b> 
-in the input file may be skipped, too.
-
-<p>
-In the definitions and rules sections, any
-<i>indented</i> 
-text or text enclosed in
-<b>%{</b> 
-and
-<b>%}</b> 
-is copied verbatim to the output (with the %{}'s removed).
-The %{}'s must appear unindented on lines by themselves.
-
-<p>
-In the rules section,
-any indented or %{} text appearing before the
-first rule may be used to declare variables
-which are local to the scanning routine and (after the declarations)
-code which is to be executed whenever the scanning routine is entered.
-Other indented or %{} text in the rule section is still copied to the output,
-but its meaning is not well-defined and it may well cause compile-time
-errors (this feature is present for
-<i>POSIX</i> 
-compliance; see below for other such features).
-
-<p>
-In the definitions section (but not in the rules section),
-an unindented comment (i.e., a line
-beginning with "/*") is also copied verbatim to the output up
-to the next "*/".
-
-</ul><H2>PATTERNS </H2><ul>
-
-The patterns in the input are written using an extended set of regular
-expressions.  These are:
-<pre>
-
-<p><br>    x          match the character 'x'
-<br>    .          any character (byte) except newline
-<br>    [xyz]      a "character class"; in this case, the pattern
-<br>                 matches either an 'x', a 'y', or a 'z'
-<br>    [abj-oZ]   a "character class" with a range in it; matches
-<br>                 an 'a', a 'b', any letter from 'j' through 'o',
-<br>                 or a 'Z'
-<br>    [^A-Z]     a "negated character class", i.e., any character
-<br>                 but those in the class.  In this case, any
-<br>                 character EXCEPT an uppercase letter.
-<br>    [^A-Z\n]   any character EXCEPT an uppercase letter or
-<br>                 a newline
-<br>    r*         zero or more r's, where r is any regular expression
-<br>    r+         one or more r's
-<br>    r?         zero or one r's (that is, "an optional r")
-<br>    r{2,5}     anywhere from two to five r's
-<br>    r{2,}      two or more r's
-<br>    r{4}       exactly 4 r's
-<br>    {name}     the expansion of the "name" definition
-<br>               (see above)
-<br>    "[xyz]\"foo"
-<br>               the literal string: [xyz]"foo
-<br>    \X         if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v',
-<br>                 then the ANSI-C interpretation of \x.
-<br>                 Otherwise, a literal 'X' (used to escape
-<br>                 operators such as '*')
-<br>    \0         a NUL character (ASCII code 0)
-<br>    \123       the character with octal value 123
-<br>    \x2a       the character with hexadecimal value 2a
-<br>    (r)        match an r; parentheses are used to override
-<br>                 precedence (see below)
-<br>
-<p><br>
-<p><br>    rs         the regular expression r followed by the
-<br>                 regular expression s; called "concatenation"
-<br>
-<p><br>
-<p><br>    r|s        either an r or an s
-<br>
-<p><br>
-<p><br>    r/s        an r but only if it is followed by an s.  The
-<br>                 text matched by s is included when determining
-<br>                 whether this rule is the "longest match",
-<br>                 but is then returned to the input before
-<br>                 the action is executed.  So the action only
-<br>                 sees the text matched by r.  This type
-<br>                 of pattern is called trailing context".
-<br>                 (There are some combinations of r/s that flex
-<br>                 cannot match correctly; see notes in the
-<br>                 Deficiencies / Bugs section below regarding
-<br>                 "dangerous trailing context".)
-<br>    ^r         an r, but only at the beginning of a line (i.e.,
-<br>                 which just starting to scan, or right after a
-<br>                 newline has been scanned).
-<br>    r$         an r, but only at the end of a line (i.e., just
-<br>                 before a newline).  Equivalent to "r/\n".
-<br>
-<p><br>               Note that flex's notion of "newline" is exactly
-<br>               whatever the C compiler used to compile flex
-<br>               interprets '\n' as; in particular, on some DOS
-<br>               systems you must either filter out \r's in the
-<br>               input yourself, or explicitly use r/\r\n for "r$".
-<br>
-<p><br>
-<p><br>    &lt;s&gt;r       an r, but only in start condition s (see
-<br>                 below for discussion of start conditions)
-<br>    &lt;s1,s2,s3&gt;r
-<br>               same, but in any of start conditions s1,
-<br>                 s2, or s3
-<br>    &lt;*&gt;r       an r in any start condition, even an exclusive one.
-<br>
-<p><br>
-<p><br>    &lt;&lt;EOF&gt;&gt;    an end-of-file
-<br>    &lt;s1,s2&gt;&lt;&lt;EOF&gt;&gt;
-<br>               an end-of-file when in start condition s1 or s2
-<br>
-<p><br></pre>
-Note that inside of a character class, all regular expression operators
-lose their special meaning except escape ('\') and the character class
-operators, '-', ']', and, at the beginning of the class, '^'.
-
-<p>
-The regular expressions listed above are grouped according to
-precedence, from highest precedence at the top to lowest at the bottom.
-Those grouped together have equal precedence.  For example,
-<pre>
-
-<p><br>    foo|bar*
-<br>
-<p><br></pre>
-is the same as
-<pre>
-
-<p><br>    (foo)|(ba(r*))
-<br>
-<p><br></pre>
-since the '*' operator has higher precedence than concatenation,
-and concatenation higher than alternation ('|').  This pattern
-therefore matches
-<i>either</i> 
-the string "foo"
-<i>or</i> 
-the string "ba" followed by zero-or-more r's.
-To match "foo" or zero-or-more "bar"'s, use:
-<pre>
-
-<p><br>    foo|(bar)*
-<br>
-<p><br></pre>
-and to match zero-or-more "foo"'s-or-"bar"'s:
-<pre>
-
-<p><br>    (foo|bar)*
-<br>
-<p><br></pre>
-
-<p>
-In addition to characters and ranges of characters, character classes
-can also contain character class
-<i>expressions.</i> 
-These are expressions enclosed inside
-<b>[:</b> 
-and
-<b>:]</b> 
-delimiters (which themselves must appear between the '[' and ']' of the
-character class; other elements may occur inside the character class, too).
-The valid expressions are:
-<pre>
-
-<p><br>    [:alnum:] [:alpha:] [:blank:]
-<br>    [:cntrl:] [:digit:] [:graph:]
-<br>    [:lower:] [:print:] [:punct:]
-<br>    [:space:] [:upper:] [:xdigit:]
-<br>
-<p><br></pre>
-These expressions all designate a set of characters equivalent to
-the corresponding standard C
-<b>isXXX</b> 
-function.  For example,
-<b>[:alnum:]</b> 
-designates those characters for which
-<b>isalnum()</b> 
-returns true - i.e., any alphabetic or numeric.
-Some systems don't provide
-<b>isblank(),</b> 
-so flex defines
-<b>[:blank:]</b> 
-as a blank or a tab.
-
-<p>
-For example, the following character classes are all equivalent:
-<pre>
-
-<p><br>    [[:alnum:]]
-<br>    [[:alpha:][:digit:]
-<br>    [[:alpha:]0-9]
-<br>    [a-zA-Z0-9]
-<br>
-<p><br></pre>
-If your scanner is case-insensitive (the
-<b>-i</b> 
-flag), then
-<b>[:upper:]</b> 
-and
-<b>[:lower:]</b> 
-are equivalent to
-<b>[:alpha:].</b> 
-
-<p>
-Some notes on patterns:
-<p><dl compact><dt>-<dd>A negated character class such as the example "[^A-Z]"
-above
-<i>will</i> <i>match</i> <i>a</i> <i>newline</i> 
-unless "\n" (or an equivalent escape sequence) is one of the
-characters explicitly present in the negated character class
-(e.g., "[^A-Z\n]").  This is unlike how many other regular
-expression tools treat negated character classes, but unfortunately
-the inconsistency is historically entrenched.
-Matching newlines means that a pattern like [^"]* can match the entire
-input unless there's another quote in the input.
-<dt>-<dd>A rule can have at most one instance of trailing context (the '/' operator
-or the '$' operator).  The start condition, '^', and "&lt;&lt;EOF&gt;&gt;" patterns
-can only occur at the beginning of a pattern, and, as well as with '/' and '$',
-cannot be grouped inside parentheses.  A '^' which does not occur at
-the beginning of a rule or a '$' which does not occur at the end of
-a rule loses its special properties and is treated as a normal character.
-<dt><dd>The following are illegal:
-<pre>
-
-<p><br>    foo/bar$
-<br>    &lt;sc1&gt;foo&lt;sc2&gt;bar
-<br>
-<p><br></pre>
-Note that the first of these, can be written "foo/bar\n".
-<dt><dd>The following will result in '$' or '^' being treated as a normal character:
-<pre>
-
-<p><br>    foo|(bar$)
-<br>    foo|^bar
-<br>
-<p><br></pre>
-If what's wanted is a "foo" or a bar-followed-by-a-newline, the following
-could be used (the special '|' action is explained below):
-<pre>
-
-<p><br>    foo      |
-<br>    bar$     /* action goes here */
-<br>
-<p><br></pre>
-A similar trick will work for matching a foo or a
-bar-at-the-beginning-of-a-line.
-</dl>
-</ul><H2>HOW THE INPUT IS MATCHED </H2><ul>
-
-When the generated scanner is run, it analyzes its input looking
-for strings which match any of its patterns.  If it finds more than
-one match, it takes the one matching the most text (for trailing
-context rules, this includes the length of the trailing part, even
-though it will then be returned to the input).  If it finds two
-or more matches of the same length, the
-rule listed first in the
-<i>flex</i> 
-input file is chosen.
-
-<p>
-Once the match is determined, the text corresponding to the match
-(called the
-<i>token)</i> 
-is made available in the global character pointer
-<b>yytext,</b> 
-and its length in the global integer
-<b>yyleng.</b> 
-The
-<i>action</i> 
-corresponding to the matched pattern is then executed (a more
-detailed description of actions follows), and then the remaining
-input is scanned for another match.
-
-<p>
-If no match is found, then the
-<i>default</i> <i>rule</i> 
-is executed: the next character in the input is considered matched and
-copied to the standard output.  Thus, the simplest legal
-<i>flex</i> 
-input is:
-<pre>
-
-<p><br>    %%
-<br>
-<p><br></pre>
-which generates a scanner that simply copies its input (one character
-at a time) to its output.
-
-<p>
-Note that
-<b>yytext</b> 
-can be defined in two different ways: either as a character
-<i>pointer</i> 
-or as a character
-<i>array.</i> 
-You can control which definition
-<i>flex</i> 
-uses by including one of the special directives
-<b>%pointer</b> 
-or
-<b>%array</b> 
-in the first (definitions) section of your flex input.  The default is
-<b>%pointer,</b> 
-unless you use the
-<b>-l</b> 
-lex compatibility option, in which case
-<b>yytext</b> 
-will be an array.
-The advantage of using
-<b>%pointer</b> 
-is substantially faster scanning and no buffer overflow when matching
-very large tokens (unless you run out of dynamic memory).  The disadvantage
-is that you are restricted in how your actions can modify
-<b>yytext</b> 
-(see the next section), and calls to the
-<b>unput()</b> 
-function destroys the present contents of
-<b>yytext,</b> 
-which can be a considerable porting headache when moving between different
-<i>lex</i> 
-versions.
-
-<p>
-The advantage of
-<b>%array</b> 
-is that you can then modify
-<b>yytext</b> 
-to your heart's content, and calls to
-<b>unput()</b> 
-do not destroy
-<b>yytext</b> 
-(see below).  Furthermore, existing
-<i>lex</i> 
-programs sometimes access
-<b>yytext</b> 
-externally using declarations of the form:
-<pre>
-    extern char yytext[];
-<br></pre>
-This definition is erroneous when used with
-<b>%pointer,</b> 
-but correct for
-<b>%array.</b> 
-
-<p>
-<b>%array</b> 
-defines
-<b>yytext</b> 
-to be an array of
-<b>YYLMAX</b> 
-characters, which defaults to a fairly large value.  You can change
-the size by simply #define'ing
-<b>YYLMAX</b> 
-to a different value in the first section of your
-<i>flex</i> 
-input.  As mentioned above, with
-<b>%pointer</b> 
-yytext grows dynamically to accommodate large tokens.  While this means your
-<b>%pointer</b> 
-scanner can accommodate very large tokens (such as matching entire blocks
-of comments), bear in mind that each time the scanner must resize
-<b>yytext</b> 
-it also must rescan the entire token from the beginning, so matching such
-tokens can prove slow.
-<b>yytext</b> 
-presently does
-<i>not</i> 
-dynamically grow if a call to
-<b>unput()</b> 
-results in too much text being pushed back; instead, a run-time error results.
-
-<p>
-Also note that you cannot use
-<b>%array</b> 
-with C++ scanner classes
-(the
-<b>c++</b> 
-option; see below).
-
-</ul><H2>ACTIONS </H2><ul>
-
-Each pattern in a rule has a corresponding action, which can be any
-arbitrary C statement.  The pattern ends at the first non-escaped
-whitespace character; the remainder of the line is its action.  If the
-action is empty, then when the pattern is matched the input token
-is simply discarded.  For example, here is the specification for a program
-which deletes all occurrences of "zap me" from its input:
-<pre>
-
-<p><br>    %%
-<br>    "zap me"
-<br>
-<p><br></pre>
-(It will copy all other characters in the input to the output since
-they will be matched by the default rule.)
-
-<p>
-Here is a program which compresses multiple blanks and tabs down to
-a single blank, and throws away whitespace found at the end of a line:
-<pre>
-
-<p><br>    %%
-<br>    [ \t]+        putchar( ' ' );
-<br>    [ \t]+$       /* ignore this token */
-<br>
-<p><br></pre>
-
-<p>
-If the action contains a '{', then the action spans till the balancing '}'
-is found, and the action may cross multiple lines.
-<i>flex</i> 
-knows about C strings and comments and won't be fooled by braces found
-within them, but also allows actions to begin with
-<b>%{</b> 
-and will consider the action to be all the text up to the next
-<b>%}</b> 
-(regardless of ordinary braces inside the action).
-
-<p>
-An action consisting solely of a vertical bar ('|') means "same as
-the action for the next rule."  See below for an illustration.
-
-<p>
-Actions can include arbitrary C code, including
-<b>return</b> 
-statements to return a value to whatever routine called
-<b>yylex().</b> 
-Each time
-<b>yylex()</b> 
-is called it continues processing tokens from where it last left
-off until it either reaches
-the end of the file or executes a return.
-
-<p>
-Actions are free to modify
-<b>yytext</b> 
-except for lengthening it (adding
-characters to its end--these will overwrite later characters in the
-input stream).  This however does not apply when using
-<b>%array</b> 
-(see above); in that case,
-<b>yytext</b> 
-may be freely modified in any way.
-
-<p>
-Actions are free to modify
-<b>yyleng</b> 
-except they should not do so if the action also includes use of
-<b>yymore()</b> 
-(see below).
-
-<p>
-There are a number of special directives which can be included within
-an action:
-<p><dl compact><dt>-<dd><b>ECHO</b> 
-copies yytext to the scanner's output.
-<dt>-<dd><b>BEGIN</b> 
-followed by the name of a start condition places the scanner in the
-corresponding start condition (see below).
-<dt>-<dd><b>REJECT</b> 
-directs the scanner to proceed on to the "second best" rule which matched the
-input (or a prefix of the input).  The rule is chosen as described
-above in "How the Input is Matched", and
-<b>yytext</b> 
-and
-<b>yyleng</b> 
-set up appropriately.
-It may either be one which matched as much text
-as the originally chosen rule but came later in the
-<i>flex</i> 
-input file, or one which matched less text.
-For example, the following will both count the
-words in the input and call the routine special() whenever "frob" is seen:
-<pre>
-
-<p><br>            int word_count = 0;
-<br>    %%
-<br>
-<p><br>    frob        special(); REJECT;
-<br>    [^ \t\n]+   ++word_count;
-<br>
-<p><br></pre>
-Without the
-<b>REJECT,</b> 
-any "frob"'s in the input would not be counted as words, since the
-scanner normally executes only one action per token.
-Multiple
-<b>REJECT's</b> 
-are allowed, each one finding the next best choice to the currently
-active rule.  For example, when the following scanner scans the token
-"abcd", it will write "abcdabcaba" to the output:
-<pre>
-
-<p><br>    %%
-<br>    a        |
-<br>    ab       |
-<br>    abc      |
-<br>    abcd     ECHO; REJECT;
-<br>    .|\n     /* eat up any unmatched character */
-<br>
-<p><br></pre>
-(The first three rules share the fourth's action since they use
-the special '|' action.)
-<b>REJECT</b> 
-is a particularly expensive feature in terms of scanner performance;
-if it is used in
-<i>any</i> 
-of the scanner's actions it will slow down
-<i>all</i> 
-of the scanner's matching.  Furthermore,
-<b>REJECT</b> 
-cannot be used with the
-<i>-Cf</i> 
-or
-<i>-CF</i> 
-options (see below).
-<dt><dd>Note also that unlike the other special actions,
-<b>REJECT</b> 
-is a
-<i>branch;</i> 
-code immediately following it in the action will
-<i>not</i> 
-be executed.
-<dt>-<dd><b>yymore()</b> 
-tells the scanner that the next time it matches a rule, the corresponding
-token should be
-<i>appended</i> 
-onto the current value of
-<b>yytext</b> 
-rather than replacing it.  For example, given the input "mega-kludge"
-the following will write "mega-mega-kludge" to the output:
-<pre>
-
-<p><br>    %%
-<br>    mega-    ECHO; yymore();
-<br>    kludge   ECHO;
-<br>
-<p><br></pre>
-First "mega-" is matched and echoed to the output.  Then "kludge"
-is matched, but the previous "mega-" is still hanging around at the
-beginning of
-<b>yytext</b> 
-so the
-<b>ECHO</b> 
-for the "kludge" rule will actually write "mega-kludge".
-</dl>
-<p>
-Two notes regarding use of
-<b>yymore().</b> 
-First,
-<b>yymore()</b> 
-depends on the value of
-<i>yyleng</i> 
-correctly reflecting the size of the current token, so you must not
-modify
-<i>yyleng</i> 
-if you are using
-<b>yymore().</b> 
-Second, the presence of
-<b>yymore()</b> 
-in the scanner's action entails a minor performance penalty in the
-scanner's matching speed.
-<p><dl compact><dt>-<dd><b>yyless(n)</b> 
-returns all but the first
-<i>n</i> 
-characters of the current token back to the input stream, where they
-will be rescanned when the scanner looks for the next match.
-<b>yytext</b> 
-and
-<b>yyleng</b> 
-are adjusted appropriately (e.g.,
-<b>yyleng</b> 
-will now be equal to
-<i>n</i> 
-).  For example, on the input "foobar" the following will write out
-"foobarbar":
-<pre>
-
-<p><br>    %%
-<br>    foobar    ECHO; yyless(3);
-<br>    [a-z]+    ECHO;
-<br>
-<p><br></pre>
-An argument of 0 to
-<b>yyless</b> 
-will cause the entire current input string to be scanned again.  Unless you've
-changed how the scanner will subsequently process its input (using
-<b>BEGIN,</b> 
-for example), this will result in an endless loop.
-</dl>
-<p>
-Note that
-<b>yyless</b> 
-is a macro and can only be used in the flex input file, not from
-other source files.
-<p><dl compact><dt>-<dd><b>unput(c)</b> 
-puts the character
-<i>c</i> 
-back onto the input stream.  It will be the next character scanned.
-The following action will take the current token and cause it
-to be rescanned enclosed in parentheses.
-<pre>
-
-<p><br>    {
-<br>    int i;
-<br>    /* Copy yytext because unput() trashes yytext */
-<br>    char *yycopy = strdup( yytext );
-<br>    unput( ')' );
-<br>    for ( i = yyleng - 1; i &gt;= 0; --i )
-<br>        unput( yycopy[i] );
-<br>    unput( '(' );
-<br>    free( yycopy );
-<br>    }
-<br>
-<p><br></pre>
-Note that since each
-<b>unput()</b> 
-puts the given character back at the
-<i>beginning</i> 
-of the input stream, pushing back strings must be done back-to-front.
-</dl>
-<p>
-An important potential problem when using
-<b>unput()</b> 
-is that if you are using
-<b>%pointer</b> 
-(the default), a call to
-<b>unput()</b> 
-<i>destroys</i> 
-the contents of
-<i>yytext,</i> 
-starting with its rightmost character and devouring one character to
-the left with each call.  If you need the value of yytext preserved
-after a call to
-<b>unput()</b> 
-(as in the above example),
-you must either first copy it elsewhere, or build your scanner using
-<b>%array</b> 
-instead (see How The Input Is Matched).
-
-<p>
-Finally, note that you cannot put back
-<b>EOF</b> 
-to attempt to mark the input stream with an end-of-file.
-<p><dl compact><dt>-<dd><b>input()</b> 
-reads the next character from the input stream.  For example,
-the following is one way to eat up C comments:
-<pre>
-
-<p><br>    %%
-<br>    "/*"        {
-<br>                register int c;
-<br>
-<p><br>                for ( ; ; )
-<br>                    {
-<br>                    while ( (c = input()) != '*' &amp;&amp;
-<br>                            c != EOF )
-<br>                        ;    /* eat up text of comment */
-<br>
-<p><br>                    if ( c == '*' )
-<br>                        {
-<br>                        while ( (c = input()) == '*' )
-<br>                            ;
-<br>                        if ( c == '/' )
-<br>                            break;    /* found the end */
-<br>                        }
-<br>
-<p><br>                    if ( c == EOF )
-<br>                        {
-<br>                        error( "EOF in comment" );
-<br>                        break;
-<br>                        }
-<br>                    }
-<br>                }
-<br>
-<p><br></pre>
-(Note that if the scanner is compiled using
-<b>C++,</b> 
-then
-<b>input()</b> 
-is instead referred to as
-<b>yyinput(),</b> 
-in order to avoid a name clash with the
-<b>C++</b> 
-stream by the name of
-<i>input.)</i> 
-<dt>-<dd><b>YY_FLUSH_BUFFER</b> 
-flushes the scanner's internal buffer
-so that the next time the scanner attempts to match a token, it will
-first refill the buffer using
-<b>YY_INPUT</b> 
-(see The Generated Scanner, below).  This action is a special case
-of the more general
-<b>yy_flush_buffer()</b> 
-function, described below in the section Multiple Input Buffers.
-<dt>-<dd><b>yyterminate()</b> 
-can be used in lieu of a return statement in an action.  It terminates
-the scanner and returns a 0 to the scanner's caller, indicating "all done".
-By default,
-<b>yyterminate()</b> 
-is also called when an end-of-file is encountered.  It is a macro and
-may be redefined.
-</dl>
-</ul><H2>THE GENERATED SCANNER </H2><ul>
-
-The output of
-<i>flex</i> 
-is the file
-<b>lex.yy.c,</b> 
-which contains the scanning routine
-<b>yylex(),</b> 
-a number of tables used by it for matching tokens, and a number
-of auxiliary routines and macros.  By default,
-<b>yylex()</b> 
-is declared as follows:
-<pre>
-
-<p><br>    int yylex()
-<br>        {
-<br>        ... various definitions and the actions in here ...
-<br>        }
-<br>
-<p><br></pre>
-(If your environment supports function prototypes, then it will
-be "int yylex( void )".)  This definition may be changed by defining
-the "YY_DECL" macro.  For example, you could use:
-<pre>
-
-<p><br>    #define YY_DECL float lexscan( a, b ) float a, b;
-<br>
-<p><br></pre>
-to give the scanning routine the name
-<i>lexscan,</i> 
-returning a float, and taking two floats as arguments.  Note that
-if you give arguments to the scanning routine using a
-K&amp;R-style/non-prototyped function declaration, you must terminate
-the definition with a semi-colon (;).
-
-<p>
-Whenever
-<b>yylex()</b> 
-is called, it scans tokens from the global input file
-<i>yyin</i> 
-(which defaults to stdin).  It continues until it either reaches
-an end-of-file (at which point it returns the value 0) or
-one of its actions executes a
-<i>return</i> 
-statement.
-
-<p>
-If the scanner reaches an end-of-file, subsequent calls are undefined
-unless either
-<i>yyin</i> 
-is pointed at a new input file (in which case scanning continues from
-that file), or
-<b>yyrestart()</b> 
-is called.
-<b>yyrestart()</b> 
-takes one argument, a
-<b>FILE</b> <b>*</b> 
-pointer (which can be nil, if you've set up
-<b>YY_INPUT</b> 
-to scan from a source other than
-<i>yyin),</i> 
-and initializes
-<i>yyin</i> 
-for scanning from that file.  Essentially there is no difference between
-just assigning
-<i>yyin</i> 
-to a new input file or using
-<b>yyrestart()</b> 
-to do so; the latter is available for compatibility with previous versions
-of
-<i>flex,</i> 
-and because it can be used to switch input files in the middle of scanning.
-It can also be used to throw away the current input buffer, by calling
-it with an argument of
-<i>yyin;</i> 
-but better is to use
-<b>YY_FLUSH_BUFFER</b> 
-(see above).
-Note that
-<b>yyrestart()</b> 
-does
-<i>not</i> 
-reset the start condition to
-<b>INITIAL</b> 
-(see Start Conditions, below).
-
-<p>
-If
-<b>yylex()</b> 
-stops scanning due to executing a
-<i>return</i> 
-statement in one of the actions, the scanner may then be called again and it
-will resume scanning where it left off.
-
-<p>
-By default (and for purposes of efficiency), the scanner uses
-block-reads rather than simple
-<i>getc()</i> 
-calls to read characters from
-<i>yyin.</i> 
-The nature of how it gets its input can be controlled by defining the
-<b>YY_INPUT</b> 
-macro.
-YY_INPUT's calling sequence is "YY_INPUT(buf,result,max_size)".  Its
-action is to place up to
-<i>max_size</i> 
-characters in the character array
-<i>buf</i> 
-and return in the integer variable
-<i>result</i> 
-either the
-number of characters read or the constant YY_NULL (0 on Unix systems)
-to indicate EOF.  The default YY_INPUT reads from the
-global file-pointer "yyin".
-
-<p>
-A sample definition of YY_INPUT (in the definitions
-section of the input file):
-<pre>
-
-<p><br>    %{
-<br>    #define YY_INPUT(buf,result,max_size) \
-<br>        { \
-<br>        int c = getchar(); \
-<br>        result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
-<br>        }
-<br>    %}
-<br>
-<p><br></pre>
-This definition will change the input processing to occur
-one character at a time.
-
-<p>
-When the scanner receives an end-of-file indication from YY_INPUT,
-it then checks the
-<b>yywrap()</b> 
-function.  If
-<b>yywrap()</b> 
-returns false (zero), then it is assumed that the
-function has gone ahead and set up
-<i>yyin</i> 
-to point to another input file, and scanning continues.  If it returns
-true (non-zero), then the scanner terminates, returning 0 to its
-caller.  Note that in either case, the start condition remains unchanged;
-it does
-<i>not</i> 
-revert to
-<b>INITIAL.</b> 
-
-<p>
-If you do not supply your own version of
-<b>yywrap(),</b> 
-then you must either use
-<b>%option</b> <b>noyywrap</b> 
-(in which case the scanner behaves as though
-<b>yywrap()</b> 
-returned 1), or you must link with
-<b>-lfl</b> 
-to obtain the default version of the routine, which always returns 1.
-
-<p>
-Three routines are available for scanning from in-memory buffers rather
-than files:
-<b>yy_scan_string(),</b> <b>yy_scan_bytes(),</b> 
-and
-<b>yy_scan_buffer().</b> 
-See the discussion of them below in the section Multiple Input Buffers.
-
-<p>
-The scanner writes its
-<b>ECHO</b> 
-output to the
-<i>yyout</i> 
-global (default, stdout), which may be redefined by the user simply
-by assigning it to some other
-<b>FILE</b> 
-pointer.
-
-</ul><H2>START CONDITIONS </H2><ul>
-
-<i>flex</i> 
-provides a mechanism for conditionally activating rules.  Any rule
-whose pattern is prefixed with "&lt;sc&gt;" will only be active when
-the scanner is in the start condition named "sc".  For example,
-<pre>
-
-<p><br>    &lt;STRING&gt;[^"]*        { /* eat up the string body ... */
-<br>                ...
-<br>                }
-<br>
-<p><br></pre>
-will be active only when the scanner is in the "STRING" start
-condition, and
-<pre>
-
-<p><br>    &lt;INITIAL,STRING,QUOTE&gt;\.        { /* handle an escape ... */
-<br>                ...
-<br>                }
-<br>
-<p><br></pre>
-will be active only when the current start condition is
-either "INITIAL", "STRING", or "QUOTE".
-
-<p>
-Start conditions
-are declared in the definitions (first) section of the input
-using unindented lines beginning with either
-<b>%s</b> 
-or
-<b>%x</b> 
-followed by a list of names.
-The former declares
-<i>inclusive</i> 
-start conditions, the latter
-<i>exclusive</i> 
-start conditions.  A start condition is activated using the
-<b>BEGIN</b> 
-action.  Until the next
-<b>BEGIN</b> 
-action is executed, rules with the given start
-condition will be active and
-rules with other start conditions will be inactive.
-If the start condition is
-<i>inclusive,</i> 
-then rules with no start conditions at all will also be active.
-If it is
-<i>exclusive,</i> 
-then
-<i>only</i> 
-rules qualified with the start condition will be active.
-A set of rules contingent on the same exclusive start condition
-describe a scanner which is independent of any of the other rules in the
-<i>flex</i> 
-input.  Because of this,
-exclusive start conditions make it easy to specify "mini-scanners"
-which scan portions of the input that are syntactically different
-from the rest (e.g., comments).
-
-<p>
-If the distinction between inclusive and exclusive start conditions
-is still a little vague, here's a simple example illustrating the
-connection between the two.  The set of rules:
-<pre>
-
-<p><br>    %s example
-<br>    %%
-<br>
-<p><br>    &lt;example&gt;foo   do_something();
-<br>
-<p><br>    bar            something_else();
-<br>
-<p><br></pre>
-is equivalent to
-<pre>
-
-<p><br>    %x example
-<br>    %%
-<br>
-<p><br>    &lt;example&gt;foo   do_something();
-<br>
-<p><br>    &lt;INITIAL,example&gt;bar    something_else();
-<br>
-<p><br></pre>
-Without the
-<b>&lt;INITIAL,example&gt;</b> 
-qualifier, the
-<i>bar</i> 
-pattern in the second example wouldn't be active (i.e., couldn't match)
-when in start condition
-<b>example.</b> 
-If we just used
-<b>&lt;example&gt;</b> 
-to qualify
-<i>bar,</i> 
-though, then it would only be active in
-<b>example</b> 
-and not in
-<b>INITIAL,</b> 
-while in the first example it's active in both, because in the first
-example the
-<b>example</b> 
-startion condition is an
-<i>inclusive</i> 
-<b>(%s)</b> 
-start condition.
-
-<p>
-Also note that the special start-condition specifier
-<b>&lt;*&gt;</b> 
-matches every start condition.  Thus, the above example could also
-have been written;
-<pre>
-
-<p><br>    %x example
-<br>    %%
-<br>
-<p><br>    &lt;example&gt;foo   do_something();
-<br>
-<p><br>    &lt;*&gt;bar    something_else();
-<br>
-<p><br></pre>
-
-<p>
-The default rule (to
-<b>ECHO</b> 
-any unmatched character) remains active in start conditions.  It
-is equivalent to:
-<pre>
-
-<p><br>    &lt;*&gt;.|\n     ECHO;
-<br>
-<p><br></pre>
-
-<p>
-<b>BEGIN(0)</b> 
-returns to the original state where only the rules with
-no start conditions are active.  This state can also be
-referred to as the start-condition "INITIAL", so
-<b>BEGIN(INITIAL)</b> 
-is equivalent to
-<b>BEGIN(0).</b> 
-(The parentheses around the start condition name are not required but
-are considered good style.)
-
-<p>
-<b>BEGIN</b> 
-actions can also be given as indented code at the beginning
-of the rules section.  For example, the following will cause
-the scanner to enter the "SPECIAL" start condition whenever
-<b>yylex()</b> 
-is called and the global variable
-<i>enter_special</i> 
-is true:
-<pre>
-
-<p><br>            int enter_special;
-<br>
-<p><br>    %x SPECIAL
-<br>    %%
-<br>            if ( enter_special )
-<br>                BEGIN(SPECIAL);
-<br>
-<p><br>    &lt;SPECIAL&gt;blahblahblah
-<br>    ...more rules follow...
-<br>
-<p><br></pre>
-
-<p>
-To illustrate the uses of start conditions,
-here is a scanner which provides two different interpretations
-of a string like "123.456".  By default it will treat it as
-as three tokens, the integer "123", a dot ('.'), and the integer "456".
-But if the string is preceded earlier in the line by the string
-"expect-floats"
-it will treat it as a single token, the floating-point number
-123.456:
-<pre>
-
-<p><br>    %{
-<br>    #include &lt;math.h&gt;
-<br>    %}
-<br>    %s expect
-<br>
-<p><br>    %%
-<br>    expect-floats        BEGIN(expect);
-<br>
-<p><br>    &lt;expect&gt;[0-9]+"."[0-9]+      {
-<br>                printf( "found a float, = %f\n",
-<br>                        atof( yytext ) );
-<br>                }
-<br>    &lt;expect&gt;\n           {
-<br>                /* that's the end of the line, so
-<br>                 * we need another "expect-number"
-<br>                 * before we'll recognize any more
-<br>                 * numbers
-<br>                 */
-<br>                BEGIN(INITIAL);
-<br>                }
-<br>
-<p><br>    [0-9]+      {
-<br>                printf( "found an integer, = %d\n",
-<br>                        atoi( yytext ) );
-<br>                }
-<br>
-<p><br>    "."         printf( "found a dot\n" );
-<br>
-<p><br></pre>
-Here is a scanner which recognizes (and discards) C comments while
-maintaining a count of the current input line.
-<pre>
-
-<p><br>    %x comment
-<br>    %%
-<br>            int line_num = 1;
-<br>
-<p><br>    "/*"         BEGIN(comment);
-<br>
-<p><br>    &lt;comment&gt;[^*\n]*        /* eat anything that's not a '*' */
-<br>    &lt;comment&gt;"*"+[^*/\n]*   /* eat up '*'s not followed by '/'s */
-<br>    &lt;comment&gt;\n             ++line_num;
-<br>    &lt;comment&gt;"*"+"/"        BEGIN(INITIAL);
-<br>
-<p><br></pre>
-This scanner goes to a bit of trouble to match as much
-text as possible with each rule.  In general, when attempting to write
-a high-speed scanner try to match as much possible in each rule, as
-it's a big win.
-
-<p>
-Note that start-conditions names are really integer values and
-can be stored as such.  Thus, the above could be extended in the
-following fashion:
-<pre>
-
-<p><br>    %x comment foo
-<br>    %%
-<br>            int line_num = 1;
-<br>            int comment_caller;
-<br>
-<p><br>    "/*"         {
-<br>                 comment_caller = INITIAL;
-<br>                 BEGIN(comment);
-<br>                 }
-<br>
-<p><br>    ...
-<br>
-<p><br>    &lt;foo&gt;"/*"    {
-<br>                 comment_caller = foo;
-<br>                 BEGIN(comment);
-<br>                 }
-<br>
-<p><br>    &lt;comment&gt;[^*\n]*        /* eat anything that's not a '*' */
-<br>    &lt;comment&gt;"*"+[^*/\n]*   /* eat up '*'s not followed by '/'s */
-<br>    &lt;comment&gt;\n             ++line_num;
-<br>    &lt;comment&gt;"*"+"/"        BEGIN(comment_caller);
-<br>
-<p><br></pre>
-Furthermore, you can access the current start condition using
-the integer-valued
-<b>YY_START</b> 
-macro.  For example, the above assignments to
-<i>comment_caller</i> 
-could instead be written
-<pre>
-
-<p><br>    comment_caller = YY_START;
-<br>
-<p><br></pre>
-Flex provides
-<b>YYSTATE</b> 
-as an alias for
-<b>YY_START</b> 
-(since that is what's used by AT&amp;T
-<i>lex).</i> 
-
-<p>
-Note that start conditions do not have their own name-space; %s's and %x's
-declare names in the same fashion as #define's.
-
-<p>
-Finally, here's an example of how to match C-style quoted strings using
-exclusive start conditions, including expanded escape sequences (but
-not including checking for a string that's too long):
-<pre>
-
-<p><br>    %x str
-<br>
-<p><br>    %%
-<br>            char string_buf[MAX_STR_CONST];
-<br>            char *string_buf_ptr;
-<br>
-<p><br>
-<p><br>    \"      string_buf_ptr = string_buf; BEGIN(str);
-<br>
-<p><br>    &lt;str&gt;\"        { /* saw closing quote - all done */
-<br>            BEGIN(INITIAL);
-<br>            *string_buf_ptr = '\0';
-<br>            /* return string constant token type and
-<br>             * value to parser
-<br>             */
-<br>            }
-<br>
-<p><br>    &lt;str&gt;\n        {
-<br>            /* error - unterminated string constant */
-<br>            /* generate error message */
-<br>            }
-<br>
-<p><br>    &lt;str&gt;\\[0-7]{1,3} {
-<br>            /* octal escape sequence */
-<br>            int result;
-<br>
-<p><br>            (void) sscanf( yytext + 1, "%o", &amp;result );
-<br>
-<p><br>            if ( result &gt; 0xff )
-<br>                    /* error, constant is out-of-bounds */
-<br>
-<p><br>            *string_buf_ptr++ = result;
-<br>            }
-<br>
-<p><br>    &lt;str&gt;\\[0-9]+ {
-<br>            /* generate error - bad escape sequence; something
-<br>             * like '\48' or '\0777777'
-<br>             */
-<br>            }
-<br>
-<p><br>    &lt;str&gt;\\n  *string_buf_ptr++ = '\n';
-<br>    &lt;str&gt;\\t  *string_buf_ptr++ = '\t';
-<br>    &lt;str&gt;\\r  *string_buf_ptr++ = '\r';
-<br>    &lt;str&gt;\\b  *string_buf_ptr++ = '\b';
-<br>    &lt;str&gt;\\f  *string_buf_ptr++ = '\f';
-<br>
-<p><br>    &lt;str&gt;\\(.|\n)  *string_buf_ptr++ = yytext[1];
-<br>
-<p><br>    &lt;str&gt;[^\\\n\"]+        {
-<br>            char *yptr = yytext;
-<br>
-<p><br>            while ( *yptr )
-<br>                    *string_buf_ptr++ = *yptr++;
-<br>            }
-<br>
-<p><br></pre>
-
-<p>
-Often, such as in some of the examples above, you wind up writing a
-whole bunch of rules all preceded by the same start condition(s).  Flex
-makes this a little easier and cleaner by introducing a notion of
-start condition
-<i>scope.</i> 
-A start condition scope is begun with:
-<pre>
-
-<p><br>    &lt;SCs&gt;{
-<br>
-<p><br></pre>
-where
-<i>SCs</i> 
-is a list of one or more start conditions.  Inside the start condition
-scope, every rule automatically has the prefix
-<i>&lt;SCs&gt;</i> 
-applied to it, until a
-<i>'}'</i> 
-which matches the initial
-<i>'{'.</i> 
-So, for example,
-<pre>
-
-<p><br>    &lt;ESC&gt;{
-<br>        "\\n"   return '\n';
-<br>        "\\r"   return '\r';
-<br>        "\\f"   return '\f';
-<br>        "\\0"   return '\0';
-<br>    }
-<br>
-<p><br></pre>
-is equivalent to:
-<pre>
-
-<p><br>    &lt;ESC&gt;"\\n"  return '\n';
-<br>    &lt;ESC&gt;"\\r"  return '\r';
-<br>    &lt;ESC&gt;"\\f"  return '\f';
-<br>    &lt;ESC&gt;"\\0"  return '\0';
-<br>
-<p><br></pre>
-Start condition scopes may be nested.
-
-<p>
-Three routines are available for manipulating stacks of start conditions:
-<p><dl compact><dt><b>void</b> <b>yy_push_state(int</b> <b>new_state)</b> 
-<dd>pushes the current start condition onto the top of the start condition
-stack and switches to
-<i>new_state</i> 
-as though you had used
-<b>BEGIN</b> <b>new_state</b> 
-(recall that start condition names are also integers).
-<dt><b>void</b> <b>yy_pop_state()</b> 
-<dd>pops the top of the stack and switches to it via
-<b>BEGIN.</b> 
-<dt><b>int</b> <b>yy_top_state()</b> 
-<dd>returns the top of the stack without altering the stack's contents.
-</dl>
-<p>
-The start condition stack grows dynamically and so has no built-in
-size limitation.  If memory is exhausted, program execution aborts.
-
-<p>
-To use start condition stacks, your scanner must include a
-<b>%option</b> <b>stack</b> 
-directive (see Options below).
-
-</ul><H2>MULTIPLE INPUT BUFFERS </H2><ul>
-
-Some scanners (such as those which support "include" files)
-require reading from several input streams.  As
-<i>flex</i> 
-scanners do a large amount of buffering, one cannot control
-where the next input will be read from by simply writing a
-<b>YY_INPUT</b> 
-which is sensitive to the scanning context.
-<b>YY_INPUT</b> 
-is only called when the scanner reaches the end of its buffer, which
-may be a long time after scanning a statement such as an "include"
-which requires switching the input source.
-
-<p>
-To negotiate these sorts of problems,
-<i>flex</i> 
-provides a mechanism for creating and switching between multiple
-input buffers.  An input buffer is created by using:
-<pre>
-
-<p><br>    YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-<br>
-<p><br></pre>
-which takes a
-<i>FILE</i> 
-pointer and a size and creates a buffer associated with the given
-file and large enough to hold
-<i>size</i> 
-characters (when in doubt, use
-<b>YY_BUF_SIZE</b> 
-for the size).  It returns a
-<b>YY_BUFFER_STATE</b> 
-handle, which may then be passed to other routines (see below).  The
-<b>YY_BUFFER_STATE</b> 
-type is a pointer to an opaque
-<b>struct</b> <b>yy_buffer_state</b> 
-structure, so you may safely initialize YY_BUFFER_STATE variables to
-<b>((YY_BUFFER_STATE)</b> <b>0)</b> 
-if you wish, and also refer to the opaque structure in order to
-correctly declare input buffers in source files other than that
-of your scanner.  Note that the
-<i>FILE</i> 
-pointer in the call to
-<b>yy_create_buffer</b> 
-is only used as the value of
-<i>yyin</i> 
-seen by
-<b>YY_INPUT;</b> 
-if you redefine
-<b>YY_INPUT</b> 
-so it no longer uses
-<i>yyin,</i> 
-then you can safely pass a nil
-<i>FILE</i> 
-pointer to
-<b>yy_create_buffer.</b> 
-You select a particular buffer to scan from using:
-<pre>
-
-<p><br>    void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-<br>
-<p><br></pre>
-switches the scanner's input buffer so subsequent tokens will
-come from
-<i>new_buffer.</i> 
-Note that
-<b>yy_switch_to_buffer()</b> 
-may be used by yywrap() to set things up for continued scanning, instead
-of opening a new file and pointing
-<i>yyin</i> 
-at it.  Note also that switching input sources via either
-<b>yy_switch_to_buffer()</b> 
-or
-<b>yywrap()</b> 
-does
-<i>not</i> 
-change the start condition.
-<pre>
-
-<p><br>    void yy_delete_buffer( YY_BUFFER_STATE buffer )
-<br>
-<p><br></pre>
-is used to reclaim the storage associated with a buffer.
-You can also clear the current contents of a buffer using:
-<pre>
-
-<p><br>    void yy_flush_buffer( YY_BUFFER_STATE buffer )
-<br>
-<p><br></pre>
-This function discards the buffer's contents,
-so the next time the scanner attempts to match a token from the
-buffer, it will first fill the buffer anew using
-<b>YY_INPUT.</b> 
-
-<p>
-<b>yy_new_buffer()</b> 
-is an alias for
-<b>yy_create_buffer(),</b> 
-provided for compatibility with the C++ use of
-<i>new</i> 
-and
-<i>delete</i> 
-for creating and destroying dynamic objects.
-
-<p>
-Finally, the
-<b>YY_CURRENT_BUFFER</b> 
-macro returns a
-<b>YY_BUFFER_STATE</b> 
-handle to the current buffer.
-
-<p>
-Here is an example of using these features for writing a scanner
-which expands include files (the
-<b>&lt;&lt;EOF&gt;&gt;</b> 
-feature is discussed below):
-<pre>
-
-<p><br>    /* the "incl" state is used for picking up the name
-<br>     * of an include file
-<br>     */
-<br>    %x incl
-<br>
-<p><br>    %{
-<br>    #define MAX_INCLUDE_DEPTH 10
-<br>    YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
-<br>    int include_stack_ptr = 0;
-<br>    %}
-<br>
-<p><br>    %%
-<br>    include             BEGIN(incl);
-<br>
-<p><br>    [a-z]+              ECHO;
-<br>    [^a-z\n]*\n?        ECHO;
-<br>
-<p><br>    &lt;incl&gt;[ \t]*      /* eat the whitespace */
-<br>    &lt;incl&gt;[^ \t\n]+   { /* got the include file name */
-<br>            if ( include_stack_ptr &gt;= MAX_INCLUDE_DEPTH )
-<br>                {
-<br>                fprintf( stderr, "Includes nested too deeply" );
-<br>                exit( 1 );
-<br>                }
-<br>
-<p><br>            include_stack[include_stack_ptr++] =
-<br>                YY_CURRENT_BUFFER;
-<br>
-<p><br>            yyin = fopen( yytext, "r" );
-<br>
-<p><br>            if ( ! yyin )
-<br>                error( ... );
-<br>
-<p><br>            yy_switch_to_buffer(
-<br>                yy_create_buffer( yyin, YY_BUF_SIZE ) );
-<br>
-<p><br>            BEGIN(INITIAL);
-<br>            }
-<br>
-<p><br>    &lt;&lt;EOF&gt;&gt; {
-<br>            if ( --include_stack_ptr &lt; 0 )
-<br>                {
-<br>                yyterminate();
-<br>                }
-<br>
-<p><br>            else
-<br>                {
-<br>                yy_delete_buffer( YY_CURRENT_BUFFER );
-<br>                yy_switch_to_buffer(
-<br>                     include_stack[include_stack_ptr] );
-<br>                }
-<br>            }
-<br>
-<p><br></pre>
-Three routines are available for setting up input buffers for
-scanning in-memory strings instead of files.  All of them create
-a new input buffer for scanning the string, and return a corresponding
-<b>YY_BUFFER_STATE</b> 
-handle (which you should delete with
-<b>yy_delete_buffer()</b> 
-when done with it).  They also switch to the new buffer using
-<b>yy_switch_to_buffer(),</b> 
-so the next call to
-<b>yylex()</b> 
-will start scanning the string.
-<p><dl compact><dt><b>yy_scan_string(const</b> <b>char</b> <b>*str)</b> 
-<dd>scans a NUL-terminated string.
-<dt><b>yy_scan_bytes(const</b> <b>char</b> <b>*bytes,</b> <b>int</b> <b>len)</b> 
-<dd>scans
-<i>len</i> 
-bytes (including possibly NUL's)
-starting at location
-<i>bytes.</i> 
-</dl>
-<p>
-Note that both of these functions create and scan a
-<i>copy</i> 
-of the string or bytes.  (This may be desirable, since
-<b>yylex()</b> 
-modifies the contents of the buffer it is scanning.)  You can avoid the
-copy by using:
-<p><dl compact><dt><b>yy_scan_buffer(char</b> <b>*base,</b> <b>yy_size_t</b> <b>size)</b> 
-<dd>which scans in place the buffer starting at
-<i>base,</i> 
-consisting of
-<i>size</i> 
-bytes, the last two bytes of which
-<i>must</i> 
-be
-<b>YY_END_OF_BUFFER_CHAR</b> 
-(ASCII NUL).
-These last two bytes are not scanned; thus, scanning
-consists of
-<b>base[0]</b> 
-through
-<b>base[size-2],</b> 
-inclusive.
-<dt><dd>If you fail to set up
-<i>base</i> 
-in this manner (i.e., forget the final two
-<b>YY_END_OF_BUFFER_CHAR</b> 
-bytes), then
-<b>yy_scan_buffer()</b> 
-returns a nil pointer instead of creating a new input buffer.
-<dt><dd>The type
-<b>yy_size_t</b> 
-is an integral type to which you can cast an integer expression
-reflecting the size of the buffer.
-</dl>
-</ul><H2>END-OF-FILE RULES </H2><ul>
-
-The special rule "&lt;&lt;EOF&gt;&gt;" indicates
-actions which are to be taken when an end-of-file is
-encountered and yywrap() returns non-zero (i.e., indicates
-no further files to process).  The action must finish
-by doing one of four things:
-<p><dl compact><dt>-<dd>assigning
-<i>yyin</i> 
-to a new input file (in previous versions of flex, after doing the
-assignment you had to call the special action
-<b>YY_NEW_FILE;</b> 
-this is no longer necessary);
-<dt>-<dd>executing a
-<i>return</i> 
-statement;
-<dt>-<dd>executing the special
-<b>yyterminate()</b> 
-action;
-<dt>-<dd>or, switching to a new buffer using
-<b>yy_switch_to_buffer()</b> 
-as shown in the example above.
-</dl>
-<p>
-&lt;&lt;EOF&gt;&gt; rules may not be used with other
-patterns; they may only be qualified with a list of start
-conditions.  If an unqualified &lt;&lt;EOF&gt;&gt; rule is given, it
-applies to
-<i>all</i> 
-start conditions which do not already have &lt;&lt;EOF&gt;&gt; actions.  To
-specify an &lt;&lt;EOF&gt;&gt; rule for only the initial start condition, use
-<pre>
-
-<p><br>    &lt;INITIAL&gt;&lt;&lt;EOF&gt;&gt;
-<br>
-<p><br></pre>
-
-<p>
-These rules are useful for catching things like unclosed comments.
-An example:
-<pre>
-
-<p><br>    %x quote
-<br>    %%
-<br>
-<p><br>    ...other rules for dealing with quotes...
-<br>
-<p><br>    &lt;quote&gt;&lt;&lt;EOF&gt;&gt;   {
-<br>             error( "unterminated quote" );
-<br>             yyterminate();
-<br>             }
-<br>    &lt;&lt;EOF&gt;&gt;  {
-<br>             if ( *++filelist )
-<br>                 yyin = fopen( *filelist, "r" );
-<br>             else
-<br>                yyterminate();
-<br>             }
-<br>
-<p><br></pre>
-
-</ul><H2>MISCELLANEOUS MACROS </H2><ul>
-
-The macro
-<b>YY_USER_ACTION</b> 
-can be defined to provide an action
-which is always executed prior to the matched rule's action.  For example,
-it could be #define'd to call a routine to convert yytext to lower-case.
-When
-<b>YY_USER_ACTION</b> 
-is invoked, the variable
-<i>yy_act</i> 
-gives the number of the matched rule (rules are numbered starting with 1).
-Suppose you want to profile how often each of your rules is matched.  The
-following would do the trick:
-<pre>
-
-<p><br>    #define YY_USER_ACTION ++ctr[yy_act]
-<br>
-<p><br></pre>
-where
-<i>ctr</i> 
-is an array to hold the counts for the different rules.  Note that
-the macro
-<b>YY_NUM_RULES</b> 
-gives the total number of rules (including the default rule, even if
-you use
-<b>-s),</b> 
-so a correct declaration for
-<i>ctr</i> 
-is:
-<pre>
-
-<p><br>    int ctr[YY_NUM_RULES];
-<br>
-<p><br></pre>
-
-<p>
-The macro
-<b>YY_USER_INIT</b> 
-may be defined to provide an action which is always executed before
-the first scan (and before the scanner's internal initializations are done).
-For example, it could be used to call a routine to read
-in a data table or open a logging file.
-
-<p>
-The macro
-<b>yy_set_interactive(is_interactive)</b> 
-can be used to control whether the current buffer is considered
-<i>interactive.</i> 
-An interactive buffer is processed more slowly,
-but must be used when the scanner's input source is indeed
-interactive to avoid problems due to waiting to fill buffers
-(see the discussion of the
-<b>-I</b> 
-flag below).  A non-zero value
-in the macro invocation marks the buffer as interactive, a zero  
-value as non-interactive.  Note that use of this macro overrides
-<b>%option</b> <b>always-interactive</b> 
-or
-<b>%option</b> <b>never-interactive</b> 
-(see Options below).
-<b>yy_set_interactive()</b> 
-must be invoked prior to beginning to scan the buffer that is
-(or is not) to be considered interactive.
-
-<p>
-The macro
-<b>yy_set_bol(at_bol)</b> 
-can be used to control whether the current buffer's scanning
-context for the next token match is done as though at the
-beginning of a line.  A non-zero macro argument makes rules anchored with
-'^' active, while a zero argument makes '^' rules inactive.
-
-<p>
-The macro
-<b>YY_AT_BOL()</b> 
-returns true if the next token scanned from the current buffer
-will have '^' rules active, false otherwise.
-
-<p>
-In the generated scanner, the actions are all gathered in one large
-switch statement and separated using
-<b>YY_BREAK,</b> 
-which may be redefined.  By default, it is simply a "break", to separate
-each rule's action from the following rule's.
-Redefining
-<b>YY_BREAK</b> 
-allows, for example, C++ users to
-#define YY_BREAK to do nothing (while being very careful that every
-rule ends with a "break" or a "return"!) to avoid suffering from
-unreachable statement warnings where because a rule's action ends with
-"return", the
-<b>YY_BREAK</b> 
-is inaccessible.
-
-</ul><H2>VALUES AVAILABLE TO THE USER </H2><ul>
-
-This section summarizes the various values available to the user
-in the rule actions.
-<p><dl compact><dt>-<dd><b>char</b> <b>*yytext</b> 
-holds the text of the current token.  It may be modified but not lengthened
-(you cannot append characters to the end).
-<dt><dd>If the special directive
-<b>%array</b> 
-appears in the first section of the scanner description, then
-<b>yytext</b> 
-is instead declared
-<b>char</b> <b>yytext[YYLMAX],</b> 
-where
-<b>YYLMAX</b> 
-is a macro definition that you can redefine in the first section
-if you don't like the default value (generally 8KB).  Using
-<b>%array</b> 
-results in somewhat slower scanners, but the value of
-<b>yytext</b> 
-becomes immune to calls to
-<i>input()</i> 
-and
-<i>unput(),</i> 
-which potentially destroy its value when
-<b>yytext</b> 
-is a character pointer.  The opposite of
-<b>%array</b> 
-is
-<b>%pointer,</b> 
-which is the default.
-<dt><dd>You cannot use
-<b>%array</b> 
-when generating C++ scanner classes
-(the
-<b>-+</b> 
-flag).
-<dt>-<dd><b>int</b> <b>yyleng</b> 
-holds the length of the current token.
-<dt>-<dd><b>FILE</b> <b>*yyin</b> 
-is the file which by default
-<i>flex</i> 
-reads from.  It may be redefined but doing so only makes sense before
-scanning begins or after an EOF has been encountered.  Changing it in
-the midst of scanning will have unexpected results since
-<i>flex</i> 
-buffers its input; use
-<b>yyrestart()</b> 
-instead.
-Once scanning terminates because an end-of-file
-has been seen, you can assign
-<i>yyin</i> 
-at the new input file and then call the scanner again to continue scanning.
-<dt>-<dd><b>void</b> <b>yyrestart(</b> <b>FILE</b> <b>*new_file</b> <b>)</b> 
-may be called to point
-<i>yyin</i> 
-at the new input file.  The switch-over to the new file is immediate
-(any previously buffered-up input is lost).  Note that calling
-<b>yyrestart()</b> 
-with
-<i>yyin</i> 
-as an argument thus throws away the current input buffer and continues
-scanning the same input file.
-<dt>-<dd><b>FILE</b> <b>*yyout</b> 
-is the file to which
-<b>ECHO</b> 
-actions are done.  It can be reassigned by the user.
-<dt>-<dd><b>YY_CURRENT_BUFFER</b> 
-returns a
-<b>YY_BUFFER_STATE</b> 
-handle to the current buffer.
-<dt>-<dd><b>YY_START</b> 
-returns an integer value corresponding to the current start
-condition.  You can subsequently use this value with
-<b>BEGIN</b> 
-to return to that start condition.
-</dl>
-</ul><H2>INTERFACING WITH YACC </H2><ul>
-
-One of the main uses of
-<i>flex</i> 
-is as a companion to the
-<i>yacc</i> 
-parser-generator.
-<i>yacc</i> 
-parsers expect to call a routine named
-<b>yylex()</b> 
-to find the next input token.  The routine is supposed to
-return the type of the next token as well as putting any associated
-value in the global
-<b>yylval.</b> 
-To use
-<i>flex</i> 
-with
-<i>yacc,</i> 
-one specifies the
-<b>-d</b> 
-option to
-<i>yacc</i> 
-to instruct it to generate the file
-<b>y.tab.h</b> 
-containing definitions of all the
-<b>%tokens</b> 
-appearing in the
-<i>yacc</i> 
-input.  This file is then included in the
-<i>flex</i> 
-scanner.  For example, if one of the tokens is "TOK_NUMBER",
-part of the scanner might look like:
-<pre>
-
-<p><br>    %{
-<br>    #include "y.tab.h"
-<br>    %}
-<br>
-<p><br>    %%
-<br>
-<p><br>    [0-9]+        yylval = atoi( yytext ); return TOK_NUMBER;
-<br>
-<p><br></pre>
-
-</ul><H2>OPTIONS </H2><ul>
-
-<i>flex</i> 
-has the following options:
-<p><dl compact><dt><b>-b</b> 
-<dd>Generate backing-up information to
-<i>lex.backup.</i> 
-This is a list of scanner states which require backing up
-and the input characters on which they do so.  By adding rules one
-can remove backing-up states.  If
-<i>all</i> 
-backing-up states are eliminated and
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-is used, the generated scanner will run faster (see the
-<b>-p</b> 
-flag).  Only users who wish to squeeze every last cycle out of their
-scanners need worry about this option.  (See the section on Performance
-Considerations below.)
-<dt><b>-c</b> 
-<dd>is a do-nothing, deprecated option included for POSIX compliance.
-<dt><b>-d</b> 
-<dd>makes the generated scanner run in
-<i>debug</i> 
-mode.  Whenever a pattern is recognized and the global
-<b>yy_flex_debug</b> 
-is non-zero (which is the default),
-the scanner will write to
-<i>stderr</i> 
-a line of the form:
-<pre>
-
-<p><br>    --accepting rule at line 53 ("the matched text")
-<br>
-<p><br></pre>
-The line number refers to the location of the rule in the file
-defining the scanner (i.e., the file that was fed to flex).  Messages
-are also generated when the scanner backs up, accepts the
-default rule, reaches the end of its input buffer (or encounters
-a NUL; at this point, the two look the same as far as the scanner's concerned),
-or reaches an end-of-file.
-<dt><b>-f</b> 
-<dd>specifies
-<i>fast</i> <i>scanner.</i> 
-No table compression is done and stdio is bypassed.
-The result is large but fast.  This option is equivalent to
-<b>-Cfr</b> 
-(see below).
-<dt><b>-h</b> 
-<dd>generates a "help" summary of
-<i>flex's</i> 
-options to
-<i>stdout</i> 
-and then exits.
-<b>-?</b> 
-and
-<b>--help</b> 
-are synonyms for
-<b>-h.</b> 
-<dt><b>-i</b> 
-<dd>instructs
-<i>flex</i> 
-to generate a
-<i>case-insensitive</i> 
-scanner.  The case of letters given in the
-<i>flex</i> 
-input patterns will
-be ignored, and tokens in the input will be matched regardless of case.  The
-matched text given in
-<i>yytext</i> 
-will have the preserved case (i.e., it will not be folded).
-<dt><b>-l</b> 
-<dd>turns on maximum compatibility with the original AT&amp;T
-<i>lex</i> 
-implementation.  Note that this does not mean
-<i>full</i> 
-compatibility.  Use of this option costs a considerable amount of
-performance, and it cannot be used with the
-<b>-+,</b> <b>-f,</b> <b>-F,</b> <b>-Cf,</b> 
-or
-<b>-CF</b> 
-options.  For details on the compatibilities it provides, see the section
-"Incompatibilities With Lex And POSIX" below.  This option also results
-in the name
-<b>YY_FLEX_LEX_COMPAT</b> 
-being #define'd in the generated scanner.
-<dt><b>-n</b> 
-<dd>is another do-nothing, deprecated option included only for
-POSIX compliance.
-<dt><b>-p</b> 
-<dd>generates a performance report to stderr.  The report
-consists of comments regarding features of the
-<i>flex</i> 
-input file which will cause a serious loss of performance in the resulting
-scanner.  If you give the flag twice, you will also get comments regarding
-features that lead to minor performance losses.
-<dt><dd>Note that the use of
-<b>REJECT,</b> 
-<b>%option</b> <b>yylineno,</b> 
-and variable trailing context (see the Deficiencies / Bugs section below)
-entails a substantial performance penalty; use of
-<i>yymore(),</i> 
-the
-<b>^</b> 
-operator,
-and the
-<b>-I</b> 
-flag entail minor performance penalties.
-<dt><b>-s</b> 
-<dd>causes the
-<i>default</i> <i>rule</i> 
-(that unmatched scanner input is echoed to
-<i>stdout)</i> 
-to be suppressed.  If the scanner encounters input that does not
-match any of its rules, it aborts with an error.  This option is
-useful for finding holes in a scanner's rule set.
-<dt><b>-t</b> 
-<dd>instructs
-<i>flex</i> 
-to write the scanner it generates to standard output instead
-of
-<b>lex.yy.c.</b> 
-<dt><b>-v</b> 
-<dd>specifies that
-<i>flex</i> 
-should write to
-<i>stderr</i> 
-a summary of statistics regarding the scanner it generates.
-Most of the statistics are meaningless to the casual
-<i>flex</i> 
-user, but the first line identifies the version of
-<i>flex</i> 
-(same as reported by
-<b>-V),</b> 
-and the next line the flags used when generating the scanner, including
-those that are on by default.
-<dt><b>-w</b> 
-<dd>suppresses warning messages.
-<dt><b>-B</b> 
-<dd>instructs
-<i>flex</i> 
-to generate a
-<i>batch</i> 
-scanner, the opposite of
-<i>interactive</i> 
-scanners generated by
-<b>-I</b> 
-(see below).  In general, you use
-<b>-B</b> 
-when you are
-<i>certain</i> 
-that your scanner will never be used interactively, and you want to
-squeeze a
-<i>little</i> 
-more performance out of it.  If your goal is instead to squeeze out a
-<i>lot</i> 
-more performance, you should  be using the
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-options (discussed below), which turn on
-<b>-B</b> 
-automatically anyway.
-<dt><b>-F</b> 
-<dd>specifies that the
-fast
-scanner table representation should be used (and stdio
-bypassed).  This representation is
-about as fast as the full table representation
-<b>(-f),</b> 
-and for some sets of patterns will be considerably smaller (and for
-others, larger).  In general, if the pattern set contains both "keywords"
-and a catch-all, "identifier" rule, such as in the set:
-<pre>
-
-<p><br>    "case"    return TOK_CASE;
-<br>    "switch"  return TOK_SWITCH;
-<br>    ...
-<br>    "default" return TOK_DEFAULT;
-<br>    [a-z]+    return TOK_ID;
-<br>
-<p><br></pre>
-then you're better off using the full table representation.  If only
-the "identifier" rule is present and you then use a hash table or some such
-to detect the keywords, you're better off using
-<b>-F.</b> 
-<dt><dd>This option is equivalent to
-<b>-CFr</b> 
-(see below).  It cannot be used with
-<b>-+.</b> 
-<dt><b>-I</b> 
-<dd>instructs
-<i>flex</i> 
-to generate an
-<i>interactive</i> 
-scanner.  An interactive scanner is one that only looks ahead to decide
-what token has been matched if it absolutely must.  It turns out that
-always looking one extra character ahead, even if the scanner has already
-seen enough text to disambiguate the current token, is a bit faster than
-only looking ahead when necessary.  But scanners that always look ahead
-give dreadful interactive performance; for example, when a user types
-a newline, it is not recognized as a newline token until they enter
-<i>another</i> 
-token, which often means typing in another whole line.
-<dt><dd><i>Flex</i> 
-scanners default to
-<i>interactive</i> 
-unless you use the
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-table-compression options (see below).  That's because if you're looking
-for high-performance you should be using one of these options, so if you
-didn't,
-<i>flex</i> 
-assumes you'd rather trade off a bit of run-time performance for intuitive
-interactive behavior.  Note also that you
-<i>cannot</i> 
-use
-<b>-I</b> 
-in conjunction with
-<b>-Cf</b> 
-or
-<b>-CF.</b> 
-Thus, this option is not really needed; it is on by default for all those
-cases in which it is allowed.
-<dt><dd>You can force a scanner to
-<i>not</i> 
-be interactive by using
-<b>-B</b> 
-(see above).
-<dt><b>-L</b> 
-<dd>instructs
-<i>flex</i> 
-not to generate
-<b>#line</b> 
-directives.  Without this option,
-<i>flex</i> 
-peppers the generated scanner
-with #line directives so error messages in the actions will be correctly
-located with respect to either the original
-<i>flex</i> 
-input file (if the errors are due to code in the input file), or
-<b>lex.yy.c</b> 
-(if the errors are
-<i>flex's</i> 
-fault -- you should report these sorts of errors to the email address
-given below).
-<dt><b>-T</b> 
-<dd>makes
-<i>flex</i> 
-run in
-<i>trace</i> 
-mode.  It will generate a lot of messages to
-<i>stderr</i> 
-concerning
-the form of the input and the resultant non-deterministic and deterministic
-finite automata.  This option is mostly for use in maintaining
-<i>flex.</i> 
-<dt><b>-V</b> 
-<dd>prints the version number to
-<i>stdout</i> 
-and exits.
-<b>--version</b> 
-is a synonym for
-<b>-V.</b> 
-<dt><b>-7</b> 
-<dd>instructs
-<i>flex</i> 
-to generate a 7-bit scanner, i.e., one which can only recognized 7-bit
-characters in its input.  The advantage of using
-<b>-7</b> 
-is that the scanner's tables can be up to half the size of those generated
-using the
-<b>-8</b> 
-option (see below).  The disadvantage is that such scanners often hang
-or crash if their input contains an 8-bit character.
-<dt><dd>Note, however, that unless you generate your scanner using the
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-table compression options, use of
-<b>-7</b> 
-will save only a small amount of table space, and make your scanner
-considerably less portable.
-<i>Flex's</i> 
-default behavior is to generate an 8-bit scanner unless you use the
-<b>-Cf</b> 
-or
-<b>-CF,</b> 
-in which case
-<i>flex</i> 
-defaults to generating 7-bit scanners unless your site was always
-configured to generate 8-bit scanners (as will often be the case
-with non-USA sites).  You can tell whether flex generated a 7-bit
-or an 8-bit scanner by inspecting the flag summary in the
-<b>-v</b> 
-output as described above.
-<dt><dd>Note that if you use
-<b>-Cfe</b> 
-or
-<b>-CFe</b> 
-(those table compression options, but also using equivalence classes as
-discussed see below), flex still defaults to generating an 8-bit
-scanner, since usually with these compression options full 8-bit tables
-are not much more expensive than 7-bit tables.
-<dt><b>-8</b> 
-<dd>instructs
-<i>flex</i> 
-to generate an 8-bit scanner, i.e., one which can recognize 8-bit
-characters.  This flag is only needed for scanners generated using
-<b>-Cf</b> 
-or
-<b>-CF,</b> 
-as otherwise flex defaults to generating an 8-bit scanner anyway.
-<dt><dd>See the discussion of
-<b>-7</b> 
-above for flex's default behavior and the tradeoffs between 7-bit
-and 8-bit scanners.
-<dt><b>-+</b> 
-<dd>specifies that you want flex to generate a C++
-scanner class.  See the section on Generating C++ Scanners below for
-details.
-<dt><b>-C[aefFmr]</b> 
-<dd>controls the degree of table compression and, more generally, trade-offs
-between small scanners and fast scanners.
-<dt><dd><b>-Ca</b> 
-("align") instructs flex to trade off larger tables in the
-generated scanner for faster performance because the elements of
-the tables are better aligned for memory access and computation.  On some
-RISC architectures, fetching and manipulating longwords is more efficient
-than with smaller-sized units such as shortwords.  This option can
-double the size of the tables used by your scanner.
-<dt><dd><b>-Ce</b> 
-directs
-<i>flex</i> 
-to construct
-<i>equivalence</i> <i>classes,</i> 
-i.e., sets of characters
-which have identical lexical properties (for example, if the only
-appearance of digits in the
-<i>flex</i> 
-input is in the character class
-"[0-9]" then the digits '0', '1', ..., '9' will all be put
-in the same equivalence class).  Equivalence classes usually give
-dramatic reductions in the final table/object file sizes (typically
-a factor of 2-5) and are pretty cheap performance-wise (one array
-look-up per character scanned).
-<dt><dd><b>-Cf</b> 
-specifies that the
-<i>full</i> 
-scanner tables should be generated -
-<i>flex</i> 
-should not compress the
-tables by taking advantages of similar transition functions for
-different states.
-<dt><dd><b>-CF</b> 
-specifies that the alternate fast scanner representation (described
-above under the
-<b>-F</b> 
-flag)
-should be used.  This option cannot be used with
-<b>-+.</b> 
-<dt><dd><b>-Cm</b> 
-directs
-<i>flex</i> 
-to construct
-<i>meta-equivalence</i> <i>classes,</i> 
-which are sets of equivalence classes (or characters, if equivalence
-classes are not being used) that are commonly used together.  Meta-equivalence
-classes are often a big win when using compressed tables, but they
-have a moderate performance impact (one or two "if" tests and one
-array look-up per character scanned).
-<dt><dd><b>-Cr</b> 
-causes the generated scanner to
-<i>bypass</i> 
-use of the standard I/O library (stdio) for input.  Instead of calling
-<b>fread()</b> 
-or
-<b>getc(),</b> 
-the scanner will use the
-<b>read()</b> 
-system call, resulting in a performance gain which varies from system
-to system, but in general is probably negligible unless you are also using
-<b>-Cf</b> 
-or
-<b>-CF.</b> 
-Using
-<b>-Cr</b> 
-can cause strange behavior if, for example, you read from
-<i>yyin</i> 
-using stdio prior to calling the scanner (because the scanner will miss
-whatever text your previous reads left in the stdio input buffer).
-<dt><dd><b>-Cr</b> 
-has no effect if you define
-<b>YY_INPUT</b> 
-(see The Generated Scanner above).
-<dt><dd>A lone
-<b>-C</b> 
-specifies that the scanner tables should be compressed but neither
-equivalence classes nor meta-equivalence classes should be used.
-<dt><dd>The options
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-and
-<b>-Cm</b> 
-do not make sense together - there is no opportunity for meta-equivalence
-classes if the table is not being compressed.  Otherwise the options
-may be freely mixed, and are cumulative.
-<dt><dd>The default setting is
-<b>-Cem,</b> 
-which specifies that
-<i>flex</i> 
-should generate equivalence classes
-and meta-equivalence classes.  This setting provides the highest
-degree of table compression.  You can trade off
-faster-executing scanners at the cost of larger tables with
-the following generally being true:
-<pre>
-
-<p><br>    slowest &amp; smallest
-<br>          -Cem
-<br>          -Cm
-<br>          -Ce
-<br>          -C
-<br>          -C{f,F}e
-<br>          -C{f,F}
-<br>          -C{f,F}a
-<br>    fastest &amp; largest
-<br>
-<p><br></pre>
-Note that scanners with the smallest tables are usually generated and
-compiled the quickest, so
-during development you will usually want to use the default, maximal
-compression.
-<dt><dd><b>-Cfe</b> 
-is often a good compromise between speed and size for production
-scanners.
-<dt><b>-ooutput</b> 
-<dd>directs flex to write the scanner to the file
-<b>output</b> 
-instead of
-<b>lex.yy.c.</b> 
-If you combine
-<b>-o</b> 
-with the
-<b>-t</b> 
-option, then the scanner is written to
-<i>stdout</i> 
-but its
-<b>#line</b> 
-directives (see the
-<b>\-L</b> 
-option above) refer to the file
-<b>output.</b> 
-<dt><b>-Pprefix</b> 
-<dd>changes the default
-<i>yy</i> 
-prefix used by
-<i>flex</i> 
-for all globally-visible variable and function names to instead be
-<i>prefix.</i> 
-For example,
-<b>-Pfoo</b> 
-changes the name of
-<b>yytext</b> 
-to
-<b>footext.</b> 
-It also changes the name of the default output file from
-<b>lex.yy.c</b> 
-to
-<b>lex.foo.c.</b> 
-Here are all of the names affected:
-<pre>
-
-<p><br>    yy_create_buffer
-<br>    yy_delete_buffer
-<br>    yy_flex_debug
-<br>    yy_init_buffer
-<br>    yy_flush_buffer
-<br>    yy_load_buffer_state
-<br>    yy_switch_to_buffer
-<br>    yyin
-<br>    yyleng
-<br>    yylex
-<br>    yylineno
-<br>    yyout
-<br>    yyrestart
-<br>    yytext
-<br>    yywrap
-<br>
-<p><br></pre>
-(If you are using a C++ scanner, then only
-<b>yywrap</b> 
-and
-<b>yyFlexLexer</b> 
-are affected.)
-Within your scanner itself, you can still refer to the global variables
-and functions using either version of their name; but externally, they
-have the modified name.
-<dt><dd>This option lets you easily link together multiple
-<i>flex</i> 
-programs into the same executable.  Note, though, that using this
-option also renames
-<b>yywrap(),</b> 
-so you now
-<i>must</i> 
-either
-provide your own (appropriately-named) version of the routine for your
-scanner, or use
-<b>%option</b> <b>noyywrap,</b> 
-as linking with
-<b>-lfl</b> 
-no longer provides one for you by default.
-<dt><b>-Sskeleton_file</b> 
-<dd>overrides the default skeleton file from which
-<i>flex</i> 
-constructs its scanners.  You'll never need this option unless you are doing
-<i>flex</i> 
-maintenance or development.
-</dl>
-<p>
-<i>flex</i> 
-also provides a mechanism for controlling options within the
-scanner specification itself, rather than from the flex command-line.
-This is done by including
-<b>%option</b> 
-directives in the first section of the scanner specification.
-You can specify multiple options with a single
-<b>%option</b> 
-directive, and multiple directives in the first section of your flex input
-file.  Most
-options are given simply as names, optionally preceded by the
-word "no" (with no intervening whitespace) to negate their meaning.
-A number are equivalent to flex flags or their negation:
-<pre>
-
-<p><br>    7bit            -7 option
-<br>    8bit            -8 option
-<br>    align           -Ca option
-<br>    backup          -b option
-<br>    batch           -B option
-<br>    c++             -+ option
-<br>
-<p><br>    caseful or
-<br>    case-sensitive  opposite of -i (default)
-<br>
-<p><br>    case-insensitive or
-<br>    caseless        -i option
-<br>
-<p><br>    debug           -d option
-<br>    default         opposite of -s option
-<br>    ecs             -Ce option
-<br>    fast            -F option
-<br>    full            -f option
-<br>    interactive     -I option
-<br>    lex-compat      -l option
-<br>    meta-ecs        -Cm option
-<br>    perf-report     -p option
-<br>    read            -Cr option
-<br>    stdout          -t option
-<br>    verbose         -v option
-<br>    warn            opposite of -w option
-<br>                    (use "%option nowarn" for -w)
-<br>
-<p><br>    array           equivalent to "%array"
-<br>    pointer         equivalent to "%pointer" (default)
-<br>
-<p><br></pre>
-Some
-<b>%option's</b> 
-provide features otherwise not available:
-<p><dl compact><dt><b>always-interactive</b> 
-<dd>instructs flex to generate a scanner which always considers its input
-"interactive".  Normally, on each new input file the scanner calls
-<b>isatty()</b> 
-in an attempt to determine whether
-the scanner's input source is interactive and thus should be read a
-character at a time.  When this option is used, however, then no
-such call is made.
-<dt><b>main</b> 
-<dd>directs flex to provide a default
-<b>main()</b> 
-program for the scanner, which simply calls
-<b>yylex().</b> 
-This option implies
-<b>noyywrap</b> 
-(see below).
-<dt><b>never-interactive</b> 
-<dd>instructs flex to generate a scanner which never considers its input
-"interactive" (again, no call made to
-<b>isatty()).</b> 
-This is the opposite of
-<b>always-interactive.</b> 
-<dt><b>stack</b> 
-<dd>enables the use of start condition stacks (see Start Conditions above).
-<dt><b>stdinit</b> 
-<dd>if unset (i.e.,
-<b>%option</b> <b>nostdinit)</b> 
-initializes
-<i>yyin</i> 
-and
-<i>yyout</i> 
-to nil
-<i>FILE</i> 
-pointers, instead of
-<i>stdin</i> 
-and
-<i>stdout.</i> 
-<dt><b>yylineno</b> 
-<dd>directs
-<i>flex</i> 
-to generate a scanner that maintains the number of the current line
-read from its input in the global variable
-<b>yylineno.</b> 
-This option is implied by
-<b>%option</b> <b>lex-compat.</b> 
-<dt><b>yywrap</b> 
-<dd>if unset (i.e.,
-<b>%option</b> <b>noyywrap),</b> 
-makes the scanner not call
-<b>yywrap()</b> 
-upon an end-of-file, but simply assume that there are no more
-files to scan (until the user points
-<i>yyin</i> 
-at a new file and calls
-<b>yylex()</b> 
-again).
-</dl>
-<p>
-<i>flex</i> 
-scans your rule actions to determine whether you use the
-<b>REJECT</b> 
-or
-<b>yymore()</b> 
-features.  The
-<b>reject</b> 
-and
-<b>yymore</b> 
-options are available to override its decision as to whether you use the
-options, either by setting them (e.g.,
-<b>%option</b> <b>reject)</b> 
-to indicate the feature is indeed used, or
-unsetting them to indicate it actually is not used
-(e.g.,
-<b>%option</b> <b>noyymore).</b> 
-
-<p>
-Three options take string-delimited values, offset with '=':
-<pre>
-
-<p><br>    %option outfile="ABC"
-<br>
-<p><br></pre>
-is equivalent to
-<b>-oABC,</b> 
-and
-<pre>
-
-<p><br>    %option prefix="XYZ"
-<br>
-<p><br></pre>
-is equivalent to
-<b>-PXYZ.</b> 
-Finally,
-<pre>
-
-<p><br>    %option yyclass="foo"
-<br>
-<p><br></pre>
-only applies when generating a C++ scanner (
-<b>-+</b> 
-option).  It informs
-<i>flex</i> 
-that you have derived
-<b>foo</b> 
-as a subclass of
-<b>yyFlexLexer,</b> 
-so
-<i>flex</i> 
-will place your actions in the member function
-<b>foo::yylex()</b> 
-instead of
-<b>yyFlexLexer::yylex().</b> 
-It also generates a
-<b>yyFlexLexer::yylex()</b> 
-member function that emits a run-time error (by invoking
-<b>yyFlexLexer::LexerError())</b> 
-if called.
-See Generating C++ Scanners, below, for additional information.
-
-<p>
-A number of options are available for lint purists who want to suppress
-the appearance of unneeded routines in the generated scanner.  Each of the
-following, if unset, results in the corresponding routine not appearing in
-the generated scanner:
-<pre>
-
-<p><br>    input, unput
-<br>    yy_push_state, yy_pop_state, yy_top_state
-<br>    yy_scan_buffer, yy_scan_bytes, yy_scan_string
-<br>
-<p><br></pre>
-(though
-<b>yy_push_state()</b> 
-and friends won't appear anyway unless you use
-<b>%option</b> <b>stack).</b> 
-
-</ul><H2>PERFORMANCE CONSIDERATIONS </H2><ul>
-
-The main design goal of
-<i>flex</i> 
-is that it generate high-performance scanners.  It has been optimized
-for dealing well with large sets of rules.  Aside from the effects on
-scanner speed of the table compression
-<b>-C</b> 
-options outlined above,
-there are a number of options/actions which degrade performance.  These
-are, from most expensive to least:
-<pre>
-
-<p><br>    REJECT
-<br>    %option yylineno
-<br>    arbitrary trailing context
-<br>
-<p><br>    pattern sets that require backing up
-<br>    %array
-<br>    %option interactive
-<br>    %option always-interactive
-<br>
-<p><br>    '^' beginning-of-line operator
-<br>    yymore()
-<br>
-<p><br></pre>
-with the first three all being quite expensive and the last two
-being quite cheap.  Note also that
-<b>unput()</b> 
-is implemented as a routine call that potentially does quite a bit of
-work, while
-<b>yyless()</b> 
-is a quite-cheap macro; so if just putting back some excess text you
-scanned, use
-<b>yyless().</b> 
-
-<p>
-<b>REJECT</b> 
-should be avoided at all costs when performance is important.
-It is a particularly expensive option.
-
-<p>
-Getting rid of backing up is messy and often may be an enormous
-amount of work for a complicated scanner.  In principal, one begins
-by using the
-<b>-b</b> 
-flag to generate a
-<i>lex.backup</i> 
-file.  For example, on the input
-<pre>
-
-<p><br>    %%
-<br>    foo        return TOK_KEYWORD;
-<br>    foobar     return TOK_KEYWORD;
-<br>
-<p><br></pre>
-the file looks like:
-<pre>
-
-<p><br>    State #6 is non-accepting -
-<br>     associated rule line numbers:
-<br>           2       3
-<br>     out-transitions: [ o ]
-<br>     jam-transitions: EOF [ \001-n  p-\177 ]
-<br>
-<p><br>    State #8 is non-accepting -
-<br>     associated rule line numbers:
-<br>           3
-<br>     out-transitions: [ a ]
-<br>     jam-transitions: EOF [ \001-`  b-\177 ]
-<br>
-<p><br>    State #9 is non-accepting -
-<br>     associated rule line numbers:
-<br>           3
-<br>     out-transitions: [ r ]
-<br>     jam-transitions: EOF [ \001-q  s-\177 ]
-<br>
-<p><br>    Compressed tables always back up.
-<br>
-<p><br></pre>
-The first few lines tell us that there's a scanner state in
-which it can make a transition on an 'o' but not on any other
-character, and that in that state the currently scanned text does not match
-any rule.  The state occurs when trying to match the rules found
-at lines 2 and 3 in the input file.
-If the scanner is in that state and then reads
-something other than an 'o', it will have to back up to find
-a rule which is matched.  With
-a bit of headscratching one can see that this must be the
-state it's in when it has seen "fo".  When this has happened,
-if anything other than another 'o' is seen, the scanner will
-have to back up to simply match the 'f' (by the default rule).
-
-<p>
-The comment regarding State #8 indicates there's a problem
-when "foob" has been scanned.  Indeed, on any character other
-than an 'a', the scanner will have to back up to accept "foo".
-Similarly, the comment for State #9 concerns when "fooba" has
-been scanned and an 'r' does not follow.
-
-<p>
-The final comment reminds us that there's no point going to
-all the trouble of removing backing up from the rules unless
-we're using
-<b>-Cf</b> 
-or
-<b>-CF,</b> 
-since there's no performance gain doing so with compressed scanners.
-
-<p>
-The way to remove the backing up is to add "error" rules:
-<pre>
-
-<p><br>    %%
-<br>    foo         return TOK_KEYWORD;
-<br>    foobar      return TOK_KEYWORD;
-<br>
-<p><br>    fooba       |
-<br>    foob        |
-<br>    fo          {
-<br>                /* false alarm, not really a keyword */
-<br>                return TOK_ID;
-<br>                }
-<br>
-<p><br></pre>
-
-<p>
-Eliminating backing up among a list of keywords can also be
-done using a "catch-all" rule:
-<pre>
-
-<p><br>    %%
-<br>    foo         return TOK_KEYWORD;
-<br>    foobar      return TOK_KEYWORD;
-<br>
-<p><br>    [a-z]+      return TOK_ID;
-<br>
-<p><br></pre>
-This is usually the best solution when appropriate.
-
-<p>
-Backing up messages tend to cascade.
-With a complicated set of rules it's not uncommon to get hundreds
-of messages.  If one can decipher them, though, it often
-only takes a dozen or so rules to eliminate the backing up (though
-it's easy to make a mistake and have an error rule accidentally match
-a valid token.  A possible future
-<i>flex</i> 
-feature will be to automatically add rules to eliminate backing up).
-
-<p>
-It's important to keep in mind that you gain the benefits of eliminating
-backing up only if you eliminate
-<i>every</i> 
-instance of backing up.  Leaving just one means you gain nothing.
-
-<p>
-<i>Variable</i> 
-trailing context (where both the leading and trailing parts do not have
-a fixed length) entails almost the same performance loss as
-<b>REJECT</b> 
-(i.e., substantial).  So when possible a rule like:
-<pre>
-
-<p><br>    %%
-<br>    mouse|rat/(cat|dog)   run();
-<br>
-<p><br></pre>
-is better written:
-<pre>
-
-<p><br>    %%
-<br>    mouse/cat|dog         run();
-<br>    rat/cat|dog           run();
-<br>
-<p><br></pre>
-or as
-<pre>
-
-<p><br>    %%
-<br>    mouse|rat/cat         run();
-<br>    mouse|rat/dog         run();
-<br>
-<p><br></pre>
-Note that here the special '|' action does
-<i>not</i> 
-provide any savings, and can even make things worse (see
-Deficiencies / Bugs below).
-
-<p>
-Another area where the user can increase a scanner's performance
-(and one that's easier to implement) arises from the fact that
-the longer the tokens matched, the faster the scanner will run.
-This is because with long tokens the processing of most input
-characters takes place in the (short) inner scanning loop, and
-does not often have to go through the additional work of setting up
-the scanning environment (e.g.,
-<b>yytext)</b> 
-for the action.  Recall the scanner for C comments:
-<pre>
-
-<p><br>    %x comment
-<br>    %%
-<br>            int line_num = 1;
-<br>
-<p><br>    "/*"         BEGIN(comment);
-<br>
-<p><br>    &lt;comment&gt;[^*\n]*
-<br>    &lt;comment&gt;"*"+[^*/\n]*
-<br>    &lt;comment&gt;\n             ++line_num;
-<br>    &lt;comment&gt;"*"+"/"        BEGIN(INITIAL);
-<br>
-<p><br></pre>
-This could be sped up by writing it as:
-<pre>
-
-<p><br>    %x comment
-<br>    %%
-<br>            int line_num = 1;
-<br>
-<p><br>    "/*"         BEGIN(comment);
-<br>
-<p><br>    &lt;comment&gt;[^*\n]*
-<br>    &lt;comment&gt;[^*\n]*\n      ++line_num;
-<br>    &lt;comment&gt;"*"+[^*/\n]*
-<br>    &lt;comment&gt;"*"+[^*/\n]*\n ++line_num;
-<br>    &lt;comment&gt;"*"+"/"        BEGIN(INITIAL);
-<br>
-<p><br></pre>
-Now instead of each newline requiring the processing of another
-action, recognizing the newlines is "distributed" over the other rules
-to keep the matched text as long as possible.  Note that
-<i>adding</i> 
-rules does
-<i>not</i> 
-slow down the scanner!  The speed of the scanner is independent
-of the number of rules or (modulo the considerations given at the
-beginning of this section) how complicated the rules are with
-regard to operators such as '*' and '|'.
-
-<p>
-A final example in speeding up a scanner: suppose you want to scan
-through a file containing identifiers and keywords, one per line
-and with no other extraneous characters, and recognize all the
-keywords.  A natural first approach is:
-<pre>
-
-<p><br>    %%
-<br>    asm      |
-<br>    auto     |
-<br>    break    |
-<br>    ... etc ...
-<br>    volatile |
-<br>    while    /* it's a keyword */
-<br>
-<p><br>    .|\n     /* it's not a keyword */
-<br>
-<p><br></pre>
-To eliminate the back-tracking, introduce a catch-all rule:
-<pre>
-
-<p><br>    %%
-<br>    asm      |
-<br>    auto     |
-<br>    break    |
-<br>    ... etc ...
-<br>    volatile |
-<br>    while    /* it's a keyword */
-<br>
-<p><br>    [a-z]+   |
-<br>    .|\n     /* it's not a keyword */
-<br>
-<p><br></pre>
-Now, if it's guaranteed that there's exactly one word per line,
-then we can reduce the total number of matches by a half by
-merging in the recognition of newlines with that of the other
-tokens:
-<pre>
-
-<p><br>    %%
-<br>    asm\n    |
-<br>    auto\n   |
-<br>    break\n  |
-<br>    ... etc ...
-<br>    volatile\n |
-<br>    while\n  /* it's a keyword */
-<br>
-<p><br>    [a-z]+\n |
-<br>    .|\n     /* it's not a keyword */
-<br>
-<p><br></pre>
-One has to be careful here, as we have now reintroduced backing up
-into the scanner.  In particular, while
-<i>we</i> 
-know that there will never be any characters in the input stream
-other than letters or newlines,
-<i>flex</i> 
-can't figure this out, and it will plan for possibly needing to back up
-when it has scanned a token like "auto" and then the next character
-is something other than a newline or a letter.  Previously it would
-then just match the "auto" rule and be done, but now it has no "auto"
-rule, only a "auto\n" rule.  To eliminate the possibility of backing up,
-we could either duplicate all rules but without final newlines, or,
-since we never expect to encounter such an input and therefore don't
-how it's classified, we can introduce one more catch-all rule, this
-one which doesn't include a newline:
-<pre>
-
-<p><br>    %%
-<br>    asm\n    |
-<br>    auto\n   |
-<br>    break\n  |
-<br>    ... etc ...
-<br>    volatile\n |
-<br>    while\n  /* it's a keyword */
-<br>
-<p><br>    [a-z]+\n |
-<br>    [a-z]+   |
-<br>    .|\n     /* it's not a keyword */
-<br>
-<p><br></pre>
-Compiled with
-<b>-Cf,</b> 
-this is about as fast as one can get a
-<i>flex</i> 
-scanner to go for this particular problem.
-
-<p>
-A final note:
-<i>flex</i> 
-is slow when matching NUL's, particularly when a token contains
-multiple NUL's.
-It's best to write rules which match
-<i>short</i> 
-amounts of text if it's anticipated that the text will often include NUL's.
-
-<p>
-Another final note regarding performance: as mentioned above in the section
-How the Input is Matched, dynamically resizing
-<b>yytext</b> 
-to accommodate huge tokens is a slow process because it presently requires that
-the (huge) token be rescanned from the beginning.  Thus if performance is
-vital, you should attempt to match "large" quantities of text but not
-"huge" quantities, where the cutoff between the two is at about 8K
-characters/token.
-
-</ul><H2>GENERATING C++ SCANNERS </H2><ul>
-
-<i>flex</i> 
-provides two different ways to generate scanners for use with C++.  The
-first way is to simply compile a scanner generated by
-<i>flex</i> 
-using a C++ compiler instead of a C compiler.  You should not encounter
-any compilations errors (please report any you find to the email address
-given in the Author section below).  You can then use C++ code in your
-rule actions instead of C code.  Note that the default input source for
-your scanner remains
-<i>yyin,</i> 
-and default echoing is still done to
-<i>yyout.</i> 
-Both of these remain
-<i>FILE</i> <i>*</i> 
-variables and not C++
-<i>streams.</i> 
-
-<p>
-You can also use
-<i>flex</i> 
-to generate a C++ scanner class, using the
-<b>-+</b> 
-option (or, equivalently,
-<b>%option</b> <b>c++),</b> 
-which is automatically specified if the name of the flex
-executable ends in a '+', such as
-<i>flex++.</i> 
-When using this option, flex defaults to generating the scanner to the file
-<b>lex.yy.cc</b> 
-instead of
-<b>lex.yy.c.</b> 
-The generated scanner includes the header file
-<i>FlexLexer.h,</i> 
-which defines the interface to two C++ classes.
-
-<p>
-The first class,
-<b>FlexLexer,</b> 
-provides an abstract base class defining the general scanner class
-interface.  It provides the following member functions:
-<p><dl compact><dt><b>const</b> <b>char*</b> <b>YYText()</b> 
-<dd>returns the text of the most recently matched token, the equivalent of
-<b>yytext.</b> 
-<dt><b>int</b> <b>YYLeng()</b> 
-<dd>returns the length of the most recently matched token, the equivalent of
-<b>yyleng.</b> 
-<dt><b>int</b> <b>lineno()</b> <b>const</b> 
-<dd>returns the current input line number
-(see
-<b>%option</b> <b>yylineno),</b> 
-or
-<b>1</b> 
-if
-<b>%option</b> <b>yylineno</b> 
-was not used.
-<dt><b>void</b> <b>set_debug(</b> <b>int</b> <b>flag</b> <b>)</b> 
-<dd>sets the debugging flag for the scanner, equivalent to assigning to
-<b>yy_flex_debug</b> 
-(see the Options section above).  Note that you must build the scanner
-using
-<b>%option</b> <b>debug</b> 
-to include debugging information in it.
-<dt><b>int</b> <b>debug()</b> <b>const</b> 
-<dd>returns the current setting of the debugging flag.
-</dl>
-<p>
-Also provided are member functions equivalent to
-<b>yy_switch_to_buffer(),</b> 
-<b>yy_create_buffer()</b> 
-(though the first argument is an
-<b>istream*</b> 
-object pointer and not a
-<b>FILE*),</b> 
-<b>yy_flush_buffer(),</b> 
-<b>yy_delete_buffer(),</b> 
-and
-<b>yyrestart()</b> 
-(again, the first argument is a
-<b>istream*</b> 
-object pointer).
-
-<p>
-The second class defined in
-<i>FlexLexer.h</i> 
-is
-<b>yyFlexLexer,</b> 
-which is derived from
-<b>FlexLexer.</b> 
-It defines the following additional member functions:
-<p><dl compact><dt><b>yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
-</b><dd>constructs a
-<b>yyFlexLexer</b> 
-object using the given streams for input and output.  If not specified,
-the streams default to
-<b>cin</b> 
-and
-<b>cout,</b> 
-respectively.
-<dt><b>virtual</b> <b>int</b> <b>yylex()</b> 
-<dd>performs the same role is
-<b>yylex()</b> 
-does for ordinary flex scanners: it scans the input stream, consuming
-tokens, until a rule's action returns a value.  If you derive a subclass
-<b>S</b> 
-from
-<b>yyFlexLexer</b> 
-and want to access the member functions and variables of
-<b>S</b> 
-inside
-<b>yylex(),</b> 
-then you need to use
-<b>%option</b> <b>yyclass=S</b> 
-to inform
-<i>flex</i> 
-that you will be using that subclass instead of
-<b>yyFlexLexer.</b> 
-In this case, rather than generating
-<b>yyFlexLexer::yylex(),</b> 
-<i>flex</i> 
-generates
-<b>S::yylex()</b> 
-(and also generates a dummy
-<b>yyFlexLexer::yylex()</b> 
-that calls
-<b>yyFlexLexer::LexerError()</b> 
-if called).
-<dt><b>virtual void switch_streams(istream* new_in = 0,
-</b><b><dd>ostream* new_out = 0)
-</b>reassigns
-<b>yyin</b> 
-to
-<b>new_in</b> 
-(if non-nil)
-and
-<b>yyout</b> 
-to
-<b>new_out</b> 
-(ditto), deleting the previous input buffer if
-<b>yyin</b> 
-is reassigned.
-<dt><b>int yylex( istream* new_in = 0, ostream* new_out = 0 )
-</b><dd>first switches the input streams via
-<b>switch_streams(</b> <b>new_in,</b> <b>new_out</b> <b>)</b> 
-and then returns the value of
-<b>yylex().</b> 
-</dl>
-<p>
-In addition,
-<b>yyFlexLexer</b> 
-defines the following protected virtual functions which you can redefine
-in derived classes to tailor the scanner:
-<p><dl compact><dt><b>virtual int LexerInput( char* buf, int max_size )
-</b><dd>reads up to
-<b>max_size</b> 
-characters into
-<b>buf</b> 
-and returns the number of characters read.  To indicate end-of-input,
-return 0 characters.  Note that "interactive" scanners (see the
-<b>-B</b> 
-and
-<b>-I</b> 
-flags) define the macro
-<b>YY_INTERACTIVE.</b> 
-If you redefine
-<b>LexerInput()</b> 
-and need to take different actions depending on whether or not
-the scanner might be scanning an interactive input source, you can
-test for the presence of this name via
-<b>#ifdef.</b> 
-<dt><b>virtual void LexerOutput( const char* buf, int size )
-</b><dd>writes out
-<b>size</b> 
-characters from the buffer
-<b>buf,</b> 
-which, while NUL-terminated, may also contain "internal" NUL's if
-the scanner's rules can match text with NUL's in them.
-<dt><b>virtual void LexerError( const char* msg )
-</b><dd>reports a fatal error message.  The default version of this function
-writes the message to the stream
-<b>cerr</b> 
-and exits.
-</dl>
-<p>
-Note that a
-<b>yyFlexLexer</b> 
-object contains its
-<i>entire</i> 
-scanning state.  Thus you can use such objects to create reentrant
-scanners.  You can instantiate multiple instances of the same
-<b>yyFlexLexer</b> 
-class, and you can also combine multiple C++ scanner classes together
-in the same program using the
-<b>-P</b> 
-option discussed above.
-
-<p>
-Finally, note that the
-<b>%array</b> 
-feature is not available to C++ scanner classes; you must use
-<b>%pointer</b> 
-(the default).
-
-<p>
-Here is an example of a simple C++ scanner:
-<pre>
-
-<p><br>        // An example of using the flex C++ scanner class.
-<br>
-<p><br>    %{
-<br>    int mylineno = 0;
-<br>    %}
-<br>
-<p><br>    string  \"[^\n"]+\"
-<br>
-<p><br>    ws      [ \t]+
-<br>
-<p><br>    alpha   [A-Za-z]
-<br>    dig     [0-9]
-<br>    name    ({alpha}|{dig}|\$)({alpha}|{dig}|[_.\-/$])*
-<br>    num1    [-+]?{dig}+\.?([eE][-+]?{dig}+)?
-<br>    num2    [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
-<br>    number  {num1}|{num2}
-<br>
-<p><br>    %%
-<br>
-<p><br>    {ws}    /* skip blanks and tabs */
-<br>
-<p><br>    "/*"    {
-<br>            int c;
-<br>
-<p><br>            while((c = yyinput()) != 0)
-<br>                {
-<br>                if(c == '\n')
-<br>                    ++mylineno;
-<br>
-<p><br>                else if(c == '*')
-<br>                    {
-<br>                    if((c = yyinput()) == '/')
-<br>                        break;
-<br>                    else
-<br>                        unput(c);
-<br>                    }
-<br>                }
-<br>            }
-<br>
-<p><br>    {number}  cout &lt;&lt; "number " &lt;&lt; YYText() &lt;&lt; '\n';
-<br>
-<p><br>    \n        mylineno++;
-<br>
-<p><br>    {name}    cout &lt;&lt; "name " &lt;&lt; YYText() &lt;&lt; '\n';
-<br>
-<p><br>    {string}  cout &lt;&lt; "string " &lt;&lt; YYText() &lt;&lt; '\n';
-<br>
-<p><br>    %%
-<br>
-<p><br>    int main( int /* argc */, char** /* argv */ )
-<br>        {
-<br>        FlexLexer* lexer = new yyFlexLexer;
-<br>        while(lexer-&gt;yylex() != 0)
-<br>            ;
-<br>        return 0;
-<br>        }
-<br></pre>
-If you want to create multiple (different) lexer classes, you use the
-<b>-P</b> 
-flag (or the
-<b>prefix=</b> 
-option) to rename each
-<b>yyFlexLexer</b> 
-to some other
-<b>xxFlexLexer.</b> 
-You then can include
-<b>&lt;FlexLexer.h&gt;</b> 
-in your other sources once per lexer class, first renaming
-<b>yyFlexLexer</b> 
-as follows:
-<pre>
-
-<p><br>    #undef yyFlexLexer
-<br>    #define yyFlexLexer xxFlexLexer
-<br>    #include &lt;FlexLexer.h&gt;
-<br>
-<p><br>    #undef yyFlexLexer
-<br>    #define yyFlexLexer zzFlexLexer
-<br>    #include &lt;FlexLexer.h&gt;
-<br>
-<p><br></pre>
-if, for example, you used
-<b>%option</b> <b>prefix=xx</b> 
-for one of your scanners and
-<b>%option</b> <b>prefix=zz</b> 
-for the other.
-
-<p>
-IMPORTANT: the present form of the scanning class is
-<i>experimental</i> 
-and may change considerably between major releases. 
-
-</ul><H2>INCOMPATIBILITIES WITH LEX AND POSIX </H2><ul>
-
-<i>flex</i> 
-is a rewrite of the AT&amp;T Unix
-<i>lex</i> 
-tool (the two implementations do not share any code, though),
-with some extensions and incompatibilities, both of which
-are of concern to those who wish to write scanners acceptable
-to either implementation.  Flex is fully compliant with the POSIX
-<i>lex</i> 
-specification, except that when using
-<b>%pointer</b> 
-(the default), a call to
-<b>unput()</b> 
-destroys the contents of
-<b>yytext,</b> 
-which is counter to the POSIX specification.
-
-<p>
-In this section we discuss all of the known areas of incompatibility
-between flex, AT&amp;T lex, and the POSIX specification.
-
-<p>
-<i>flex's</i> 
-<b>-l</b> 
-option turns on maximum compatibility with the original AT&amp;T
-<i>lex</i> 
-implementation, at the cost of a major loss in the generated scanner's
-performance.  We note below which incompatibilities can be overcome
-using the
-<b>-l</b> 
-option.
-
-<p>
-<i>flex</i> 
-is fully compatible with
-<i>lex</i> 
-with the following exceptions:
-<p><dl compact><dt>-<dd>The undocumented
-<i>lex</i> 
-scanner internal variable
-<b>yylineno</b> 
-is not supported unless
-<b>-l</b> 
-or
-<b>%option</b> <b>yylineno</b> 
-is used.
-<dt><dd><b>yylineno</b> 
-should be maintained on a per-buffer basis, rather than a per-scanner
-(single global variable) basis.
-<dt><dd><b>yylineno</b> 
-is not part of the POSIX specification.
-<dt>-<dd>The
-<b>input()</b> 
-routine is not redefinable, though it may be called to read characters
-following whatever has been matched by a rule.  If
-<b>input()</b> 
-encounters an end-of-file the normal
-<b>yywrap()</b> 
-processing is done.  A ``real'' end-of-file is returned by
-<b>input()</b> 
-as
-<i>EOF.</i> 
-<dt><dd>Input is instead controlled by defining the
-<b>YY_INPUT</b> 
-macro.
-<dt><dd>The
-<i>flex</i> 
-restriction that
-<b>input()</b> 
-cannot be redefined is in accordance with the POSIX specification,
-which simply does not specify any way of controlling the
-scanner's input other than by making an initial assignment to
-<i>yyin.</i> 
-<dt>-<dd>The
-<b>unput()</b> 
-routine is not redefinable.  This restriction is in accordance with POSIX.
-<dt>-<dd><i>flex</i> 
-scanners are not as reentrant as
-<i>lex</i> 
-scanners.  In particular, if you have an interactive scanner and
-an interrupt handler which long-jumps out of the scanner, and
-the scanner is subsequently called again, you may get the following
-message:
-<pre>
-
-<p><br>    fatal flex scanner internal error--end of buffer missed
-<br>
-<p><br></pre>
-To reenter the scanner, first use
-<pre>
-
-<p><br>    yyrestart( yyin );
-<br>
-<p><br></pre>
-Note that this call will throw away any buffered input; usually this
-isn't a problem with an interactive scanner.
-<dt><dd>Also note that flex C++ scanner classes
-<i>are</i> 
-reentrant, so if using C++ is an option for you, you should use
-them instead.  See "Generating C++ Scanners" above for details.
-<dt>-<dd><b>output()</b> 
-is not supported.
-Output from the
-<b>ECHO</b> 
-macro is done to the file-pointer
-<i>yyout</i> 
-(default
-<i>stdout).</i> 
-<dt><dd><b>output()</b> 
-is not part of the POSIX specification.
-<dt>-<dd><i>lex</i> 
-does not support exclusive start conditions (%x), though they
-are in the POSIX specification.
-<dt>-<dd>When definitions are expanded,
-<i>flex</i> 
-encloses them in parentheses.
-With lex, the following:
-<pre>
-
-<p><br>    NAME    [A-Z][A-Z0-9]*
-<br>    %%
-<br>    foo{NAME}?      printf( "Found it\n" );
-<br>    %%
-<br>
-<p><br></pre>
-will not match the string "foo" because when the macro
-is expanded the rule is equivalent to "foo[A-Z][A-Z0-9]*?"
-and the precedence is such that the '?' is associated with
-"[A-Z0-9]*".  With
-<i>flex,</i> 
-the rule will be expanded to
-"foo([A-Z][A-Z0-9]*)?" and so the string "foo" will match.
-<dt><dd>Note that if the definition begins with
-<b>^</b> 
-or ends with
-<b>$</b> 
-then it is
-<i>not</i> 
-expanded with parentheses, to allow these operators to appear in
-definitions without losing their special meanings.  But the
-<b>&lt;s&gt;,</b> <b>/,</b> 
-and
-<b>&lt;&lt;EOF&gt;&gt;</b> 
-operators cannot be used in a
-<i>flex</i> 
-definition.
-<dt><dd>Using
-<b>-l</b> 
-results in the
-<i>lex</i> 
-behavior of no parentheses around the definition.
-<dt><dd>The POSIX specification is that the definition be enclosed in parentheses.
-<dt>-<dd>Some implementations of
-<i>lex</i> 
-allow a rule's action to begin on a separate line, if the rule's pattern
-has trailing whitespace:
-<pre>
-
-<p><br>    %%
-<br>    foo|bar&lt;space here&gt;
-<br>      { foobar_action(); }
-<br>
-<p><br></pre>
-<i>flex</i> 
-does not support this feature.
-<dt>-<dd>The
-<i>lex</i> 
-<b>%r</b> 
-(generate a Ratfor scanner) option is not supported.  It is not part
-of the POSIX specification.
-<dt>-<dd>After a call to
-<b>unput(),</b> 
-<i>yytext</i> 
-is undefined until the next token is matched, unless the scanner
-was built using
-<b>%array.</b> 
-This is not the case with
-<i>lex</i> 
-or the POSIX specification.  The
-<b>-l</b> 
-option does away with this incompatibility.
-<dt>-<dd>The precedence of the
-<b>{}</b> 
-(numeric range) operator is different.
-<i>lex</i> 
-interprets "abc{1,3}" as "match one, two, or
-three occurrences of 'abc'", whereas
-<i>flex</i> 
-interprets it as "match 'ab'
-followed by one, two, or three occurrences of 'c'".  The latter is
-in agreement with the POSIX specification.
-<dt>-<dd>The precedence of the
-<b>^</b> 
-operator is different.
-<i>lex</i> 
-interprets "^foo|bar" as "match either 'foo' at the beginning of a line,
-or 'bar' anywhere", whereas
-<i>flex</i> 
-interprets it as "match either 'foo' or 'bar' if they come at the beginning
-of a line".  The latter is in agreement with the POSIX specification.
-<dt>-<dd>The special table-size declarations such as
-<b>%a</b> 
-supported by
-<i>lex</i> 
-are not required by
-<i>flex</i> 
-scanners;
-<i>flex</i> 
-ignores them.
-<dt>-<dd>The name
-FLEX_SCANNER
-is #define'd so scanners may be written for use with either
-<i>flex</i> 
-or
-<i>lex.</i> 
-Scanners also include
-<b>YY_FLEX_MAJOR_VERSION</b> 
-and
-<b>YY_FLEX_MINOR_VERSION</b> 
-indicating which version of
-<i>flex</i> 
-generated the scanner
-(for example, for the 2.5 release, these defines would be 2 and 5
-respectively).
-</dl>
-<p>
-The following
-<i>flex</i> 
-features are not included in
-<i>lex</i> 
-or the POSIX specification:
-<pre>
-
-<p><br>    C++ scanners
-<br>    %option
-<br>    start condition scopes
-<br>    start condition stacks
-<br>    interactive/non-interactive scanners
-<br>    yy_scan_string() and friends
-<br>    yyterminate()
-<br>    yy_set_interactive()
-<br>    yy_set_bol()
-<br>    YY_AT_BOL()
-<br>    &lt;&lt;EOF&gt;&gt;
-<br>    &lt;*&gt;
-<br>    YY_DECL
-<br>    YY_START
-<br>    YY_USER_ACTION
-<br>    YY_USER_INIT
-<br>    #line directives
-<br>    %{}'s around actions
-<br>    multiple actions on a line
-<br>
-<p><br></pre>
-plus almost all of the flex flags.
-The last feature in the list refers to the fact that with
-<i>flex</i> 
-you can put multiple actions on the same line, separated with
-semi-colons, while with
-<i>lex,</i> 
-the following
-<pre>
-
-<p><br>    foo    handle_foo(); ++num_foos_seen;
-<br>
-<p><br></pre>
-is (rather surprisingly) truncated to
-<pre>
-
-<p><br>    foo    handle_foo();
-<br>
-<p><br></pre>
-<i>flex</i> 
-does not truncate the action.  Actions that are not enclosed in
-braces are simply terminated at the end of the line.
-
-</ul><H2>DIAGNOSTICS </H2><ul>
-
-
-<p>
-<i>warning,</i> <i>rule</i> <i>cannot</i> <i>be</i> <i>matched</i> 
-indicates that the given rule
-cannot be matched because it follows other rules that will
-always match the same text as it.  For
-example, in the following "foo" cannot be matched because it comes after
-an identifier "catch-all" rule:
-<pre>
-
-<p><br>    [a-z]+    got_identifier();
-<br>    foo       got_foo();
-<br>
-<p><br></pre>
-Using
-<b>REJECT</b> 
-in a scanner suppresses this warning.
-
-<p>
-<i>warning,</i> 
-<b>-s</b> 
-<i>option given but default rule can be matched
-</i>means that it is possible (perhaps only in a particular start condition)
-that the default rule (match any single character) is the only one
-that will match a particular input.  Since
-<b>-s</b> 
-was given, presumably this is not intended.
-
-<p>
-<i>reject_used_but_not_detected</i> <i>undefined</i> 
-or
-<i>yymore_used_but_not_detected</i> <i>undefined</i> <i>-</i> 
-These errors can occur at compile time.  They indicate that the
-scanner uses
-<b>REJECT</b> 
-or
-<b>yymore()</b> 
-but that
-<i>flex</i> 
-failed to notice the fact, meaning that
-<i>flex</i> 
-scanned the first two sections looking for occurrences of these actions
-and failed to find any, but somehow you snuck some in (via a #include
-file, for example).  Use
-<b>%option</b> <b>reject</b> 
-or
-<b>%option</b> <b>yymore</b> 
-to indicate to flex that you really do use these features.
-
-<p>
-<i>flex</i> <i>scanner</i> <i>jammed</i> <i>-</i> 
-a scanner compiled with
-<b>-s</b> 
-has encountered an input string which wasn't matched by
-any of its rules.  This error can also occur due to internal problems.
-
-<p>
-<i>token</i> <i>too</i> <i>large,</i> <i>exceeds</i> <i>YYLMAX</i> <i>-</i> 
-your scanner uses
-<b>%array</b> 
-and one of its rules matched a string longer than the
-<b>YYLMAX</b> 
-constant (8K bytes by default).  You can increase the value by
-#define'ing
-<b>YYLMAX</b> 
-in the definitions section of your
-<i>flex</i> 
-input.
-
-<p>
-<i>scanner</i> <i>requires</i> <i>-8</i> <i>flag</i> <i>to</i> 
-<i>use</i> <i>the</i> <i>character</i> <i>'x'</i> <i>-</i> 
-Your scanner specification includes recognizing the 8-bit character
-<i>'x'</i> 
-and you did not specify the -8 flag, and your scanner defaulted to 7-bit
-because you used the
-<b>-Cf</b> 
-or
-<b>-CF</b> 
-table compression options.  See the discussion of the
-<b>-7</b> 
-flag for details.
-
-<p>
-<i>flex</i> <i>scanner</i> <i>push-back</i> <i>overflow</i> <i>-</i> 
-you used
-<b>unput()</b> 
-to push back so much text that the scanner's buffer could not hold
-both the pushed-back text and the current token in
-<b>yytext.</b> 
-Ideally the scanner should dynamically resize the buffer in this case, but at
-present it does not.
-
-<p>
-<i>input buffer overflow, can't enlarge buffer because scanner uses REJECT -
-</i>the scanner was working on matching an extremely large token and needed
-to expand the input buffer.  This doesn't work with scanners that use
-<b>REJECT.
-</b>
-<p>
-<i>fatal flex scanner internal error--end of buffer missed -
-</i>This can occur in an scanner which is reentered after a long-jump
-has jumped out (or over) the scanner's activation frame.  Before
-reentering the scanner, use:
-<pre>
-
-<p><br>    yyrestart( yyin );
-<br>
-<p><br></pre>
-or, as noted above, switch to using the C++ scanner class.
-
-<p>
-<i>too</i> <i>many</i> <i>start</i> <i>conditions</i> <i>in</i> <i>&lt;&gt;</i> <i>construct!</i> <i>-</i> 
-you listed more start conditions in a &lt;&gt; construct than exist (so
-you must have listed at least one of them twice).
-
-</ul><H2>FILES </H2><ul>
-
-<p><dl compact><dt><b>-lfl</b> 
-<dd>library with which scanners must be linked.
-<dt><i>lex.yy.c</i> 
-<dd>generated scanner (called
-<i>lexyy.c</i> 
-on some systems).
-<dt><i>lex.yy.cc</i> 
-<dd>generated C++ scanner class, when using
-<b>-+.</b> 
-<dt><i>&lt;FlexLexer.h&gt;</i> 
-<dd>header file defining the C++ scanner base class,
-<b>FlexLexer,</b> 
-and its derived class,
-<b>yyFlexLexer.</b> 
-<dt><i>flex.skl</i> 
-<dd>skeleton scanner.  This file is only used when building flex, not when
-flex executes.
-<dt><i>lex.backup</i> 
-<dd>backing-up information for
-<b>-b</b> 
-flag (called
-<i>lex.bck</i> 
-on some systems).
-</dl>
-</ul><H2>DEFICIENCIES / BUGS </H2><ul>
-
-
-<p>
-Some trailing context
-patterns cannot be properly matched and generate
-warning messages ("dangerous trailing context").  These are
-patterns where the ending of the
-first part of the rule matches the beginning of the second
-part, such as "zx*/xy*", where the 'x*' matches the 'x' at
-the beginning of the trailing context.  (Note that the POSIX draft
-states that the text matched by such patterns is undefined.)
-
-<p>
-For some trailing context rules, parts which are actually fixed-length are
-not recognized as such, leading to the abovementioned performance loss.
-In particular, parts using '|' or {n} (such as "foo{3}") are always
-considered variable-length.
-
-<p>
-Combining trailing context with the special '|' action can result in
-<i>fixed</i> 
-trailing context being turned into the more expensive
-<i>variable</i> 
-trailing context.  For example, in the following:
-<pre>
-
-<p><br>    %%
-<br>    abc      |
-<br>    xyz/def
-<br>
-<p><br></pre>
-
-<p>
-Use of
-<b>unput()</b> 
-invalidates yytext and yyleng, unless the
-<b>%array</b> 
-directive
-or the
-<b>-l</b> 
-option has been used.
-
-<p>
-Pattern-matching of NUL's is substantially slower than matching other
-characters.
-
-<p>
-Dynamic resizing of the input buffer is slow, as it entails rescanning
-all the text matched so far by the current (generally huge) token.
-
-<p>
-Due to both buffering of input and read-ahead, you cannot intermix
-calls to &lt;stdio.h&gt; routines, such as, for example,
-<b>getchar(),</b> 
-with
-<i>flex</i> 
-rules and expect it to work.  Call
-<b>input()</b> 
-instead.
-
-<p>
-The total table entries listed by the
-<b>-v</b> 
-flag excludes the number of table entries needed to determine
-what rule has been matched.  The number of entries is equal
-to the number of DFA states if the scanner does not use
-<b>REJECT,</b> 
-and somewhat greater than the number of states if it does.
-
-<p>
-<b>REJECT</b> 
-cannot be used with the
-<b>-f</b> 
-or
-<b>-F</b> 
-options.
-
-<p>
-The
-<i>flex</i> 
-internal algorithms need documentation.
-
-</ul><H2>SEE ALSO </H2><ul>
-
-
-<p>
-lex(1), yacc(1), sed(1), awk(1).
-
-<p>
-John Levine, Tony Mason, and Doug Brown,
-<i>Lex</i> <i>&amp;</i> <i>Yacc,</i> 
-O'Reilly and Associates.  Be sure to get the 2nd edition.
-
-<p>
-M. E. Lesk and E. Schmidt,
-<i>LEX</i> <i>-</i> <i>Lexical</i> <i>Analyzer</i> <i>Generator</i> 
-
-<p>
-Alfred Aho, Ravi Sethi and Jeffrey Ullman,
-<i>Compilers:</i> <i>Principles,</i> <i>Techniques</i> <i>and</i> <i>Tools,</i> 
-Addison-Wesley (1986).  Describes the pattern-matching techniques used by
-<i>flex</i> 
-(deterministic finite automata).
-
-</ul><H2>AUTHOR </H2><ul>
-
-Vern Paxson, with the help of many ideas and much inspiration from
-Van Jacobson.  Original version by Jef Poskanzer.  The fast table
-representation is a partial implementation of a design done by Van
-Jacobson.  The implementation was done by Kevin Gong and Vern Paxson.
-
-<p>
-Thanks to the many
-<i>flex</i> 
-beta-testers, feedbackers, and contributors, especially Francois Pinard,
-Casey Leedom,
-Stan Adermann, Terry Allen, David Barker-Plummer, John Basrai,
-Nelson H.F. Beebe, [email protected],
-Karl Berry, Peter A. Bigot, Simon Blanchard,
-Keith Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick Christopher,
-Brian Clapper, J.T. Conklin,
-Jason Coughlin, Bill Cox, Nick Cropper, Dave Curtis, Scott David
-Daniels, Chris G. Demetriou, Theo Deraadt,
-Mike Donahue, Chuck Doucette, Tom Epperly, Leo Eskin,
-Chris Faylor, Chris Flatters, Jon Forrest, Joe Gayda, Kaveh R. Ghazi,
-Eric Goldman, Christopher M. Gould, Ulrich Grepel, Peer Griebel,
-Jan Hajic, Charles Hemphill, NORO Hideo,
-Jarkko Hietaniemi, Scott Hofmann,
-Jeff Honig, Dana Hudes, Eric Hughes, John Interrante,
-Ceriel Jacobs, Michal Jaegermann, Sakari Jalovaara, Jeffrey R. Jones,
-Henry Juengst, Klaus Kaempf, Jonathan I. Kamens, Terrence O Kane,
-Amir Katz, [email protected], Kevin B. Kenny,
-Steve Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht,
-Greg Lee, Rohan Lenard, Craig Leres, John Levine, Steve Liddle, Mike Long,
-Mohamed el Lozy, Brian Madsen, Malte, Joe Marshall,
-Bengt Martensson, Chris Metcalf,
-Luke Mewburn, Jim Meyering, R. Alexander Milowski, Erik Naggum,
-G.T. Nicol, Landon Noll, James Nordby, Marc Nozell,
-Richard Ohnemus, Karsten Pahnke,
-Sven Panne, Roland Pesch, Walter Pelissero, Gaumond
-Pierre, Esmond Pitt, Jef Poskanzer, Joe Rahmeh, Jarmo Raiha,
-Frederic Raimbault, Pat Rankin, Rick Richardson,
-Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini,
-Andreas Scherer, Darrell Schiebel, Raf Schietekat,
-Doug Schmidt, Philippe Schnoebelen, Andreas Schwab,
-Alex Siegel, Eckehard Stolz, Jan-Erik Strvmquist,
-Mike Stump, Paul Stuart, Dave Tallman, Ian Lance Taylor,
-Chris Thewalt, Richard M. Timoney, Jodi Tsai,
-Paul Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, Ken
-Yap, Ron Zellar, Nathan Zelle, David Zuhn,
-and those whose names have slipped my marginal
-mail-archiving skills but whose contributions are appreciated all the
-same.
-
-<p>
-Thanks to Keith Bostic, Jon Forrest, Noah Friedman,
-John Gilmore, Craig Leres, John Levine, Bob Mulcahy, G.T.
-Nicol, Francois Pinard, Rich Salz, and Richard Stallman for help with various
-distribution headaches.
-
-<p>
-Thanks to Esmond Pitt and Earle Horton for 8-bit character support; to
-Benson Margulies and Fred Burke for C++ support; to Kent Williams and Tom
-Epperly for C++ class support; to Ove Ewerlid for support of NUL's; and to
-Eric Hughes for support of multiple buffers.
-
-<p>
-This work was primarily done when I was with the Real Time Systems Group
-at the Lawrence Berkeley Laboratory in Berkeley, CA.  Many thanks to all there
-for the support I received.
-
-<p>
-Send comments to [email protected].
-</ul></body></html>

+ 170 - 0
Engine/source/console/torquescript/CMDgram.h

@@ -0,0 +1,170 @@
+/* A Bison parser, made by GNU Bison 3.8.2.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
+#ifndef YY_CMD_CMDGRAM_H_INCLUDED
+# define YY_CMD_CMDGRAM_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int CMDdebug;
+#endif
+
+/* Token kinds.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    YYEMPTY = -2,
+    YYEOF = 0,                     /* "end of file"  */
+    YYerror = 256,                 /* error  */
+    YYUNDEF = 257,                 /* "invalid token"  */
+    rwDEFINE = 258,                /* rwDEFINE  */
+    rwENDDEF = 259,                /* rwENDDEF  */
+    rwDECLARE = 260,               /* rwDECLARE  */
+    rwDECLARESINGLETON = 261,      /* rwDECLARESINGLETON  */
+    rwBREAK = 262,                 /* rwBREAK  */
+    rwELSE = 263,                  /* rwELSE  */
+    rwCONTINUE = 264,              /* rwCONTINUE  */
+    rwGLOBAL = 265,                /* rwGLOBAL  */
+    rwIF = 266,                    /* rwIF  */
+    rwNIL = 267,                   /* rwNIL  */
+    rwRETURN = 268,                /* rwRETURN  */
+    rwWHILE = 269,                 /* rwWHILE  */
+    rwDO = 270,                    /* rwDO  */
+    rwENDIF = 271,                 /* rwENDIF  */
+    rwENDWHILE = 272,              /* rwENDWHILE  */
+    rwENDFOR = 273,                /* rwENDFOR  */
+    rwDEFAULT = 274,               /* rwDEFAULT  */
+    rwFOR = 275,                   /* rwFOR  */
+    rwFOREACH = 276,               /* rwFOREACH  */
+    rwFOREACHSTR = 277,            /* rwFOREACHSTR  */
+    rwIN = 278,                    /* rwIN  */
+    rwDATABLOCK = 279,             /* rwDATABLOCK  */
+    rwSWITCH = 280,                /* rwSWITCH  */
+    rwCASE = 281,                  /* rwCASE  */
+    rwSWITCHSTR = 282,             /* rwSWITCHSTR  */
+    rwCASEOR = 283,                /* rwCASEOR  */
+    rwPACKAGE = 284,               /* rwPACKAGE  */
+    rwNAMESPACE = 285,             /* rwNAMESPACE  */
+    rwCLASS = 286,                 /* rwCLASS  */
+    rwASSERT = 287,                /* rwASSERT  */
+    ILLEGAL_TOKEN = 288,           /* ILLEGAL_TOKEN  */
+    CHRCONST = 289,                /* CHRCONST  */
+    INTCONST = 290,                /* INTCONST  */
+    TTAG = 291,                    /* TTAG  */
+    VAR = 292,                     /* VAR  */
+    IDENT = 293,                   /* IDENT  */
+    TYPEIDENT = 294,               /* TYPEIDENT  */
+    DOCBLOCK = 295,                /* DOCBLOCK  */
+    STRATOM = 296,                 /* STRATOM  */
+    TAGATOM = 297,                 /* TAGATOM  */
+    FLTCONST = 298,                /* FLTCONST  */
+    opINTNAME = 299,               /* opINTNAME  */
+    opINTNAMER = 300,              /* opINTNAMER  */
+    opMINUSMINUS = 301,            /* opMINUSMINUS  */
+    opPLUSPLUS = 302,              /* opPLUSPLUS  */
+    STMT_SEP = 303,                /* STMT_SEP  */
+    opSHL = 304,                   /* opSHL  */
+    opSHR = 305,                   /* opSHR  */
+    opPLASN = 306,                 /* opPLASN  */
+    opMIASN = 307,                 /* opMIASN  */
+    opMLASN = 308,                 /* opMLASN  */
+    opDVASN = 309,                 /* opDVASN  */
+    opMODASN = 310,                /* opMODASN  */
+    opANDASN = 311,                /* opANDASN  */
+    opXORASN = 312,                /* opXORASN  */
+    opORASN = 313,                 /* opORASN  */
+    opSLASN = 314,                 /* opSLASN  */
+    opSRASN = 315,                 /* opSRASN  */
+    opCAT = 316,                   /* opCAT  */
+    opEQ = 317,                    /* opEQ  */
+    opNE = 318,                    /* opNE  */
+    opGE = 319,                    /* opGE  */
+    opLE = 320,                    /* opLE  */
+    opAND = 321,                   /* opAND  */
+    opOR = 322,                    /* opOR  */
+    opSTREQ = 323,                 /* opSTREQ  */
+    opCOLONCOLON = 324,            /* opCOLONCOLON  */
+    opMDASN = 325,                 /* opMDASN  */
+    opNDASN = 326,                 /* opNDASN  */
+    opNTASN = 327,                 /* opNTASN  */
+    opSTRNE = 328,                 /* opSTRNE  */
+    UNARY = 329                    /* UNARY  */
+  };
+  typedef enum yytokentype yytoken_kind_t;
+#endif
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+union YYSTYPE
+{
+#line 82 "CMDgram.y"
+
+   Token< char >           c;
+   Token< int >            i;
+   Token< const char* >    s;
+   Token< char* >          str;
+   Token< double >         f;
+   StmtNode*               stmt;
+   ExprNode*               expr;
+   SlotAssignNode*         slist;
+   VarNode*                var;
+   SlotDecl                slot;
+   InternalSlotDecl        intslot;
+   ObjectBlockDecl         odcl;
+   ObjectDeclNode*         od;
+   AssignDecl              asn;
+   IfStmtNode*             ifnode;
+
+#line 156 "CMDgram.h"
+
+};
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE CMDlval;
+
+
+int CMDparse (void);
+
+
+#endif /* !YY_CMD_CMDGRAM_H_INCLUDED  */

+ 2 - 2
Engine/source/console/torquescript/CMDgram.y

@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "console/console.h"
-#include "console/compiler.h"
+#include "console/torquescript/compiler.h"
 #include "console/consoleInternal.h"
 #include "core/strings/stringFunctions.h"
 
@@ -166,7 +166,7 @@ decl_list
    :
       { $$ = nil; }
    | decl_list decl
-      { if(!gStatementList) { gStatementList = $2; } else { gStatementList->append($2); } }
+      { if(!Script::gStatementList) { Script::gStatementList = $2; } else { Script::gStatementList->append($2); } }
    ;
 
 decl

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 539 - 181
Engine/source/console/torquescript/CMDscan.cpp


+ 2 - 2
Engine/source/console/torquescript/CMDscan.l

@@ -9,7 +9,7 @@
 #include "platform/platform.h"
 #include "core/stringTable.h"
 #include "console/console.h"
-#include "console/compiler.h"
+#include "console/torquescript/compiler.h"
 #include "console/dynamicTypes.h"
 #include "core/strings/stringFunctions.h"
 
@@ -30,7 +30,7 @@ inline Token< T > MakeToken( T value, U32 lineNumber )
    return result;
 }
 
-#include "console/cmdgram.h"
+#include "console/torquescript/CMDgram.h"
 
 // HACK: C++17 and beyond can't use register keyword
 #define register

+ 1 - 1
Engine/source/console/torquescript/astNodes.cpp

@@ -35,7 +35,7 @@ struct Token
    T value;
    S32 lineNumber;
 };
-#include "cmdgram.h"
+#include "CMDgram.h"
 
 namespace Compiler
 {

+ 1 - 1
Engine/source/console/torquescript/bison.bat

@@ -1,6 +1,6 @@
 echo Changing to %4 ...
 cd %4
 echo Generating %2 and %3 with prefix %1.
-..\..\bin\bison\bison.exe -o %2 %3 --defines -p %1
+..\..\..\bin\bison-flex\win_bison.exe -o %2 %3 --defines -p %1 -H
 echo Renaming %2 to %5 .
 move /Y %2 %5

+ 2913 - 2172
Engine/source/console/torquescript/cmdgram.cpp

@@ -1,90 +1,80 @@
+/* A Bison parser, made by GNU Bison 3.8.2.  */
 
-/*  A Bison parser, made from cmdgram.y with Bison version GNU Bison version 1.24
-  */
-
-#define YYBISON 1  /* Identify Bison output.  */
-
-#define yyparse CMDparse
-#define yylex CMDlex
-#define yyerror CMDerror
-#define yylval CMDlval
-#define yychar CMDchar
-#define yydebug CMDdebug
-#define yynerrs CMDnerrs
-#define	rwDEFINE	258
-#define	rwENDDEF	259
-#define	rwDECLARE	260
-#define	rwDECLARESINGLETON	261
-#define	rwBREAK	262
-#define	rwELSE	263
-#define	rwCONTINUE	264
-#define	rwGLOBAL	265
-#define	rwIF	266
-#define	rwNIL	267
-#define	rwRETURN	268
-#define	rwWHILE	269
-#define	rwDO	270
-#define	rwENDIF	271
-#define	rwENDWHILE	272
-#define	rwENDFOR	273
-#define	rwDEFAULT	274
-#define	rwFOR	275
-#define	rwFOREACH	276
-#define	rwFOREACHSTR	277
-#define	rwIN	278
-#define	rwDATABLOCK	279
-#define	rwSWITCH	280
-#define	rwCASE	281
-#define	rwSWITCHSTR	282
-#define	rwCASEOR	283
-#define	rwPACKAGE	284
-#define	rwNAMESPACE	285
-#define	rwCLASS	286
-#define	rwASSERT	287
-#define	ILLEGAL_TOKEN	288
-#define	CHRCONST	289
-#define	INTCONST	290
-#define	TTAG	291
-#define	VAR	292
-#define	IDENT	293
-#define	TYPEIDENT	294
-#define	DOCBLOCK	295
-#define	STRATOM	296
-#define	TAGATOM	297
-#define	FLTCONST	298
-#define	opINTNAME	299
-#define	opINTNAMER	300
-#define	opMINUSMINUS	301
-#define	opPLUSPLUS	302
-#define	STMT_SEP	303
-#define	opSHL	304
-#define	opSHR	305
-#define	opPLASN	306
-#define	opMIASN	307
-#define	opMLASN	308
-#define	opDVASN	309
-#define	opMODASN	310
-#define	opANDASN	311
-#define	opXORASN	312
-#define	opORASN	313
-#define	opSLASN	314
-#define	opSRASN	315
-#define	opCAT	316
-#define	opEQ	317
-#define	opNE	318
-#define	opGE	319
-#define	opLE	320
-#define	opAND	321
-#define	opOR	322
-#define	opSTREQ	323
-#define	opCOLONCOLON	324
-#define	opMDASN	325
-#define	opNDASN	326
-#define	opNTASN	327
-#define	opSTRNE	328
-#define	UNARY	329
-
-#line 1 "cmdgram.y"
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+   Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output, and Bison version.  */
+#define YYBISON 30802
+
+/* Bison version string.  */
+#define YYBISON_VERSION "3.8.2"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+/* Substitute the variable and function names.  */
+#define yyparse         CMDparse
+#define yylex           CMDlex
+#define yyerror         CMDerror
+#define yydebug         CMDdebug
+#define yynerrs         CMDnerrs
+#define yylval          CMDlval
+#define yychar          CMDchar
+
+/* First part of user prologue.  */
+#line 1 "CMDgram.y"
 
 
 // bison --defines=cmdgram.h --verbose -o cmdgram.cpp -p CMD CMDgram.y
@@ -95,7 +85,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "console/console.h"
-#include "compiler.h"
+#include "console/torquescript/compiler.h"
 #include "console/consoleInternal.h"
 #include "core/strings/stringFunctions.h"
 
@@ -127,2266 +117,3017 @@ struct Token
    U32 lineNumber;
 };
 
-#line 44 "cmdgram.y"
+#line 44 "CMDgram.y"
 
         /* Reserved Word Definitions */
-#line 55 "cmdgram.y"
+#line 55 "CMDgram.y"
 
         /* Constants and Identifier Definitions */
-#line 69 "cmdgram.y"
+#line 69 "CMDgram.y"
 
         /* Operator Definitions */
 
-#line 82 "cmdgram.y"
-typedef union {
-   Token< char >           c;
-   Token< int >            i;
-   Token< const char* >    s;
-   Token< char* >          str;
-   Token< double >         f;
-   StmtNode*               stmt;
-   ExprNode*               expr;
-   SlotAssignNode*         slist;
-   VarNode*                var;
-   SlotDecl                slot;
-   InternalSlotDecl        intslot;
-   ObjectBlockDecl         odcl;
-   ObjectDeclNode*         od;
-   AssignDecl              asn;
-   IfStmtNode*             ifnode;
-} YYSTYPE;
-
-#ifndef YYLTYPE
-typedef
-  struct yyltype
-    {
-      int timestamp;
-      int first_line;
-      int first_column;
-      int last_line;
-      int last_column;
-      char *text;
-   }
-  yyltype;
-
-#define YYLTYPE yyltype
+#line 131 "CMDgram.c"
+
+# ifndef YY_CAST
+#  ifdef __cplusplus
+#   define YY_CAST(Type, Val) static_cast<Type> (Val)
+#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+#  else
+#   define YY_CAST(Type, Val) ((Type) (Val))
+#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+#  endif
+# endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
+#  else
+#   define YY_NULLPTR ((void*)0)
+#  endif
+# endif
+
+#include "CMDgram.h"
+/* Symbol kind.  */
+enum yysymbol_kind_t
+{
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_rwDEFINE = 3,                   /* rwDEFINE  */
+  YYSYMBOL_rwENDDEF = 4,                   /* rwENDDEF  */
+  YYSYMBOL_rwDECLARE = 5,                  /* rwDECLARE  */
+  YYSYMBOL_rwDECLARESINGLETON = 6,         /* rwDECLARESINGLETON  */
+  YYSYMBOL_rwBREAK = 7,                    /* rwBREAK  */
+  YYSYMBOL_rwELSE = 8,                     /* rwELSE  */
+  YYSYMBOL_rwCONTINUE = 9,                 /* rwCONTINUE  */
+  YYSYMBOL_rwGLOBAL = 10,                  /* rwGLOBAL  */
+  YYSYMBOL_rwIF = 11,                      /* rwIF  */
+  YYSYMBOL_rwNIL = 12,                     /* rwNIL  */
+  YYSYMBOL_rwRETURN = 13,                  /* rwRETURN  */
+  YYSYMBOL_rwWHILE = 14,                   /* rwWHILE  */
+  YYSYMBOL_rwDO = 15,                      /* rwDO  */
+  YYSYMBOL_rwENDIF = 16,                   /* rwENDIF  */
+  YYSYMBOL_rwENDWHILE = 17,                /* rwENDWHILE  */
+  YYSYMBOL_rwENDFOR = 18,                  /* rwENDFOR  */
+  YYSYMBOL_rwDEFAULT = 19,                 /* rwDEFAULT  */
+  YYSYMBOL_rwFOR = 20,                     /* rwFOR  */
+  YYSYMBOL_rwFOREACH = 21,                 /* rwFOREACH  */
+  YYSYMBOL_rwFOREACHSTR = 22,              /* rwFOREACHSTR  */
+  YYSYMBOL_rwIN = 23,                      /* rwIN  */
+  YYSYMBOL_rwDATABLOCK = 24,               /* rwDATABLOCK  */
+  YYSYMBOL_rwSWITCH = 25,                  /* rwSWITCH  */
+  YYSYMBOL_rwCASE = 26,                    /* rwCASE  */
+  YYSYMBOL_rwSWITCHSTR = 27,               /* rwSWITCHSTR  */
+  YYSYMBOL_rwCASEOR = 28,                  /* rwCASEOR  */
+  YYSYMBOL_rwPACKAGE = 29,                 /* rwPACKAGE  */
+  YYSYMBOL_rwNAMESPACE = 30,               /* rwNAMESPACE  */
+  YYSYMBOL_rwCLASS = 31,                   /* rwCLASS  */
+  YYSYMBOL_rwASSERT = 32,                  /* rwASSERT  */
+  YYSYMBOL_ILLEGAL_TOKEN = 33,             /* ILLEGAL_TOKEN  */
+  YYSYMBOL_CHRCONST = 34,                  /* CHRCONST  */
+  YYSYMBOL_INTCONST = 35,                  /* INTCONST  */
+  YYSYMBOL_TTAG = 36,                      /* TTAG  */
+  YYSYMBOL_VAR = 37,                       /* VAR  */
+  YYSYMBOL_IDENT = 38,                     /* IDENT  */
+  YYSYMBOL_TYPEIDENT = 39,                 /* TYPEIDENT  */
+  YYSYMBOL_DOCBLOCK = 40,                  /* DOCBLOCK  */
+  YYSYMBOL_STRATOM = 41,                   /* STRATOM  */
+  YYSYMBOL_TAGATOM = 42,                   /* TAGATOM  */
+  YYSYMBOL_FLTCONST = 43,                  /* FLTCONST  */
+  YYSYMBOL_44_ = 44,                       /* '+'  */
+  YYSYMBOL_45_ = 45,                       /* '-'  */
+  YYSYMBOL_46_ = 46,                       /* '*'  */
+  YYSYMBOL_47_ = 47,                       /* '/'  */
+  YYSYMBOL_48_ = 48,                       /* '<'  */
+  YYSYMBOL_49_ = 49,                       /* '>'  */
+  YYSYMBOL_50_ = 50,                       /* '='  */
+  YYSYMBOL_51_ = 51,                       /* '.'  */
+  YYSYMBOL_52_ = 52,                       /* '|'  */
+  YYSYMBOL_53_ = 53,                       /* '&'  */
+  YYSYMBOL_54_ = 54,                       /* '%'  */
+  YYSYMBOL_55_ = 55,                       /* '('  */
+  YYSYMBOL_56_ = 56,                       /* ')'  */
+  YYSYMBOL_57_ = 57,                       /* ','  */
+  YYSYMBOL_58_ = 58,                       /* ':'  */
+  YYSYMBOL_59_ = 59,                       /* ';'  */
+  YYSYMBOL_60_ = 60,                       /* '{'  */
+  YYSYMBOL_61_ = 61,                       /* '}'  */
+  YYSYMBOL_62_ = 62,                       /* '^'  */
+  YYSYMBOL_63_ = 63,                       /* '~'  */
+  YYSYMBOL_64_ = 64,                       /* '!'  */
+  YYSYMBOL_65_ = 65,                       /* '@'  */
+  YYSYMBOL_opINTNAME = 66,                 /* opINTNAME  */
+  YYSYMBOL_opINTNAMER = 67,                /* opINTNAMER  */
+  YYSYMBOL_opMINUSMINUS = 68,              /* opMINUSMINUS  */
+  YYSYMBOL_opPLUSPLUS = 69,                /* opPLUSPLUS  */
+  YYSYMBOL_STMT_SEP = 70,                  /* STMT_SEP  */
+  YYSYMBOL_opSHL = 71,                     /* opSHL  */
+  YYSYMBOL_opSHR = 72,                     /* opSHR  */
+  YYSYMBOL_opPLASN = 73,                   /* opPLASN  */
+  YYSYMBOL_opMIASN = 74,                   /* opMIASN  */
+  YYSYMBOL_opMLASN = 75,                   /* opMLASN  */
+  YYSYMBOL_opDVASN = 76,                   /* opDVASN  */
+  YYSYMBOL_opMODASN = 77,                  /* opMODASN  */
+  YYSYMBOL_opANDASN = 78,                  /* opANDASN  */
+  YYSYMBOL_opXORASN = 79,                  /* opXORASN  */
+  YYSYMBOL_opORASN = 80,                   /* opORASN  */
+  YYSYMBOL_opSLASN = 81,                   /* opSLASN  */
+  YYSYMBOL_opSRASN = 82,                   /* opSRASN  */
+  YYSYMBOL_opCAT = 83,                     /* opCAT  */
+  YYSYMBOL_opEQ = 84,                      /* opEQ  */
+  YYSYMBOL_opNE = 85,                      /* opNE  */
+  YYSYMBOL_opGE = 86,                      /* opGE  */
+  YYSYMBOL_opLE = 87,                      /* opLE  */
+  YYSYMBOL_opAND = 88,                     /* opAND  */
+  YYSYMBOL_opOR = 89,                      /* opOR  */
+  YYSYMBOL_opSTREQ = 90,                   /* opSTREQ  */
+  YYSYMBOL_opCOLONCOLON = 91,              /* opCOLONCOLON  */
+  YYSYMBOL_92_ = 92,                       /* '['  */
+  YYSYMBOL_opMDASN = 93,                   /* opMDASN  */
+  YYSYMBOL_opNDASN = 94,                   /* opNDASN  */
+  YYSYMBOL_opNTASN = 95,                   /* opNTASN  */
+  YYSYMBOL_96_ = 96,                       /* '?'  */
+  YYSYMBOL_opSTRNE = 97,                   /* opSTRNE  */
+  YYSYMBOL_UNARY = 98,                     /* UNARY  */
+  YYSYMBOL_99_ = 99,                       /* ']'  */
+  YYSYMBOL_YYACCEPT = 100,                 /* $accept  */
+  YYSYMBOL_start = 101,                    /* start  */
+  YYSYMBOL_decl_list = 102,                /* decl_list  */
+  YYSYMBOL_decl = 103,                     /* decl  */
+  YYSYMBOL_package_decl = 104,             /* package_decl  */
+  YYSYMBOL_fn_decl_list = 105,             /* fn_decl_list  */
+  YYSYMBOL_statement_list = 106,           /* statement_list  */
+  YYSYMBOL_stmt = 107,                     /* stmt  */
+  YYSYMBOL_fn_decl_stmt = 108,             /* fn_decl_stmt  */
+  YYSYMBOL_var_list_decl = 109,            /* var_list_decl  */
+  YYSYMBOL_var_list = 110,                 /* var_list  */
+  YYSYMBOL_datablock_decl = 111,           /* datablock_decl  */
+  YYSYMBOL_object_decl = 112,              /* object_decl  */
+  YYSYMBOL_parent_block = 113,             /* parent_block  */
+  YYSYMBOL_object_name = 114,              /* object_name  */
+  YYSYMBOL_object_args = 115,              /* object_args  */
+  YYSYMBOL_object_declare_block = 116,     /* object_declare_block  */
+  YYSYMBOL_object_decl_list = 117,         /* object_decl_list  */
+  YYSYMBOL_stmt_block = 118,               /* stmt_block  */
+  YYSYMBOL_switch_stmt = 119,              /* switch_stmt  */
+  YYSYMBOL_case_block = 120,               /* case_block  */
+  YYSYMBOL_case_expr = 121,                /* case_expr  */
+  YYSYMBOL_if_stmt = 122,                  /* if_stmt  */
+  YYSYMBOL_while_stmt = 123,               /* while_stmt  */
+  YYSYMBOL_for_stmt = 124,                 /* for_stmt  */
+  YYSYMBOL_foreach_stmt = 125,             /* foreach_stmt  */
+  YYSYMBOL_expression_stmt = 126,          /* expression_stmt  */
+  YYSYMBOL_expr = 127,                     /* expr  */
+  YYSYMBOL_slot_acc = 128,                 /* slot_acc  */
+  YYSYMBOL_intslot_acc = 129,              /* intslot_acc  */
+  YYSYMBOL_class_name_expr = 130,          /* class_name_expr  */
+  YYSYMBOL_assign_op_struct = 131,         /* assign_op_struct  */
+  YYSYMBOL_stmt_expr = 132,                /* stmt_expr  */
+  YYSYMBOL_funcall_expr = 133,             /* funcall_expr  */
+  YYSYMBOL_assert_expr = 134,              /* assert_expr  */
+  YYSYMBOL_expr_list_decl = 135,           /* expr_list_decl  */
+  YYSYMBOL_expr_list = 136,                /* expr_list  */
+  YYSYMBOL_slot_assign_list_opt = 137,     /* slot_assign_list_opt  */
+  YYSYMBOL_slot_assign_list = 138,         /* slot_assign_list  */
+  YYSYMBOL_slot_assign = 139,              /* slot_assign  */
+  YYSYMBOL_aidx_expr = 140                 /* aidx_expr  */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+
+
+
+
+#ifdef short
+# undef short
 #endif
 
-#include <stdio.h>
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+   <limits.h> and (if available) <stdint.h> are included
+   so that the code can choose integer types of a good width.  */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+#  define YY_STDINT_H
+# endif
+#endif
+
+/* Narrow types that promote to a signed type and that can represent a
+   signed or unsigned integer of at least N bits.  In tables they can
+   save space and decrease cache pressure.  Promoting to a signed type
+   helps avoid bugs in integer arithmetic.  */
 
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
+typedef signed char yytype_int8;
 #endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
+#else
+typedef short yytype_int16;
 #endif
 
+/* Work around bug in HP-UX 11.23, which defines these macros
+   incorrectly for preprocessor constants.  This workaround can likely
+   be removed in 2023, as HPE has promised support for HP-UX 11.23
+   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
 
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
+#else
+typedef short yytype_uint8;
+#endif
 
-#define	YYFINAL		380
-#define	YYFLAG		-32768
-#define	YYNTBASE	100
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140)
-
-static const char yytranslate[] = {     0,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,    64,     2,     2,     2,    54,    53,     2,    55,
-    56,    46,    44,    57,    45,    51,    47,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,    58,    59,    48,
-    50,    49,    96,    65,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    92,     2,    99,    62,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,    60,    52,    61,    63,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
-    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-    36,    37,    38,    39,    40,    41,    42,    43,    66,    67,
-    68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
-    78,    79,    80,    81,    82,    83,    84,    85,    86,    87,
-    88,    89,    90,    91,    93,    94,    95,    97,    98
-};
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
 
-#if YYDEBUG != 0
-static const short yyprhs[] = {     0,
-     0,     2,     3,     6,     8,    10,    12,    19,    21,    24,
-    25,    28,    30,    32,    34,    36,    38,    40,    43,    46,
-    49,    53,    56,    61,    68,    70,    79,    90,    91,    93,
-    95,    99,   110,   121,   129,   142,   152,   163,   171,   172,
-   175,   176,   178,   179,   182,   183,   185,   187,   190,   193,
-   197,   201,   203,   211,   219,   224,   232,   238,   240,   244,
-   250,   258,   264,   271,   281,   290,   299,   307,   316,   324,
-   332,   339,   347,   355,   357,   359,   363,   367,   371,   375,
-   379,   383,   387,   391,   395,   398,   401,   403,   409,   413,
-   417,   421,   425,   429,   433,   437,   441,   445,   449,   453,
-   457,   461,   464,   467,   469,   471,   473,   475,   477,   479,
-   481,   483,   485,   490,   494,   501,   505,   509,   511,   515,
-   517,   519,   522,   525,   528,   531,   534,   537,   540,   543,
-   546,   549,   551,   553,   555,   559,   566,   569,   575,   578,
-   582,   588,   593,   600,   607,   612,   619,   620,   622,   624,
-   628,   629,   631,   633,   636,   641,   647,   652,   660,   669,
-   671
-};
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+#  define YYPTRDIFF_T __PTRDIFF_TYPE__
+#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+#  ifndef ptrdiff_t
+#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  endif
+#  define YYPTRDIFF_T ptrdiff_t
+#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+#  define YYPTRDIFF_T long
+#  define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM                                  \
+  YY_CAST (YYPTRDIFF_T,                                 \
+           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
+            ? YYPTRDIFF_MAXIMUM                         \
+            : YY_CAST (YYSIZE_T, -1)))
 
-static const short yyrhs[] = {   101,
-     0,     0,   101,   102,     0,   106,     0,   107,     0,   103,
-     0,    29,    38,    60,   104,    61,    59,     0,   107,     0,
-   104,   107,     0,     0,   105,   106,     0,   121,     0,   122,
-     0,   123,     0,   124,     0,   110,     0,   118,     0,     7,
-    59,     0,     9,    59,     0,    13,    59,     0,    13,   126,
-    59,     0,   125,    59,     0,    36,    50,   126,    59,     0,
-    36,    50,   126,    57,   126,    59,     0,    40,     0,     3,
-    38,    55,   108,    56,    60,   105,    61,     0,     3,    38,
-    91,    38,    55,   108,    56,    60,   105,    61,     0,     0,
-   109,     0,    37,     0,   109,    57,    37,     0,    24,   129,
-    55,   126,   112,    56,    60,   136,    61,    59,     0,     5,
-   129,    55,   113,   112,   114,    56,    60,   115,    61,     0,
-     5,   129,    55,   113,   112,   114,    56,     0,     5,   129,
-    55,    92,   113,    99,   112,   114,    56,    60,   115,    61,
-     0,     5,   129,    55,    92,   113,    99,   112,   114,    56,
-     0,     6,   129,    55,   113,   112,   114,    56,    60,   115,
-    61,     0,     6,   129,    55,   113,   112,   114,    56,     0,
-     0,    58,    38,     0,     0,   126,     0,     0,    57,   135,
-     0,     0,   137,     0,   116,     0,   137,   116,     0,   111,
-    59,     0,   116,   111,    59,     0,    60,   105,    61,     0,
-   106,     0,    25,    55,   126,    56,    60,   119,    61,     0,
-    27,    55,   126,    56,    60,   119,    61,     0,    26,   120,
-    58,   105,     0,    26,   120,    58,   105,    19,    58,   105,
-     0,    26,   120,    58,   105,   119,     0,   126,     0,   120,
-    28,   126,     0,    11,    55,   126,    56,   117,     0,    11,
-    55,   126,    56,   117,     8,   117,     0,    14,    55,   126,
-    56,   117,     0,    15,   117,    14,    55,   126,    56,     0,
-    20,    55,   126,    59,   126,    59,   126,    56,   117,     0,
-    20,    55,   126,    59,   126,    59,    56,   117,     0,    20,
-    55,   126,    59,    59,   126,    56,   117,     0,    20,    55,
-   126,    59,    59,    56,   117,     0,    20,    55,    59,   126,
-    59,   126,    56,   117,     0,    20,    55,    59,   126,    59,
-    56,   117,     0,    20,    55,    59,    59,   126,    56,   117,
-     0,    20,    55,    59,    59,    56,   117,     0,    21,    55,
-    37,    23,   126,    56,   117,     0,    22,    55,    37,    23,
-   126,    56,   117,     0,   131,     0,   131,     0,    55,   126,
-    56,     0,   126,    62,   126,     0,   126,    54,   126,     0,
-   126,    53,   126,     0,   126,    52,   126,     0,   126,    44,
-   126,     0,   126,    45,   126,     0,   126,    46,   126,     0,
-   126,    47,   126,     0,    45,   126,     0,    46,   126,     0,
-    36,     0,   126,    96,   126,    58,   126,     0,   126,    48,
-   126,     0,   126,    49,   126,     0,   126,    86,   126,     0,
-   126,    87,   126,     0,   126,    84,   126,     0,   126,    85,
-   126,     0,   126,    89,   126,     0,   126,    71,   126,     0,
-   126,    72,   126,     0,   126,    88,   126,     0,   126,    90,
-   126,     0,   126,    97,   126,     0,   126,    65,   126,     0,
-    64,   126,     0,    63,   126,     0,    42,     0,    43,     0,
-    35,     0,     7,     0,   127,     0,   128,     0,    38,     0,
-    41,     0,    37,     0,    37,    92,   139,    99,     0,   126,
-    51,    38,     0,   126,    51,    38,    92,   139,    99,     0,
-   126,    66,   129,     0,   126,    67,   129,     0,    38,     0,
-    55,   126,    56,     0,    69,     0,    68,     0,    73,   126,
-     0,    74,   126,     0,    75,   126,     0,    76,   126,     0,
-    77,   126,     0,    78,   126,     0,    79,   126,     0,    80,
-   126,     0,    81,   126,     0,    82,   126,     0,   132,     0,
-   133,     0,   111,     0,    37,    50,   126,     0,    37,    92,
-   139,    99,    50,   126,     0,    37,   130,     0,    37,    92,
-   139,    99,   130,     0,   127,   130,     0,   127,    50,   126,
-     0,   127,    50,    60,   135,    61,     0,    38,    55,   134,
-    56,     0,    38,    91,    38,    55,   134,    56,     0,   126,
-    51,    38,    55,   134,    56,     0,    32,    55,   126,    56,
-     0,    32,    55,   126,    57,    41,    56,     0,     0,   135,
-     0,   126,     0,   135,    57,   126,     0,     0,   137,     0,
-   138,     0,   137,   138,     0,    38,    50,   126,    59,     0,
-    39,    38,    50,   126,    59,     0,    24,    50,   126,    59,
-     0,    38,    92,   139,    99,    50,   126,    59,     0,    39,
-    38,    92,   139,    99,    50,   126,    59,     0,   126,     0,
-   139,    57,   126,     0
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int16 yy_state_t;
+
+/* State numbers in computations.  */
+typedef int yy_state_fast_t;
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+#  define YY_ATTRIBUTE_UNUSED
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YY_USE(E) ((void) (E))
+#else
+# define YY_USE(E) /* empty */
+#endif
+
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN                          \
+    _Pragma ("GCC diagnostic push")                            \
+    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END            \
+    _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if !defined yyoverflow
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* !defined yyoverflow */
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yy_state_t yyss_alloc;
+  YYSTYPE yyvs_alloc;
 };
 
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYPTRDIFF_T yynewbytes;                                         \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
+      }                                                                 \
+    while (0)
+
 #endif
 
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
-   161,   166,   168,   173,   175,   177,   182,   187,   189,   194,
-   196,   201,   202,   203,   204,   205,   206,   207,   209,   211,
-   213,   215,   217,   219,   221,   226,   228,   233,   235,   240,
-   242,   247,   252,   254,   256,   258,   260,   262,   267,   269,
-   274,   276,   281,   283,   288,   290,   292,   294,   299,   301,
-   306,   308,   313,   315,   320,   322,   324,   329,   331,   336,
-   338,   343,   345,   350,   352,   354,   356,   358,   360,   362,
-   364,   369,   371,   376,   381,   383,   385,   387,   389,   391,
-   393,   395,   397,   399,   401,   403,   405,   407,   409,   411,
-   413,   415,   417,   419,   421,   423,   425,   427,   429,   431,
-   433,   435,   437,   439,   441,   443,   445,   447,   449,   451,
-   453,   455,   457,   479,   481,   486,   488,   493,   495,   500,
-   502,   504,   506,   508,   510,   512,   514,   516,   518,   520,
-   522,   527,   529,   531,   533,   535,   537,   539,   541,   543,
-   545,   550,   552,   554,   564,   566,   571,   573,   578,   580,
-   585,   587,   592,   594,   599,   601,   603,   605,   607,   612,
-   614
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYPTRDIFF_T yyi;                      \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  3
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   2858
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  100
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  41
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  162
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  380
+
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   329
+
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : YYSYMBOL_YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex.  */
+static const yytype_int8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    64,     2,     2,     2,    54,    53,     2,
+      55,    56,    46,    44,    57,    45,    51,    47,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,    58,    59,
+      48,    50,    49,    96,    65,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,    92,     2,    99,    62,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    60,    52,    61,    63,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    66,
+      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
+      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
+      87,    88,    89,    90,    91,    93,    94,    95,    97,    98
 };
 
-static const char * const yytname[] = {   "$","error","$undefined.","rwDEFINE",
-"rwENDDEF","rwDECLARE","rwDECLARESINGLETON","rwBREAK","rwELSE","rwCONTINUE",
-"rwGLOBAL","rwIF","rwNIL","rwRETURN","rwWHILE","rwDO","rwENDIF","rwENDWHILE",
-"rwENDFOR","rwDEFAULT","rwFOR","rwFOREACH","rwFOREACHSTR","rwIN","rwDATABLOCK",
-"rwSWITCH","rwCASE","rwSWITCHSTR","rwCASEOR","rwPACKAGE","rwNAMESPACE","rwCLASS",
-"rwASSERT","ILLEGAL_TOKEN","CHRCONST","INTCONST","TTAG","VAR","IDENT","TYPEIDENT",
-"DOCBLOCK","STRATOM","TAGATOM","FLTCONST","'+'","'-'","'*'","'/'","'<'","'>'",
-"'='","'.'","'|'","'&'","'%'","'('","')'","','","':'","';'","'{'","'}'","'^'",
-"'~'","'!'","'@'","opINTNAME","opINTNAMER","opMINUSMINUS","opPLUSPLUS","STMT_SEP",
-"opSHL","opSHR","opPLASN","opMIASN","opMLASN","opDVASN","opMODASN","opANDASN",
-"opXORASN","opORASN","opSLASN","opSRASN","opCAT","opEQ","opNE","opGE","opLE",
-"opAND","opOR","opSTREQ","opCOLONCOLON","'['","opMDASN","opNDASN","opNTASN",
-"'?'","opSTRNE","UNARY","']'","start","decl_list","decl","package_decl","fn_decl_list",
-"statement_list","stmt","fn_decl_stmt","var_list_decl","var_list","datablock_decl",
-"object_decl","parent_block","object_name","object_args","object_declare_block",
-"object_decl_list","stmt_block","switch_stmt","case_block","case_expr","if_stmt",
-"while_stmt","for_stmt","foreach_stmt","expression_stmt","expr","slot_acc","intslot_acc",
-"class_name_expr","assign_op_struct","stmt_expr","funcall_expr","assert_expr",
-"expr_list_decl","expr_list","slot_assign_list_opt","slot_assign_list","slot_assign",
-"aidx_expr",""
+#if YYDEBUG
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_int16 yyrline[] =
+{
+       0,   161,   161,   167,   168,   173,   175,   177,   182,   187,
+     189,   195,   196,   201,   202,   203,   204,   205,   206,   207,
+     209,   211,   213,   215,   217,   219,   221,   226,   228,   234,
+     235,   240,   242,   247,   252,   254,   256,   258,   260,   262,
+     268,   269,   275,   276,   282,   283,   289,   290,   292,   294,
+     299,   301,   306,   308,   313,   315,   320,   322,   324,   329,
+     331,   336,   338,   343,   345,   350,   352,   354,   356,   358,
+     360,   362,   364,   369,   371,   376,   381,   383,   385,   387,
+     389,   391,   393,   395,   397,   399,   401,   403,   405,   407,
+     409,   411,   413,   415,   417,   419,   421,   423,   425,   427,
+     429,   431,   433,   435,   437,   439,   441,   443,   445,   447,
+     449,   451,   453,   455,   457,   479,   481,   486,   488,   493,
+     495,   500,   502,   504,   506,   508,   510,   512,   514,   516,
+     518,   520,   522,   527,   529,   531,   533,   535,   537,   539,
+     541,   543,   545,   550,   552,   554,   564,   566,   572,   573,
+     578,   580,   586,   587,   592,   594,   599,   601,   603,   605,
+     607,   612,   614
 };
 #endif
 
-static const short yyr1[] = {     0,
-   100,   101,   101,   102,   102,   102,   103,   104,   104,   105,
-   105,   106,   106,   106,   106,   106,   106,   106,   106,   106,
-   106,   106,   106,   106,   106,   107,   107,   108,   108,   109,
-   109,   110,   111,   111,   111,   111,   111,   111,   112,   112,
-   113,   113,   114,   114,   115,   115,   115,   115,   116,   116,
-   117,   117,   118,   118,   119,   119,   119,   120,   120,   121,
-   121,   122,   122,   123,   123,   123,   123,   123,   123,   123,
-   123,   124,   124,   125,   126,   126,   126,   126,   126,   126,
-   126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
-   126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
-   126,   126,   126,   126,   126,   126,   126,   126,   126,   126,
-   126,   126,   126,   127,   127,   128,   128,   129,   129,   130,
-   130,   130,   130,   130,   130,   130,   130,   130,   130,   130,
-   130,   131,   131,   131,   131,   131,   131,   131,   131,   131,
-   131,   132,   132,   132,   133,   133,   134,   134,   135,   135,
-   136,   136,   137,   137,   138,   138,   138,   138,   138,   139,
-   139
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "\"end of file\"", "error", "\"invalid token\"", "rwDEFINE", "rwENDDEF",
+  "rwDECLARE", "rwDECLARESINGLETON", "rwBREAK", "rwELSE", "rwCONTINUE",
+  "rwGLOBAL", "rwIF", "rwNIL", "rwRETURN", "rwWHILE", "rwDO", "rwENDIF",
+  "rwENDWHILE", "rwENDFOR", "rwDEFAULT", "rwFOR", "rwFOREACH",
+  "rwFOREACHSTR", "rwIN", "rwDATABLOCK", "rwSWITCH", "rwCASE",
+  "rwSWITCHSTR", "rwCASEOR", "rwPACKAGE", "rwNAMESPACE", "rwCLASS",
+  "rwASSERT", "ILLEGAL_TOKEN", "CHRCONST", "INTCONST", "TTAG", "VAR",
+  "IDENT", "TYPEIDENT", "DOCBLOCK", "STRATOM", "TAGATOM", "FLTCONST",
+  "'+'", "'-'", "'*'", "'/'", "'<'", "'>'", "'='", "'.'", "'|'", "'&'",
+  "'%'", "'('", "')'", "','", "':'", "';'", "'{'", "'}'", "'^'", "'~'",
+  "'!'", "'@'", "opINTNAME", "opINTNAMER", "opMINUSMINUS", "opPLUSPLUS",
+  "STMT_SEP", "opSHL", "opSHR", "opPLASN", "opMIASN", "opMLASN", "opDVASN",
+  "opMODASN", "opANDASN", "opXORASN", "opORASN", "opSLASN", "opSRASN",
+  "opCAT", "opEQ", "opNE", "opGE", "opLE", "opAND", "opOR", "opSTREQ",
+  "opCOLONCOLON", "'['", "opMDASN", "opNDASN", "opNTASN", "'?'", "opSTRNE",
+  "UNARY", "']'", "$accept", "start", "decl_list", "decl", "package_decl",
+  "fn_decl_list", "statement_list", "stmt", "fn_decl_stmt",
+  "var_list_decl", "var_list", "datablock_decl", "object_decl",
+  "parent_block", "object_name", "object_args", "object_declare_block",
+  "object_decl_list", "stmt_block", "switch_stmt", "case_block",
+  "case_expr", "if_stmt", "while_stmt", "for_stmt", "foreach_stmt",
+  "expression_stmt", "expr", "slot_acc", "intslot_acc", "class_name_expr",
+  "assign_op_struct", "stmt_expr", "funcall_expr", "assert_expr",
+  "expr_list_decl", "expr_list", "slot_assign_list_opt",
+  "slot_assign_list", "slot_assign", "aidx_expr", YY_NULLPTR
 };
 
-static const short yyr2[] = {     0,
-     1,     0,     2,     1,     1,     1,     6,     1,     2,     0,
-     2,     1,     1,     1,     1,     1,     1,     2,     2,     2,
-     3,     2,     4,     6,     1,     8,    10,     0,     1,     1,
-     3,    10,    10,     7,    12,     9,    10,     7,     0,     2,
-     0,     1,     0,     2,     0,     1,     1,     2,     2,     3,
-     3,     1,     7,     7,     4,     7,     5,     1,     3,     5,
-     7,     5,     6,     9,     8,     8,     7,     8,     7,     7,
-     6,     7,     7,     1,     1,     3,     3,     3,     3,     3,
-     3,     3,     3,     3,     2,     2,     1,     5,     3,     3,
-     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-     3,     2,     2,     1,     1,     1,     1,     1,     1,     1,
-     1,     1,     4,     3,     6,     3,     3,     1,     3,     1,
-     1,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     1,     1,     1,     3,     6,     2,     5,     2,     3,
-     5,     4,     6,     6,     4,     6,     0,     1,     1,     3,
-     0,     1,     1,     2,     4,     5,     4,     7,     8,     1,
-     3
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}
+#endif
+
+#define YYPACT_NINF (-310)
+
+#define yypact_value_is_default(Yyn) \
+  ((Yyn) == YYPACT_NINF)
+
+#define YYTABLE_NINF (-76)
+
+#define yytable_value_is_error(Yyn) \
+  0
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+static const yytype_int16 yypact[] =
+{
+    -310,    31,   397,  -310,     4,     2,     2,    -3,    32,    27,
+     167,    34,   489,    40,    41,    43,     2,    44,    47,    66,
+      55,  -310,    67,   115,   -33,  -310,  -310,  -310,  -310,  1002,
+    1002,  1002,  1002,  1002,  -310,  -310,  -310,  -310,  -310,  -310,
+    -310,  -310,  -310,  -310,  -310,    59,  2465,  2727,  -310,    71,
+    -310,  -310,   -12,  -310,  1002,    81,    82,  -310,  -310,  1002,
+    -310,  -310,  -310,  1115,  -310,  1002,  -310,  -310,   124,   708,
+     108,   129,    97,  1002,  1002,   107,  1002,  1002,  1002,  -310,
+    -310,  1002,  1002,  1002,  1002,  1002,  1002,  1002,  1002,  1002,
+    1002,  1002,  -310,  1002,   133,   -34,   -34,  1169,   -34,   -34,
+    -310,  1002,  1002,  1002,  1002,  1002,  1002,   137,  1002,  1002,
+    1002,  1002,  1002,     2,     2,  1002,  1002,  1002,  1002,  1002,
+    1002,  1002,  1002,  1002,  1002,  1002,   750,  -310,   141,   143,
+    1223,     9,  1002,  1277,  -310,  1331,   549,   127,   792,  1385,
+     156,   162,  1002,  1439,  1493,   183,  1007,  1061,  2465,  2465,
+    2465,  2465,  2465,  2465,  2465,  2465,  2465,  2465,  2465,  2465,
+     -39,  2465,   131,   149,   159,  -310,   292,   292,   -34,   -34,
+    2722,  2722,   -43,  2606,  2664,   -34,  2635,  2786,  -310,  -310,
+      39,    39,  2693,  2693,  2722,  2722,  2577,  2548,  2786,  1547,
+    2786,  1002,  2465,  -310,   142,   154,   160,  -310,  1002,   158,
+    2465,   158,   489,   489,  -310,  -310,  1002,   319,  1601,   834,
+    1002,  1002,  1655,   157,   161,     5,  -310,  -310,   179,  1002,
+    -310,  1002,  2747,  -310,  1002,  1002,  1002,  1002,  1002,   -31,
+     165,   190,   141,   135,   197,   171,   171,   231,  -310,  1709,
+     489,  1763,   876,   918,  1817,  1871,  1925,   184,   217,   217,
+     187,  -310,   194,  1979,  2465,  1002,  -310,  2465,   199,   200,
+     -38,  2519,  -310,  -310,  -310,   204,   158,  -310,  1002,   205,
+     211,   489,  -310,  -310,   489,   489,  2033,   489,  2087,   960,
+     489,   489,   193,  1002,   207,   210,  -310,  -310,  -310,  2465,
+    -310,  -310,  -310,   594,   214,   171,   149,   216,   222,  -310,
+    -310,  -310,   489,  -310,   489,   489,  2141,  -310,  -310,    70,
+      -5,  2465,  -310,  -310,  -310,  -310,   221,   213,   213,  -310,
+    -310,  -310,   489,   233,   -30,   246,   224,    70,  -310,  1002,
+    -310,   639,   226,   228,   227,    23,   213,   229,  -310,  1002,
+    1002,  1002,   -29,   230,  -310,  2465,   444,  -310,   213,  -310,
+    -310,   235,    23,  -310,  2195,  2249,   -23,  1002,  1002,  -310,
+     237,  -310,   236,  -310,  -310,  -310,   248,  2303,   -19,  -310,
+    -310,  1002,  -310,   249,   684,  2357,  1002,  -310,  2411,  -310
 };
 
-static const short yydefact[] = {     2,
-     1,     0,     0,     0,   107,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,   106,    87,
-   112,   110,    25,   111,   104,   105,     0,     0,     0,     0,
-     0,     3,     6,     4,     5,    16,   134,    17,    12,    13,
-    14,    15,     0,     0,   108,   109,    75,   132,   133,     0,
-   118,     0,     0,     0,    18,    19,     0,   107,    87,    20,
-     0,    75,     0,    10,    52,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,   121,   120,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   137,
-   147,     0,    85,    86,     0,   103,   102,    22,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,   139,    28,     0,     0,    41,    41,
-     0,    21,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   135,   122,   123,   124,   125,
-   126,   127,   128,   129,   130,   131,   160,     0,   149,     0,
-   148,     0,    76,    81,    82,    83,    84,    89,    90,   114,
-    80,    79,    78,    77,   101,   116,   117,    96,    97,    93,
-    94,    91,    92,    98,    95,    99,     0,   100,     0,   140,
-    30,     0,    29,     0,   119,    41,    39,    42,    39,     0,
-     0,    51,    11,     0,     0,     0,     0,     0,     0,    39,
-     0,     0,     0,     8,   145,     0,     0,    23,     0,   113,
-   142,     0,   147,   147,     0,     0,     0,     0,     0,    28,
-     0,     0,    43,    43,    60,    62,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     9,     0,
-     0,   161,     0,   138,   150,     0,     0,     0,    88,   141,
-    10,    31,     0,    39,    40,     0,     0,     0,     0,    63,
-    71,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     7,   146,    24,   136,   143,   144,   115,
-     0,     0,    43,    44,    34,    38,    61,    70,    69,     0,
-    67,     0,     0,     0,    72,    73,   151,     0,    58,    53,
-    54,    26,    10,     0,    45,    45,    68,    66,    65,     0,
-     0,     0,     0,     0,   152,   153,     0,    10,     0,    36,
-     0,     0,    47,    46,     0,    64,     0,     0,     0,     0,
-     0,   154,    59,    55,    27,    45,    49,    33,     0,    48,
-    37,     0,     0,     0,     0,     0,    32,     0,    57,     0,
-    50,   157,   155,     0,     0,     0,    10,    35,     0,   156,
-     0,    56,     0,     0,   158,     0,   159,     0,     0,     0
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE does not specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       3,     0,     2,     1,     0,     0,     0,   108,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   107,    88,   113,   111,    26,   112,   105,   106,     0,
+       0,     0,     0,     0,     4,     7,     5,     6,    17,   135,
+      18,    13,    14,    15,    16,     0,     0,   109,   110,    76,
+     133,   134,     0,   119,     0,     0,     0,    19,    20,     0,
+     108,    88,    21,     0,    76,     0,    11,    53,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   122,
+     121,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   138,   148,     0,    86,    87,     0,   104,   103,
+      23,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   140,    29,     0,
+       0,    42,    42,     0,    22,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   136,   123,
+     124,   125,   126,   127,   128,   129,   130,   131,   132,   161,
+       0,   150,     0,   149,     0,    77,    82,    83,    84,    85,
+      90,    91,   115,    81,    80,    79,    78,   102,   117,   118,
+      97,    98,    94,    95,    92,    93,    99,    96,   100,     0,
+     101,     0,   141,    31,     0,    30,     0,   120,    42,    40,
+      43,    40,     0,     0,    52,    12,     0,     0,     0,     0,
+       0,     0,    40,     0,     0,     0,     9,   146,     0,     0,
+      24,     0,   114,   143,     0,   148,   148,     0,     0,     0,
+       0,     0,    29,     0,     0,    44,    44,    61,    63,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    10,     0,     0,   162,     0,   139,   151,     0,     0,
+       0,    89,   142,    11,    32,     0,    40,    41,     0,     0,
+       0,     0,    64,    72,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     8,   147,    25,   137,
+     144,   145,   116,     0,     0,    44,    45,    35,    39,    62,
+      71,    70,     0,    68,     0,     0,     0,    73,    74,   152,
+       0,    59,    54,    55,    27,    11,     0,    46,    46,    69,
+      67,    66,     0,     0,     0,     0,     0,   153,   154,     0,
+      11,     0,    37,     0,     0,    48,    47,     0,    65,     0,
+       0,     0,     0,     0,   155,    60,    56,    28,    46,    50,
+      34,     0,    49,    38,     0,     0,     0,     0,     0,    33,
+       0,    58,     0,    51,   158,   156,     0,     0,     0,    11,
+      36,     0,   157,     0,    57,     0,     0,   159,     0,   160
 };
 
-static const short yydefgoto[] = {   378,
-     1,    32,    33,   213,   134,    65,    35,   192,   193,    36,
-    37,   233,   197,   267,   332,   333,    66,    38,   282,   308,
-    39,    40,    41,    42,    43,    44,    45,    46,    53,    90,
-    62,    48,    49,   160,   161,   324,   334,   326,   158
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int16 yypgoto[] =
+{
+    -310,  -310,  -310,  -310,  -310,  -310,  -256,    -1,  -140,    64,
+    -310,  -310,   -94,  -188,  -121,  -230,  -309,   -28,    30,  -310,
+    -246,  -310,  -310,  -310,  -310,  -310,  -310,    38,  -310,  -310,
+      19,   -45,    -2,  -310,  -310,  -138,  -187,  -310,     0,  -300,
+    -190
 };
 
-static const short yypact[] = {-32768,
-   396,   -30,    -7,    -7,    -5,    29,   -39,   166,   -29,   488,
-   -26,    37,    40,    -7,    46,    74,    97,    82,-32768,    94,
-   -36,   -28,-32768,-32768,-32768,-32768,  1001,  1001,  1001,  1001,
-  1001,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,    92,  2464,  2726,-32768,   105,-32768,-32768,   -27,
--32768,  1001,   110,   111,-32768,-32768,  1001,-32768,-32768,-32768,
-  1114,-32768,  1001,-32768,-32768,   156,   707,   137,   139,   123,
-  1001,  1001,   120,  1001,  1001,  1001,-32768,-32768,  1001,  1001,
-  1001,  1001,  1001,  1001,  1001,  1001,  1001,  1001,  1001,-32768,
-  1001,   143,    27,    27,  1168,    27,    27,-32768,  1001,  1001,
-  1001,  1001,  1001,  1001,   144,  1001,  1001,  1001,  1001,  1001,
-    -7,    -7,  1001,  1001,  1001,  1001,  1001,  1001,  1001,  1001,
-  1001,  1001,  1001,   749,-32768,   146,   147,  1222,    44,  1001,
-  1276,-32768,  1330,   548,   129,   791,  1384,   163,   167,  1001,
-  1438,  1492,   186,  1006,  1060,  2464,  2464,  2464,  2464,  2464,
-  2464,  2464,  2464,  2464,  2464,  2464,  2464,   -47,  2464,   135,
-   136,   140,-32768,   713,   713,    27,    27,  2721,  2721,   -33,
-  2605,  2663,    27,  2634,  2785,-32768,-32768,   291,   291,  2692,
-  2692,  2721,  2721,  2576,  2547,  2785,  1546,  2785,  1001,  2464,
--32768,   138,   153,   141,-32768,  1001,   134,  2464,   134,   488,
-   488,-32768,-32768,  1001,   318,  1600,   833,  1001,  1001,  1654,
-   154,   155,    14,-32768,-32768,   172,  1001,-32768,  1001,  2746,
--32768,  1001,  1001,  1001,  1001,  1001,    48,   157,   160,   146,
-   117,   185,   169,   169,   216,-32768,  1708,   488,  1762,   875,
-   917,  1816,  1870,  1924,   171,   207,   207,   175,-32768,   180,
-  1978,  2464,  1001,-32768,  2464,   183,   184,   -46,  2518,-32768,
--32768,-32768,   189,   134,-32768,  1001,   193,   194,   488,-32768,
--32768,   488,   488,  2032,   488,  2086,   959,   488,   488,   181,
-  1001,   190,   196,-32768,-32768,-32768,  2464,-32768,-32768,-32768,
-   593,   182,   169,   136,   195,   199,-32768,-32768,-32768,   488,
--32768,   488,   488,  2140,-32768,-32768,    59,    -3,  2464,-32768,
--32768,-32768,-32768,   198,   214,   214,-32768,-32768,-32768,   488,
-   210,   -35,   228,   206,    59,-32768,  1001,-32768,   638,   213,
-   211,   215,    98,   214,   220,-32768,  1001,  1001,  1001,   -32,
-   223,-32768,  2464,   443,-32768,   214,-32768,-32768,   224,    98,
--32768,  2194,  2248,   -38,  1001,  1001,-32768,   217,-32768,   225,
--32768,-32768,-32768,   234,  2302,   -37,-32768,-32768,  1001,-32768,
-   235,   683,  2356,  1001,-32768,  2410,-32768,   287,   288,-32768
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int16 yydefgoto[] =
+{
+       0,     1,     2,    34,    35,   215,   136,    67,    37,   194,
+     195,    38,    39,   235,   199,   269,   334,   335,    68,    40,
+     284,   310,    41,    42,    43,    44,    45,    46,    47,    48,
+      55,    92,    64,    50,    51,   162,   163,   326,   336,   328,
+     160
 };
 
-static const short yypgoto[] = {-32768,
--32768,-32768,-32768,-32768,  -255,     0,  -139,    63,-32768,-32768,
-  -128,  -187,  -125,  -221,  -281,   -45,    31,-32768,  -244,-32768,
--32768,-32768,-32768,-32768,-32768,    39,-32768,-32768,    20,   -43,
-    -1,-32768,-32768,  -107,  -182,-32768,   -13,  -304,  -189
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule whose
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_int16 yytable[] =
+{
+      49,    36,   127,   285,   229,   216,   270,   293,     4,   337,
+      49,   201,   226,   236,     5,     6,    60,   107,   221,   221,
+     340,   357,    93,   329,   247,    56,   224,   344,     5,     6,
+     262,     3,   113,   114,   221,    72,   344,   260,   221,   362,
+      53,    20,    52,   128,    21,    61,    23,    24,    63,   227,
+      26,    27,    28,   330,    29,    30,    57,    54,    94,   331,
+     222,   292,   341,   358,    31,   316,   250,    95,    96,    97,
+      98,    99,    32,    33,   346,   251,   366,   233,   295,   129,
+     373,   296,    59,   101,   102,   103,   104,   258,   259,    65,
+     107,    58,   130,   110,   323,    69,    70,   133,    71,    73,
+     361,   198,    74,   135,    75,   113,   114,   139,   324,   325,
+      76,   143,   144,   374,   146,   147,   148,    77,   100,   149,
+     150,   151,   152,   153,   154,   155,   156,   157,   158,   159,
+     -75,   161,   178,   179,    49,   205,   131,   132,   137,   166,
+     167,   168,   169,   170,   171,   140,   173,   174,   175,   176,
+     177,   356,   142,   180,   181,   182,   183,   184,   185,   186,
+     187,   188,   189,   190,   192,    78,   141,   145,   368,   200,
+     200,   164,     5,     6,    60,   172,   208,   256,   193,   210,
+     212,   196,   206,    79,    80,   211,     4,   223,    81,    82,
+      83,    84,    85,    86,    87,    88,    89,    90,   230,    20,
+      49,    49,    21,    61,    23,    24,   224,    91,    26,    27,
+      28,   231,    29,    30,   225,   232,   234,   248,     5,     6,
+     252,   249,    31,   333,   333,   263,    62,   264,   268,   161,
+      32,    33,   237,   238,   266,   267,   200,   323,    49,   271,
+     282,   351,   333,   283,   239,   241,   286,   244,   245,   246,
+     287,   324,   325,   309,   333,   290,   291,   253,   351,   254,
+     294,   297,   257,   161,   161,   159,   261,   298,   312,    49,
+     273,   313,    49,    49,   315,    49,   317,   332,    49,    49,
+     276,   278,   318,   339,   342,   343,   348,   349,   350,   359,
+     353,    49,   205,   289,   363,   369,   265,   370,   371,   376,
+      49,   299,    49,    49,   300,   301,   161,   303,   352,   327,
+     307,   308,     0,     0,     0,     0,     0,   306,     0,     0,
+      49,   311,     0,     0,     5,     6,    60,     0,     0,    49,
+     205,     0,   319,     0,   320,   321,     0,     0,   103,   104,
+       0,     0,     0,   107,    49,   205,   110,     0,     0,     0,
+       0,    20,   338,     0,    21,    61,    23,    24,   113,   114,
+      26,    27,    28,     0,    29,    30,     0,   345,     0,     0,
+       0,     0,    49,   205,    31,   240,     0,   354,   355,   159,
+       0,     0,    32,    33,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   367,   159,     0,     0,     0,
+       4,     0,     5,     6,     7,     0,     8,     0,     9,   375,
+      10,    11,    12,     0,   378,     0,     0,    13,    14,    15,
+       0,    16,    17,     0,    18,     0,    19,     0,     0,    20,
+       0,     0,    21,    22,    23,    24,     0,    25,    26,    27,
+      28,     0,    29,    30,     0,     0,     0,     0,     0,     5,
+       6,     7,    31,     8,     0,     9,     0,    10,    11,    12,
+      32,    33,     0,   360,    13,    14,    15,     0,    16,    17,
+     283,    18,     0,     0,     0,     0,    20,     0,     0,    21,
+      22,    23,    24,     0,    25,    26,    27,    28,     0,    29,
+      30,     0,     0,     0,     5,     6,     7,     0,     8,    31,
+       9,     0,    10,    11,    12,     0,     0,    32,    33,    13,
+      14,    15,     0,    16,    17,     0,    18,     0,     0,     0,
+       0,    20,     0,     0,    21,    22,    23,    24,     0,    25,
+      26,    27,    28,     0,    29,    30,     0,     0,     0,     0,
+       0,     0,     0,     0,    31,     0,     0,     0,     0,    66,
+       0,     0,    32,    33,     5,     6,     7,     0,     8,     0,
+       9,     0,    10,    11,    12,     0,     0,     0,     0,    13,
+      14,    15,     0,    16,    17,     0,    18,     0,     0,     0,
+       0,    20,     0,     0,    21,    22,    23,    24,     0,    25,
+      26,    27,    28,     0,    29,    30,     0,     0,     0,     5,
+       6,     7,     0,     8,    31,     9,     0,    10,    11,    12,
+     204,     0,    32,    33,    13,    14,    15,     0,    16,    17,
+       0,    18,     0,     0,     0,     0,    20,     0,     0,    21,
+      22,    23,    24,     0,    25,    26,    27,    28,     0,    29,
+      30,     0,     0,     0,     5,     6,     7,     0,     8,    31,
+       9,     0,    10,    11,    12,   314,     0,    32,    33,    13,
+      14,    15,     0,    16,    17,     0,    18,     0,     0,     0,
+       0,    20,     0,     0,    21,    22,    23,    24,     0,    25,
+      26,    27,    28,     0,    29,    30,     0,     0,     0,     5,
+       6,     7,     0,     8,    31,     9,     0,    10,    11,    12,
+     347,     0,    32,    33,    13,    14,    15,     0,    16,    17,
+       0,    18,     0,     5,     6,    60,    20,     0,     0,    21,
+      22,    23,    24,     0,    25,    26,    27,    28,     0,    29,
+      30,     0,     0,     0,     0,     0,     0,     0,     0,    31,
+      20,     0,     0,    21,    61,    23,    24,    32,    33,    26,
+      27,    28,     0,    29,    30,     5,     6,    60,     0,     0,
+       0,     0,     0,    31,     0,     0,     0,   138,     0,     0,
+       0,    32,    33,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    20,     0,     0,    21,    61,    23,    24,     0,
+       0,    26,    27,    28,     0,    29,    30,     5,     6,    60,
+       0,     0,     0,     0,     0,    31,     0,     0,     0,     0,
+     191,     0,     0,    32,    33,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    20,     0,     0,    21,    61,    23,
+      24,     0,     0,    26,    27,    28,     0,    29,    30,     5,
+       6,    60,     0,     0,     0,     0,     0,    31,     0,     0,
+       0,   207,     0,     0,     0,    32,    33,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    20,     0,     0,    21,
+      61,    23,    24,     0,     0,    26,    27,    28,     0,    29,
+      30,     5,     6,    60,     0,     0,     0,     0,     0,    31,
+       0,     0,     0,   243,     0,     0,     0,    32,    33,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,    20,     0,
+       0,    21,    61,    23,    24,     0,     0,    26,    27,    28,
+       0,    29,    30,     5,     6,    60,     0,     0,     0,     0,
+       0,    31,   275,     0,     0,     0,     0,     0,     0,    32,
+      33,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      20,     0,     0,    21,    61,    23,    24,     0,     0,    26,
+      27,    28,     0,    29,    30,     5,     6,    60,     0,     0,
+       0,     0,     0,    31,   277,     0,     0,     0,     0,     0,
+       0,    32,    33,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    20,     0,     0,    21,    61,    23,    24,     0,
+       0,    26,    27,    28,     0,    29,    30,     5,     6,    60,
+       0,     0,     0,     0,     0,    31,   305,     0,     0,     0,
+       0,     0,     0,    32,    33,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    20,     0,     0,    21,    61,    23,
+      24,     0,     0,    26,    27,    28,     0,    29,    30,     0,
+       0,   101,   102,   103,   104,   105,   106,    31,   107,   108,
+     109,   110,     0,   217,   218,    32,    33,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,     0,   219,     0,
+     220,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,     0,     0,     0,   134,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,   165,     0,     0,     0,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   117,   118,   119,   120,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,   125,   101,   102,   103,
+     104,   105,   106,     0,   107,   108,   109,   110,     0,   197,
+       0,     0,     0,     0,     0,   111,     0,     0,   112,   113,
+     114,     0,     0,     0,   115,   116,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   117,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+     125,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,     0,   202,     0,     0,     0,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,   203,     0,     0,
+       0,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,     0,     0,     0,   209,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,   213,     0,     0,     0,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   117,   118,   119,   120,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,   125,   101,   102,   103,
+     104,   105,   106,     0,   107,   108,   109,   110,     0,   214,
+       0,     0,     0,     0,     0,   111,     0,     0,   112,   113,
+     114,     0,     0,     0,   115,   116,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   117,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+     125,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,     0,     0,     0,   228,     0,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,     0,     0,     0,
+     242,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,     0,     0,   234,     0,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,   272,     0,     0,     0,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   117,   118,   119,   120,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,   125,   101,   102,   103,
+     104,   105,   106,     0,   107,   108,   109,   110,     0,   274,
+       0,     0,     0,     0,     0,   111,     0,     0,   112,   113,
+     114,     0,     0,     0,   115,   116,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   117,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+     125,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,     0,     0,     0,     0,   279,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,   280,     0,     0,
+       0,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,   281,     0,     0,     0,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,     0,     0,     0,   288,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   117,   118,   119,   120,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,   125,   101,   102,   103,
+     104,   105,   106,     0,   107,   108,   109,   110,     0,   302,
+       0,     0,     0,     0,     0,   111,     0,     0,   112,   113,
+     114,     0,     0,     0,   115,   116,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   117,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+     125,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,     0,   304,     0,     0,     0,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,   322,     0,     0,
+       0,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,     0,     0,     0,   364,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,     0,     0,     0,   365,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   117,   118,   119,   120,   121,   122,   123,
+       0,     0,     0,     0,     0,   124,   125,   101,   102,   103,
+     104,   105,   106,     0,   107,   108,   109,   110,     0,     0,
+       0,     0,   372,     0,     0,   111,     0,     0,   112,   113,
+     114,     0,     0,     0,   115,   116,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   117,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,     0,     0,   124,
+     125,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,     0,     0,     0,     0,   377,     0,     0,   111,
+       0,     0,   112,   113,   114,     0,     0,     0,   115,   116,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   117,   118,   119,   120,   121,   122,   123,     0,     0,
+       0,     0,     0,   124,   125,   101,   102,   103,   104,   105,
+     106,     0,   107,   108,   109,   110,     0,     0,     0,     0,
+     379,     0,     0,   111,     0,     0,   112,   113,   114,     0,
+       0,     0,   115,   116,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   117,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,     0,   124,   125,   101,
+     102,   103,   104,   105,   106,     0,   107,   108,   109,   110,
+       0,     0,     0,     0,     0,     0,     0,   111,     0,     0,
+     112,   113,   114,     0,     0,     0,   115,   116,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   117,
+     118,   119,   120,   121,   122,   123,     0,     0,     0,     0,
+       0,   124,   125,   101,   102,   103,   104,   105,   106,     0,
+     107,   108,   109,   110,     0,     0,     0,     0,     0,     0,
+       0,   111,     0,     0,   112,   113,   114,     0,     0,     0,
+     115,   116,   101,   102,   103,   104,   105,   106,     0,   107,
+     108,   109,   110,   117,   118,   119,   120,   121,   122,   123,
+     111,     0,     0,   112,   113,   114,   125,     0,     0,   115,
+     116,   101,   102,   103,   104,   105,   106,     0,   107,   108,
+     109,   110,   117,   118,   119,   120,   121,     0,   123,   111,
+       0,     0,   112,   113,   114,   125,     0,     0,   115,   116,
+     101,   102,   103,   104,   105,   106,     0,   107,     0,   109,
+     110,   117,   118,   119,   120,     0,     0,   123,   111,     0,
+       0,   112,   113,   114,   125,     0,     0,   115,   116,   101,
+     102,   103,   104,   105,   106,     0,   107,     0,   109,   110,
+     117,   118,   119,   120,     0,     0,   123,     0,     0,     0,
+     112,   113,   114,   125,     0,     0,   115,   116,   101,   102,
+     103,   104,   105,   106,     0,   107,     0,     0,   110,   117,
+     118,   119,   120,     0,     0,   123,     0,     0,     0,   112,
+     113,   114,   125,     0,     0,   115,   116,   101,   102,   103,
+     104,   105,   106,     0,   107,     0,     0,   110,   117,   118,
+     119,   120,     0,     0,   123,     0,     0,     0,   112,   113,
+     114,   125,     0,     0,   115,   116,   101,   102,   103,   104,
+       0,     0,     0,   107,     0,     0,   110,   126,     0,   119,
+     120,     0,     0,   123,     0,     0,     0,   112,   113,   114,
+     125,     0,     0,   115,   116,    79,    80,   255,     0,     0,
+      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
+       0,     0,   123,     0,     0,    79,    80,     0,     0,   125,
+      81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
+     101,   102,   103,   104,     0,     0,     0,   107,     0,     0,
+     110,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   113,   114,     0,     0,     0,   115,   116
 };
 
+static const yytype_int16 yycheck[] =
+{
+       2,     2,    47,   249,   191,   145,   236,   263,     3,   318,
+      12,   132,    55,   201,     5,     6,     7,    51,    57,    57,
+      50,    50,    55,    28,   212,     6,    57,   327,     5,     6,
+      61,     0,    66,    67,    57,    16,   336,   227,    57,   348,
+      38,    32,    38,    55,    35,    36,    37,    38,    10,    92,
+      41,    42,    43,    58,    45,    46,    59,    55,    91,   315,
+      99,    99,    92,    92,    55,   295,    61,    29,    30,    31,
+      32,    33,    63,    64,   330,   215,    99,   198,   266,    91,
+      99,   268,    55,    44,    45,    46,    47,   225,   226,    55,
+      51,    59,    54,    54,    24,    55,    55,    59,    55,    55,
+     346,    92,    55,    65,    38,    66,    67,    69,    38,    39,
+      55,    73,    74,   369,    76,    77,    78,    50,    59,    81,
+      82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
+      59,    93,   113,   114,   136,   136,    55,    55,    14,   101,
+     102,   103,   104,   105,   106,    37,   108,   109,   110,   111,
+     112,   341,    55,   115,   116,   117,   118,   119,   120,   121,
+     122,   123,   124,   125,   126,    50,    37,    60,   358,   131,
+     132,    38,     5,     6,     7,    38,   138,   222,    37,    23,
+     142,    38,    55,    68,    69,    23,     3,    56,    73,    74,
+      75,    76,    77,    78,    79,    80,    81,    82,    56,    32,
+     202,   203,    35,    36,    37,    38,    57,    92,    41,    42,
+      43,    57,    45,    46,    55,    55,    58,    60,     5,     6,
+      41,    60,    55,   317,   318,    60,    59,    37,    57,   191,
+      63,    64,   202,   203,    99,    38,   198,    24,   240,     8,
+      56,   335,   336,    26,   206,   207,    59,   209,   210,   211,
+      56,    38,    39,    60,   348,    56,    56,   219,   352,   221,
+      56,    56,   224,   225,   226,   227,   228,    56,    61,   271,
+     240,    61,   274,   275,    60,   277,    60,    56,   280,   281,
+     242,   243,    60,    50,    38,    61,    60,    59,    61,    59,
+      61,   293,   293,   255,    59,    58,   232,    61,    50,    50,
+     302,   271,   304,   305,   274,   275,   268,   277,   336,   309,
+     280,   281,    -1,    -1,    -1,    -1,    -1,   279,    -1,    -1,
+     322,   283,    -1,    -1,     5,     6,     7,    -1,    -1,   331,
+     331,    -1,   302,    -1,   304,   305,    -1,    -1,    46,    47,
+      -1,    -1,    -1,    51,   346,   346,    54,    -1,    -1,    -1,
+      -1,    32,   322,    -1,    35,    36,    37,    38,    66,    67,
+      41,    42,    43,    -1,    45,    46,    -1,   329,    -1,    -1,
+      -1,    -1,   374,   374,    55,    56,    -1,   339,   340,   341,
+      -1,    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   357,   358,    -1,    -1,    -1,
+       3,    -1,     5,     6,     7,    -1,     9,    -1,    11,   371,
+      13,    14,    15,    -1,   376,    -1,    -1,    20,    21,    22,
+      -1,    24,    25,    -1,    27,    -1,    29,    -1,    -1,    32,
+      -1,    -1,    35,    36,    37,    38,    -1,    40,    41,    42,
+      43,    -1,    45,    46,    -1,    -1,    -1,    -1,    -1,     5,
+       6,     7,    55,     9,    -1,    11,    -1,    13,    14,    15,
+      63,    64,    -1,    19,    20,    21,    22,    -1,    24,    25,
+      26,    27,    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,
+      36,    37,    38,    -1,    40,    41,    42,    43,    -1,    45,
+      46,    -1,    -1,    -1,     5,     6,     7,    -1,     9,    55,
+      11,    -1,    13,    14,    15,    -1,    -1,    63,    64,    20,
+      21,    22,    -1,    24,    25,    -1,    27,    -1,    -1,    -1,
+      -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,    40,
+      41,    42,    43,    -1,    45,    46,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    55,    -1,    -1,    -1,    -1,    60,
+      -1,    -1,    63,    64,     5,     6,     7,    -1,     9,    -1,
+      11,    -1,    13,    14,    15,    -1,    -1,    -1,    -1,    20,
+      21,    22,    -1,    24,    25,    -1,    27,    -1,    -1,    -1,
+      -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,    40,
+      41,    42,    43,    -1,    45,    46,    -1,    -1,    -1,     5,
+       6,     7,    -1,     9,    55,    11,    -1,    13,    14,    15,
+      61,    -1,    63,    64,    20,    21,    22,    -1,    24,    25,
+      -1,    27,    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,
+      36,    37,    38,    -1,    40,    41,    42,    43,    -1,    45,
+      46,    -1,    -1,    -1,     5,     6,     7,    -1,     9,    55,
+      11,    -1,    13,    14,    15,    61,    -1,    63,    64,    20,
+      21,    22,    -1,    24,    25,    -1,    27,    -1,    -1,    -1,
+      -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,    40,
+      41,    42,    43,    -1,    45,    46,    -1,    -1,    -1,     5,
+       6,     7,    -1,     9,    55,    11,    -1,    13,    14,    15,
+      61,    -1,    63,    64,    20,    21,    22,    -1,    24,    25,
+      -1,    27,    -1,     5,     6,     7,    32,    -1,    -1,    35,
+      36,    37,    38,    -1,    40,    41,    42,    43,    -1,    45,
+      46,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
+      32,    -1,    -1,    35,    36,    37,    38,    63,    64,    41,
+      42,    43,    -1,    45,    46,     5,     6,     7,    -1,    -1,
+      -1,    -1,    -1,    55,    -1,    -1,    -1,    59,    -1,    -1,
+      -1,    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,
+      -1,    41,    42,    43,    -1,    45,    46,     5,     6,     7,
+      -1,    -1,    -1,    -1,    -1,    55,    -1,    -1,    -1,    -1,
+      60,    -1,    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    32,    -1,    -1,    35,    36,    37,
+      38,    -1,    -1,    41,    42,    43,    -1,    45,    46,     5,
+       6,     7,    -1,    -1,    -1,    -1,    -1,    55,    -1,    -1,
+      -1,    59,    -1,    -1,    -1,    63,    64,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,
+      36,    37,    38,    -1,    -1,    41,    42,    43,    -1,    45,
+      46,     5,     6,     7,    -1,    -1,    -1,    -1,    -1,    55,
+      -1,    -1,    -1,    59,    -1,    -1,    -1,    63,    64,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    -1,
+      -1,    35,    36,    37,    38,    -1,    -1,    41,    42,    43,
+      -1,    45,    46,     5,     6,     7,    -1,    -1,    -1,    -1,
+      -1,    55,    56,    -1,    -1,    -1,    -1,    -1,    -1,    63,
+      64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      32,    -1,    -1,    35,    36,    37,    38,    -1,    -1,    41,
+      42,    43,    -1,    45,    46,     5,     6,     7,    -1,    -1,
+      -1,    -1,    -1,    55,    56,    -1,    -1,    -1,    -1,    -1,
+      -1,    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,
+      -1,    41,    42,    43,    -1,    45,    46,     5,     6,     7,
+      -1,    -1,    -1,    -1,    -1,    55,    56,    -1,    -1,    -1,
+      -1,    -1,    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    32,    -1,    -1,    35,    36,    37,
+      38,    -1,    -1,    41,    42,    43,    -1,    45,    46,    -1,
+      -1,    44,    45,    46,    47,    48,    49,    55,    51,    52,
+      53,    54,    -1,    56,    57,    63,    64,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    -1,    57,    -1,
+      59,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
+      -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
+      47,    48,    49,    -1,    51,    52,    53,    54,    -1,    56,
+      -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
+      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
+      87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
+      97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
+      -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
+      -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
+      47,    48,    49,    -1,    51,    52,    53,    54,    -1,    56,
+      -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
+      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
+      87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
+      97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    -1,    -1,    -1,    58,    -1,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    -1,    -1,    -1,
+      59,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    -1,    -1,    58,    -1,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
+      -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
+      47,    48,    49,    -1,    51,    52,    53,    54,    -1,    56,
+      -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
+      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
+      87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
+      97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
+      -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    56,    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    -1,    -1,    -1,    59,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
+      -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
+      47,    48,    49,    -1,    51,    52,    53,    54,    -1,    56,
+      -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
+      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
+      87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
+      97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
+      -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    -1,    -1,    -1,    59,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
+      -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
+      47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
+      -1,    -1,    59,    -1,    -1,    62,    -1,    -1,    65,    66,
+      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
+      87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
+      97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,
+      -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
+      -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
+      49,    -1,    51,    52,    53,    54,    -1,    -1,    -1,    -1,
+      59,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
+      -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
+      89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
+      45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,
+      65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
+      85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
+      -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
+      51,    52,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
+      71,    72,    44,    45,    46,    47,    48,    49,    -1,    51,
+      52,    53,    54,    84,    85,    86,    87,    88,    89,    90,
+      62,    -1,    -1,    65,    66,    67,    97,    -1,    -1,    71,
+      72,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
+      53,    54,    84,    85,    86,    87,    88,    -1,    90,    62,
+      -1,    -1,    65,    66,    67,    97,    -1,    -1,    71,    72,
+      44,    45,    46,    47,    48,    49,    -1,    51,    -1,    53,
+      54,    84,    85,    86,    87,    -1,    -1,    90,    62,    -1,
+      -1,    65,    66,    67,    97,    -1,    -1,    71,    72,    44,
+      45,    46,    47,    48,    49,    -1,    51,    -1,    53,    54,
+      84,    85,    86,    87,    -1,    -1,    90,    -1,    -1,    -1,
+      65,    66,    67,    97,    -1,    -1,    71,    72,    44,    45,
+      46,    47,    48,    49,    -1,    51,    -1,    -1,    54,    84,
+      85,    86,    87,    -1,    -1,    90,    -1,    -1,    -1,    65,
+      66,    67,    97,    -1,    -1,    71,    72,    44,    45,    46,
+      47,    48,    49,    -1,    51,    -1,    -1,    54,    84,    85,
+      86,    87,    -1,    -1,    90,    -1,    -1,    -1,    65,    66,
+      67,    97,    -1,    -1,    71,    72,    44,    45,    46,    47,
+      -1,    -1,    -1,    51,    -1,    -1,    54,    50,    -1,    86,
+      87,    -1,    -1,    90,    -1,    -1,    -1,    65,    66,    67,
+      97,    -1,    -1,    71,    72,    68,    69,    50,    -1,    -1,
+      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
+      -1,    -1,    90,    -1,    -1,    68,    69,    -1,    -1,    97,
+      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
+      44,    45,    46,    47,    -1,    -1,    -1,    51,    -1,    -1,
+      54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    66,    67,    -1,    -1,    -1,    71,    72
+};
 
-#define	YYLAST		2857
-
-
-static const short yytable[] = {    47,
-    34,   125,   283,   214,   199,   291,   227,    50,    47,   219,
-   219,   234,   268,    76,   338,    57,     2,   355,   219,   219,
-   342,   224,   245,    54,   327,    63,    91,   126,    67,   342,
-    51,    77,    78,    70,   335,   258,    79,    80,    81,    82,
-    83,    84,    85,    86,    87,    88,    61,    52,     3,     4,
-    58,   220,   290,    55,   328,    89,   339,   329,   225,   356,
-   364,   371,    92,   127,   360,    93,    94,    95,    96,    97,
-   231,   314,   344,   249,   248,    18,   293,   105,    19,    59,
-    21,    22,   321,   294,    24,    25,    26,    56,    27,    28,
-   128,    68,   111,   112,    69,   131,   322,   323,    29,   359,
-    71,   133,     3,     4,   222,   137,    30,    31,   260,   141,
-   142,   372,   144,   145,   146,   256,   257,   147,   148,   149,
-   150,   151,   152,   153,   154,   155,   156,   157,    72,   159,
-   176,   177,    47,   203,    73,   196,    74,   164,   165,   166,
-   167,   168,   169,    75,   171,   172,   173,   174,   175,   354,
-    98,   178,   179,   180,   181,   182,   183,   184,   185,   186,
-   187,   188,   190,   -74,   129,   130,   366,   198,   198,   135,
-     3,     4,    58,   138,   206,   139,   254,   140,   210,   143,
-   162,   170,   191,   204,   194,   208,   331,   331,     2,   209,
-   221,   232,   222,   228,   223,   230,   262,    18,    47,    47,
-    19,    59,    21,    22,   349,   331,    24,    25,    26,   229,
-    27,    28,   250,   246,   247,   264,   261,   331,     3,     4,
-    29,   349,   265,   269,    60,   266,   280,   159,    30,    31,
-   235,   236,   281,   284,   198,   285,    47,   321,   288,   289,
-   307,   313,   237,   239,   292,   242,   243,   244,   295,   296,
-   310,   322,   323,   330,   315,   251,   311,   252,   316,   337,
-   255,   159,   159,   157,   259,   340,   341,    47,   271,   347,
-    47,    47,   346,    47,   367,   348,    47,    47,   274,   276,
-   351,   357,   361,   369,   374,   368,   379,   380,   350,    47,
-   203,   287,   263,   325,     0,     0,     0,     0,    47,   297,
-    47,    47,   298,   299,   159,   301,     0,     0,   305,   306,
-     0,     0,     0,     0,     0,   304,     0,     0,    47,   309,
-     0,     0,     3,     4,    58,     0,     0,    47,   203,     0,
-   317,     0,   318,   319,    99,   100,   101,   102,     0,     0,
-     0,   105,    47,   203,   108,     0,     0,     0,     0,    18,
-   336,     0,    19,    59,    21,    22,   111,   112,    24,    25,
-    26,     0,    27,    28,     0,   343,     0,     0,     0,     0,
-    47,   203,    29,   238,     0,   352,   353,   157,     0,     0,
-    30,    31,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   365,   157,     0,     0,     0,     2,     0,
-     3,     4,     5,     0,     6,     0,     7,   373,     8,     9,
-    10,     0,   376,     0,     0,    11,    12,    13,     0,    14,
-    15,     0,    16,     0,    17,     0,     0,    18,     0,     0,
-    19,    20,    21,    22,     0,    23,    24,    25,    26,     0,
-    27,    28,     0,     0,     0,     0,     0,     3,     4,     5,
-    29,     6,     0,     7,     0,     8,     9,    10,    30,    31,
-     0,   358,    11,    12,    13,     0,    14,    15,   281,    16,
-     0,     0,     0,     0,    18,     0,     0,    19,    20,    21,
-    22,     0,    23,    24,    25,    26,     0,    27,    28,     0,
-     0,     0,     3,     4,     5,     0,     6,    29,     7,     0,
-     8,     9,    10,     0,     0,    30,    31,    11,    12,    13,
-     0,    14,    15,     0,    16,     0,     0,     0,     0,    18,
-     0,     0,    19,    20,    21,    22,     0,    23,    24,    25,
-    26,     0,    27,    28,     0,     0,     0,     0,     0,     0,
-     0,     0,    29,     0,     0,     0,     0,    64,     0,     0,
-    30,    31,     3,     4,     5,     0,     6,     0,     7,     0,
-     8,     9,    10,     0,     0,     0,     0,    11,    12,    13,
-     0,    14,    15,     0,    16,     0,     0,     0,     0,    18,
-     0,     0,    19,    20,    21,    22,     0,    23,    24,    25,
-    26,     0,    27,    28,     0,     0,     0,     3,     4,     5,
-     0,     6,    29,     7,     0,     8,     9,    10,   202,     0,
-    30,    31,    11,    12,    13,     0,    14,    15,     0,    16,
-     0,     0,     0,     0,    18,     0,     0,    19,    20,    21,
-    22,     0,    23,    24,    25,    26,     0,    27,    28,     0,
-     0,     0,     3,     4,     5,     0,     6,    29,     7,     0,
-     8,     9,    10,   312,     0,    30,    31,    11,    12,    13,
-     0,    14,    15,     0,    16,     0,     0,     0,     0,    18,
-     0,     0,    19,    20,    21,    22,     0,    23,    24,    25,
-    26,     0,    27,    28,     0,     0,     0,     3,     4,     5,
-     0,     6,    29,     7,     0,     8,     9,    10,   345,     0,
-    30,    31,    11,    12,    13,     0,    14,    15,     0,    16,
-     0,     3,     4,    58,    18,     0,     0,    19,    20,    21,
-    22,     0,    23,    24,    25,    26,     0,    27,    28,     0,
-     0,     0,     0,     0,     0,     0,     0,    29,    18,     0,
-     0,    19,    59,    21,    22,    30,    31,    24,    25,    26,
-     0,    27,    28,     3,     4,    58,     0,     0,   101,   102,
-     0,    29,     0,   105,     0,   136,   108,     0,     0,    30,
-    31,     0,     0,     0,     0,     0,     0,     0,   111,   112,
-    18,     0,     0,    19,    59,    21,    22,     0,     0,    24,
-    25,    26,     0,    27,    28,     3,     4,    58,     0,     0,
-     0,     0,     0,    29,     0,     0,     0,     0,   189,     0,
-     0,    30,    31,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,    18,     0,     0,    19,    59,    21,    22,     0,
-     0,    24,    25,    26,     0,    27,    28,     3,     4,    58,
-     0,     0,     0,     0,     0,    29,     0,     0,     0,   205,
-     0,     0,     0,    30,    31,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,    18,     0,     0,    19,    59,    21,
-    22,     0,     0,    24,    25,    26,     0,    27,    28,     3,
-     4,    58,     0,     0,     0,     0,     0,    29,     0,     0,
-     0,   241,     0,     0,     0,    30,    31,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,    18,     0,     0,    19,
-    59,    21,    22,     0,     0,    24,    25,    26,     0,    27,
-    28,     3,     4,    58,     0,     0,     0,     0,     0,    29,
-   273,     0,     0,     0,     0,     0,     0,    30,    31,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,    18,     0,
-     0,    19,    59,    21,    22,     0,     0,    24,    25,    26,
-     0,    27,    28,     3,     4,    58,     0,     0,     0,     0,
-     0,    29,   275,     0,     0,     0,     0,     0,     0,    30,
-    31,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-    18,     0,     0,    19,    59,    21,    22,     0,     0,    24,
-    25,    26,     0,    27,    28,     3,     4,    58,     0,     0,
-     0,     0,     0,    29,   303,     0,     0,     0,     0,     0,
-     0,    30,    31,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,    18,     0,     0,    19,    59,    21,    22,     0,
-     0,    24,    25,    26,     0,    27,    28,     0,     0,    99,
-   100,   101,   102,   103,   104,    29,   105,   106,   107,   108,
-     0,   215,   216,    30,    31,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,     0,   217,     0,   218,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,     0,
-     0,     0,   132,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,   163,     0,     0,     0,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,   115,   116,   117,   118,   119,   120,   121,     0,     0,
-     0,     0,     0,   122,   123,    99,   100,   101,   102,   103,
-   104,     0,   105,   106,   107,   108,     0,   195,     0,     0,
-     0,     0,     0,   109,     0,     0,   110,   111,   112,     0,
-     0,     0,   113,   114,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   115,   116,   117,   118,   119,
-   120,   121,     0,     0,     0,     0,     0,   122,   123,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-     0,   200,     0,     0,     0,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,   201,     0,     0,     0,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,     0,
-     0,     0,   207,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,   211,     0,     0,     0,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,   115,   116,   117,   118,   119,   120,   121,     0,     0,
-     0,     0,     0,   122,   123,    99,   100,   101,   102,   103,
-   104,     0,   105,   106,   107,   108,     0,   212,     0,     0,
-     0,     0,     0,   109,     0,     0,   110,   111,   112,     0,
-     0,     0,   113,   114,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   115,   116,   117,   118,   119,
-   120,   121,     0,     0,     0,     0,     0,   122,   123,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-     0,     0,     0,   226,     0,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,     0,     0,     0,   240,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,     0,
-     0,   232,     0,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,   270,     0,     0,     0,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,   115,   116,   117,   118,   119,   120,   121,     0,     0,
-     0,     0,     0,   122,   123,    99,   100,   101,   102,   103,
-   104,     0,   105,   106,   107,   108,     0,   272,     0,     0,
-     0,     0,     0,   109,     0,     0,   110,   111,   112,     0,
-     0,     0,   113,   114,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   115,   116,   117,   118,   119,
-   120,   121,     0,     0,     0,     0,     0,   122,   123,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-     0,     0,     0,     0,   277,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,   278,     0,     0,     0,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,   279,
-     0,     0,     0,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,     0,     0,     0,   286,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,   115,   116,   117,   118,   119,   120,   121,     0,     0,
-     0,     0,     0,   122,   123,    99,   100,   101,   102,   103,
-   104,     0,   105,   106,   107,   108,     0,   300,     0,     0,
-     0,     0,     0,   109,     0,     0,   110,   111,   112,     0,
-     0,     0,   113,   114,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   115,   116,   117,   118,   119,
-   120,   121,     0,     0,     0,     0,     0,   122,   123,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-     0,   302,     0,     0,     0,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,   320,     0,     0,     0,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,     0,
-     0,     0,   362,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,     0,     0,     0,   363,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,   115,   116,   117,   118,   119,   120,   121,     0,     0,
-     0,     0,     0,   122,   123,    99,   100,   101,   102,   103,
-   104,     0,   105,   106,   107,   108,     0,     0,     0,     0,
-   370,     0,     0,   109,     0,     0,   110,   111,   112,     0,
-     0,     0,   113,   114,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,   115,   116,   117,   118,   119,
-   120,   121,     0,     0,     0,     0,     0,   122,   123,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-     0,     0,     0,     0,   375,     0,     0,   109,     0,     0,
-   110,   111,   112,     0,     0,     0,   113,   114,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-   116,   117,   118,   119,   120,   121,     0,     0,     0,     0,
-     0,   122,   123,    99,   100,   101,   102,   103,   104,     0,
-   105,   106,   107,   108,     0,     0,     0,     0,   377,     0,
-     0,   109,     0,     0,   110,   111,   112,     0,     0,     0,
-   113,   114,     0,     0,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,   115,   116,   117,   118,   119,   120,   121,
-     0,     0,     0,     0,     0,   122,   123,    99,   100,   101,
-   102,   103,   104,     0,   105,   106,   107,   108,     0,     0,
-     0,     0,     0,     0,     0,   109,     0,     0,   110,   111,
-   112,     0,     0,     0,   113,   114,     0,     0,     0,     0,
-     0,     0,     0,     0,     0,     0,     0,   115,   116,   117,
-   118,   119,   120,   121,     0,     0,     0,     0,     0,   122,
-   123,    99,   100,   101,   102,   103,   104,     0,   105,   106,
-   107,   108,     0,     0,     0,     0,     0,     0,     0,   109,
-     0,     0,   110,   111,   112,     0,     0,     0,   113,   114,
-    99,   100,   101,   102,   103,   104,     0,   105,   106,   107,
-   108,   115,   116,   117,   118,   119,   120,   121,   109,     0,
-     0,   110,   111,   112,   123,     0,     0,   113,   114,    99,
-   100,   101,   102,   103,   104,     0,   105,   106,   107,   108,
-   115,   116,   117,   118,   119,     0,   121,   109,     0,     0,
-   110,   111,   112,   123,     0,     0,   113,   114,    99,   100,
-   101,   102,   103,   104,     0,   105,     0,   107,   108,   115,
-   116,   117,   118,     0,     0,   121,   109,     0,     0,   110,
-   111,   112,   123,     0,     0,   113,   114,    99,   100,   101,
-   102,   103,   104,     0,   105,     0,   107,   108,   115,   116,
-   117,   118,     0,     0,   121,     0,     0,     0,   110,   111,
-   112,   123,     0,     0,   113,   114,    99,   100,   101,   102,
-   103,   104,     0,   105,     0,     0,   108,   115,   116,   117,
-   118,     0,     0,   121,     0,     0,     0,   110,   111,   112,
-   123,     0,     0,   113,   114,    99,   100,   101,   102,   103,
-   104,     0,   105,     0,     0,   108,   115,   116,   117,   118,
-     0,     0,   121,     0,     0,     0,   110,   111,   112,   123,
-     0,     0,   113,   114,    99,   100,   101,   102,     0,     0,
-     0,   105,     0,     0,   108,   124,     0,   117,   118,     0,
-     0,   121,     0,     0,     0,   110,   111,   112,   123,     0,
-     0,   113,   114,    77,    78,   253,     0,     0,    79,    80,
-    81,    82,    83,    84,    85,    86,    87,    88,     0,     0,
-   121,     0,     0,    77,    78,     0,     0,   123,    79,    80,
-    81,    82,    83,    84,    85,    86,    87,    88,    99,   100,
-   101,   102,     0,     0,     0,   105,     0,     0,   108,     0,
-     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-   111,   112,     0,     0,     0,   113,   114
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+   state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,   101,   102,     0,     3,     5,     6,     7,     9,    11,
+      13,    14,    15,    20,    21,    22,    24,    25,    27,    29,
+      32,    35,    36,    37,    38,    40,    41,    42,    43,    45,
+      46,    55,    63,    64,   103,   104,   107,   108,   111,   112,
+     119,   122,   123,   124,   125,   126,   127,   128,   129,   132,
+     133,   134,    38,    38,    55,   130,   130,    59,    59,    55,
+       7,    36,    59,   127,   132,    55,    60,   107,   118,    55,
+      55,    55,   130,    55,    55,    38,    55,    50,    50,    68,
+      69,    73,    74,    75,    76,    77,    78,    79,    80,    81,
+      82,    92,   131,    55,    91,   127,   127,   127,   127,   127,
+      59,    44,    45,    46,    47,    48,    49,    51,    52,    53,
+      54,    62,    65,    66,    67,    71,    72,    84,    85,    86,
+      87,    88,    89,    90,    96,    97,    50,   131,    55,    91,
+     127,    55,    55,   127,    59,   127,   106,    14,    59,   127,
+      37,    37,    55,   127,   127,    60,   127,   127,   127,   127,
+     127,   127,   127,   127,   127,   127,   127,   127,   127,   127,
+     140,   127,   135,   136,    38,    56,   127,   127,   127,   127,
+     127,   127,    38,   127,   127,   127,   127,   127,   130,   130,
+     127,   127,   127,   127,   127,   127,   127,   127,   127,   127,
+     127,    60,   127,    37,   109,   110,    38,    56,    92,   114,
+     127,   114,    56,    56,    61,   107,    55,    59,   127,    59,
+      23,    23,   127,    56,    56,   105,   108,    56,    57,    57,
+      59,    57,    99,    56,    57,    55,    55,    92,    58,   136,
+      56,    57,    55,   114,    58,   113,   113,   118,   118,   127,
+      56,   127,    59,    59,   127,   127,   127,   113,    60,    60,
+      61,   108,    41,   127,   127,    50,   131,   127,   135,   135,
+     140,   127,    61,    60,    37,   109,    99,    38,    57,   115,
+     115,     8,    56,   118,    56,    56,   127,    56,   127,    59,
+      56,    56,    56,    26,   120,   120,    59,    56,    59,   127,
+      56,    56,    99,   106,    56,   113,   136,    56,    56,   118,
+     118,   118,    56,   118,    56,    56,   127,   118,   118,    60,
+     121,   127,    61,    61,    61,    60,   115,    60,    60,   118,
+     118,   118,    56,    24,    38,    39,   137,   138,   139,    28,
+      58,   106,    56,   112,   116,   117,   138,   116,   118,    50,
+      50,    92,    38,    61,   139,   127,   106,    61,    60,    59,
+      61,   112,   117,    61,   127,   127,   140,    50,    92,    59,
+      19,   120,   116,    59,    59,    59,    99,   127,   140,    58,
+      61,    50,    59,    99,   106,   127,    50,    59,   127,    59
 };
 
-static const short yycheck[] = {     1,
-     1,    45,   247,   143,   130,   261,   189,    38,    10,    57,
-    57,   199,   234,    50,    50,    55,     3,    50,    57,    57,
-   325,    55,   210,     4,    28,    55,    55,    55,    55,   334,
-    38,    68,    69,    14,   316,   225,    73,    74,    75,    76,
-    77,    78,    79,    80,    81,    82,     8,    55,     5,     6,
-     7,    99,    99,    59,    58,    92,    92,   313,    92,    92,
-    99,    99,    91,    91,   346,    27,    28,    29,    30,    31,
-   196,   293,   328,   213,    61,    32,   264,    51,    35,    36,
-    37,    38,    24,   266,    41,    42,    43,    59,    45,    46,
-    52,    55,    66,    67,    55,    57,    38,    39,    55,   344,
-    55,    63,     5,     6,    57,    67,    63,    64,    61,    71,
-    72,   367,    74,    75,    76,   223,   224,    79,    80,    81,
-    82,    83,    84,    85,    86,    87,    88,    89,    55,    91,
-   111,   112,   134,   134,    38,    92,    55,    99,   100,   101,
-   102,   103,   104,    50,   106,   107,   108,   109,   110,   339,
-    59,   113,   114,   115,   116,   117,   118,   119,   120,   121,
-   122,   123,   124,    59,    55,    55,   356,   129,   130,    14,
-     5,     6,     7,    37,   136,    37,   220,    55,   140,    60,
-    38,    38,    37,    55,    38,    23,   315,   316,     3,    23,
-    56,    58,    57,    56,    55,    55,    37,    32,   200,   201,
-    35,    36,    37,    38,   333,   334,    41,    42,    43,    57,
-    45,    46,    41,    60,    60,    99,    60,   346,     5,     6,
-    55,   350,    38,     8,    59,    57,    56,   189,    63,    64,
-   200,   201,    26,    59,   196,    56,   238,    24,    56,    56,
-    60,    60,   204,   205,    56,   207,   208,   209,    56,    56,
-    61,    38,    39,    56,    60,   217,    61,   219,    60,    50,
-   222,   223,   224,   225,   226,    38,    61,   269,   238,    59,
-   272,   273,    60,   275,    58,    61,   278,   279,   240,   241,
-    61,    59,    59,    50,    50,    61,     0,     0,   334,   291,
-   291,   253,   230,   307,    -1,    -1,    -1,    -1,   300,   269,
-   302,   303,   272,   273,   266,   275,    -1,    -1,   278,   279,
-    -1,    -1,    -1,    -1,    -1,   277,    -1,    -1,   320,   281,
-    -1,    -1,     5,     6,     7,    -1,    -1,   329,   329,    -1,
-   300,    -1,   302,   303,    44,    45,    46,    47,    -1,    -1,
-    -1,    51,   344,   344,    54,    -1,    -1,    -1,    -1,    32,
-   320,    -1,    35,    36,    37,    38,    66,    67,    41,    42,
-    43,    -1,    45,    46,    -1,   327,    -1,    -1,    -1,    -1,
-   372,   372,    55,    56,    -1,   337,   338,   339,    -1,    -1,
-    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,   355,   356,    -1,    -1,    -1,     3,    -1,
-     5,     6,     7,    -1,     9,    -1,    11,   369,    13,    14,
-    15,    -1,   374,    -1,    -1,    20,    21,    22,    -1,    24,
-    25,    -1,    27,    -1,    29,    -1,    -1,    32,    -1,    -1,
-    35,    36,    37,    38,    -1,    40,    41,    42,    43,    -1,
-    45,    46,    -1,    -1,    -1,    -1,    -1,     5,     6,     7,
-    55,     9,    -1,    11,    -1,    13,    14,    15,    63,    64,
-    -1,    19,    20,    21,    22,    -1,    24,    25,    26,    27,
-    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,    36,    37,
-    38,    -1,    40,    41,    42,    43,    -1,    45,    46,    -1,
-    -1,    -1,     5,     6,     7,    -1,     9,    55,    11,    -1,
-    13,    14,    15,    -1,    -1,    63,    64,    20,    21,    22,
-    -1,    24,    25,    -1,    27,    -1,    -1,    -1,    -1,    32,
-    -1,    -1,    35,    36,    37,    38,    -1,    40,    41,    42,
-    43,    -1,    45,    46,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    55,    -1,    -1,    -1,    -1,    60,    -1,    -1,
-    63,    64,     5,     6,     7,    -1,     9,    -1,    11,    -1,
-    13,    14,    15,    -1,    -1,    -1,    -1,    20,    21,    22,
-    -1,    24,    25,    -1,    27,    -1,    -1,    -1,    -1,    32,
-    -1,    -1,    35,    36,    37,    38,    -1,    40,    41,    42,
-    43,    -1,    45,    46,    -1,    -1,    -1,     5,     6,     7,
-    -1,     9,    55,    11,    -1,    13,    14,    15,    61,    -1,
-    63,    64,    20,    21,    22,    -1,    24,    25,    -1,    27,
-    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,    36,    37,
-    38,    -1,    40,    41,    42,    43,    -1,    45,    46,    -1,
-    -1,    -1,     5,     6,     7,    -1,     9,    55,    11,    -1,
-    13,    14,    15,    61,    -1,    63,    64,    20,    21,    22,
-    -1,    24,    25,    -1,    27,    -1,    -1,    -1,    -1,    32,
-    -1,    -1,    35,    36,    37,    38,    -1,    40,    41,    42,
-    43,    -1,    45,    46,    -1,    -1,    -1,     5,     6,     7,
-    -1,     9,    55,    11,    -1,    13,    14,    15,    61,    -1,
-    63,    64,    20,    21,    22,    -1,    24,    25,    -1,    27,
-    -1,     5,     6,     7,    32,    -1,    -1,    35,    36,    37,
-    38,    -1,    40,    41,    42,    43,    -1,    45,    46,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,    32,    -1,
-    -1,    35,    36,    37,    38,    63,    64,    41,    42,    43,
-    -1,    45,    46,     5,     6,     7,    -1,    -1,    46,    47,
-    -1,    55,    -1,    51,    -1,    59,    54,    -1,    -1,    63,
-    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    66,    67,
-    32,    -1,    -1,    35,    36,    37,    38,    -1,    -1,    41,
-    42,    43,    -1,    45,    46,     5,     6,     7,    -1,    -1,
-    -1,    -1,    -1,    55,    -1,    -1,    -1,    -1,    60,    -1,
-    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,
-    -1,    41,    42,    43,    -1,    45,    46,     5,     6,     7,
-    -1,    -1,    -1,    -1,    -1,    55,    -1,    -1,    -1,    59,
-    -1,    -1,    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,    36,    37,
-    38,    -1,    -1,    41,    42,    43,    -1,    45,    46,     5,
-     6,     7,    -1,    -1,    -1,    -1,    -1,    55,    -1,    -1,
-    -1,    59,    -1,    -1,    -1,    63,    64,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    32,    -1,    -1,    35,
-    36,    37,    38,    -1,    -1,    41,    42,    43,    -1,    45,
-    46,     5,     6,     7,    -1,    -1,    -1,    -1,    -1,    55,
-    56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    -1,
-    -1,    35,    36,    37,    38,    -1,    -1,    41,    42,    43,
-    -1,    45,    46,     5,     6,     7,    -1,    -1,    -1,    -1,
-    -1,    55,    56,    -1,    -1,    -1,    -1,    -1,    -1,    63,
-    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    32,    -1,    -1,    35,    36,    37,    38,    -1,    -1,    41,
-    42,    43,    -1,    45,    46,     5,     6,     7,    -1,    -1,
-    -1,    -1,    -1,    55,    56,    -1,    -1,    -1,    -1,    -1,
-    -1,    63,    64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    32,    -1,    -1,    35,    36,    37,    38,    -1,
-    -1,    41,    42,    43,    -1,    45,    46,    -1,    -1,    44,
-    45,    46,    47,    48,    49,    55,    51,    52,    53,    54,
-    -1,    56,    57,    63,    64,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    -1,    57,    -1,    59,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
-    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
-    -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
-    49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
-    -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
-    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
-    89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
-    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
-    -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
-    49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
-    -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
-    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
-    89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    -1,    -1,    -1,    58,    -1,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    -1,    -1,    -1,    59,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
-    -1,    58,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
-    -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
-    49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
-    -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
-    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
-    89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    56,
-    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
-    -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
-    49,    -1,    51,    52,    53,    54,    -1,    56,    -1,    -1,
-    -1,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
-    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
-    89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    -1,    56,    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    56,    -1,    -1,    -1,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
-    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
-    -1,    -1,    -1,    96,    97,    44,    45,    46,    47,    48,
-    49,    -1,    51,    52,    53,    54,    -1,    -1,    -1,    -1,
-    59,    -1,    -1,    62,    -1,    -1,    65,    66,    67,    -1,
-    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    84,    85,    86,    87,    88,
-    89,    90,    -1,    -1,    -1,    -1,    -1,    96,    97,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    -1,    -1,
-    65,    66,    67,    -1,    -1,    -1,    71,    72,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,
-    85,    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,
-    -1,    96,    97,    44,    45,    46,    47,    48,    49,    -1,
-    51,    52,    53,    54,    -1,    -1,    -1,    -1,    59,    -1,
-    -1,    62,    -1,    -1,    65,    66,    67,    -1,    -1,    -1,
-    71,    72,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    84,    85,    86,    87,    88,    89,    90,
-    -1,    -1,    -1,    -1,    -1,    96,    97,    44,    45,    46,
-    47,    48,    49,    -1,    51,    52,    53,    54,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    62,    -1,    -1,    65,    66,
-    67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    84,    85,    86,
-    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    96,
-    97,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
-    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    62,
-    -1,    -1,    65,    66,    67,    -1,    -1,    -1,    71,    72,
-    44,    45,    46,    47,    48,    49,    -1,    51,    52,    53,
-    54,    84,    85,    86,    87,    88,    89,    90,    62,    -1,
-    -1,    65,    66,    67,    97,    -1,    -1,    71,    72,    44,
-    45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
-    84,    85,    86,    87,    88,    -1,    90,    62,    -1,    -1,
-    65,    66,    67,    97,    -1,    -1,    71,    72,    44,    45,
-    46,    47,    48,    49,    -1,    51,    -1,    53,    54,    84,
-    85,    86,    87,    -1,    -1,    90,    62,    -1,    -1,    65,
-    66,    67,    97,    -1,    -1,    71,    72,    44,    45,    46,
-    47,    48,    49,    -1,    51,    -1,    53,    54,    84,    85,
-    86,    87,    -1,    -1,    90,    -1,    -1,    -1,    65,    66,
-    67,    97,    -1,    -1,    71,    72,    44,    45,    46,    47,
-    48,    49,    -1,    51,    -1,    -1,    54,    84,    85,    86,
-    87,    -1,    -1,    90,    -1,    -1,    -1,    65,    66,    67,
-    97,    -1,    -1,    71,    72,    44,    45,    46,    47,    48,
-    49,    -1,    51,    -1,    -1,    54,    84,    85,    86,    87,
-    -1,    -1,    90,    -1,    -1,    -1,    65,    66,    67,    97,
-    -1,    -1,    71,    72,    44,    45,    46,    47,    -1,    -1,
-    -1,    51,    -1,    -1,    54,    50,    -1,    86,    87,    -1,
-    -1,    90,    -1,    -1,    -1,    65,    66,    67,    97,    -1,
-    -1,    71,    72,    68,    69,    50,    -1,    -1,    73,    74,
-    75,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
-    90,    -1,    -1,    68,    69,    -1,    -1,    97,    73,    74,
-    75,    76,    77,    78,    79,    80,    81,    82,    44,    45,
-    46,    47,    -1,    -1,    -1,    51,    -1,    -1,    54,    -1,
-    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-    66,    67,    -1,    -1,    -1,    71,    72
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,   100,   101,   102,   102,   103,   103,   103,   104,   105,
+     105,   106,   106,   107,   107,   107,   107,   107,   107,   107,
+     107,   107,   107,   107,   107,   107,   107,   108,   108,   109,
+     109,   110,   110,   111,   112,   112,   112,   112,   112,   112,
+     113,   113,   114,   114,   115,   115,   116,   116,   116,   116,
+     117,   117,   118,   118,   119,   119,   120,   120,   120,   121,
+     121,   122,   122,   123,   123,   124,   124,   124,   124,   124,
+     124,   124,   124,   125,   125,   126,   127,   127,   127,   127,
+     127,   127,   127,   127,   127,   127,   127,   127,   127,   127,
+     127,   127,   127,   127,   127,   127,   127,   127,   127,   127,
+     127,   127,   127,   127,   127,   127,   127,   127,   127,   127,
+     127,   127,   127,   127,   127,   128,   128,   129,   129,   130,
+     130,   131,   131,   131,   131,   131,   131,   131,   131,   131,
+     131,   131,   131,   132,   132,   132,   132,   132,   132,   132,
+     132,   132,   132,   133,   133,   133,   134,   134,   135,   135,
+     136,   136,   137,   137,   138,   138,   139,   139,   139,   139,
+     139,   140,   140
 };
-/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "bison.simple"
 
-/* Skeleton output parser for bison,
-   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
+static const yytype_int8 yyr2[] =
+{
+       0,     2,     1,     0,     2,     1,     1,     1,     6,     1,
+       2,     0,     2,     1,     1,     1,     1,     1,     1,     2,
+       2,     2,     3,     2,     4,     6,     1,     8,    10,     0,
+       1,     1,     3,    10,    10,     7,    12,     9,    10,     7,
+       0,     2,     0,     1,     0,     2,     0,     1,     1,     2,
+       2,     3,     3,     1,     7,     7,     4,     7,     5,     1,
+       3,     5,     7,     5,     6,     9,     8,     8,     7,     8,
+       7,     7,     6,     7,     7,     1,     1,     3,     3,     3,
+       3,     3,     3,     3,     3,     3,     2,     2,     1,     5,
+       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
+       3,     3,     3,     2,     2,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     4,     3,     6,     3,     3,     1,
+       3,     1,     1,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     1,     1,     1,     3,     6,     2,     5,
+       2,     3,     5,     4,     6,     6,     4,     6,     0,     1,
+       1,     3,     0,     1,     1,     2,     4,     5,     4,     7,
+       8,     1,     3
+};
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+enum { YYENOMEM = -2 };
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+#define YYNOMEM         goto yyexhaustedlab
+
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
-
-/* As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  */
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc.  */
-#endif /* not GNU C.  */
-#endif /* alloca not defined.  */
-
-/* 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.  */
-
-/* Note: there must be only one dollar sign in this file.
-   It is replaced by the list of actions, each action
-   as one case of the switch.  */
-
-#define yyerrok		(yyerrstatus = 0)
-#define yyclearin	(yychar = YYEMPTY)
-#define YYEMPTY		-2
-#define YYEOF		0
-#define YYACCEPT	return(0)
-#define YYABORT 	return(1)
-#define YYERROR		goto yyerrlab1
-/* Like YYERROR except do call yyerror.
-   This remains here temporarily to ease the
-   transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
-#define YYFAIL		goto yyerrlab
 #define YYRECOVERING()  (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do								\
-  if (yychar == YYEMPTY && yylen == 1)				\
-    { yychar = (token), yylval = (value);			\
-      yychar1 = YYTRANSLATE (yychar);				\
-      YYPOPSTACK;						\
-      goto yybackup;						\
-    }								\
-  else								\
-    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
-while (0)
-
-#define YYTERROR	1
-#define YYERRCODE	256
-
-#ifndef YYPURE
-#define YYLEX		yylex()
-#endif
 
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX		yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX		yylex(&yylval, YYLEX_PARAM)
-#else
-#define YYLEX		yylex(&yylval)
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
+
+/* Backward compatibility with an undocumented macro.
+   Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
+
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
+
+
+
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Kind, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  FILE *yyoutput = yyo;
+  YY_USE (yyoutput);
+  if (!yyvaluep)
+    return;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YY_USE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
 
-/* If nonreentrant, generate the variables here */
 
-#ifndef YYPURE
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
 
-int	yychar;			/*  the lookahead symbol		*/
-YYSTYPE	yylval;			/*  the semantic value of the		*/
-				/*  lookahead symbol			*/
+static void
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc;			/*  location data for the lookahead	*/
-				/*  symbol				*/
-#endif
+  yy_symbol_value_print (yyo, yykind, yyvaluep);
+  YYFPRINTF (yyo, ")");
+}
 
-int yynerrs;			/*  number of parse errors so far       */
-#endif  /* not YYPURE */
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
 
-#if YYDEBUG != 0
-int yydebug;			/*  nonzero means print parse trace	*/
-/* Since this is uninitialized, it does not stop multiple parsers
-   from coexisting.  */
-#endif
+static void
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
 
-/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
 
-#ifndef	YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
 
-/*  YYMAXDEPTH is the maximum size the stacks can grow to
-    (effective only if the built-in stack extension method is used).  */
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
 
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
+static void
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+                 int yyrule)
+{
+  int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)]);
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
 #endif
 
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
 #ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
+# define YYMAXDEPTH 10000
 #endif
 
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-int yyparse (void);
-#endif
-
-#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
-#define __yy_memcpy(FROM,TO,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
-#else				/* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
-   in available built-in functions on various systems.  */
-static void
-__yy_memcpy (from, to, count)
-     char *from;
-     char *to;
-     int count;
-{
-  char *f = from;
-  char *t = to;
-  int i = count;
 
-  while (i-- > 0)
-    *t++ = *f++;
-}
 
-#else /* __cplusplus */
 
-/* This is the most reliable way to avoid incompatibilities
-   in available built-in functions on various systems.  */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
 static void
-__yy_memcpy (char *from, char *to, int count)
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
 {
-  char *f = from;
-  char *t = to;
-  int i = count;
-
-  while (i-- > 0)
-    *t++ = *f++;
+  YY_USE (yyvaluep);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YY_USE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
-#endif
-#endif
-
-#line 192 "bison.simple"
 
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
-   into yyparse.  The argument should have type void *.
-   It should actually point to an object.
-   Grammar actions can access the variable by casting it
-   to the proper pointer type.  */
+/* Lookahead token kind.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+/* Number of syntax errors so far.  */
+int yynerrs;
 
-#ifdef YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#else
-#define YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#endif
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
 
 int
-yyparse(YYPARSE_PARAM)
-     YYPARSE_PARAM_DECL
+yyparse (void)
 {
-  int yystate;
-  int yyn;
-  short *yyssp;
-  YYSTYPE *yyvsp;
-  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
-  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
+    yy_state_fast_t yystate = 0;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus = 0;
 
-  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
-  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
 
-  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
-  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize = YYINITDEPTH;
 
-#ifdef YYLSP_NEEDED
-  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
-  YYLTYPE *yyls = yylsa;
-  YYLTYPE *yylsp;
+    /* The state stack: array, bottom, top.  */
+    yy_state_t yyssa[YYINITDEPTH];
+    yy_state_t *yyss = yyssa;
+    yy_state_t *yyssp = yyss;
 
-#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK   (yyvsp--, yyssp--)
-#endif
+    /* The semantic value stack: array, bottom, top.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs = yyvsa;
+    YYSTYPE *yyvsp = yyvs;
 
-  int yystacksize = YYINITDEPTH;
-
-#ifdef YYPURE
-  int yychar;
-  YYSTYPE yylval;
-  int yynerrs;
-#ifdef YYLSP_NEEDED
-  YYLTYPE yylloc;
-#endif
-#endif
+  int yyn;
+  /* The return value of yyparse.  */
+  int yyresult;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
 
-  YYSTYPE yyval;		/*  the variable used to return		*/
-				/*  semantic values from the action	*/
-				/*  routines				*/
 
-  int yylen;
 
-#if YYDEBUG != 0
-  if (yydebug)
-    fprintf(stderr, "Starting parse\n");
-#endif
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY;		/* Cause a token to be read.  */
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
 
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
+  YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yyssp = yyss - 1;
-  yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
-  yylsp = yyls;
-#endif
+  yychar = YYEMPTY; /* Cause a token to be read.  */
 
-/* Push a new state, which is found in  yystate  .  */
-/* In all cases, when you get here, the value and location stacks
-   have just been pushed. so pushing a state here evens the stacks.  */
-yynewstate:
+  goto yysetstate;
 
-  *++yyssp = yystate;
 
-  if (yyssp >= yyss + yystacksize - 1)
+/*------------------------------------------------------------.
+| yynewstate -- push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
+
+  if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    YYNOMEM;
+#else
     {
-      /* Give user a chance to reallocate the stack */
-      /* Use copies of these so that the &'s don't force the real ones into memory. */
-      YYSTYPE *yyvs1 = yyvs;
-      short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
-      YYLTYPE *yyls1 = yyls;
-#endif
-
       /* Get the current used size of the three stacks, in elements.  */
-      int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      /* Each stack pointer address is followed by the size of
-	 the data in use in that stack, in bytes.  */
-#ifdef YYLSP_NEEDED
-      /* This used to be a conditional around just the two extra args,
-	 but that might be undefined if yyoverflow is a macro.  */
-      yyoverflow("parser stack overflow",
-		 &yyss1, size * sizeof (*yyssp),
-		 &yyvs1, size * sizeof (*yyvsp),
-		 &yyls1, size * sizeof (*yylsp),
-		 &yystacksize);
-#else
-      yyoverflow("parser stack overflow",
-		 &yyss1, size * sizeof (*yyssp),
-		 &yyvs1, size * sizeof (*yyvsp),
-		 &yystacksize);
-#endif
-
-      yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
-      yyls = yyls1;
-#endif
-#else /* no yyoverflow */
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+
+# if defined yyoverflow
+      {
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        yy_state_t *yyss1 = yyss;
+        YYSTYPE *yyvs1 = yyvs;
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                    &yystacksize);
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
+# else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
-      if (yystacksize >= YYMAXDEPTH)
-	{
-	  yyerror("parser stack overflow");
-	  return 2;
-	}
+      if (YYMAXDEPTH <= yystacksize)
+        YYNOMEM;
       yystacksize *= 2;
-      if (yystacksize > YYMAXDEPTH)
-	yystacksize = YYMAXDEPTH;
-      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
-      __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
-      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
-      __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
-      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
-      __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + size - 1;
-      yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
-      yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
-      if (yydebug)
-	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
-      if (yyssp >= yyss + yystacksize - 1)
-	YYABORT;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yy_state_t *yyss1 = yyss;
+        union yyalloc *yyptr =
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+        if (! yyptr)
+          YYNOMEM;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
     }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
-#if YYDEBUG != 0
-  if (yydebug)
-    fprintf(stderr, "Entering state %d\n", yystate);
-#endif
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
 
   goto yybackup;
- yybackup:
 
-/* Do appropriate processing given the current state.  */
-/* Read a lookahead token if we need one and don't already have one.  */
-/* yyresume: */
 
-  /* First try to decide what to do without reference to lookahead token.  */
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
 
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yyn == YYFLAG)
+  if (yypact_value_is_default (yyn))
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
 
-  /* yychar is either YYEMPTY or YYEOF
-     or a valid token in external form.  */
-
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
   if (yychar == YYEMPTY)
     {
-#if YYDEBUG != 0
-      if (yydebug)
-	fprintf(stderr, "Reading a token: ");
-#endif
-      yychar = YYLEX;
+      YYDPRINTF ((stderr, "Reading a token\n"));
+      yychar = yylex ();
     }
 
-  /* Convert token to internal form (in yychar1) for indexing tables with */
-
-  if (yychar <= 0)		/* This means end of input. */
+  if (yychar <= YYEOF)
     {
-      yychar1 = 0;
-      yychar = YYEOF;		/* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
-      if (yydebug)
-	fprintf(stderr, "Now at end of input.\n");
-#endif
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else if (yychar == YYerror)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
     }
   else
     {
-      yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
-      if (yydebug)
-	{
-	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
-	  /* Give the individual parser a way to print the precise meaning
-	     of a token, for further debugging info.  */
-#ifdef YYPRINT
-	  YYPRINT (stderr, yychar, yylval);
-#endif
-	  fprintf (stderr, ")\n");
-	}
-#endif
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
     }
 
-  yyn += yychar1;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
     goto yydefault;
-
   yyn = yytable[yyn];
-
-  /* yyn is what to do for this token type in this state.
-     Negative => reduce, -yyn is rule number.
-     Positive => shift, yyn is new state.
-       New state is final state => don't bother to shift,
-       just return success.
-     0, or most negative number => error.  */
-
-  if (yyn < 0)
+  if (yyn <= 0)
     {
-      if (yyn == YYFLAG)
-	goto yyerrlab;
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
-  else if (yyn == 0)
-    goto yyerrlab;
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
 
   /* Shift the lookahead token.  */
-
-#if YYDEBUG != 0
-  if (yydebug)
-    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
-  /* Discard the token being shifted unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
-
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
-  /* count tokens shifted since error; after three, turn off error status.  */
-  if (yyerrstatus) yyerrstatus--;
-
-  yystate = yyn;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
   goto yynewstate;
 
-/* Do the default action for the current state.  */
-yydefault:
 
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
   yyn = yydefact[yystate];
   if (yyn == 0)
     goto yyerrlab;
+  goto yyreduce;
 
-/* Do a reduction.  yyn is the number of a rule to reduce with.  */
+
+/*-----------------------------.
+| yyreduce -- do a reduction.  |
+`-----------------------------*/
 yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
   yylen = yyr2[yyn];
-  if (yylen > 0)
-    yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
-  if (yydebug)
-    {
-      int i;
 
-      fprintf (stderr, "Reducing via rule %d (line %d), ",
-	       yyn, yyrline[yyn]);
+  /* If YYLEN is nonzero, implement the default value of the action:
+     '$$ = $1'.
 
-      /* Print the symbols being reduced, and their result.  */
-      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
-	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
-      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
-    }
-#endif
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
 
 
-  switch (yyn) {
-
-case 1:
-#line 162 "cmdgram.y"
-{ ;
-    break;}
-case 2:
-#line 167 "cmdgram.y"
-{ yyval.stmt = nil; ;
-    break;}
-case 3:
-#line 169 "cmdgram.y"
-{ if(!Script::gStatementList) { Script::gStatementList = yyvsp[0].stmt; } else { Script::gStatementList->append(yyvsp[0].stmt); } ;
-    break;}
-case 4:
-#line 174 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].stmt; ;
-    break;}
-case 5:
-#line 176 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].stmt; ;
-    break;}
-case 6:
-#line 178 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].stmt; ;
-    break;}
-case 7:
-#line 183 "cmdgram.y"
-{ yyval.stmt = yyvsp[-2].stmt; for(StmtNode *walk = (yyvsp[-2].stmt);walk;walk = walk->getNext() ) walk->setPackage(yyvsp[-4].s.value); ;
-    break;}
-case 8:
-#line 188 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].stmt; ;
-    break;}
-case 9:
-#line 190 "cmdgram.y"
-{ yyval.stmt = yyvsp[-1].stmt; (yyvsp[-1].stmt)->append(yyvsp[0].stmt);  ;
-    break;}
-case 10:
-#line 195 "cmdgram.y"
-{ yyval.stmt = nil; ;
-    break;}
-case 11:
-#line 197 "cmdgram.y"
-{ if(!yyvsp[-1].stmt) { yyval.stmt = yyvsp[0].stmt; } else { (yyvsp[-1].stmt)->append(yyvsp[0].stmt); yyval.stmt = yyvsp[-1].stmt; } ;
-    break;}
-case 18:
-#line 208 "cmdgram.y"
-{ yyval.stmt = BreakStmtNode::alloc( yyvsp[-1].i.lineNumber ); ;
-    break;}
-case 19:
-#line 210 "cmdgram.y"
-{ yyval.stmt = ContinueStmtNode::alloc( yyvsp[-1].i.lineNumber ); ;
-    break;}
-case 20:
-#line 212 "cmdgram.y"
-{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-1].i.lineNumber, NULL ); ;
-    break;}
-case 21:
-#line 214 "cmdgram.y"
-{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-2].i.lineNumber, yyvsp[-1].expr ); ;
-    break;}
-case 22:
-#line 216 "cmdgram.y"
-{ yyval.stmt = yyvsp[-1].stmt; ;
-    break;}
-case 23:
-#line 218 "cmdgram.y"
-{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr, NULL ); ;
-    break;}
-case 24:
-#line 220 "cmdgram.y"
-{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[-1].expr ); ;
-    break;}
-case 25:
-#line 222 "cmdgram.y"
-{ yyval.stmt = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false, true ); ;
-    break;}
-case 26:
-#line 227 "cmdgram.y"
-{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-7].i.lineNumber, yyvsp[-6].s.value, NULL, yyvsp[-4].var, yyvsp[-1].stmt ); ;
-    break;}
-case 27:
-#line 229 "cmdgram.y"
-{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-6].s.value, yyvsp[-8].s.value, yyvsp[-4].var, yyvsp[-1].stmt ); ;
-    break;}
-case 28:
-#line 234 "cmdgram.y"
-{ yyval.var = NULL; ;
-    break;}
-case 29:
-#line 236 "cmdgram.y"
-{ yyval.var = yyvsp[0].var; ;
-    break;}
-case 30:
-#line 241 "cmdgram.y"
-{ yyval.var = VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ); ;
-    break;}
-case 31:
-#line 243 "cmdgram.y"
-{ yyval.var = yyvsp[-2].var; ((StmtNode*)(yyvsp[-2].var))->append((StmtNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ) ); ;
-    break;}
-case 32:
-#line 248 "cmdgram.y"
-{ yyval.stmt = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, NULL, yyvsp[-5].s.value, yyvsp[-2].slist, NULL, true, false, false); ;
-    break;}
-case 33:
-#line 253 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, false); ;
-    break;}
-case 34:
-#line 255 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, false); ;
-    break;}
-case 35:
-#line 257 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-11].i.lineNumber, yyvsp[-10].expr, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, true, false); ;
-    break;}
-case 36:
-#line 259 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-8].i.lineNumber, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, true, false); ;
-    break;}
-case 37:
-#line 261 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, true); ;
-    break;}
-case 38:
-#line 263 "cmdgram.y"
-{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, true); ;
-    break;}
-case 39:
-#line 268 "cmdgram.y"
-{ yyval.s.value = NULL; ;
-    break;}
-case 40:
-#line 270 "cmdgram.y"
-{ yyval.s = yyvsp[0].s; ;
-    break;}
-case 41:
-#line 275 "cmdgram.y"
-{ yyval.expr = StrConstNode::alloc( CodeBlock::smCurrentParser->getCurrentLine(), "", false); ;
-    break;}
-case 42:
-#line 277 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 43:
-#line 282 "cmdgram.y"
-{ yyval.expr = NULL; ;
-    break;}
-case 44:
-#line 284 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 45:
-#line 289 "cmdgram.y"
-{ yyval.odcl.slots = NULL; yyval.odcl.decls = NULL; ;
-    break;}
-case 46:
-#line 291 "cmdgram.y"
-{ yyval.odcl.slots = yyvsp[0].slist; yyval.odcl.decls = NULL; ;
-    break;}
-case 47:
-#line 293 "cmdgram.y"
-{ yyval.odcl.slots = NULL; yyval.odcl.decls = yyvsp[0].od; ;
-    break;}
-case 48:
-#line 295 "cmdgram.y"
-{ yyval.odcl.slots = yyvsp[-1].slist; yyval.odcl.decls = yyvsp[0].od; ;
-    break;}
-case 49:
-#line 300 "cmdgram.y"
-{ yyval.od = yyvsp[-1].od; ;
-    break;}
-case 50:
-#line 302 "cmdgram.y"
-{ yyvsp[-2].od->append(yyvsp[-1].od); yyval.od = yyvsp[-2].od; ;
-    break;}
-case 51:
-#line 307 "cmdgram.y"
-{ yyval.stmt = yyvsp[-1].stmt; ;
-    break;}
-case 52:
-#line 309 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].stmt; ;
-    break;}
-case 53:
-#line 314 "cmdgram.y"
-{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, false); ;
-    break;}
-case 54:
-#line 316 "cmdgram.y"
-{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, true); ;
-    break;}
-case 55:
-#line 321 "cmdgram.y"
-{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ;
-    break;}
-case 56:
-#line 323 "cmdgram.y"
-{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].stmt, yyvsp[0].stmt, false); ;
-    break;}
-case 57:
-#line 325 "cmdgram.y"
-{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-4].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].stmt, yyvsp[0].ifnode, true); ;
-    break;}
-case 58:
-#line 330 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr;;
-    break;}
-case 59:
-#line 332 "cmdgram.y"
-{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr=yyvsp[-2].expr; ;
-    break;}
-case 60:
-#line 337 "cmdgram.y"
-{ yyval.stmt = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ;
-    break;}
-case 61:
-#line 339 "cmdgram.y"
-{ yyval.stmt = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt, false); ;
-    break;}
-case 62:
-#line 344 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-4].i.lineNumber, nil, yyvsp[-2].expr, nil, yyvsp[0].stmt, false); ;
-    break;}
-case 63:
-#line 346 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-3].i.lineNumber, nil, yyvsp[-1].expr, nil, yyvsp[-4].stmt, true); ;
-    break;}
-case 64:
-#line 351 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ;
-    break;}
-case 65:
-#line 353 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ;
-    break;}
-case 66:
-#line 355 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ;
-    break;}
-case 67:
-#line 357 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, NULL, NULL, yyvsp[0].stmt, false); ;
-    break;}
-case 68:
-#line 359 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ;
-    break;}
-case 69:
-#line 361 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ;
-    break;}
-case 70:
-#line 363 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ;
-    break;}
-case 71:
-#line 365 "cmdgram.y"
-{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-5].i.lineNumber, NULL, NULL, NULL, yyvsp[0].stmt, false); ;
-    break;}
-case 72:
-#line 370 "cmdgram.y"
-{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, false ); ;
-    break;}
-case 73:
-#line 372 "cmdgram.y"
-{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, true ); ;
-    break;}
-case 74:
-#line 377 "cmdgram.y"
-{ yyval.stmt = yyvsp[0].expr; ;
-    break;}
-case 75:
-#line 382 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 76:
-#line 384 "cmdgram.y"
-{ yyval.expr = yyvsp[-1].expr; ;
-    break;}
-case 77:
-#line 386 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 78:
-#line 388 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 79:
-#line 390 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 80:
-#line 392 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 81:
-#line 394 "cmdgram.y"
-{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 82:
-#line 396 "cmdgram.y"
-{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 83:
-#line 398 "cmdgram.y"
-{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 84:
-#line 400 "cmdgram.y"
-{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 85:
-#line 402 "cmdgram.y"
-{ yyval.expr = FloatUnaryExprNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ;
-    break;}
-case 86:
-#line 404 "cmdgram.y"
-{ yyval.expr = TTagDerefNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[0].expr ); ;
-    break;}
-case 87:
-#line 406 "cmdgram.y"
-{ yyval.expr = TTagExprNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ;
-    break;}
-case 88:
-#line 408 "cmdgram.y"
-{ yyval.expr = ConditionalExprNode::alloc( yyvsp[-4].expr->dbgLineNumber, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 89:
-#line 410 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 90:
-#line 412 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 91:
-#line 414 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 92:
-#line 416 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 93:
-#line 418 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 94:
-#line 420 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 95:
-#line 422 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 96:
-#line 424 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 97:
-#line 426 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 98:
-#line 428 "cmdgram.y"
-{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-case 99:
-#line 430 "cmdgram.y"
-{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, true); ;
-    break;}
-case 100:
-#line 432 "cmdgram.y"
-{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, false); ;
-    break;}
-case 101:
-#line 434 "cmdgram.y"
-{ yyval.expr = StrcatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].i.value); ;
-    break;}
-case 102:
-#line 436 "cmdgram.y"
-{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ;
-    break;}
-case 103:
-#line 438 "cmdgram.y"
-{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ;
-    break;}
-case 104:
-#line 440 "cmdgram.y"
-{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, true); ;
-    break;}
-case 105:
-#line 442 "cmdgram.y"
-{ yyval.expr = FloatNode::alloc( yyvsp[0].f.lineNumber, yyvsp[0].f.value ); ;
-    break;}
-case 106:
-#line 444 "cmdgram.y"
-{ yyval.expr = IntNode::alloc( yyvsp[0].i.lineNumber, yyvsp[0].i.value ); ;
-    break;}
-case 107:
-#line 446 "cmdgram.y"
-{ yyval.expr = ConstantNode::alloc( yyvsp[0].i.lineNumber, StringTable->insert("break")); ;
-    break;}
-case 108:
-#line 448 "cmdgram.y"
-{ yyval.expr = SlotAccessNode::alloc( yyvsp[0].slot.lineNumber, yyvsp[0].slot.object, yyvsp[0].slot.array, yyvsp[0].slot.slotName ); ;
-    break;}
-case 109:
-#line 450 "cmdgram.y"
-{ yyval.expr = InternalSlotAccessNode::alloc( yyvsp[0].intslot.lineNumber, yyvsp[0].intslot.object, yyvsp[0].intslot.slotExpr, yyvsp[0].intslot.recurse); ;
-    break;}
-case 110:
-#line 452 "cmdgram.y"
-{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ;
-    break;}
-case 111:
-#line 454 "cmdgram.y"
-{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false); ;
-    break;}
-case 112:
-#line 456 "cmdgram.y"
-{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ;
-    break;}
-case 113:
-#line 458 "cmdgram.y"
-{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr ); ;
-    break;}
-case 114:
-#line 480 "cmdgram.y"
-{ yyval.slot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.slot.object = yyvsp[-2].expr; yyval.slot.slotName = yyvsp[0].s.value; yyval.slot.array = NULL; ;
-    break;}
-case 115:
-#line 482 "cmdgram.y"
-{ yyval.slot.lineNumber = yyvsp[-5].expr->dbgLineNumber; yyval.slot.object = yyvsp[-5].expr; yyval.slot.slotName = yyvsp[-3].s.value; yyval.slot.array = yyvsp[-1].expr; ;
-    break;}
-case 116:
-#line 487 "cmdgram.y"
-{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = false; ;
-    break;}
-case 117:
-#line 489 "cmdgram.y"
-{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = true; ;
-    break;}
-case 118:
-#line 494 "cmdgram.y"
-{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ;
-    break;}
-case 119:
-#line 496 "cmdgram.y"
-{ yyval.expr = yyvsp[-1].expr; ;
-    break;}
-case 120:
-#line 501 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opPLUSPLUS; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ;
-    break;}
-case 121:
-#line 503 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opMINUSMINUS; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ;
-    break;}
-case 122:
-#line 505 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 123:
-#line 507 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 124:
-#line 509 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '*'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 125:
-#line 511 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '/'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 126:
-#line 513 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '%'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 127:
-#line 515 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '&'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 128:
-#line 517 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '^'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 129:
-#line 519 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '|'; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 130:
-#line 521 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHL; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 131:
-#line 523 "cmdgram.y"
-{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHR; yyval.asn.expr = yyvsp[0].expr; ;
-    break;}
-case 132:
-#line 528 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 133:
-#line 530 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 134:
-#line 532 "cmdgram.y"
-{ yyval.expr = yyvsp[0].od; ;
-    break;}
-case 135:
-#line 534 "cmdgram.y"
-{ yyval.expr = AssignExprNode::alloc( yyvsp[-2].s.lineNumber, yyvsp[-2].s.value, NULL, yyvsp[0].expr); ;
-    break;}
-case 136:
-#line 536 "cmdgram.y"
-{ yyval.expr = AssignExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[0].expr); ;
-    break;}
-case 137:
-#line 538 "cmdgram.y"
-{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-1].s.lineNumber, yyvsp[-1].s.value, NULL, yyvsp[0].asn.expr, yyvsp[0].asn.token); ;
-    break;}
-case 138:
-#line 540 "cmdgram.y"
-{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-4].s.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].asn.expr, yyvsp[0].asn.token); ;
-    break;}
-case 139:
-#line 542 "cmdgram.y"
-{ yyval.expr = SlotAssignOpNode::alloc( yyvsp[-1].slot.lineNumber, yyvsp[-1].slot.object, yyvsp[-1].slot.slotName, yyvsp[-1].slot.array, yyvsp[0].asn.token, yyvsp[0].asn.expr); ;
-    break;}
-case 140:
-#line 544 "cmdgram.y"
-{ yyval.expr = SlotAssignNode::alloc( yyvsp[-2].slot.lineNumber, yyvsp[-2].slot.object, yyvsp[-2].slot.array, yyvsp[-2].slot.slotName, yyvsp[0].expr); ;
-    break;}
-case 141:
-#line 546 "cmdgram.y"
-{ yyval.expr = SlotAssignNode::alloc( yyvsp[-4].slot.lineNumber, yyvsp[-4].slot.object, yyvsp[-4].slot.array, yyvsp[-4].slot.slotName, yyvsp[-1].expr); ;
-    break;}
-case 142:
-#line 551 "cmdgram.y"
-{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, NULL, yyvsp[-1].expr, false); ;
-    break;}
-case 143:
-#line 553 "cmdgram.y"
-{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-3].s.value, yyvsp[-5].s.value, yyvsp[-1].expr, false); ;
-    break;}
-case 144:
-#line 555 "cmdgram.y"
-{ yyvsp[-5].expr->append(yyvsp[-1].expr); yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].expr->dbgLineNumber, yyvsp[-3].s.value, NULL, yyvsp[-5].expr, true); ;
-    break;}
-case 145:
-#line 565 "cmdgram.y"
-{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-1].expr, NULL ); ;
-    break;}
-case 146:
-#line 567 "cmdgram.y"
-{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-5].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].str.value ); ;
-    break;}
-case 147:
-#line 572 "cmdgram.y"
-{ yyval.expr = NULL; ;
-    break;}
-case 148:
-#line 574 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 149:
-#line 579 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 150:
-#line 581 "cmdgram.y"
-{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ;
-    break;}
-case 151:
-#line 586 "cmdgram.y"
-{ yyval.slist = NULL; ;
-    break;}
-case 152:
-#line 588 "cmdgram.y"
-{ yyval.slist = yyvsp[0].slist; ;
-    break;}
-case 153:
-#line 593 "cmdgram.y"
-{ yyval.slist = yyvsp[0].slist; ;
-    break;}
-case 154:
-#line 595 "cmdgram.y"
-{ yyvsp[-1].slist->append(yyvsp[0].slist); yyval.slist = yyvsp[-1].slist; ;
-    break;}
-case 155:
-#line 600 "cmdgram.y"
-{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].s.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr); ;
-    break;}
-case 156:
-#line 602 "cmdgram.y"
-{ yyval.slist = SlotAssignNode::alloc( yyvsp[-4].i.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr, yyvsp[-4].i.value); ;
-    break;}
-case 157:
-#line 604 "cmdgram.y"
-{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].i.lineNumber, NULL, NULL, StringTable->insert("datablock"), yyvsp[-1].expr); ;
-    break;}
-case 158:
-#line 606 "cmdgram.y"
-{ yyval.slist = SlotAssignNode::alloc( yyvsp[-6].s.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr); ;
-    break;}
-case 159:
-#line 608 "cmdgram.y"
-{ yyval.slist = SlotAssignNode::alloc( yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr, yyvsp[-7].i.value); ;
-    break;}
-case 160:
-#line 613 "cmdgram.y"
-{ yyval.expr = yyvsp[0].expr; ;
-    break;}
-case 161:
-#line 615 "cmdgram.y"
-{ yyval.expr = CommaCatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr); ;
-    break;}
-}
-   /* the action file gets copied in in place of this dollarsign */
-#line 487 "bison.simple"
-
-  yyvsp -= yylen;
-  yyssp -= yylen;
-#ifdef YYLSP_NEEDED
-  yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
-  if (yydebug)
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
     {
-      short *ssp1 = yyss - 1;
-      fprintf (stderr, "state stack now");
-      while (ssp1 != yyssp)
-	fprintf (stderr, " %d", *++ssp1);
-      fprintf (stderr, "\n");
+  case 2: /* start: decl_list  */
+#line 162 "CMDgram.y"
+      { }
+#line 2011 "CMDgram.c"
+    break;
+
+  case 3: /* decl_list: %empty  */
+#line 167 "CMDgram.y"
+      { (yyval.stmt) = nil; }
+#line 2017 "CMDgram.c"
+    break;
+
+  case 4: /* decl_list: decl_list decl  */
+#line 169 "CMDgram.y"
+      { if(!Script::gStatementList) { Script::gStatementList = (yyvsp[0].stmt); } else { Script::gStatementList->append((yyvsp[0].stmt)); } }
+#line 2023 "CMDgram.c"
+    break;
+
+  case 5: /* decl: stmt  */
+#line 174 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2029 "CMDgram.c"
+    break;
+
+  case 6: /* decl: fn_decl_stmt  */
+#line 176 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2035 "CMDgram.c"
+    break;
+
+  case 7: /* decl: package_decl  */
+#line 178 "CMDgram.y"
+     { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2041 "CMDgram.c"
+    break;
+
+  case 8: /* package_decl: rwPACKAGE IDENT '{' fn_decl_list '}' ';'  */
+#line 183 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-2].stmt); for(StmtNode *walk = ((yyvsp[-2].stmt));walk;walk = walk->getNext() ) walk->setPackage((yyvsp[-4].s).value); }
+#line 2047 "CMDgram.c"
+    break;
+
+  case 9: /* fn_decl_list: fn_decl_stmt  */
+#line 188 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2053 "CMDgram.c"
+    break;
+
+  case 10: /* fn_decl_list: fn_decl_list fn_decl_stmt  */
+#line 190 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-1].stmt); ((yyvsp[-1].stmt))->append((yyvsp[0].stmt));  }
+#line 2059 "CMDgram.c"
+    break;
+
+  case 11: /* statement_list: %empty  */
+#line 195 "CMDgram.y"
+      { (yyval.stmt) = nil; }
+#line 2065 "CMDgram.c"
+    break;
+
+  case 12: /* statement_list: statement_list stmt  */
+#line 197 "CMDgram.y"
+      { if(!(yyvsp[-1].stmt)) { (yyval.stmt) = (yyvsp[0].stmt); } else { ((yyvsp[-1].stmt))->append((yyvsp[0].stmt)); (yyval.stmt) = (yyvsp[-1].stmt); } }
+#line 2071 "CMDgram.c"
+    break;
+
+  case 19: /* stmt: rwBREAK ';'  */
+#line 208 "CMDgram.y"
+      { (yyval.stmt) = BreakStmtNode::alloc( (yyvsp[-1].i).lineNumber ); }
+#line 2077 "CMDgram.c"
+    break;
+
+  case 20: /* stmt: rwCONTINUE ';'  */
+#line 210 "CMDgram.y"
+      { (yyval.stmt) = ContinueStmtNode::alloc( (yyvsp[-1].i).lineNumber ); }
+#line 2083 "CMDgram.c"
+    break;
+
+  case 21: /* stmt: rwRETURN ';'  */
+#line 212 "CMDgram.y"
+      { (yyval.stmt) = ReturnStmtNode::alloc( (yyvsp[-1].i).lineNumber, NULL ); }
+#line 2089 "CMDgram.c"
+    break;
+
+  case 22: /* stmt: rwRETURN expr ';'  */
+#line 214 "CMDgram.y"
+      { (yyval.stmt) = ReturnStmtNode::alloc( (yyvsp[-2].i).lineNumber, (yyvsp[-1].expr) ); }
+#line 2095 "CMDgram.c"
+    break;
+
+  case 23: /* stmt: expression_stmt ';'  */
+#line 216 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-1].stmt); }
+#line 2101 "CMDgram.c"
+    break;
+
+  case 24: /* stmt: TTAG '=' expr ';'  */
+#line 218 "CMDgram.y"
+      { (yyval.stmt) = TTagSetStmtNode::alloc( (yyvsp[-3].s).lineNumber, (yyvsp[-3].s).value, (yyvsp[-1].expr), NULL ); }
+#line 2107 "CMDgram.c"
+    break;
+
+  case 25: /* stmt: TTAG '=' expr ',' expr ';'  */
+#line 220 "CMDgram.y"
+      { (yyval.stmt) = TTagSetStmtNode::alloc( (yyvsp[-5].s).lineNumber, (yyvsp[-5].s).value, (yyvsp[-3].expr), (yyvsp[-1].expr) ); }
+#line 2113 "CMDgram.c"
+    break;
+
+  case 26: /* stmt: DOCBLOCK  */
+#line 222 "CMDgram.y"
+      { (yyval.stmt) = StrConstNode::alloc( (yyvsp[0].str).lineNumber, (yyvsp[0].str).value, false, true ); }
+#line 2119 "CMDgram.c"
+    break;
+
+  case 27: /* fn_decl_stmt: rwDEFINE IDENT '(' var_list_decl ')' '{' statement_list '}'  */
+#line 227 "CMDgram.y"
+      { (yyval.stmt) = FunctionDeclStmtNode::alloc( (yyvsp[-7].i).lineNumber, (yyvsp[-6].s).value, NULL, (yyvsp[-4].var), (yyvsp[-1].stmt) ); }
+#line 2125 "CMDgram.c"
+    break;
+
+  case 28: /* fn_decl_stmt: rwDEFINE IDENT opCOLONCOLON IDENT '(' var_list_decl ')' '{' statement_list '}'  */
+#line 229 "CMDgram.y"
+     { (yyval.stmt) = FunctionDeclStmtNode::alloc( (yyvsp[-9].i).lineNumber, (yyvsp[-6].s).value, (yyvsp[-8].s).value, (yyvsp[-4].var), (yyvsp[-1].stmt) ); }
+#line 2131 "CMDgram.c"
+    break;
+
+  case 29: /* var_list_decl: %empty  */
+#line 234 "CMDgram.y"
+     { (yyval.var) = NULL; }
+#line 2137 "CMDgram.c"
+    break;
+
+  case 30: /* var_list_decl: var_list  */
+#line 236 "CMDgram.y"
+     { (yyval.var) = (yyvsp[0].var); }
+#line 2143 "CMDgram.c"
+    break;
+
+  case 31: /* var_list: VAR  */
+#line 241 "CMDgram.y"
+      { (yyval.var) = VarNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value, NULL ); }
+#line 2149 "CMDgram.c"
+    break;
+
+  case 32: /* var_list: var_list ',' VAR  */
+#line 243 "CMDgram.y"
+      { (yyval.var) = (yyvsp[-2].var); ((StmtNode*)((yyvsp[-2].var)))->append((StmtNode*)VarNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value, NULL ) ); }
+#line 2155 "CMDgram.c"
+    break;
+
+  case 33: /* datablock_decl: rwDATABLOCK class_name_expr '(' expr parent_block ')' '{' slot_assign_list_opt '}' ';'  */
+#line 248 "CMDgram.y"
+      { (yyval.stmt) = ObjectDeclNode::alloc( (yyvsp[-9].i).lineNumber, (yyvsp[-8].expr), (yyvsp[-6].expr), NULL, (yyvsp[-5].s).value, (yyvsp[-2].slist), NULL, true, false, false); }
+#line 2161 "CMDgram.c"
+    break;
+
+  case 34: /* object_decl: rwDECLARE class_name_expr '(' object_name parent_block object_args ')' '{' object_declare_block '}'  */
+#line 253 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-9].i).lineNumber, (yyvsp[-8].expr), (yyvsp[-6].expr), (yyvsp[-4].expr), (yyvsp[-5].s).value, (yyvsp[-1].odcl).slots, (yyvsp[-1].odcl).decls, false, false, false); }
+#line 2167 "CMDgram.c"
+    break;
+
+  case 35: /* object_decl: rwDECLARE class_name_expr '(' object_name parent_block object_args ')'  */
+#line 255 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-6].i).lineNumber, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr), (yyvsp[-2].s).value, NULL, NULL, false, false, false); }
+#line 2173 "CMDgram.c"
+    break;
+
+  case 36: /* object_decl: rwDECLARE class_name_expr '(' '[' object_name ']' parent_block object_args ')' '{' object_declare_block '}'  */
+#line 257 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-11].i).lineNumber, (yyvsp[-10].expr), (yyvsp[-7].expr), (yyvsp[-4].expr), (yyvsp[-5].s).value, (yyvsp[-1].odcl).slots, (yyvsp[-1].odcl).decls, false, true, false); }
+#line 2179 "CMDgram.c"
+    break;
+
+  case 37: /* object_decl: rwDECLARE class_name_expr '(' '[' object_name ']' parent_block object_args ')'  */
+#line 259 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-8].i).lineNumber, (yyvsp[-7].expr), (yyvsp[-4].expr), (yyvsp[-1].expr), (yyvsp[-2].s).value, NULL, NULL, false, true, false); }
+#line 2185 "CMDgram.c"
+    break;
+
+  case 38: /* object_decl: rwDECLARESINGLETON class_name_expr '(' object_name parent_block object_args ')' '{' object_declare_block '}'  */
+#line 261 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-9].i).lineNumber, (yyvsp[-8].expr), (yyvsp[-6].expr), (yyvsp[-4].expr), (yyvsp[-5].s).value, (yyvsp[-1].odcl).slots, (yyvsp[-1].odcl).decls, false, false, true); }
+#line 2191 "CMDgram.c"
+    break;
+
+  case 39: /* object_decl: rwDECLARESINGLETON class_name_expr '(' object_name parent_block object_args ')'  */
+#line 263 "CMDgram.y"
+      { (yyval.od) = ObjectDeclNode::alloc( (yyvsp[-6].i).lineNumber, (yyvsp[-5].expr), (yyvsp[-3].expr), (yyvsp[-1].expr), (yyvsp[-2].s).value, NULL, NULL, false, false, true); }
+#line 2197 "CMDgram.c"
+    break;
+
+  case 40: /* parent_block: %empty  */
+#line 268 "CMDgram.y"
+      { (yyval.s).value = NULL; }
+#line 2203 "CMDgram.c"
+    break;
+
+  case 41: /* parent_block: ':' IDENT  */
+#line 270 "CMDgram.y"
+      { (yyval.s) = (yyvsp[0].s); }
+#line 2209 "CMDgram.c"
+    break;
+
+  case 42: /* object_name: %empty  */
+#line 275 "CMDgram.y"
+      { (yyval.expr) = StrConstNode::alloc( CodeBlock::smCurrentParser->getCurrentLine(), "", false); }
+#line 2215 "CMDgram.c"
+    break;
+
+  case 43: /* object_name: expr  */
+#line 277 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2221 "CMDgram.c"
+    break;
+
+  case 44: /* object_args: %empty  */
+#line 282 "CMDgram.y"
+      { (yyval.expr) = NULL; }
+#line 2227 "CMDgram.c"
+    break;
+
+  case 45: /* object_args: ',' expr_list  */
+#line 284 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2233 "CMDgram.c"
+    break;
+
+  case 46: /* object_declare_block: %empty  */
+#line 289 "CMDgram.y"
+      { (yyval.odcl).slots = NULL; (yyval.odcl).decls = NULL; }
+#line 2239 "CMDgram.c"
+    break;
+
+  case 47: /* object_declare_block: slot_assign_list  */
+#line 291 "CMDgram.y"
+      { (yyval.odcl).slots = (yyvsp[0].slist); (yyval.odcl).decls = NULL; }
+#line 2245 "CMDgram.c"
+    break;
+
+  case 48: /* object_declare_block: object_decl_list  */
+#line 293 "CMDgram.y"
+      { (yyval.odcl).slots = NULL; (yyval.odcl).decls = (yyvsp[0].od); }
+#line 2251 "CMDgram.c"
+    break;
+
+  case 49: /* object_declare_block: slot_assign_list object_decl_list  */
+#line 295 "CMDgram.y"
+      { (yyval.odcl).slots = (yyvsp[-1].slist); (yyval.odcl).decls = (yyvsp[0].od); }
+#line 2257 "CMDgram.c"
+    break;
+
+  case 50: /* object_decl_list: object_decl ';'  */
+#line 300 "CMDgram.y"
+      { (yyval.od) = (yyvsp[-1].od); }
+#line 2263 "CMDgram.c"
+    break;
+
+  case 51: /* object_decl_list: object_decl_list object_decl ';'  */
+#line 302 "CMDgram.y"
+      { (yyvsp[-2].od)->append((yyvsp[-1].od)); (yyval.od) = (yyvsp[-2].od); }
+#line 2269 "CMDgram.c"
+    break;
+
+  case 52: /* stmt_block: '{' statement_list '}'  */
+#line 307 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-1].stmt); }
+#line 2275 "CMDgram.c"
+    break;
+
+  case 53: /* stmt_block: stmt  */
+#line 309 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[0].stmt); }
+#line 2281 "CMDgram.c"
+    break;
+
+  case 54: /* switch_stmt: rwSWITCH '(' expr ')' '{' case_block '}'  */
+#line 314 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-1].ifnode); (yyvsp[-1].ifnode)->propagateSwitchExpr((yyvsp[-4].expr), false); }
+#line 2287 "CMDgram.c"
+    break;
+
+  case 55: /* switch_stmt: rwSWITCHSTR '(' expr ')' '{' case_block '}'  */
+#line 316 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[-1].ifnode); (yyvsp[-1].ifnode)->propagateSwitchExpr((yyvsp[-4].expr), true); }
+#line 2293 "CMDgram.c"
+    break;
+
+  case 56: /* case_block: rwCASE case_expr ':' statement_list  */
+#line 321 "CMDgram.y"
+      { (yyval.ifnode) = IfStmtNode::alloc( (yyvsp[-3].i).lineNumber, (yyvsp[-2].expr), (yyvsp[0].stmt), NULL, false); }
+#line 2299 "CMDgram.c"
+    break;
+
+  case 57: /* case_block: rwCASE case_expr ':' statement_list rwDEFAULT ':' statement_list  */
+#line 323 "CMDgram.y"
+      { (yyval.ifnode) = IfStmtNode::alloc( (yyvsp[-6].i).lineNumber, (yyvsp[-5].expr), (yyvsp[-3].stmt), (yyvsp[0].stmt), false); }
+#line 2305 "CMDgram.c"
+    break;
+
+  case 58: /* case_block: rwCASE case_expr ':' statement_list case_block  */
+#line 325 "CMDgram.y"
+      { (yyval.ifnode) = IfStmtNode::alloc( (yyvsp[-4].i).lineNumber, (yyvsp[-3].expr), (yyvsp[-1].stmt), (yyvsp[0].ifnode), true); }
+#line 2311 "CMDgram.c"
+    break;
+
+  case 59: /* case_expr: expr  */
+#line 330 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr);}
+#line 2317 "CMDgram.c"
+    break;
+
+  case 60: /* case_expr: case_expr rwCASEOR expr  */
+#line 332 "CMDgram.y"
+      { ((yyvsp[-2].expr))->append((yyvsp[0].expr)); (yyval.expr)=(yyvsp[-2].expr); }
+#line 2323 "CMDgram.c"
+    break;
+
+  case 61: /* if_stmt: rwIF '(' expr ')' stmt_block  */
+#line 337 "CMDgram.y"
+      { (yyval.stmt) = IfStmtNode::alloc((yyvsp[-4].i).lineNumber, (yyvsp[-2].expr), (yyvsp[0].stmt), NULL, false); }
+#line 2329 "CMDgram.c"
+    break;
+
+  case 62: /* if_stmt: rwIF '(' expr ')' stmt_block rwELSE stmt_block  */
+#line 339 "CMDgram.y"
+      { (yyval.stmt) = IfStmtNode::alloc((yyvsp[-6].i).lineNumber, (yyvsp[-4].expr), (yyvsp[-2].stmt), (yyvsp[0].stmt), false); }
+#line 2335 "CMDgram.c"
+    break;
+
+  case 63: /* while_stmt: rwWHILE '(' expr ')' stmt_block  */
+#line 344 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-4].i).lineNumber, nil, (yyvsp[-2].expr), nil, (yyvsp[0].stmt), false); }
+#line 2341 "CMDgram.c"
+    break;
+
+  case 64: /* while_stmt: rwDO stmt_block rwWHILE '(' expr ')'  */
+#line 346 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-3].i).lineNumber, nil, (yyvsp[-1].expr), nil, (yyvsp[-4].stmt), true); }
+#line 2347 "CMDgram.c"
+    break;
+
+  case 65: /* for_stmt: rwFOR '(' expr ';' expr ';' expr ')' stmt_block  */
+#line 351 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-8].i).lineNumber, (yyvsp[-6].expr), (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].stmt), false); }
+#line 2353 "CMDgram.c"
+    break;
+
+  case 66: /* for_stmt: rwFOR '(' expr ';' expr ';' ')' stmt_block  */
+#line 353 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-7].i).lineNumber, (yyvsp[-5].expr), (yyvsp[-3].expr), NULL, (yyvsp[0].stmt), false); }
+#line 2359 "CMDgram.c"
+    break;
+
+  case 67: /* for_stmt: rwFOR '(' expr ';' ';' expr ')' stmt_block  */
+#line 355 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-7].i).lineNumber, (yyvsp[-5].expr), NULL, (yyvsp[-2].expr), (yyvsp[0].stmt), false); }
+#line 2365 "CMDgram.c"
+    break;
+
+  case 68: /* for_stmt: rwFOR '(' expr ';' ';' ')' stmt_block  */
+#line 357 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-6].i).lineNumber, (yyvsp[-4].expr), NULL, NULL, (yyvsp[0].stmt), false); }
+#line 2371 "CMDgram.c"
+    break;
+
+  case 69: /* for_stmt: rwFOR '(' ';' expr ';' expr ')' stmt_block  */
+#line 359 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-7].i).lineNumber, NULL, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].stmt), false); }
+#line 2377 "CMDgram.c"
+    break;
+
+  case 70: /* for_stmt: rwFOR '(' ';' expr ';' ')' stmt_block  */
+#line 361 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-6].i).lineNumber, NULL, (yyvsp[-3].expr), NULL, (yyvsp[0].stmt), false); }
+#line 2383 "CMDgram.c"
+    break;
+
+  case 71: /* for_stmt: rwFOR '(' ';' ';' expr ')' stmt_block  */
+#line 363 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-6].i).lineNumber, NULL, NULL, (yyvsp[-2].expr), (yyvsp[0].stmt), false); }
+#line 2389 "CMDgram.c"
+    break;
+
+  case 72: /* for_stmt: rwFOR '(' ';' ';' ')' stmt_block  */
+#line 365 "CMDgram.y"
+      { (yyval.stmt) = LoopStmtNode::alloc((yyvsp[-5].i).lineNumber, NULL, NULL, NULL, (yyvsp[0].stmt), false); }
+#line 2395 "CMDgram.c"
+    break;
+
+  case 73: /* foreach_stmt: rwFOREACH '(' VAR rwIN expr ')' stmt_block  */
+#line 370 "CMDgram.y"
+      { (yyval.stmt) = IterStmtNode::alloc( (yyvsp[-6].i).lineNumber, (yyvsp[-4].s).value, (yyvsp[-2].expr), (yyvsp[0].stmt), false ); }
+#line 2401 "CMDgram.c"
+    break;
+
+  case 74: /* foreach_stmt: rwFOREACHSTR '(' VAR rwIN expr ')' stmt_block  */
+#line 372 "CMDgram.y"
+      { (yyval.stmt) = IterStmtNode::alloc( (yyvsp[-6].i).lineNumber, (yyvsp[-4].s).value, (yyvsp[-2].expr), (yyvsp[0].stmt), true ); }
+#line 2407 "CMDgram.c"
+    break;
+
+  case 75: /* expression_stmt: stmt_expr  */
+#line 377 "CMDgram.y"
+      { (yyval.stmt) = (yyvsp[0].expr); }
+#line 2413 "CMDgram.c"
+    break;
+
+  case 76: /* expr: stmt_expr  */
+#line 382 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2419 "CMDgram.c"
+    break;
+
+  case 77: /* expr: '(' expr ')'  */
+#line 384 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[-1].expr); }
+#line 2425 "CMDgram.c"
+    break;
+
+  case 78: /* expr: expr '^' expr  */
+#line 386 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2431 "CMDgram.c"
+    break;
+
+  case 79: /* expr: expr '%' expr  */
+#line 388 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2437 "CMDgram.c"
+    break;
+
+  case 80: /* expr: expr '&' expr  */
+#line 390 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2443 "CMDgram.c"
+    break;
+
+  case 81: /* expr: expr '|' expr  */
+#line 392 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2449 "CMDgram.c"
+    break;
+
+  case 82: /* expr: expr '+' expr  */
+#line 394 "CMDgram.y"
+      { (yyval.expr) = FloatBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2455 "CMDgram.c"
+    break;
+
+  case 83: /* expr: expr '-' expr  */
+#line 396 "CMDgram.y"
+      { (yyval.expr) = FloatBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2461 "CMDgram.c"
+    break;
+
+  case 84: /* expr: expr '*' expr  */
+#line 398 "CMDgram.y"
+      { (yyval.expr) = FloatBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2467 "CMDgram.c"
+    break;
+
+  case 85: /* expr: expr '/' expr  */
+#line 400 "CMDgram.y"
+      { (yyval.expr) = FloatBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2473 "CMDgram.c"
+    break;
+
+  case 86: /* expr: '-' expr  */
+#line 402 "CMDgram.y"
+      { (yyval.expr) = FloatUnaryExprNode::alloc( (yyvsp[-1].i).lineNumber, (yyvsp[-1].i).value, (yyvsp[0].expr)); }
+#line 2479 "CMDgram.c"
+    break;
+
+  case 87: /* expr: '*' expr  */
+#line 404 "CMDgram.y"
+      { (yyval.expr) = TTagDerefNode::alloc( (yyvsp[-1].i).lineNumber, (yyvsp[0].expr) ); }
+#line 2485 "CMDgram.c"
+    break;
+
+  case 88: /* expr: TTAG  */
+#line 406 "CMDgram.y"
+      { (yyval.expr) = TTagExprNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value ); }
+#line 2491 "CMDgram.c"
+    break;
+
+  case 89: /* expr: expr '?' expr ':' expr  */
+#line 408 "CMDgram.y"
+      { (yyval.expr) = ConditionalExprNode::alloc( (yyvsp[-4].expr)->dbgLineNumber, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2497 "CMDgram.c"
+    break;
+
+  case 90: /* expr: expr '<' expr  */
+#line 410 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2503 "CMDgram.c"
+    break;
+
+  case 91: /* expr: expr '>' expr  */
+#line 412 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2509 "CMDgram.c"
+    break;
+
+  case 92: /* expr: expr opGE expr  */
+#line 414 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2515 "CMDgram.c"
+    break;
+
+  case 93: /* expr: expr opLE expr  */
+#line 416 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2521 "CMDgram.c"
+    break;
+
+  case 94: /* expr: expr opEQ expr  */
+#line 418 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2527 "CMDgram.c"
+    break;
+
+  case 95: /* expr: expr opNE expr  */
+#line 420 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2533 "CMDgram.c"
+    break;
+
+  case 96: /* expr: expr opOR expr  */
+#line 422 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2539 "CMDgram.c"
+    break;
+
+  case 97: /* expr: expr opSHL expr  */
+#line 424 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2545 "CMDgram.c"
+    break;
+
+  case 98: /* expr: expr opSHR expr  */
+#line 426 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2551 "CMDgram.c"
+    break;
+
+  case 99: /* expr: expr opAND expr  */
+#line 428 "CMDgram.y"
+      { (yyval.expr) = IntBinaryExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-1].i).value, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2557 "CMDgram.c"
+    break;
+
+  case 100: /* expr: expr opSTREQ expr  */
+#line 430 "CMDgram.y"
+      { (yyval.expr) = StreqExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-2].expr), (yyvsp[0].expr), true); }
+#line 2563 "CMDgram.c"
+    break;
+
+  case 101: /* expr: expr opSTRNE expr  */
+#line 432 "CMDgram.y"
+      { (yyval.expr) = StreqExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-2].expr), (yyvsp[0].expr), false); }
+#line 2569 "CMDgram.c"
+    break;
+
+  case 102: /* expr: expr '@' expr  */
+#line 434 "CMDgram.y"
+      { (yyval.expr) = StrcatExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-2].expr), (yyvsp[0].expr), (yyvsp[-1].i).value); }
+#line 2575 "CMDgram.c"
+    break;
+
+  case 103: /* expr: '!' expr  */
+#line 436 "CMDgram.y"
+      { (yyval.expr) = IntUnaryExprNode::alloc((yyvsp[-1].i).lineNumber, (yyvsp[-1].i).value, (yyvsp[0].expr)); }
+#line 2581 "CMDgram.c"
+    break;
+
+  case 104: /* expr: '~' expr  */
+#line 438 "CMDgram.y"
+      { (yyval.expr) = IntUnaryExprNode::alloc((yyvsp[-1].i).lineNumber, (yyvsp[-1].i).value, (yyvsp[0].expr)); }
+#line 2587 "CMDgram.c"
+    break;
+
+  case 105: /* expr: TAGATOM  */
+#line 440 "CMDgram.y"
+      { (yyval.expr) = StrConstNode::alloc( (yyvsp[0].str).lineNumber, (yyvsp[0].str).value, true); }
+#line 2593 "CMDgram.c"
+    break;
+
+  case 106: /* expr: FLTCONST  */
+#line 442 "CMDgram.y"
+      { (yyval.expr) = FloatNode::alloc( (yyvsp[0].f).lineNumber, (yyvsp[0].f).value ); }
+#line 2599 "CMDgram.c"
+    break;
+
+  case 107: /* expr: INTCONST  */
+#line 444 "CMDgram.y"
+      { (yyval.expr) = IntNode::alloc( (yyvsp[0].i).lineNumber, (yyvsp[0].i).value ); }
+#line 2605 "CMDgram.c"
+    break;
+
+  case 108: /* expr: rwBREAK  */
+#line 446 "CMDgram.y"
+      { (yyval.expr) = ConstantNode::alloc( (yyvsp[0].i).lineNumber, StringTable->insert("break")); }
+#line 2611 "CMDgram.c"
+    break;
+
+  case 109: /* expr: slot_acc  */
+#line 448 "CMDgram.y"
+      { (yyval.expr) = SlotAccessNode::alloc( (yyvsp[0].slot).lineNumber, (yyvsp[0].slot).object, (yyvsp[0].slot).array, (yyvsp[0].slot).slotName ); }
+#line 2617 "CMDgram.c"
+    break;
+
+  case 110: /* expr: intslot_acc  */
+#line 450 "CMDgram.y"
+      { (yyval.expr) = InternalSlotAccessNode::alloc( (yyvsp[0].intslot).lineNumber, (yyvsp[0].intslot).object, (yyvsp[0].intslot).slotExpr, (yyvsp[0].intslot).recurse); }
+#line 2623 "CMDgram.c"
+    break;
+
+  case 111: /* expr: IDENT  */
+#line 452 "CMDgram.y"
+      { (yyval.expr) = ConstantNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value ); }
+#line 2629 "CMDgram.c"
+    break;
+
+  case 112: /* expr: STRATOM  */
+#line 454 "CMDgram.y"
+      { (yyval.expr) = StrConstNode::alloc( (yyvsp[0].str).lineNumber, (yyvsp[0].str).value, false); }
+#line 2635 "CMDgram.c"
+    break;
+
+  case 113: /* expr: VAR  */
+#line 456 "CMDgram.y"
+      { (yyval.expr) = (ExprNode*)VarNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value, NULL); }
+#line 2641 "CMDgram.c"
+    break;
+
+  case 114: /* expr: VAR '[' aidx_expr ']'  */
+#line 458 "CMDgram.y"
+      { (yyval.expr) = (ExprNode*)VarNode::alloc( (yyvsp[-3].s).lineNumber, (yyvsp[-3].s).value, (yyvsp[-1].expr) ); }
+#line 2647 "CMDgram.c"
+    break;
+
+  case 115: /* slot_acc: expr '.' IDENT  */
+#line 480 "CMDgram.y"
+      { (yyval.slot).lineNumber = (yyvsp[-2].expr)->dbgLineNumber; (yyval.slot).object = (yyvsp[-2].expr); (yyval.slot).slotName = (yyvsp[0].s).value; (yyval.slot).array = NULL; }
+#line 2653 "CMDgram.c"
+    break;
+
+  case 116: /* slot_acc: expr '.' IDENT '[' aidx_expr ']'  */
+#line 482 "CMDgram.y"
+      { (yyval.slot).lineNumber = (yyvsp[-5].expr)->dbgLineNumber; (yyval.slot).object = (yyvsp[-5].expr); (yyval.slot).slotName = (yyvsp[-3].s).value; (yyval.slot).array = (yyvsp[-1].expr); }
+#line 2659 "CMDgram.c"
+    break;
+
+  case 117: /* intslot_acc: expr opINTNAME class_name_expr  */
+#line 487 "CMDgram.y"
+     { (yyval.intslot).lineNumber = (yyvsp[-2].expr)->dbgLineNumber; (yyval.intslot).object = (yyvsp[-2].expr); (yyval.intslot).slotExpr = (yyvsp[0].expr); (yyval.intslot).recurse = false; }
+#line 2665 "CMDgram.c"
+    break;
+
+  case 118: /* intslot_acc: expr opINTNAMER class_name_expr  */
+#line 489 "CMDgram.y"
+     { (yyval.intslot).lineNumber = (yyvsp[-2].expr)->dbgLineNumber; (yyval.intslot).object = (yyvsp[-2].expr); (yyval.intslot).slotExpr = (yyvsp[0].expr); (yyval.intslot).recurse = true; }
+#line 2671 "CMDgram.c"
+    break;
+
+  case 119: /* class_name_expr: IDENT  */
+#line 494 "CMDgram.y"
+      { (yyval.expr) = ConstantNode::alloc( (yyvsp[0].s).lineNumber, (yyvsp[0].s).value ); }
+#line 2677 "CMDgram.c"
+    break;
+
+  case 120: /* class_name_expr: '(' expr ')'  */
+#line 496 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[-1].expr); }
+#line 2683 "CMDgram.c"
+    break;
+
+  case 121: /* assign_op_struct: opPLUSPLUS  */
+#line 501 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[0].i).lineNumber; (yyval.asn).token = opPLUSPLUS; (yyval.asn).expr = FloatNode::alloc( (yyvsp[0].i).lineNumber, 1 ); }
+#line 2689 "CMDgram.c"
+    break;
+
+  case 122: /* assign_op_struct: opMINUSMINUS  */
+#line 503 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[0].i).lineNumber; (yyval.asn).token = opMINUSMINUS; (yyval.asn).expr = FloatNode::alloc( (yyvsp[0].i).lineNumber, 1 ); }
+#line 2695 "CMDgram.c"
+    break;
+
+  case 123: /* assign_op_struct: opPLASN expr  */
+#line 505 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '+'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2701 "CMDgram.c"
+    break;
+
+  case 124: /* assign_op_struct: opMIASN expr  */
+#line 507 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '-'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2707 "CMDgram.c"
+    break;
+
+  case 125: /* assign_op_struct: opMLASN expr  */
+#line 509 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '*'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2713 "CMDgram.c"
+    break;
+
+  case 126: /* assign_op_struct: opDVASN expr  */
+#line 511 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '/'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2719 "CMDgram.c"
+    break;
+
+  case 127: /* assign_op_struct: opMODASN expr  */
+#line 513 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '%'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2725 "CMDgram.c"
+    break;
+
+  case 128: /* assign_op_struct: opANDASN expr  */
+#line 515 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '&'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2731 "CMDgram.c"
+    break;
+
+  case 129: /* assign_op_struct: opXORASN expr  */
+#line 517 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '^'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2737 "CMDgram.c"
+    break;
+
+  case 130: /* assign_op_struct: opORASN expr  */
+#line 519 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = '|'; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2743 "CMDgram.c"
+    break;
+
+  case 131: /* assign_op_struct: opSLASN expr  */
+#line 521 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = opSHL; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2749 "CMDgram.c"
+    break;
+
+  case 132: /* assign_op_struct: opSRASN expr  */
+#line 523 "CMDgram.y"
+      { (yyval.asn).lineNumber = (yyvsp[-1].i).lineNumber; (yyval.asn).token = opSHR; (yyval.asn).expr = (yyvsp[0].expr); }
+#line 2755 "CMDgram.c"
+    break;
+
+  case 133: /* stmt_expr: funcall_expr  */
+#line 528 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2761 "CMDgram.c"
+    break;
+
+  case 134: /* stmt_expr: assert_expr  */
+#line 530 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2767 "CMDgram.c"
+    break;
+
+  case 135: /* stmt_expr: object_decl  */
+#line 532 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].od); }
+#line 2773 "CMDgram.c"
+    break;
+
+  case 136: /* stmt_expr: VAR '=' expr  */
+#line 534 "CMDgram.y"
+      { (yyval.expr) = AssignExprNode::alloc( (yyvsp[-2].s).lineNumber, (yyvsp[-2].s).value, NULL, (yyvsp[0].expr)); }
+#line 2779 "CMDgram.c"
+    break;
+
+  case 137: /* stmt_expr: VAR '[' aidx_expr ']' '=' expr  */
+#line 536 "CMDgram.y"
+      { (yyval.expr) = AssignExprNode::alloc( (yyvsp[-5].s).lineNumber, (yyvsp[-5].s).value, (yyvsp[-3].expr), (yyvsp[0].expr)); }
+#line 2785 "CMDgram.c"
+    break;
+
+  case 138: /* stmt_expr: VAR assign_op_struct  */
+#line 538 "CMDgram.y"
+      { (yyval.expr) = AssignOpExprNode::alloc( (yyvsp[-1].s).lineNumber, (yyvsp[-1].s).value, NULL, (yyvsp[0].asn).expr, (yyvsp[0].asn).token); }
+#line 2791 "CMDgram.c"
+    break;
+
+  case 139: /* stmt_expr: VAR '[' aidx_expr ']' assign_op_struct  */
+#line 540 "CMDgram.y"
+      { (yyval.expr) = AssignOpExprNode::alloc( (yyvsp[-4].s).lineNumber, (yyvsp[-4].s).value, (yyvsp[-2].expr), (yyvsp[0].asn).expr, (yyvsp[0].asn).token); }
+#line 2797 "CMDgram.c"
+    break;
+
+  case 140: /* stmt_expr: slot_acc assign_op_struct  */
+#line 542 "CMDgram.y"
+      { (yyval.expr) = SlotAssignOpNode::alloc( (yyvsp[-1].slot).lineNumber, (yyvsp[-1].slot).object, (yyvsp[-1].slot).slotName, (yyvsp[-1].slot).array, (yyvsp[0].asn).token, (yyvsp[0].asn).expr); }
+#line 2803 "CMDgram.c"
+    break;
+
+  case 141: /* stmt_expr: slot_acc '=' expr  */
+#line 544 "CMDgram.y"
+      { (yyval.expr) = SlotAssignNode::alloc( (yyvsp[-2].slot).lineNumber, (yyvsp[-2].slot).object, (yyvsp[-2].slot).array, (yyvsp[-2].slot).slotName, (yyvsp[0].expr)); }
+#line 2809 "CMDgram.c"
+    break;
+
+  case 142: /* stmt_expr: slot_acc '=' '{' expr_list '}'  */
+#line 546 "CMDgram.y"
+      { (yyval.expr) = SlotAssignNode::alloc( (yyvsp[-4].slot).lineNumber, (yyvsp[-4].slot).object, (yyvsp[-4].slot).array, (yyvsp[-4].slot).slotName, (yyvsp[-1].expr)); }
+#line 2815 "CMDgram.c"
+    break;
+
+  case 143: /* funcall_expr: IDENT '(' expr_list_decl ')'  */
+#line 551 "CMDgram.y"
+     { (yyval.expr) = FuncCallExprNode::alloc( (yyvsp[-3].s).lineNumber, (yyvsp[-3].s).value, NULL, (yyvsp[-1].expr), false); }
+#line 2821 "CMDgram.c"
+    break;
+
+  case 144: /* funcall_expr: IDENT opCOLONCOLON IDENT '(' expr_list_decl ')'  */
+#line 553 "CMDgram.y"
+     { (yyval.expr) = FuncCallExprNode::alloc( (yyvsp[-5].s).lineNumber, (yyvsp[-3].s).value, (yyvsp[-5].s).value, (yyvsp[-1].expr), false); }
+#line 2827 "CMDgram.c"
+    break;
+
+  case 145: /* funcall_expr: expr '.' IDENT '(' expr_list_decl ')'  */
+#line 555 "CMDgram.y"
+      { (yyvsp[-5].expr)->append((yyvsp[-1].expr)); (yyval.expr) = FuncCallExprNode::alloc( (yyvsp[-5].expr)->dbgLineNumber, (yyvsp[-3].s).value, NULL, (yyvsp[-5].expr), true); }
+#line 2833 "CMDgram.c"
+    break;
+
+  case 146: /* assert_expr: rwASSERT '(' expr ')'  */
+#line 565 "CMDgram.y"
+      { (yyval.expr) = AssertCallExprNode::alloc( (yyvsp[-3].i).lineNumber, (yyvsp[-1].expr), NULL ); }
+#line 2839 "CMDgram.c"
+    break;
+
+  case 147: /* assert_expr: rwASSERT '(' expr ',' STRATOM ')'  */
+#line 567 "CMDgram.y"
+      { (yyval.expr) = AssertCallExprNode::alloc( (yyvsp[-5].i).lineNumber, (yyvsp[-3].expr), (yyvsp[-1].str).value ); }
+#line 2845 "CMDgram.c"
+    break;
+
+  case 148: /* expr_list_decl: %empty  */
+#line 572 "CMDgram.y"
+      { (yyval.expr) = NULL; }
+#line 2851 "CMDgram.c"
+    break;
+
+  case 149: /* expr_list_decl: expr_list  */
+#line 574 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2857 "CMDgram.c"
+    break;
+
+  case 150: /* expr_list: expr  */
+#line 579 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2863 "CMDgram.c"
+    break;
+
+  case 151: /* expr_list: expr_list ',' expr  */
+#line 581 "CMDgram.y"
+      { ((yyvsp[-2].expr))->append((yyvsp[0].expr)); (yyval.expr) = (yyvsp[-2].expr); }
+#line 2869 "CMDgram.c"
+    break;
+
+  case 152: /* slot_assign_list_opt: %empty  */
+#line 586 "CMDgram.y"
+      { (yyval.slist) = NULL; }
+#line 2875 "CMDgram.c"
+    break;
+
+  case 153: /* slot_assign_list_opt: slot_assign_list  */
+#line 588 "CMDgram.y"
+      { (yyval.slist) = (yyvsp[0].slist); }
+#line 2881 "CMDgram.c"
+    break;
+
+  case 154: /* slot_assign_list: slot_assign  */
+#line 593 "CMDgram.y"
+      { (yyval.slist) = (yyvsp[0].slist); }
+#line 2887 "CMDgram.c"
+    break;
+
+  case 155: /* slot_assign_list: slot_assign_list slot_assign  */
+#line 595 "CMDgram.y"
+      { (yyvsp[-1].slist)->append((yyvsp[0].slist)); (yyval.slist) = (yyvsp[-1].slist); }
+#line 2893 "CMDgram.c"
+    break;
+
+  case 156: /* slot_assign: IDENT '=' expr ';'  */
+#line 600 "CMDgram.y"
+      { (yyval.slist) = SlotAssignNode::alloc( (yyvsp[-3].s).lineNumber, NULL, NULL, (yyvsp[-3].s).value, (yyvsp[-1].expr)); }
+#line 2899 "CMDgram.c"
+    break;
+
+  case 157: /* slot_assign: TYPEIDENT IDENT '=' expr ';'  */
+#line 602 "CMDgram.y"
+      { (yyval.slist) = SlotAssignNode::alloc( (yyvsp[-4].i).lineNumber, NULL, NULL, (yyvsp[-3].s).value, (yyvsp[-1].expr), (yyvsp[-4].i).value); }
+#line 2905 "CMDgram.c"
+    break;
+
+  case 158: /* slot_assign: rwDATABLOCK '=' expr ';'  */
+#line 604 "CMDgram.y"
+      { (yyval.slist) = SlotAssignNode::alloc( (yyvsp[-3].i).lineNumber, NULL, NULL, StringTable->insert("datablock"), (yyvsp[-1].expr)); }
+#line 2911 "CMDgram.c"
+    break;
+
+  case 159: /* slot_assign: IDENT '[' aidx_expr ']' '=' expr ';'  */
+#line 606 "CMDgram.y"
+      { (yyval.slist) = SlotAssignNode::alloc( (yyvsp[-6].s).lineNumber, NULL, (yyvsp[-4].expr), (yyvsp[-6].s).value, (yyvsp[-1].expr)); }
+#line 2917 "CMDgram.c"
+    break;
+
+  case 160: /* slot_assign: TYPEIDENT IDENT '[' aidx_expr ']' '=' expr ';'  */
+#line 608 "CMDgram.y"
+      { (yyval.slist) = SlotAssignNode::alloc( (yyvsp[-7].i).lineNumber, NULL, (yyvsp[-4].expr), (yyvsp[-6].s).value, (yyvsp[-1].expr), (yyvsp[-7].i).value); }
+#line 2923 "CMDgram.c"
+    break;
+
+  case 161: /* aidx_expr: expr  */
+#line 613 "CMDgram.y"
+      { (yyval.expr) = (yyvsp[0].expr); }
+#line 2929 "CMDgram.c"
+    break;
+
+  case 162: /* aidx_expr: aidx_expr ',' expr  */
+#line 615 "CMDgram.y"
+      { (yyval.expr) = CommaCatExprNode::alloc( (yyvsp[-2].expr)->dbgLineNumber, (yyvsp[-2].expr), (yyvsp[0].expr)); }
+#line 2935 "CMDgram.c"
+    break;
+
+
+#line 2939 "CMDgram.c"
+
+      default: break;
     }
-#endif
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
 
   *++yyvsp = yyval;
 
-#ifdef YYLSP_NEEDED
-  yylsp++;
-  if (yylen == 0)
-    {
-      yylsp->first_line = yylloc.first_line;
-      yylsp->first_column = yylloc.first_column;
-      yylsp->last_line = (yylsp-1)->last_line;
-      yylsp->last_column = (yylsp-1)->last_column;
-      yylsp->text = 0;
-    }
-  else
-    {
-      yylsp->last_line = (yylsp+yylen-1)->last_line;
-      yylsp->last_column = (yylsp+yylen-1)->last_column;
-    }
-#endif
-
-  /* Now "shift" the result of the reduction.
-     Determine what state that goes to,
-     based on the state we popped back to
-     and the rule number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
-  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTBASE];
+  /* Now 'shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
 
   goto yynewstate;
 
-yyerrlab:   /* here on detecting error */
 
-  if (! yyerrstatus)
-    /* If not already recovering from an error, report this error.  */
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
     {
       ++yynerrs;
+      yyerror (YY_("syntax error"));
+    }
 
-#ifdef YYERROR_VERBOSE
-      yyn = yypact[yystate];
-
-      if (yyn > YYFLAG && yyn < YYLAST)
-	{
-	  int size = 0;
-	  char *msg;
-	  int x, count;
-
-	  count = 0;
-	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
-	  for (x = (yyn < 0 ? -yyn : 0);
-	       x < (sizeof(yytname) / sizeof(char *)); x++)
-	    if (yycheck[x + yyn] == x)
-	      size += strlen(yytname[x]) + 15, count++;
-	  msg = (char *) malloc(size + 15);
-	  if (msg != 0)
-	    {
-	      strcpy(msg, "parse error");
-
-	      if (count < 5)
-		{
-		  count = 0;
-		  for (x = (yyn < 0 ? -yyn : 0);
-		       x < (sizeof(yytname) / sizeof(char *)); x++)
-		    if (yycheck[x + yyn] == x)
-		      {
-			strcat(msg, count == 0 ? ", expecting `" : " or `");
-			strcat(msg, yytname[x]);
-			strcat(msg, "'");
-			count++;
-		      }
-		}
-	      yyerror(msg);
-	      free(msg);
-	    }
-	  else
-	    yyerror ("parse error; also virtual memory exceeded");
-	}
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
+
+      if (yychar <= YYEOF)
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
       else
-#endif /* YYERROR_VERBOSE */
-	yyerror("parse error");
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
+        }
     }
 
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
   goto yyerrlab1;
-yyerrlab1:   /* here on error raised explicitly by an action */
 
-  if (yyerrstatus == 3)
-    {
-      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
 
-      /* return failure if at end of input */
-      if (yychar == YYEOF)
-	YYABORT;
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+  ++yynerrs;
+
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
 
-#if YYDEBUG != 0
-      if (yydebug)
-	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
 
-      yychar = YYEMPTY;
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+
+  /* Pop stack until we find a state that shifts the error token.  */
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+        YYABORT;
+
+
+      yydestruct ("Error: popping",
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
     }
 
-  /* Else will try to reuse lookahead token
-     after shifting the error token.  */
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
-  yyerrstatus = 3;		/* Each real token shifted decrements this */
 
-  goto yyerrhandle;
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
-yyerrdefault:  /* current state does not do anything special for the error token. */
+  yystate = yyn;
+  goto yynewstate;
 
-#if 0
-  /* This is wrong; only states that explicitly want error tokens
-     should shift them.  */
-  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
-  if (yyn) goto yydefault;
-#endif
 
-yyerrpop:   /* pop the current state because it cannot handle the error token */
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturnlab;
 
-  if (yyssp == yyss) YYABORT;
-  yyvsp--;
-  yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
-  yylsp--;
-#endif
 
-#if YYDEBUG != 0
-  if (yydebug)
-    {
-      short *ssp1 = yyss - 1;
-      fprintf (stderr, "Error: state stack now");
-      while (ssp1 != yyssp)
-	fprintf (stderr, " %d", *++ssp1);
-      fprintf (stderr, "\n");
-    }
-#endif
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturnlab;
 
-yyerrhandle:
 
-  yyn = yypact[yystate];
-  if (yyn == YYFLAG)
-    goto yyerrdefault;
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
+`-----------------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturnlab;
 
-  yyn += YYTERROR;
-  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
-    goto yyerrdefault;
 
-  yyn = yytable[yyn];
-  if (yyn < 0)
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return.  |
+`----------------------------------------------------------*/
+yyreturnlab:
+  if (yychar != YYEMPTY)
     {
-      if (yyn == YYFLAG)
-	goto yyerrpop;
-      yyn = -yyn;
-      goto yyreduce;
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+      YYPOPSTACK (1);
     }
-  else if (yyn == 0)
-    goto yyerrpop;
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
+  return yyresult;
+}
 
-#if YYDEBUG != 0
-  if (yydebug)
-    fprintf(stderr, "Shifting error token, ");
-#endif
+#line 617 "CMDgram.y"
 
-  *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
-  *++yylsp = yylloc;
-#endif
 
-  yystate = yyn;
-  goto yynewstate;
-}
-#line 617 "cmdgram.y"

+ 0 - 97
Engine/source/console/torquescript/cmdgram.h

@@ -1,97 +0,0 @@
-#ifndef _CMDGRAM_H_
-#define _CMDGRAM_H_
-
-typedef union {
-   Token< char >           c;
-   Token< int >            i;
-   Token< const char* >    s;
-   Token< char* >          str;
-   Token< double >         f;
-   StmtNode*               stmt;
-   ExprNode*               expr;
-   SlotAssignNode*         slist;
-   VarNode*                var;
-   SlotDecl                slot;
-   InternalSlotDecl        intslot;
-   ObjectBlockDecl         odcl;
-   ObjectDeclNode*         od;
-   AssignDecl              asn;
-   IfStmtNode*             ifnode;
-} YYSTYPE;
-#define	rwDEFINE	258
-#define	rwENDDEF	259
-#define	rwDECLARE	260
-#define	rwDECLARESINGLETON	261
-#define	rwBREAK	262
-#define	rwELSE	263
-#define	rwCONTINUE	264
-#define	rwGLOBAL	265
-#define	rwIF	266
-#define	rwNIL	267
-#define	rwRETURN	268
-#define	rwWHILE	269
-#define	rwDO	270
-#define	rwENDIF	271
-#define	rwENDWHILE	272
-#define	rwENDFOR	273
-#define	rwDEFAULT	274
-#define	rwFOR	275
-#define	rwFOREACH	276
-#define	rwFOREACHSTR	277
-#define	rwIN	278
-#define	rwDATABLOCK	279
-#define	rwSWITCH	280
-#define	rwCASE	281
-#define	rwSWITCHSTR	282
-#define	rwCASEOR	283
-#define	rwPACKAGE	284
-#define	rwNAMESPACE	285
-#define	rwCLASS	286
-#define	rwASSERT	287
-#define	ILLEGAL_TOKEN	288
-#define	CHRCONST	289
-#define	INTCONST	290
-#define	TTAG	291
-#define	VAR	292
-#define	IDENT	293
-#define	TYPEIDENT	294
-#define	DOCBLOCK	295
-#define	STRATOM	296
-#define	TAGATOM	297
-#define	FLTCONST	298
-#define	opINTNAME	299
-#define	opINTNAMER	300
-#define	opMINUSMINUS	301
-#define	opPLUSPLUS	302
-#define	STMT_SEP	303
-#define	opSHL	304
-#define	opSHR	305
-#define	opPLASN	306
-#define	opMIASN	307
-#define	opMLASN	308
-#define	opDVASN	309
-#define	opMODASN	310
-#define	opANDASN	311
-#define	opXORASN	312
-#define	opORASN	313
-#define	opSLASN	314
-#define	opSRASN	315
-#define	opCAT	316
-#define	opEQ	317
-#define	opNE	318
-#define	opGE	319
-#define	opLE	320
-#define	opAND	321
-#define	opOR	322
-#define	opSTREQ	323
-#define	opCOLONCOLON	324
-#define	opMDASN	325
-#define	opNDASN	326
-#define	opNTASN	327
-#define	opSTRNE	328
-#define	UNARY	329
-
-
-extern YYSTYPE CMDlval;
-
-#endif

+ 3 - 0
Engine/source/console/torquescript/generateCompiler.bat

@@ -0,0 +1,3 @@
+
+call bison.bat CMD CMDgram.c CMDgram.y . CMDgram.cpp
+..\..\..\bin\bison-flex\win_flex -PCMD -oCMDscan.cpp CMDscan.l

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác