// Generated by Bisonc++ V4.13.00 on Wed, 14 Oct 2015 13:59:55 +0200

// $insert class.ih
#include "parser.ih"

// The FIRST element of SR arrays shown below uses `d_type', defining the
// state's type, and `d_lastIdx' containing the last element's index. If
// d_lastIdx contains the REQ_TOKEN bitflag (see below) then the state needs
// a token: if in this state d_token__ is _UNDETERMINED_, nextToken() will be
// called

// The LAST element of SR arrays uses `d_token' containing the last retrieved
// token to speed up the (linear) seach.  Except for the first element of SR
// arrays, the field `d_action' is used to determine what to do next. If
// positive, it represents the next state (used with SHIFT); if zero, it
// indicates `ACCEPT', if negative, -d_action represents the number of the
// rule to reduce to.

// `lookup()' tries to find d_token__ in the current SR array. If it fails, and
// there is no default reduction UNEXPECTED_TOKEN__ is thrown, which is then
// caught by the error-recovery function.

// The error-recovery function will pop elements off the stack until a state
// having bit flag ERR_ITEM is found. This state has a transition on _error_
// which is applied. In this _error_ state, while the current token is not a
// proper continuation, new tokens are obtained by nextToken(). If such a
// token is found, error recovery is successful and the token is
// handled according to the error state's SR table and parsing continues.
// During error recovery semantic actions are ignored.

// A state flagged with the DEF_RED flag will perform a default
// reduction if no other continuations are available for the current token.

// The ACCEPT STATE never shows a default reduction: when it is reached the
// parser returns ACCEPT(). During the grammar
// analysis phase a default reduction may have been defined, but it is
// removed during the state-definition phase.

// So:
//      s_x[] = 
//      {
//                  [_field_1_]         [_field_2_]
//
// First element:   {state-type,        idx of last element},
// Other elements:  {required token,    action to perform},
//                                      ( < 0: reduce, 
//                                          0: ACCEPT,
//                                        > 0: next state)
// Last element:    {set to d_token__,    action to perform}
//      }

// When the --thread-safe option is specified, all static data are defined as
// const. If --thread-safe is not provided, the state-tables are not defined
// as const, since the lookup() function below will modify them

// $insert debugincludes
#include <iostream>
#include <sstream>
#include <string>
#include <unordered_map>
#include <iomanip>

namespace // anonymous
{
    char const author[] = "Frank B. Brokken (f.b.brokken@rug.nl)";

    enum 
    {
        STACK_EXPANSION = 5     // size to expand the state-stack with when
                                // full
    };

    enum ReservedTokens
    {
        PARSE_ACCEPT     = 0,   // `ACCEPT' TRANSITION
        _UNDETERMINED_   = -2,
        _EOF_            = -1,
        _error_          = 256
    };
    enum StateType       // modify statetype/data.cc when this enum changes
    {
        NORMAL,
        ERR_ITEM,
        REQ_TOKEN,
        ERR_REQ,    // ERR_ITEM | REQ_TOKEN
        DEF_RED,    // state having default reduction
        ERR_DEF,    // ERR_ITEM | DEF_RED
        REQ_DEF,    // REQ_TOKEN | DEF_RED
        ERR_REQ_DEF // ERR_ITEM | REQ_TOKEN | DEF_RED
    };    
    struct PI__     // Production Info
    {
        size_t d_nonTerm; // identification number of this production's
                            // non-terminal 
        size_t d_size;    // number of elements in this production 
    };

    struct SR__     // Shift Reduce info, see its description above
    {
        union
        {
            int _field_1_;      // initializer, allowing initializations 
                                // of the SR s_[] arrays
            int d_type;
            int d_token;
        };
        union
        {
            int _field_2_;

            int d_lastIdx;          // if negative, the state uses SHIFT
            int d_action;           // may be negative (reduce), 
                                    // postive (shift), or 0 (accept)
            size_t d_errorState;    // used with Error states
        };
    };

    // $insert staticdata
    
// Productions Info Records:
PI__ const s_productionInfo[] = 
{
     {0, 0}, // not used: reduction values are negative
     {304, 4}, // 1: input ->  directives _two_percents rules optTwo_percents
     {306, 1}, // 2: _two_percents (TWO_PERCENTS) ->  TWO_PERCENTS
     {309, 1}, // 3: identifier (IDENTIFIER) ->  IDENTIFIER
     {310, 3}, // 4: typename ('<') ->  '<' identifier '>'
     {311, 1}, // 5: optComma (',') ->  ','
     {311, 0}, // 6: optComma ->  <empty>
     {312, 1}, // 7: optNumber (NUMBER) ->  NUMBER
     {312, 0}, // 8: optNumber ->  <empty>
     {313, 1}, // 9: optSemiCol (';') ->  ';'
     {313, 0}, // 10: optSemiCol ->  <empty>
     {314, 0}, // 11: _tokenname ->  <empty>
     {315, 2}, // 12: optTypename ->  typename _tokenname
     {315, 1}, // 13: optTypename ->  _tokenname
     {308, 1}, // 14: optTwo_percents (TWO_PERCENTS) ->  TWO_PERCENTS
     {308, 0}, // 15: optTwo_percents ->  <empty>
     {316, 1}, // 16: _baseclass_header (BASECLASS_HEADER) ->  BASECLASS_HEADER
     {317, 1}, // 17: _baseclass_preinclude (BASECLASS_PREINCLUDE) ->  BASECLASS_PREINCLUDE
     {318, 1}, // 18: _class_header (CLASS_HEADER) ->  CLASS_HEADER
     {319, 1}, // 19: _class_name (CLASS_NAME) ->  CLASS_NAME
     {320, 1}, // 20: _expect (EXPECT) ->  EXPECT
     {321, 1}, // 21: _filenames (FILENAMES) ->  FILENAMES
     {322, 1}, // 22: _implementation_header (IMPLEMENTATION_HEADER) ->  IMPLEMENTATION_HEADER
     {323, 0}, // 23: _incrementPrecedence ->  <empty>
     {324, 2}, // 24: _left (LEFT) ->  LEFT _typesymbol
     {326, 1}, // 25: _locationstruct (LOCATIONSTRUCT) ->  LOCATIONSTRUCT
     {327, 1}, // 26: _ltype (LTYPE) ->  LTYPE
     {328, 1}, // 27: _namespace (NAMESPACE) ->  NAMESPACE
     {329, 2}, // 28: _nonassoc (NONASSOC) ->  NONASSOC _typesymbol
     {330, 1}, // 29: _parsefun_source (PARSEFUN_SOURCE) ->  PARSEFUN_SOURCE
     {331, 0}, // 30: _pushPrecedence ->  <empty>
     {332, 1}, // 31: _required (REQUIRED) ->  REQUIRED
     {333, 2}, // 32: _right (RIGHT) ->  RIGHT _typesymbol
     {334, 1}, // 33: _scanner (SCANNER) ->  SCANNER
     {335, 1}, // 34: _scanner_class_name (SCANNER_CLASS_NAME) ->  SCANNER_CLASS_NAME
     {336, 1}, // 35: _scanner_token_function (SCANNER_TOKEN_FUNCTION) ->  SCANNER_TOKEN_FUNCTION
     {337, 1}, // 36: _scanner_matched_text_function (SCANNER_MATCHED_TEXT_FUNCTION) ->  SCANNER_MATCHED_TEXT_FUNCTION
     {338, 1}, // 37: _start (START) ->  START
     {339, 0}, // 38: _symbol_exp ->  <empty>
     {340, 1}, // 39: _symbol (QUOTE) ->  QUOTE
     {340, 2}, // 40: _symbol ->  identifier optNumber
     {341, 3}, // 41: _symbolList ->  _symbolList optComma _symbol
     {341, 1}, // 42: _symbolList ->  _symbol
     {342, 3}, // 43: _symbols ->  _symbol_exp _symbolList optSemiCol
     {343, 1}, // 44: _target_directory (TARGET_DIRECTORY) ->  TARGET_DIRECTORY
     {344, 1}, // 45: _type (TYPE) ->  TYPE
     {345, 1}, // 46: _stype (STYPE) ->  STYPE
     {325, 0}, // 47: _typesymbol ->  <empty>
     {346, 2}, // 48: _token (TOKEN) ->  TOKEN _typesymbol
     {347, 1}, // 49: _union (UNION) ->  UNION
     {348, 1}, // 50: _polymorphic (POLYMORPHIC) ->  POLYMORPHIC
     {349, 1}, // 51: _typespec (':') ->  ':'
     {350, 3}, // 52: _polyspec ->  identifier _typespec identifier
     {351, 3}, // 53: _polyspecs (';') ->  _polyspecs ';' _polyspec
     {351, 1}, // 54: _polyspecs ->  _polyspec
     {352, 2}, // 55: _directiveSpec (STRING) ->  _baseclass_header STRING
     {352, 2}, // 56: _directiveSpec (STRING) ->  _baseclass_preinclude STRING
     {352, 2}, // 57: _directiveSpec (STRING) ->  _class_header STRING
     {352, 2}, // 58: _directiveSpec (IDENTIFIER) ->  _class_name IDENTIFIER
     {352, 1}, // 59: _directiveSpec (DEBUGFLAG) ->  DEBUGFLAG
     {352, 1}, // 60: _directiveSpec (ERROR_VERBOSE) ->  ERROR_VERBOSE
     {352, 2}, // 61: _directiveSpec (NUMBER) ->  _expect NUMBER
     {352, 2}, // 62: _directiveSpec (STRING) ->  _filenames STRING
     {352, 1}, // 63: _directiveSpec (FLEX) ->  FLEX
     {352, 2}, // 64: _directiveSpec (STRING) ->  _implementation_header STRING
     {352, 4}, // 65: _directiveSpec ->  _left _incrementPrecedence optTypename _symbols
     {352, 3}, // 66: _directiveSpec (BLOCK) ->  _locationstruct BLOCK optSemiCol
     {352, 1}, // 67: _directiveSpec (LSP_NEEDED) ->  LSP_NEEDED
     {352, 2}, // 68: _directiveSpec (STRING) ->  _ltype STRING
     {352, 2}, // 69: _directiveSpec (IDENTIFIER) ->  _namespace IDENTIFIER
     {352, 1}, // 70: _directiveSpec (NEG_DOLLAR) ->  NEG_DOLLAR
     {352, 1}, // 71: _directiveSpec (NOLINES) ->  NOLINES
     {352, 4}, // 72: _directiveSpec ->  _nonassoc _incrementPrecedence optTypename _symbols
     {352, 2}, // 73: _directiveSpec (STRING) ->  _parsefun_source STRING
     {352, 1}, // 74: _directiveSpec (PRINT_TOKENS) ->  PRINT_TOKENS
     {352, 2}, // 75: _directiveSpec (NUMBER) ->  _required NUMBER
     {352, 4}, // 76: _directiveSpec ->  _right _incrementPrecedence optTypename _symbols
     {352, 2}, // 77: _directiveSpec (STRING) ->  _scanner STRING
     {352, 2}, // 78: _directiveSpec (STRING) ->  _scanner_class_name STRING
     {352, 2}, // 79: _directiveSpec (STRING) ->  _scanner_token_function STRING
     {352, 2}, // 80: _directiveSpec (STRING) ->  _scanner_matched_text_function STRING
     {352, 2}, // 81: _directiveSpec (IDENTIFIER) ->  _start IDENTIFIER
     {352, 2}, // 82: _directiveSpec (STRING) ->  _stype STRING
     {352, 2}, // 83: _directiveSpec (STRING) ->  _target_directory STRING
     {352, 4}, // 84: _directiveSpec ->  _token optTypename _pushPrecedence _symbols
     {352, 3}, // 85: _directiveSpec ->  _type typename _symbols
     {352, 3}, // 86: _directiveSpec (BLOCK) ->  _union BLOCK optSemiCol
     {352, 3}, // 87: _directiveSpec ->  _polymorphic _polyspecs optSemiCol
     {352, 1}, // 88: _directiveSpec (WEAK_TAGS) ->  WEAK_TAGS
     {352, 1}, // 89: _directiveSpec (_error_) ->  _error_
     {353, 1}, // 90: _directive ->  _directiveSpec
     {305, 2}, // 91: directives ->  directives _directive
     {305, 0}, // 92: directives ->  <empty>
     {354, 1}, // 93: _precSpec (IDENTIFIER) ->  IDENTIFIER
     {354, 1}, // 94: _precSpec (QUOTE) ->  QUOTE
     {355, 1}, // 95: _productionElement (QUOTE) ->  QUOTE
     {355, 1}, // 96: _productionElement (IDENTIFIER) ->  IDENTIFIER
     {355, 1}, // 97: _productionElement (BLOCK) ->  BLOCK
     {355, 2}, // 98: _productionElement (PREC) ->  PREC _precSpec
     {356, 2}, // 99: _productionElements ->  _productionElements _productionElement
     {356, 1}, // 100: _productionElements ->  _productionElement
     {357, 1}, // 101: _production ->  _productionElements
     {357, 0}, // 102: _production ->  <empty>
     {358, 1}, // 103: _productionSeparator ('|') ->  '|'
     {359, 3}, // 104: _productionList ->  _productionList _productionSeparator _production
     {359, 1}, // 105: _productionList ->  _production
     {360, 2}, // 106: _ruleName (':') ->  identifier ':'
     {361, 3}, // 107: _rule (';') ->  _ruleName _productionList ';'
     {307, 2}, // 108: rules ->  rules _rule
     {307, 0}, // 109: rules ->  <empty>
     {362, 1}, // 110: input_$ ->  input
};

// State info and SR__ transitions for each state.


SR__ s_0[] =
{
    { { DEF_RED}, {   3} },              
    { {     304}, {   1} }, // input     
    { {     305}, {   2} }, // directives
    { {       0}, { -92} },              
};

SR__ s_1[] =
{
    { { REQ_TOKEN}, {            2} }, 
    { {     _EOF_}, { PARSE_ACCEPT} }, 
    { {         0}, {            0} }, 
};

SR__ s_2[] =
{
    { { ERR_REQ}, { 66} },                                  
    { {     306}, {  3} }, // _two_percents                 
    { {     353}, {  4} }, // _directive                    
    { {     294}, {  5} }, // TWO_PERCENTS                  
    { {     352}, {  6} }, // _directiveSpec                
    { {     316}, {  7} }, // _baseclass_header             
    { {     317}, {  8} }, // _baseclass_preinclude         
    { {     318}, {  9} }, // _class_header                 
    { {     319}, { 10} }, // _class_name                   
    { {     262}, { 11} }, // DEBUGFLAG                     
    { {     263}, { 12} }, // ERROR_VERBOSE                 
    { {     320}, { 13} }, // _expect                       
    { {     321}, { 14} }, // _filenames                    
    { {     266}, { 15} }, // FLEX                          
    { {     322}, { 16} }, // _implementation_header        
    { {     324}, { 17} }, // _left                         
    { {     326}, { 18} }, // _locationstruct               
    { {     271}, { 19} }, // LSP_NEEDED                    
    { {     327}, { 20} }, // _ltype                        
    { {     328}, { 21} }, // _namespace                    
    { {     274}, { 22} }, // NEG_DOLLAR                    
    { {     275}, { 23} }, // NOLINES                       
    { {     329}, { 24} }, // _nonassoc                     
    { {     330}, { 25} }, // _parsefun_source              
    { {     281}, { 26} }, // PRINT_TOKENS                  
    { {     332}, { 27} }, // _required                     
    { {     333}, { 28} }, // _right                        
    { {     334}, { 29} }, // _scanner                      
    { {     335}, { 30} }, // _scanner_class_name           
    { {     336}, { 31} }, // _scanner_token_function       
    { {     337}, { 32} }, // _scanner_matched_text_function
    { {     338}, { 33} }, // _start                        
    { {     345}, { 34} }, // _stype                        
    { {     343}, { 35} }, // _target_directory             
    { {     346}, { 36} }, // _token                        
    { {     344}, { 37} }, // _type                         
    { {     347}, { 38} }, // _union                        
    { {     348}, { 39} }, // _polymorphic                  
    { {     297}, { 40} }, // WEAK_TAGS                     
    { { _error_}, { 41} }, // _error_                       
    { {     257}, { 42} }, // BASECLASS_HEADER              
    { {     258}, { 43} }, // BASECLASS_PREINCLUDE          
    { {     260}, { 44} }, // CLASS_HEADER                  
    { {     261}, { 45} }, // CLASS_NAME                    
    { {     264}, { 46} }, // EXPECT                        
    { {     265}, { 47} }, // FILENAMES                     
    { {     268}, { 48} }, // IMPLEMENTATION_HEADER         
    { {     269}, { 49} }, // LEFT                          
    { {     270}, { 50} }, // LOCATIONSTRUCT                
    { {     272}, { 51} }, // LTYPE                         
    { {     273}, { 52} }, // NAMESPACE                     
    { {     276}, { 53} }, // NONASSOC                      
    { {     278}, { 54} }, // PARSEFUN_SOURCE               
    { {     283}, { 55} }, // REQUIRED                      
    { {     284}, { 56} }, // RIGHT                         
    { {     285}, { 57} }, // SCANNER                       
    { {     286}, { 58} }, // SCANNER_CLASS_NAME            
    { {     288}, { 59} }, // SCANNER_TOKEN_FUNCTION        
    { {     287}, { 60} }, // SCANNER_MATCHED_TEXT_FUNCTION 
    { {     289}, { 61} }, // START                         
    { {     291}, { 62} }, // STYPE                         
    { {     292}, { 63} }, // TARGET_DIRECTORY              
    { {     293}, { 64} }, // TOKEN                         
    { {     295}, { 65} }, // TYPE                          
    { {     296}, { 66} }, // UNION                         
    { {     279}, { 67} }, // POLYMORPHIC                   
    { {       0}, {  0} },                                  
};

SR__ s_3[] =
{
    { { DEF_RED}, {    2} },         
    { {     307}, {   68} }, // rules
    { {       0}, { -109} },         
};

SR__ s_4[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -91} }, 
};

SR__ s_5[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -2} }, 
};

SR__ s_6[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -90} }, 
};

SR__ s_7[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 69} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_8[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 70} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_9[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 71} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_10[] =
{
    { { REQ_TOKEN}, {  2} },              
    { {       267}, { 72} }, // IDENTIFIER
    { {         0}, {  0} },              
};

SR__ s_11[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -59} }, 
};

SR__ s_12[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -60} }, 
};

SR__ s_13[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       277}, { 73} }, // NUMBER
    { {         0}, {  0} },          
};

SR__ s_14[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 74} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_15[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -63} }, 
};

SR__ s_16[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 75} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_17[] =
{
    { { DEF_RED}, {   2} },                        
    { {     323}, {  76} }, // _incrementPrecedence
    { {       0}, { -23} },                        
};

SR__ s_18[] =
{
    { { REQ_TOKEN}, {  2} },         
    { {       259}, { 77} }, // BLOCK
    { {         0}, {  0} },         
};

SR__ s_19[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -67} }, 
};

SR__ s_20[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 78} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_21[] =
{
    { { REQ_TOKEN}, {  2} },              
    { {       267}, { 79} }, // IDENTIFIER
    { {         0}, {  0} },              
};

SR__ s_22[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -70} }, 
};

SR__ s_23[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -71} }, 
};

SR__ s_24[] =
{
    { { DEF_RED}, {   2} },                        
    { {     323}, {  80} }, // _incrementPrecedence
    { {       0}, { -23} },                        
};

SR__ s_25[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 81} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_26[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -74} }, 
};

SR__ s_27[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       277}, { 82} }, // NUMBER
    { {         0}, {  0} },          
};

SR__ s_28[] =
{
    { { DEF_RED}, {   2} },                        
    { {     323}, {  83} }, // _incrementPrecedence
    { {       0}, { -23} },                        
};

SR__ s_29[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 84} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_30[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 85} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_31[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 86} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_32[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 87} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_33[] =
{
    { { REQ_TOKEN}, {  2} },              
    { {       267}, { 88} }, // IDENTIFIER
    { {         0}, {  0} },              
};

SR__ s_34[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 89} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_35[] =
{
    { { REQ_TOKEN}, {  2} },          
    { {       290}, { 90} }, // STRING
    { {         0}, {  0} },          
};

SR__ s_36[] =
{
    { { REQ_DEF}, {   5} },               
    { {     315}, {  91} }, // optTypename
    { {     310}, {  92} }, // typename   
    { {     314}, {  93} }, // _tokenname 
    { {      60}, {  94} }, // '<'        
    { {       0}, { -11} },               
};

SR__ s_37[] =
{
    { { REQ_TOKEN}, {  3} },            
    { {       310}, { 95} }, // typename
    { {        60}, { 94} }, // '<'     
    { {         0}, {  0} },            
};

SR__ s_38[] =
{
    { { REQ_TOKEN}, {  2} },         
    { {       259}, { 96} }, // BLOCK
    { {         0}, {  0} },         
};

SR__ s_39[] =
{
    { { REQ_TOKEN}, {   5} },              
    { {       351}, {  97} }, // _polyspecs
    { {       350}, {  98} }, // _polyspec 
    { {       309}, {  99} }, // identifier
    { {       267}, { 100} }, // IDENTIFIER
    { {         0}, {   0} },              
};

SR__ s_40[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -88} }, 
};

SR__ s_41[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -89} }, 
};

SR__ s_42[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -16} }, 
};

SR__ s_43[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -17} }, 
};

SR__ s_44[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -18} }, 
};

SR__ s_45[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -19} }, 
};

SR__ s_46[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -20} }, 
};

SR__ s_47[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -21} }, 
};

SR__ s_48[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -22} }, 
};

SR__ s_49[] =
{
    { { DEF_RED}, {   2} },               
    { {     325}, { 101} }, // _typesymbol
    { {       0}, { -47} },               
};

SR__ s_50[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -25} }, 
};

SR__ s_51[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -26} }, 
};

SR__ s_52[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -27} }, 
};

SR__ s_53[] =
{
    { { DEF_RED}, {   2} },               
    { {     325}, { 102} }, // _typesymbol
    { {       0}, { -47} },               
};

SR__ s_54[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -29} }, 
};

SR__ s_55[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -31} }, 
};

SR__ s_56[] =
{
    { { DEF_RED}, {   2} },               
    { {     325}, { 103} }, // _typesymbol
    { {       0}, { -47} },               
};

SR__ s_57[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -33} }, 
};

SR__ s_58[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -34} }, 
};

SR__ s_59[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -35} }, 
};

SR__ s_60[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -36} }, 
};

SR__ s_61[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -37} }, 
};

SR__ s_62[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -46} }, 
};

SR__ s_63[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -44} }, 
};

SR__ s_64[] =
{
    { { DEF_RED}, {   2} },               
    { {     325}, { 104} }, // _typesymbol
    { {       0}, { -47} },               
};

SR__ s_65[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -45} }, 
};

SR__ s_66[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -49} }, 
};

SR__ s_67[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -50} }, 
};

SR__ s_68[] =
{
    { { REQ_DEF}, {   7} },                   
    { {     308}, { 105} }, // optTwo_percents
    { {     361}, { 106} }, // _rule          
    { {     294}, { 107} }, // TWO_PERCENTS   
    { {     360}, { 108} }, // _ruleName      
    { {     309}, { 109} }, // identifier     
    { {     267}, { 100} }, // IDENTIFIER     
    { {       0}, { -15} },                   
};

SR__ s_69[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -55} }, 
};

SR__ s_70[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -56} }, 
};

SR__ s_71[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -57} }, 
};

SR__ s_72[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -58} }, 
};

SR__ s_73[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -61} }, 
};

SR__ s_74[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -62} }, 
};

SR__ s_75[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -64} }, 
};

SR__ s_76[] =
{
    { { REQ_DEF}, {   5} },               
    { {     315}, { 110} }, // optTypename
    { {     310}, {  92} }, // typename   
    { {     314}, {  93} }, // _tokenname 
    { {      60}, {  94} }, // '<'        
    { {       0}, { -11} },               
};

SR__ s_77[] =
{
    { { REQ_DEF}, {   3} },              
    { {     313}, { 111} }, // optSemiCol
    { {      59}, { 112} }, // ';'       
    { {       0}, { -10} },              
};

SR__ s_78[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -68} }, 
};

SR__ s_79[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -69} }, 
};

SR__ s_80[] =
{
    { { REQ_DEF}, {   5} },               
    { {     315}, { 113} }, // optTypename
    { {     310}, {  92} }, // typename   
    { {     314}, {  93} }, // _tokenname 
    { {      60}, {  94} }, // '<'        
    { {       0}, { -11} },               
};

SR__ s_81[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -73} }, 
};

SR__ s_82[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -75} }, 
};

SR__ s_83[] =
{
    { { REQ_DEF}, {   5} },               
    { {     315}, { 114} }, // optTypename
    { {     310}, {  92} }, // typename   
    { {     314}, {  93} }, // _tokenname 
    { {      60}, {  94} }, // '<'        
    { {       0}, { -11} },               
};

SR__ s_84[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -77} }, 
};

SR__ s_85[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -78} }, 
};

SR__ s_86[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -79} }, 
};

SR__ s_87[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -80} }, 
};

SR__ s_88[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -81} }, 
};

SR__ s_89[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -82} }, 
};

SR__ s_90[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -83} }, 
};

SR__ s_91[] =
{
    { { DEF_RED}, {   2} },                   
    { {     331}, { 115} }, // _pushPrecedence
    { {       0}, { -30} },                   
};

SR__ s_92[] =
{
    { { DEF_RED}, {   2} },              
    { {     314}, { 116} }, // _tokenname
    { {       0}, { -11} },              
};

SR__ s_93[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -13} }, 
};

SR__ s_94[] =
{
    { { REQ_TOKEN}, {   3} },              
    { {       309}, { 117} }, // identifier
    { {       267}, { 100} }, // IDENTIFIER
    { {         0}, {   0} },              
};

SR__ s_95[] =
{
    { { DEF_RED}, {   3} },               
    { {     342}, { 118} }, // _symbols   
    { {     339}, { 119} }, // _symbol_exp
    { {       0}, { -38} },               
};

SR__ s_96[] =
{
    { { REQ_DEF}, {   3} },              
    { {     313}, { 120} }, // optSemiCol
    { {      59}, { 112} }, // ';'       
    { {       0}, { -10} },              
};

SR__ s_97[] =
{
    { { REQ_DEF}, {   3} },              
    { {     313}, { 121} }, // optSemiCol
    { {      59}, { 122} }, // ';'       
    { {       0}, { -10} },              
};

SR__ s_98[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -54} }, 
};

SR__ s_99[] =
{
    { { REQ_TOKEN}, {   3} },             
    { {       349}, { 123} }, // _typespec
    { {        58}, { 124} }, // ':'      
    { {         0}, {   0} },             
};

SR__ s_100[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -3} }, 
};

SR__ s_101[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -24} }, 
};

SR__ s_102[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -28} }, 
};

SR__ s_103[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -32} }, 
};

SR__ s_104[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -48} }, 
};

SR__ s_105[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -1} }, 
};

SR__ s_106[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -108} }, 
};

SR__ s_107[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -14} }, 
};

SR__ s_108[] =
{
    { { REQ_DEF}, {    9} },                       
    { {     359}, {  125} }, // _productionList    
    { {     357}, {  126} }, // _production        
    { {     356}, {  127} }, // _productionElements
    { {     355}, {  128} }, // _productionElement 
    { {     282}, {  129} }, // QUOTE              
    { {     267}, {  130} }, // IDENTIFIER         
    { {     259}, {  131} }, // BLOCK              
    { {     280}, {  132} }, // PREC               
    { {       0}, { -102} },                       
};

SR__ s_109[] =
{
    { { REQ_TOKEN}, {   2} },       
    { {        58}, { 133} }, // ':'
    { {         0}, {   0} },       
};

SR__ s_110[] =
{
    { { DEF_RED}, {   3} },               
    { {     342}, { 134} }, // _symbols   
    { {     339}, { 119} }, // _symbol_exp
    { {       0}, { -38} },               
};

SR__ s_111[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -66} }, 
};

SR__ s_112[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -9} }, 
};

SR__ s_113[] =
{
    { { DEF_RED}, {   3} },               
    { {     342}, { 135} }, // _symbols   
    { {     339}, { 119} }, // _symbol_exp
    { {       0}, { -38} },               
};

SR__ s_114[] =
{
    { { DEF_RED}, {   3} },               
    { {     342}, { 136} }, // _symbols   
    { {     339}, { 119} }, // _symbol_exp
    { {       0}, { -38} },               
};

SR__ s_115[] =
{
    { { DEF_RED}, {   3} },               
    { {     342}, { 137} }, // _symbols   
    { {     339}, { 119} }, // _symbol_exp
    { {       0}, { -38} },               
};

SR__ s_116[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -12} }, 
};

SR__ s_117[] =
{
    { { REQ_TOKEN}, {   2} },       
    { {        62}, { 138} }, // '>'
    { {         0}, {   0} },       
};

SR__ s_118[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -85} }, 
};

SR__ s_119[] =
{
    { { REQ_TOKEN}, {   6} },               
    { {       341}, { 139} }, // _symbolList
    { {       340}, { 140} }, // _symbol    
    { {       282}, { 141} }, // QUOTE      
    { {       309}, { 142} }, // identifier 
    { {       267}, { 100} }, // IDENTIFIER 
    { {         0}, {   0} },               
};

SR__ s_120[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -86} }, 
};

SR__ s_121[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -87} }, 
};

SR__ s_122[] =
{
    { { REQ_DEF}, {   4} },              
    { {     350}, { 143} }, // _polyspec 
    { {     309}, {  99} }, // identifier
    { {     267}, { 100} }, // IDENTIFIER
    { {       0}, {  -9} },              
};

SR__ s_123[] =
{
    { { REQ_TOKEN}, {   3} },              
    { {       309}, { 144} }, // identifier
    { {       267}, { 100} }, // IDENTIFIER
    { {         0}, {   0} },              
};

SR__ s_124[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -51} }, 
};

SR__ s_125[] =
{
    { { REQ_TOKEN}, {   4} },                        
    { {        59}, { 145} }, // ';'                 
    { {       358}, { 146} }, // _productionSeparator
    { {       124}, { 147} }, // '|'                 
    { {         0}, {   0} },                        
};

SR__ s_126[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -105} }, 
};

SR__ s_127[] =
{
    { { REQ_DEF}, {    6} },                      
    { {     355}, {  148} }, // _productionElement
    { {     282}, {  129} }, // QUOTE             
    { {     267}, {  130} }, // IDENTIFIER        
    { {     259}, {  131} }, // BLOCK             
    { {     280}, {  132} }, // PREC              
    { {       0}, { -101} },                      
};

SR__ s_128[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -100} }, 
};

SR__ s_129[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -95} }, 
};

SR__ s_130[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -96} }, 
};

SR__ s_131[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -97} }, 
};

SR__ s_132[] =
{
    { { REQ_TOKEN}, {   4} },              
    { {       354}, { 149} }, // _precSpec 
    { {       267}, { 150} }, // IDENTIFIER
    { {       282}, { 151} }, // QUOTE     
    { {         0}, {   0} },              
};

SR__ s_133[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -106} }, 
};

SR__ s_134[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -65} }, 
};

SR__ s_135[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -72} }, 
};

SR__ s_136[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -76} }, 
};

SR__ s_137[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -84} }, 
};

SR__ s_138[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -4} }, 
};

SR__ s_139[] =
{
    { { REQ_DEF}, {  41} },                                 
    { {     313}, { 152} }, // optSemiCol                   
    { {     311}, { 153} }, // optComma                     
    { {      59}, { 112} }, // ';'                          
    { {      44}, { 154} }, // ','                          
    { { _error_}, { -10} }, // _error_                      
    { {     257}, { -10} }, // BASECLASS_HEADER             
    { {     258}, { -10} }, // BASECLASS_PREINCLUDE         
    { {     260}, { -10} }, // CLASS_HEADER                 
    { {     261}, { -10} }, // CLASS_NAME                   
    { {     262}, { -10} }, // DEBUGFLAG                    
    { {     263}, { -10} }, // ERROR_VERBOSE                
    { {     264}, { -10} }, // EXPECT                       
    { {     265}, { -10} }, // FILENAMES                    
    { {     266}, { -10} }, // FLEX                         
    { {     268}, { -10} }, // IMPLEMENTATION_HEADER        
    { {     269}, { -10} }, // LEFT                         
    { {     270}, { -10} }, // LOCATIONSTRUCT               
    { {     271}, { -10} }, // LSP_NEEDED                   
    { {     272}, { -10} }, // LTYPE                        
    { {     273}, { -10} }, // NAMESPACE                    
    { {     274}, { -10} }, // NEG_DOLLAR                   
    { {     275}, { -10} }, // NOLINES                      
    { {     276}, { -10} }, // NONASSOC                     
    { {     278}, { -10} }, // PARSEFUN_SOURCE              
    { {     279}, { -10} }, // POLYMORPHIC                  
    { {     281}, { -10} }, // PRINT_TOKENS                 
    { {     283}, { -10} }, // REQUIRED                     
    { {     284}, { -10} }, // RIGHT                        
    { {     285}, { -10} }, // SCANNER                      
    { {     286}, { -10} }, // SCANNER_CLASS_NAME           
    { {     287}, { -10} }, // SCANNER_MATCHED_TEXT_FUNCTION
    { {     288}, { -10} }, // SCANNER_TOKEN_FUNCTION       
    { {     289}, { -10} }, // START                        
    { {     291}, { -10} }, // STYPE                        
    { {     292}, { -10} }, // TARGET_DIRECTORY             
    { {     293}, { -10} }, // TOKEN                        
    { {     294}, { -10} }, // TWO_PERCENTS                 
    { {     295}, { -10} }, // TYPE                         
    { {     296}, { -10} }, // UNION                        
    { {     297}, { -10} }, // WEAK_TAGS                    
    { {       0}, {  -6} },                                 
};

SR__ s_140[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -42} }, 
};

SR__ s_141[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -39} }, 
};

SR__ s_142[] =
{
    { { REQ_DEF}, {   3} },             
    { {     312}, { 155} }, // optNumber
    { {     277}, { 156} }, // NUMBER   
    { {       0}, {  -8} },             
};

SR__ s_143[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -53} }, 
};

SR__ s_144[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -52} }, 
};

SR__ s_145[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -107} }, 
};

SR__ s_146[] =
{
    { { REQ_DEF}, {    8} },                       
    { {     357}, {  157} }, // _production        
    { {     356}, {  127} }, // _productionElements
    { {     355}, {  128} }, // _productionElement 
    { {     282}, {  129} }, // QUOTE              
    { {     267}, {  130} }, // IDENTIFIER         
    { {     259}, {  131} }, // BLOCK              
    { {     280}, {  132} }, // PREC               
    { {       0}, { -102} },                       
};

SR__ s_147[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -103} }, 
};

SR__ s_148[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -99} }, 
};

SR__ s_149[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -98} }, 
};

SR__ s_150[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -93} }, 
};

SR__ s_151[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -94} }, 
};

SR__ s_152[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -43} }, 
};

SR__ s_153[] =
{
    { { REQ_TOKEN}, {   5} },              
    { {       340}, { 158} }, // _symbol   
    { {       282}, { 141} }, // QUOTE     
    { {       309}, { 142} }, // identifier
    { {       267}, { 100} }, // IDENTIFIER
    { {         0}, {   0} },              
};

SR__ s_154[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -5} }, 
};

SR__ s_155[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -40} }, 
};

SR__ s_156[] =
{
    { { DEF_RED}, {  1} }, 
    { {       0}, { -7} }, 
};

SR__ s_157[] =
{
    { { DEF_RED}, {    1} }, 
    { {       0}, { -104} }, 
};

SR__ s_158[] =
{
    { { DEF_RED}, {   1} }, 
    { {       0}, { -41} }, 
};


// State array:
SR__ *s_state[] =
{
  s_0,  s_1,  s_2,  s_3,  s_4,  s_5,  s_6,  s_7,  s_8,  s_9,
  s_10,  s_11,  s_12,  s_13,  s_14,  s_15,  s_16,  s_17,  s_18,  s_19,
  s_20,  s_21,  s_22,  s_23,  s_24,  s_25,  s_26,  s_27,  s_28,  s_29,
  s_30,  s_31,  s_32,  s_33,  s_34,  s_35,  s_36,  s_37,  s_38,  s_39,
  s_40,  s_41,  s_42,  s_43,  s_44,  s_45,  s_46,  s_47,  s_48,  s_49,
  s_50,  s_51,  s_52,  s_53,  s_54,  s_55,  s_56,  s_57,  s_58,  s_59,
  s_60,  s_61,  s_62,  s_63,  s_64,  s_65,  s_66,  s_67,  s_68,  s_69,
  s_70,  s_71,  s_72,  s_73,  s_74,  s_75,  s_76,  s_77,  s_78,  s_79,
  s_80,  s_81,  s_82,  s_83,  s_84,  s_85,  s_86,  s_87,  s_88,  s_89,
  s_90,  s_91,  s_92,  s_93,  s_94,  s_95,  s_96,  s_97,  s_98,  s_99,
  s_100,  s_101,  s_102,  s_103,  s_104,  s_105,  s_106,  s_107,  s_108,  s_109,
  s_110,  s_111,  s_112,  s_113,  s_114,  s_115,  s_116,  s_117,  s_118,  s_119,
  s_120,  s_121,  s_122,  s_123,  s_124,  s_125,  s_126,  s_127,  s_128,  s_129,
  s_130,  s_131,  s_132,  s_133,  s_134,  s_135,  s_136,  s_137,  s_138,  s_139,
  s_140,  s_141,  s_142,  s_143,  s_144,  s_145,  s_146,  s_147,  s_148,  s_149,
  s_150,  s_151,  s_152,  s_153,  s_154,  s_155,  s_156,  s_157,  s_158,
};

typedef std::unordered_map<int, char const *> SMap;
typedef SMap::value_type SMapVal;

SMapVal s_symArr[] =
{
    SMapVal(-2, "_UNDETERMINED_"),  // predefined symbols
    SMapVal(-1, "_EOF_"),
    SMapVal(256, "_error_"),

    SMapVal(257, "BASECLASS_HEADER"),
    SMapVal(258, "BASECLASS_PREINCLUDE"),
    SMapVal(259, "BLOCK"),
    SMapVal(260, "CLASS_HEADER"),
    SMapVal(261, "CLASS_NAME"),
    SMapVal(262, "DEBUGFLAG"),
    SMapVal(263, "ERROR_VERBOSE"),
    SMapVal(264, "EXPECT"),
    SMapVal(265, "FILENAMES"),
    SMapVal(266, "FLEX"),
    SMapVal(267, "IDENTIFIER"),
    SMapVal(268, "IMPLEMENTATION_HEADER"),
    SMapVal(269, "LEFT"),
    SMapVal(270, "LOCATIONSTRUCT"),
    SMapVal(271, "LSP_NEEDED"),
    SMapVal(272, "LTYPE"),
    SMapVal(273, "NAMESPACE"),
    SMapVal(274, "NEG_DOLLAR"),
    SMapVal(275, "NOLINES"),
    SMapVal(276, "NONASSOC"),
    SMapVal(277, "NUMBER"),
    SMapVal(278, "PARSEFUN_SOURCE"),
    SMapVal(279, "POLYMORPHIC"),
    SMapVal(280, "PREC"),
    SMapVal(281, "PRINT_TOKENS"),
    SMapVal(282, "QUOTE"),
    SMapVal(283, "REQUIRED"),
    SMapVal(284, "RIGHT"),
    SMapVal(285, "SCANNER"),
    SMapVal(286, "SCANNER_CLASS_NAME"),
    SMapVal(287, "SCANNER_MATCHED_TEXT_FUNCTION"),
    SMapVal(288, "SCANNER_TOKEN_FUNCTION"),
    SMapVal(289, "START"),
    SMapVal(290, "STRING"),
    SMapVal(291, "STYPE"),
    SMapVal(292, "TARGET_DIRECTORY"),
    SMapVal(293, "TOKEN"),
    SMapVal(294, "TWO_PERCENTS"),
    SMapVal(295, "TYPE"),
    SMapVal(296, "UNION"),
    SMapVal(297, "WEAK_TAGS"),
    SMapVal(304, "input"),
    SMapVal(305, "directives"),
    SMapVal(306, "_two_percents"),
    SMapVal(307, "rules"),
    SMapVal(308, "optTwo_percents"),
    SMapVal(309, "identifier"),
    SMapVal(310, "typename"),
    SMapVal(311, "optComma"),
    SMapVal(312, "optNumber"),
    SMapVal(313, "optSemiCol"),
    SMapVal(314, "_tokenname"),
    SMapVal(315, "optTypename"),
    SMapVal(316, "_baseclass_header"),
    SMapVal(317, "_baseclass_preinclude"),
    SMapVal(318, "_class_header"),
    SMapVal(319, "_class_name"),
    SMapVal(320, "_expect"),
    SMapVal(321, "_filenames"),
    SMapVal(322, "_implementation_header"),
    SMapVal(323, "_incrementPrecedence"),
    SMapVal(324, "_left"),
    SMapVal(325, "_typesymbol"),
    SMapVal(326, "_locationstruct"),
    SMapVal(327, "_ltype"),
    SMapVal(328, "_namespace"),
    SMapVal(329, "_nonassoc"),
    SMapVal(330, "_parsefun_source"),
    SMapVal(331, "_pushPrecedence"),
    SMapVal(332, "_required"),
    SMapVal(333, "_right"),
    SMapVal(334, "_scanner"),
    SMapVal(335, "_scanner_class_name"),
    SMapVal(336, "_scanner_token_function"),
    SMapVal(337, "_scanner_matched_text_function"),
    SMapVal(338, "_start"),
    SMapVal(339, "_symbol_exp"),
    SMapVal(340, "_symbol"),
    SMapVal(341, "_symbolList"),
    SMapVal(342, "_symbols"),
    SMapVal(343, "_target_directory"),
    SMapVal(344, "_type"),
    SMapVal(345, "_stype"),
    SMapVal(346, "_token"),
    SMapVal(347, "_union"),
    SMapVal(348, "_polymorphic"),
    SMapVal(349, "_typespec"),
    SMapVal(350, "_polyspec"),
    SMapVal(351, "_polyspecs"),
    SMapVal(352, "_directiveSpec"),
    SMapVal(353, "_directive"),
    SMapVal(354, "_precSpec"),
    SMapVal(355, "_productionElement"),
    SMapVal(356, "_productionElements"),
    SMapVal(357, "_production"),
    SMapVal(358, "_productionSeparator"),
    SMapVal(359, "_productionList"),
    SMapVal(360, "_ruleName"),
    SMapVal(361, "_rule"),
    SMapVal(362, "input_$"),
};

SMap s_symbol
(
    s_symArr, s_symArr + sizeof(s_symArr) / sizeof(SMapVal)
);

} // anonymous namespace ends



// If the parsing function call uses arguments, then provide an overloaded
// function.  The code below doesn't rely on parameters, so no arguments are
// required.  Furthermore, parse uses a function try block to allow us to do
// ACCEPT and ABORT from anywhere, even from within members called by actions,
// simply throwing the appropriate exceptions.

ParserBase::ParserBase()
:
    d_stackIdx__(-1),
    // $insert debuginit
    d_debug__(true),
    d_nErrors__(0),
    // $insert requiredtokens
    d_requiredTokens__(0),
    d_acceptedTokens__(d_requiredTokens__),
    d_token__(_UNDETERMINED_),
    d_nextToken__(_UNDETERMINED_)
{}

// $insert debugfunctions
std::ostringstream ParserBase::s_out__;
std::ostream &ParserBase::dflush__(std::ostream &out)
{
    std::ostringstream &s_out__ = dynamic_cast<std::ostringstream &>(out);

    std::cout << "    " << s_out__.str() << std::flush;
    s_out__.clear();
    s_out__.str("");
    return out;
}

std::string ParserBase::stype__(char const *pre, 
                 STYPE__ const &semVal, char const *post) const
{
    return "";
}
std::string ParserBase::symbol__(int value) const
{
    using namespace std;
    ostringstream ostr;
    SMap::const_iterator it = s_symbol.find(value);
    if (it != s_symbol.end())
        ostr << '\'' << it->second << '\'';
    else if (isprint(value))
        ostr << '`' << static_cast<char>(value) << "' (" << value << ')';
    else
        ostr << "'\\x" << setfill('0') << hex << setw(2) << value << '\'';
    return ostr.str();
}



void Parser::print__()
{
// $insert print
    
    enum { _UNDETERMINED_ = -2 };
    
    std::cout << "Token: " << symbol__(d_token__) << ", text: `";
    if (d_token__ == _UNDETERMINED_)
        std::cout << "'\n";
    else
        std::cout << d_scanner.matched() << "'\n";
}

void ParserBase::clearin()
{
    d_token__ = d_nextToken__ = _UNDETERMINED_;
}

void ParserBase::push__(size_t state)
{
    if (static_cast<size_t>(d_stackIdx__ + 1) == d_stateStack__.size())
    {
        size_t newSize = d_stackIdx__ + STACK_EXPANSION;
        d_stateStack__.resize(newSize);
        d_valueStack__.resize(newSize);
    }
    ++d_stackIdx__;
    d_stateStack__[d_stackIdx__] = d_state__ = state;
    *(d_vsp__ = &d_valueStack__[d_stackIdx__]) = d_val__;
    // $insert debug
    if (d_debug__)
        s_out__ <<   "push(state " << state << stype__(", semantic TOS = ", d_val__, ")") << ')' << "\n" << dflush__;
}

void ParserBase::popToken__()
{
    d_token__ = d_nextToken__;

    d_val__ = d_nextVal__;
    d_nextVal__ = STYPE__();

    d_nextToken__ = _UNDETERMINED_;
}
     
void ParserBase::pushToken__(int token)
{
    d_nextToken__ = d_token__;
    d_nextVal__ = d_val__;
    d_token__ = token;
}
     
void ParserBase::pop__(size_t count)
{
    // $insert debug
    if (d_debug__)
        s_out__ <<  "pop(" << count << ") from stack having size " << (d_stackIdx__ + 1) << "\n" << dflush__;
    if (d_stackIdx__ < static_cast<int>(count))
    {
        // $insert debug
        if (d_debug__)
            s_out__ <<  "Terminating parse(): unrecoverable input error at token " << symbol__(d_token__) << "\n" << dflush__;
        ABORT();
    }

    d_stackIdx__ -= count;
    d_state__ = d_stateStack__[d_stackIdx__];
    d_vsp__ = &d_valueStack__[d_stackIdx__];
    // $insert debug
    if (d_debug__)
        s_out__ <<  "pop(): next state: " << d_state__ << ", token: " << symbol__(d_token__) ;
    // $insert debug
    if (d_debug__)
        s_out__ <<  stype__("semantic: ", d_val__) << "\n" << dflush__;
}

inline size_t ParserBase::top__() const
{
    return d_stateStack__[d_stackIdx__];
}

void Parser::executeAction(int production)
try
{
    if (d_token__ != _UNDETERMINED_)
        pushToken__(d_token__);     // save an already available token


    // $insert debug
    if (d_debug__)
        s_out__ <<  "executeAction(): of rule " << production ;
    // $insert debug
    if (d_debug__)
        s_out__ <<   stype__(", semantic [TOS]: ", d_val__) << " ..." << "\n" << dflush__;
    switch (production)
    {
        // $insert actioncases
        
        case 2:
        {
         expectRules();
         }
        break;

        case 3:
        {
         d_val__.get<Tag__::TEXT>() = d_matched;
         }
        break;

        case 4:
        {
         d_field = d_vsp__[-1].data<Tag__::TEXT>(); 
         }
        break;

        case 7:
        {
         d_val__.get<Tag__::BOOL>() = true;
         }
        break;

        case 8:
        {
         d_val__.get<Tag__::BOOL>() = false;
         }
        break;

        case 11:
        {
         d_expect = "token name";
         }
        break;

        case 13:
        {
         d_field.clear();
         }
        break;

        case 14:
        {
         wmsg << 
         "Ignoring all input beyond the second %% token" << endl;
         ACCEPT();
         }
        break;

        case 16:
        {
         d_expect = "baseclass header name";
         }
        break;

        case 17:
        {
         d_expect = "baseclass pre-include name";
         }
        break;

        case 18:
        {
         d_expect = "class header name";
         }
        break;

        case 19:
        {
         d_expect = "class name";
         }
        break;

        case 20:
        {
         d_expect = "number (of conflicts)";
         }
        break;

        case 21:
        {
         d_expect = "generic name of files";
         }
        break;

        case 22:
        {
         d_expect = "implementation header name";
         }
        break;

        case 23:
        {
         Terminal::incrementPrecedence();
         }
        break;

        case 24:
        {
         d_association = Terminal::LEFT;
         }
        break;

        case 25:
        {
         d_expect = "Location struct definition";
         }
        break;

        case 26:
        {
         d_expect = "Location type specification";
         }
        break;

        case 27:
        {
         d_expect = "Namespace identifier";
         }
        break;

        case 28:
        {
         d_association = Terminal::NONASSOC;
         }
        break;

        case 29:
        {
         d_expect = "File name for the parse() member";
         }
        break;

        case 30:
        {
         d_val__.get<Tag__::SIZE_T>() = Terminal::sPrecedence();
         Terminal::resetPrecedence();
         }
        break;

        case 31:
        {
         d_expect = "Required number of tokens between errors";
         }
        break;

        case 32:
        {
         d_association = Terminal::RIGHT;
         }
        break;

        case 33:
        {
         d_expect = "Path to the scanner header filename";
         }
        break;

        case 34:
        {
         d_expect = "Name of the Scanner class";
         }
        break;

        case 35:
        {
         d_expect = "Scanner function returning the next token";
         }
        break;

        case 36:
        {
         d_expect = "Scanner function returning the matched text";
         }
        break;

        case 37:
        {
         d_expect = "Start rule" ;
         }
        break;

        case 38:
        {
         d_expect = "identifier or character-constant";
         }
        break;

        case 39:
        {
         defineTerminal(d_scanner.canonicalQuote(), Symbol::CHAR_TERMINAL);
         }
        break;

        case 40:
        { 
         defineTokenName(d_vsp__[-1].data<Tag__::TEXT>(), d_vsp__[0].data<Tag__::BOOL>()); 
         }
        break;

        case 44:
        {
         d_expect = "target directory";
         }
        break;

        case 45:
        {
         d_expect = "type-name";
         d_typeDirective = true;
         }
        break;

        case 46:
        {
         d_expect = "STYPE type name" ;
         }
        break;

        case 47:
        {
         d_expect = "opt. <type> identifier(s) or char constant(s)";
         }
        break;

        case 48:
        {
         d_association = Terminal::UNDEFINED;
         }
        break;

        case 49:
        {
         d_expect = "Semantic value union definition";
         }
        break;

        case 50:
        {
         setPolymorphicDecl();
         }
        break;

        case 51:
        {
         d_scanner.beginTypeSpec();
         }
        break;

        case 52:
        {
         addPolymorphic(d_vsp__[-2].data<Tag__::TEXT>(), d_vsp__[0].data<Tag__::TEXT>());
         }
        break;

        case 55:
        {
         d_options.setBaseClassHeader(); 
         }
        break;

        case 56:
        {
         d_options.setPreInclude();
         }
        break;

        case 57:
        {
         d_options.setClassHeader();
         }
        break;

        case 58:
        {
         d_options.setClassName();
         }
        break;

        case 59:
        {
         d_options.setDebug();
         }
        break;

        case 60:
        {
         d_options.setErrorVerbose();
         }
        break;

        case 61:
        {
         setExpectedConflicts();
         }
        break;

        case 62:
        {
         d_options.setGenericFilename();
         }
        break;

        case 63:
        {
         d_options.setFlex();
         }
        break;

        case 64:
        {
         d_options.setImplementationHeader();
         }
        break;

        case 66:
        {
         d_options.setLocationDecl(d_scanner.block().str());
         }
        break;

        case 67:
        {
         d_options.setLspNeeded();
         }
        break;

        case 68:
        {
         d_options.setLtype();
         }
        break;

        case 69:
        {
         d_options.setNamespace();
         }
        break;

        case 70:
        {
         setNegativeDollarIndices();
         }
        break;

        case 71:
        {
         d_options.unsetLines();
         }
        break;

        case 73:
        {
         d_options.setParsefunSource();
         }
        break;

        case 74:
        {
         d_options.setPrintTokens();
         }
        break;

        case 75:
        {
         d_options.setRequiredTokens(d_scanner.number());
         }
        break;

        case 77:
        {
         d_options.setScannerInclude();
         }
        break;

        case 78:
        {
         d_options.setScannerClassName();
         }
        break;

        case 79:
        {
         d_options.setScannerTokenFunction();
         }
        break;

        case 80:
        {
         d_options.setScannerMatchedTextFunction();
         }
        break;

        case 81:
        {
         setStart();
         }
        break;

        case 82:
        {
         d_options.setStype();
         }
        break;

        case 83:
        {
         d_options.setTargetDirectory();
         }
        break;

        case 84:
        {
         Terminal::set_sPrecedence(d_vsp__[-1].data<Tag__::SIZE_T>());
         }
        break;

        case 86:
        {
         setUnionDecl();
         }
        break;

        case 88:
        {
         d_options.unsetStrongTags();
         }
        break;

        case 90:
        {
         d_expect.erase();
         d_typeDirective = false;
         }
        break;

        case 93:
        {
         d_val__.get<Tag__::SIZE_T>() = static_cast<size_t>(IDENTIFIER);
         }
        break;

        case 94:
        {
         d_val__.get<Tag__::SIZE_T>() = static_cast<size_t>(QUOTE);
         }
        break;

        case 95:
        {
         d_val__ = useTerminal();
         }
        break;

        case 96:
        {
         d_val__ = useSymbol();
         }
        break;

        case 97:
        {
         d_val__ = d_scanner.block();
         }
        break;

        case 98:
        {
         setPrecedence(d_vsp__[0].data<Tag__::SIZE_T>());
         d_val__ = STYPE__();
         
         
         }
        break;

        case 99:
        {
         d_val__ = handleProductionElements(d_vsp__[-1], d_vsp__[0]);
         
         
         }
        break;

        case 100:
        {
         d_val__ = d_vsp__[0];
         }
        break;

        case 101:
        {
         handleProductionElement(d_vsp__[0]);
         
         
         }
        break;

        case 102:
        {
         
         
         checkEmptyBlocktype();
         }
        break;

        case 103:
        {
         d_rules.addProduction(d_scanner.lineNr());
         }
        break;

        case 106:
        {
         openRule(d_vsp__[-1].data<Tag__::TEXT>());
         }
        break;

    }
    // $insert debug
    if (d_debug__)
        s_out__ <<  "... action of rule " << production << " completed" ;
    // $insert debug
    if (d_debug__)
        s_out__ <<   stype__(", semantic: ", d_val__) << "\n" << dflush__;
}
catch (std::exception const &exc)
{
    exceptionHandler__(exc);
}

inline void ParserBase::reduce__(PI__ const &pi)
{
    d_token__ = pi.d_nonTerm;
    pop__(pi.d_size);

    // $insert debug
    if (d_debug__)
        s_out__ <<  "reduce(): by rule " << (&pi - s_productionInfo) ;
    // $insert debug
    if (d_debug__)
        s_out__ <<  " to N-terminal " << symbol__(d_token__) << stype__(", semantic = ", d_val__) << "\n" << dflush__;
}

// If d_token__ is _UNDETERMINED_ then if d_nextToken__ is _UNDETERMINED_ another
// token is obtained from lex(). Then d_nextToken__ is assigned to d_token__.
void Parser::nextToken()
{
    if (d_token__ != _UNDETERMINED_)        // no need for a token: got one
        return;                             // already

    if (d_nextToken__ != _UNDETERMINED_)
    {
        popToken__();                       // consume pending token
        // $insert debug
        if (d_debug__)
            s_out__ <<  "nextToken(): popped " << symbol__(d_token__) << stype__(", semantic = ", d_val__) << "\n" << dflush__;
    }
    else
    {
        ++d_acceptedTokens__;               // accept another token (see
                                            // errorRecover())
        d_token__ = lex();
        if (d_token__ <= 0)
            d_token__ = _EOF_;
    }
    print();
    // $insert debug
    if (d_debug__)
        s_out__ <<  "nextToken(): using " << symbol__(d_token__) << stype__(", semantic = ", d_val__) << "\n" << dflush__;
}

// if the final transition is negative, then we should reduce by the rule
// given by its positive value. Note that the `recovery' parameter is only
// used with the --debug option
int Parser::lookup(bool recovery)
{
// $insert threading
    SR__ *sr = s_state[d_state__];          // get the appropriate state-table
    int lastIdx = sr->d_lastIdx;            // sentinel-index in the SR__ array
    
    SR__ *lastElementPtr = sr + lastIdx;
    lastElementPtr->d_token = d_token__;    // set search-token
    
    SR__ *elementPtr = sr + 1;              // start the search at s_xx[1]
    while (elementPtr->d_token != d_token__)
        ++elementPtr;
    

    if (elementPtr == lastElementPtr)   // reached the last element
    {
        if (elementPtr->d_action < 0)   // default reduction
        {
        // $insert debug
        if (d_debug__)
            s_out__ <<  "lookup(" << d_state__ << ", " << symbol__(d_token__) ;
        // $insert debug
        if (d_debug__)
            s_out__ <<  "): default reduction by rule " << -elementPtr->d_action << "\n" << dflush__;
            return elementPtr->d_action;                
        }
        // $insert debug
        if (d_debug__)
            s_out__ <<  "lookup(" << d_state__ << ", " << symbol__(d_token__) << "): Not " ;
        // $insert debug
        if (d_debug__)
            s_out__ <<  "found. " << (recovery ? "Continue" : "Start") << " error recovery."  << "\n" << dflush__;

        // No default reduction, so token not found, so error.
        throw UNEXPECTED_TOKEN__;
    }

    // not at the last element: inspect the nature of the action
    // (< 0: reduce, 0: ACCEPT, > 0: shift)

    int action = elementPtr->d_action;

// $insert debuglookup
    if (d_debug__)
    {
        s_out__ <<  "lookup(" << d_state__ << ", " << symbol__(d_token__);
    
        if (action < 0)             // a reduction was found
            s_out__ << "): reduce by rule " << -action;
        else if (action == 0)
            s_out__ <<  "): ACCEPT";
        else
            s_out__ <<  "): shift " << action << " (" << symbol__(d_token__) <<
                        " processed)";
    
        s_out__ << "\n" << dflush__;
    }

    return action;
}

    // When an error has occurred, pop elements off the stack until the top
    // state has an error-item. If none is found, the default recovery
    // mode (which is to abort) is activated. 
    //
    // If EOF is encountered without being appropriate for the current state,
    // then the error recovery will fall back to the default recovery mode.
    // (i.e., parsing terminates)
void Parser::errorRecovery()
try
{
    if (d_acceptedTokens__ >= d_requiredTokens__)// only generate an error-
    {                                           // message if enough tokens 
        ++d_nErrors__;                          // were accepted. Otherwise
        error("Syntax error");                  // simply skip input

    }

    // $insert debug
    if (d_debug__)
        s_out__ <<  "errorRecovery(): " << d_nErrors__ << " error(s) so far. State = " << top__() << "\n" << dflush__;

    // get the error state
    while (not (s_state[top__()][0].d_type & ERR_ITEM))
    {
        // $insert debug
        if (d_debug__)
            s_out__ <<  "errorRecovery(): pop state " << top__() << "\n" << dflush__;
        pop__();
    }
    // $insert debug
    if (d_debug__)
        s_out__ <<  "errorRecovery(): state " << top__() << " is an ERROR state" << "\n" << dflush__;

    // In the error state, lookup a token allowing us to proceed.
    // Continuation may be possible following multiple reductions,
    // but eventuall a shift will be used, requiring the retrieval of
    // a terminal token. If a retrieved token doesn't match, the catch below 
    // will ensure the next token is requested in the while(true) block
    // implemented below:

    int lastToken = d_token__;                  // give the unexpected token a
                                                // chance to be processed
                                                // again.

    pushToken__(_error_);                       // specify _error_ as next token
    push__(lookup(true));                       // push the error state

    d_token__ = lastToken;                      // reactivate the unexpected
                                                // token (we're now in an
                                                // ERROR state).

    bool gotToken = true;                       // the next token is a terminal

    while (true)
    {
        try
        {
            if (s_state[d_state__]->d_type & REQ_TOKEN)
            {
                gotToken = d_token__ == _UNDETERMINED_;
                nextToken();                    // obtain next token
            }
            
            int action = lookup(true);

            if (action > 0)                 // push a new state
            {
                push__(action);
                popToken__();
                // $insert debug
                if (d_debug__)
                    s_out__ <<  "errorRecovery() SHIFT state " << action ;
                // $insert debug
                if (d_debug__)
                    s_out__ <<  ", continue with " << symbol__(d_token__) << "\n" << dflush__;

                if (gotToken)
                {
                    // $insert debug
                    if (d_debug__)
                        s_out__ <<  "errorRecovery() COMPLETED: next state " ;
                    // $insert debug
                    if (d_debug__)
                        s_out__ <<  action << ", no token yet" << "\n" << dflush__;

                    d_acceptedTokens__ = 0;
                    return;
                }
            }
            else if (action < 0)
            {
                // no actions executed on recovery but save an already 
                // available token:
                if (d_token__ != _UNDETERMINED_)
                    pushToken__(d_token__);
 
                                            // next token is the rule's LHS
                reduce__(s_productionInfo[-action]); 
                // $insert debug
                if (d_debug__)
                    s_out__ <<  "errorRecovery() REDUCE by rule " << -action ;
                // $insert debug
                if (d_debug__)
                    s_out__ <<  ", token = " << symbol__(d_token__) << "\n" << dflush__;
            }
            else
                ABORT();                    // abort when accepting during
                                            // error recovery
        }
        catch (...)
        {
            if (d_token__ == _EOF_)
                ABORT();                    // saw inappropriate _EOF_
                      
            popToken__();                   // failing token now skipped
        }
    }
}
catch (ErrorRecovery__)       // This is: DEFAULT_RECOVERY_MODE
{
    ABORT();
}

    // The parsing algorithm:
    // Initially, state 0 is pushed on the stack, and d_token__ as well as
    // d_nextToken__ are initialized to _UNDETERMINED_. 
    //
    // Then, in an eternal loop:
    //
    //  1. If a state does not have REQ_TOKEN no token is assigned to
    //     d_token__. If the state has REQ_TOKEN, nextToken() is called to
    //      determine d_nextToken__ and d_token__ is set to
    //     d_nextToken__. nextToken() will not call lex() unless d_nextToken__ is 
    //     _UNDETERMINED_. 
    //
    //  2. lookup() is called: 
    //     d_token__ is stored in the final element's d_token field of the
    //     state's SR_ array. 
    //
    //  3. The current token is looked up in the state's SR_ array
    //
    //  4. Depending on the result of the lookup() function the next state is
    //     shifted on the parser's stack, a reduction by some rule is applied,
    //     or the parsing function returns ACCEPT(). When a reduction is
    //     called for, any action that may have been defined for that
    //     reduction is executed.
    //
    //  5. An error occurs if d_token__ is not found, and the state has no
    //     default reduction. Error handling was described at the top of this
    //     file.

int Parser::parse()
try 
{
    // $insert debug
    if (d_debug__)
        s_out__ <<  "parse(): Parsing starts" << "\n" << dflush__;
    push__(0);                              // initial state
    clearin();                              // clear the tokens.

    while (true)
    {
        // $insert debug
        if (d_debug__)
            s_out__ <<  "==" << "\n" << dflush__;
        try
        {
            if (s_state[d_state__]->d_type & REQ_TOKEN)
                nextToken();                // obtain next token


            int action = lookup(false);     // lookup d_token__ in d_state__

            if (action > 0)                 // SHIFT: push a new state
            {
                push__(action);
                popToken__();               // token processed
            }
            else if (action < 0)            // REDUCE: execute and pop.
            {
                executeAction(-action);
                                            // next token is the rule's LHS
                reduce__(s_productionInfo[-action]); 
            }
            else 
                ACCEPT();
        }
        catch (ErrorRecovery__)
        {
            errorRecovery();
        }
    }
}
catch (Return__ retValue)
{
    // $insert debug
    if (d_debug__)
        s_out__ <<  "parse(): returns " << retValue << "\n" << dflush__;
    return retValue;
}



