LCOV - code coverage report
Current view: top level - builds/barbot/Cosmos/build/src/ModelGenerator/GspnParser - Gspn-parser.hh (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2021-06-16 15:43:28 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // A Bison parser, made by GNU Bison 3.0.4.
       2             : 
       3             : // Skeleton interface for Bison LALR(1) parsers in C++
       4             : 
       5             : // Copyright (C) 2002-2015 Free Software Foundation, Inc.
       6             : 
       7             : // This program is free software: you can redistribute it and/or modify
       8             : // it under the terms of the GNU General Public License as published by
       9             : // the Free Software Foundation, either version 3 of the License, or
      10             : // (at your option) any later version.
      11             : 
      12             : // This program is distributed in the hope that it will be useful,
      13             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             : // GNU General Public License for more details.
      16             : 
      17             : // You should have received a copy of the GNU General Public License
      18             : // along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : 
      20             : // As a special exception, you may create a larger work that contains
      21             : // part or all of the Bison parser skeleton and distribute that work
      22             : // under terms of your choice, so long as that work isn't itself a
      23             : // parser generator using the skeleton or a modified version thereof
      24             : // as a parser skeleton.  Alternatively, if you modify or redistribute
      25             : // the parser skeleton itself, you may (at your option) remove this
      26             : // special exception, which will cause the skeleton and the resulting
      27             : // Bison output files to be licensed under the GNU General Public
      28             : // License without this special exception.
      29             : 
      30             : // This special exception was added by the Free Software Foundation in
      31             : // version 2.2 of Bison.
      32             : 
      33             : /**
      34             :  ** \file y.tab.h
      35             :  ** Define the gspn::parser class.
      36             :  */
      37             : 
      38             : // C++ LALR(1) parser skeleton written by Akim Demaille.
      39             : 
      40             : #ifndef YY_GSPN_GSPN_PARSER_HH_INCLUDED
      41             : # define YY_GSPN_GSPN_PARSER_HH_INCLUDED
      42             : // //                    "%code requires" blocks.
      43             : #line 6 "../../../../src/ModelGenerator/GspnParser/Gspn-parser.yy" // lalr1.cc:377
      44             : 
      45             : #include <math.h>
      46             : #include <limits.h>
      47             : #include <string>
      48             : #include <fstream>
      49             : #include <sstream>
      50             : #include <set>
      51             : 
      52             : #include "../expressionStruct.hpp"
      53             : #include "../../Simulator/DistributionDef.hpp"
      54             : #include "../Eval/Eval.hpp"
      55             : 
      56             : class Gspn_Reader;
      57             : using namespace std;
      58             : 
      59             : #define BUFF_SIZE 5000
      60             : 
      61             :  
      62             : 
      63             : #line 64 "Gspn-parser.hh" // lalr1.cc:377
      64             : 
      65             : 
      66             : # include <cstdlib> // std::abort
      67             : # include <iostream>
      68             : # include <stdexcept>
      69             : # include <string>
      70             : # include <vector>
      71             : # include "stack.hh"
      72             : # include "location.hh"
      73             : 
      74             : 
      75             : #ifndef YY_ATTRIBUTE
      76             : # if (defined __GNUC__                                               \
      77             :       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
      78             :      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
      79             : #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
      80             : # else
      81             : #  define YY_ATTRIBUTE(Spec) /* empty */
      82             : # endif
      83             : #endif
      84             : 
      85             : #ifndef YY_ATTRIBUTE_PURE
      86             : # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
      87             : #endif
      88             : 
      89             : #ifndef YY_ATTRIBUTE_UNUSED
      90             : # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
      91             : #endif
      92             : 
      93             : #if !defined _Noreturn \
      94             :      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
      95             : # if defined _MSC_VER && 1200 <= _MSC_VER
      96             : #  define _Noreturn __declspec (noreturn)
      97             : # else
      98             : #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
      99             : # endif
     100             : #endif
     101             : 
     102             : /* Suppress unused-variable warnings by "using" E.  */
     103             : #if ! defined lint || defined __GNUC__
     104             : # define YYUSE(E) ((void) (E))
     105             : #else
     106             : # define YYUSE(E) /* empty */
     107             : #endif
     108             : 
     109             : #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
     110             : /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
     111             : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
     112             :     _Pragma ("GCC diagnostic push") \
     113             :     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
     114             :     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
     115             : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
     116             :     _Pragma ("GCC diagnostic pop")
     117             : #else
     118             : # define YY_INITIAL_VALUE(Value) Value
     119             : #endif
     120             : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     121             : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     122             : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
     123             : #endif
     124             : #ifndef YY_INITIAL_VALUE
     125             : # define YY_INITIAL_VALUE(Value) /* Nothing. */
     126             : #endif
     127             : 
     128             : /* Debug traces.  */
     129             : #ifndef YYDEBUG
     130             : # define YYDEBUG 1
     131             : #endif
     132             : 
     133             : 
     134             : namespace gspn {
     135             : #line 136 "Gspn-parser.hh" // lalr1.cc:377
     136             : 
     137             : 
     138             : 
     139             : 
     140             : 
     141             :   /// A Bison parser.
     142             :   class Gspn_parser
     143             :   {
     144             :   public:
     145             : #ifndef YYSTYPE
     146             :     /// Symbol semantic values.
     147             :     union semantic_type
     148             :     {
     149             :     #line 36 "/builds/barbot/Cosmos/build/src/ModelGenerator/GspnParser/../../../../src/ModelGenerator/GspnParser/Gspn-parser.yy" // lalr1.cc:377
     150             : 
     151             :    double       RealVal;
     152             :    int         IntVal;
     153             :    std::string *name;
     154             :    char CharVal[100];
     155             :    char expression[BUFF_SIZE];
     156             : 
     157             : #line 158 "Gspn-parser.hh" // lalr1.cc:377
     158             :     };
     159             : #else
     160             :     typedef YYSTYPE semantic_type;
     161             : #endif
     162             :     /// Symbol locations.
     163             :     typedef location location_type;
     164             : 
     165             :     /// Syntax errors thrown from user actions.
     166             :     struct syntax_error : std::runtime_error
     167             :     {
     168             :       syntax_error (const location_type& l, const std::string& m);
     169             :       location_type location;
     170             :     };
     171             : 
     172             :     /// Tokens.
     173             :     struct token
     174             :     {
     175             :       enum yytokentype
     176             :       {
     177             :         END = 0,
     178             :         str = 258,
     179             :         chr = 259,
     180             :         rval = 260,
     181             :         ival = 261,
     182             :         SEMICOLON = 262,
     183             :         COMMA = 263,
     184             :         LB = 264,
     185             :         RB = 265,
     186             :         EQ = 266,
     187             :         DIV = 267,
     188             :         MUL = 268,
     189             :         PLUS = 269,
     190             :         MINUS = 270,
     191             :         POWER = 271,
     192             :         GspnName = 272,
     193             :         NbPl = 273,
     194             :         NbTr = 274,
     195             :         PList = 275,
     196             :         TList = 276,
     197             :         in = 277,
     198             :         out = 278,
     199             :         marking = 279,
     200             :         transitions = 280,
     201             :         Const = 281,
     202             :         INT = 282,
     203             :         DOUBLE = 283,
     204             :         inhibitor = 284,
     205             :         MIN = 285,
     206             :         MAX = 286,
     207             :         FLOOR = 287,
     208             :         SINGLE = 288,
     209             :         INFINITE = 289,
     210             :         MULTIPLE = 290,
     211             :         ENABLINGMEMORY = 291,
     212             :         AGEMEMORY = 292,
     213             :         IMDT = 293,
     214             :         EXPO = 294
     215             :       };
     216             :     };
     217             : 
     218             :     /// (External) token type, as returned by yylex.
     219             :     typedef token::yytokentype token_type;
     220             : 
     221             :     /// Symbol type: an internal symbol number.
     222             :     typedef int symbol_number_type;
     223             : 
     224             :     /// The symbol type number to denote an empty symbol.
     225             :     enum { empty_symbol = -2 };
     226             : 
     227             :     /// Internal symbol number for tokens (subsumed by symbol_number_type).
     228             :     typedef unsigned char token_number_type;
     229             : 
     230             :     /// A complete symbol.
     231             :     ///
     232             :     /// Expects its Base type to provide access to the symbol type
     233             :     /// via type_get().
     234             :     ///
     235             :     /// Provide access to semantic value and location.
     236             :     template <typename Base>
     237             :     struct basic_symbol : Base
     238             :     {
     239             :       /// Alias to Base.
     240             :       typedef Base super_type;
     241             : 
     242             :       /// Default constructor.
     243             :       basic_symbol ();
     244             : 
     245             :       /// Copy constructor.
     246             :       basic_symbol (const basic_symbol& other);
     247             : 
     248             :       /// Constructor for valueless symbols.
     249             :       basic_symbol (typename Base::kind_type t,
     250             :                     const location_type& l);
     251             : 
     252             :       /// Constructor for symbols with semantic value.
     253             :       basic_symbol (typename Base::kind_type t,
     254             :                     const semantic_type& v,
     255             :                     const location_type& l);
     256             : 
     257             :       /// Destroy the symbol.
     258             :       ~basic_symbol ();
     259             : 
     260             :       /// Destroy contents, and record that is empty.
     261             :       void clear ();
     262             : 
     263             :       /// Whether empty.
     264             :       bool empty () const;
     265             : 
     266             :       /// Destructive move, \a s is emptied into this.
     267             :       void move (basic_symbol& s);
     268             : 
     269             :       /// The semantic value.
     270             :       semantic_type value;
     271             : 
     272             :       /// The location.
     273             :       location_type location;
     274             : 
     275             :     private:
     276             :       /// Assignment operator.
     277             :       basic_symbol& operator= (const basic_symbol& other);
     278             :     };
     279             : 
     280             :     /// Type access provider for token (enum) based symbols.
     281             :     struct by_type
     282             :     {
     283             :       /// Default constructor.
     284             :       by_type ();
     285             : 
     286             :       /// Copy constructor.
     287             :       by_type (const by_type& other);
     288             : 
     289             :       /// The symbol type as needed by the constructor.
     290             :       typedef token_type kind_type;
     291             : 
     292             :       /// Constructor from (external) token numbers.
     293             :       by_type (kind_type t);
     294             : 
     295             :       /// Record that this symbol is empty.
     296             :       void clear ();
     297             : 
     298             :       /// Steal the symbol type from \a that.
     299             :       void move (by_type& that);
     300             : 
     301             :       /// The (internal) type number (corresponding to \a type).
     302             :       /// \a empty when empty.
     303             :       symbol_number_type type_get () const;
     304             : 
     305             :       /// The token.
     306             :       token_type token () const;
     307             : 
     308             :       /// The symbol type.
     309             :       /// \a empty_symbol when empty.
     310             :       /// An int, not token_number_type, to be able to store empty_symbol.
     311             :       int type;
     312             :     };
     313             : 
     314             :     /// "External" symbols: returned by the scanner.
     315             :     typedef basic_symbol<by_type> symbol_type;
     316             : 
     317             : 
     318             :     /// Build a parser object.
     319             :     Gspn_parser (Gspn_Reader& Reader_yyarg);
     320             :     virtual ~Gspn_parser ();
     321             : 
     322             :     /// Parse.
     323             :     /// \returns  0 iff parsing succeeded.
     324             :     virtual int parse ();
     325             : 
     326             : #if YYDEBUG
     327             :     /// The current debugging stream.
     328             :     std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
     329             :     /// Set the current debugging stream.
     330             :     void set_debug_stream (std::ostream &);
     331             : 
     332             :     /// Type for debugging levels.
     333             :     typedef int debug_level_type;
     334             :     /// The current debugging level.
     335             :     debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
     336             :     /// Set the current debugging level.
     337             :     void set_debug_level (debug_level_type l);
     338             : #endif
     339             : 
     340             :     /// Report a syntax error.
     341             :     /// \param loc    where the syntax error is found.
     342             :     /// \param msg    a description of the syntax error.
     343             :     virtual void error (const location_type& loc, const std::string& msg);
     344             : 
     345             :     /// Report a syntax error.
     346             :     void error (const syntax_error& err);
     347             : 
     348             :   private:
     349             :     /// This class is not copyable.
     350             :     Gspn_parser (const Gspn_parser&);
     351             :     Gspn_parser& operator= (const Gspn_parser&);
     352             : 
     353             :     /// State numbers.
     354             :     typedef int state_type;
     355             : 
     356             :     /// Generate an error message.
     357             :     /// \param yystate   the state where the error occurred.
     358             :     /// \param yyla      the lookahead token.
     359             :     virtual std::string yysyntax_error_ (state_type yystate,
     360             :                                          const symbol_type& yyla) const;
     361             : 
     362             :     /// Compute post-reduction state.
     363             :     /// \param yystate   the current state
     364             :     /// \param yysym     the nonterminal to push on the stack
     365             :     state_type yy_lr_goto_state_ (state_type yystate, int yysym);
     366             : 
     367             :     /// Whether the given \c yypact_ value indicates a defaulted state.
     368             :     /// \param yyvalue   the value to check
     369             :     static bool yy_pact_value_is_default_ (int yyvalue);
     370             : 
     371             :     /// Whether the given \c yytable_ value indicates a syntax error.
     372             :     /// \param yyvalue   the value to check
     373             :     static bool yy_table_value_is_error_ (int yyvalue);
     374             : 
     375             :     static const short int yypact_ninf_;
     376             :     static const signed char yytable_ninf_;
     377             : 
     378             :     /// Convert a scanner token number \a t to a symbol number.
     379             :     static token_number_type yytranslate_ (int t);
     380             : 
     381             :     // Tables.
     382             :   // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     383             :   // STATE-NUM.
     384             :   static const short int yypact_[];
     385             : 
     386             :   // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     387             :   // Performed when YYTABLE does not specify something else to do.  Zero
     388             :   // means the default is an error.
     389             :   static const unsigned char yydefact_[];
     390             : 
     391             :   // YYPGOTO[NTERM-NUM].
     392             :   static const short int yypgoto_[];
     393             : 
     394             :   // YYDEFGOTO[NTERM-NUM].
     395             :   static const short int yydefgoto_[];
     396             : 
     397             :   // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     398             :   // positive, shift that token.  If negative, reduce the rule whose
     399             :   // number is the opposite.  If YYTABLE_NINF, syntax error.
     400             :   static const unsigned short int yytable_[];
     401             : 
     402             :   static const short int yycheck_[];
     403             : 
     404             :   // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     405             :   // symbol of state STATE-NUM.
     406             :   static const unsigned char yystos_[];
     407             : 
     408             :   // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
     409             :   static const unsigned char yyr1_[];
     410             : 
     411             :   // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
     412             :   static const unsigned char yyr2_[];
     413             : 
     414             : 
     415             :     /// Convert the symbol name \a n to a form suitable for a diagnostic.
     416             :     static std::string yytnamerr_ (const char *n);
     417             : 
     418             : 
     419             :     /// For a symbol, its name in clear.
     420             :     static const char* const yytname_[];
     421             : #if YYDEBUG
     422             :   // YYRLINE[YYN] -- Source line where rule number YYN was defined.
     423             :   static const unsigned short int yyrline_[];
     424             :     /// Report on the debug stream that the rule \a r is going to be reduced.
     425             :     virtual void yy_reduce_print_ (int r);
     426             :     /// Print the state stack on the debug stream.
     427             :     virtual void yystack_print_ ();
     428             : 
     429             :     // Debugging.
     430             :     int yydebug_;
     431             :     std::ostream* yycdebug_;
     432             : 
     433             :     /// \brief Display a symbol type, value and location.
     434             :     /// \param yyo    The output stream.
     435             :     /// \param yysym  The symbol.
     436             :     template <typename Base>
     437             :     void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
     438             : #endif
     439             : 
     440             :     /// \brief Reclaim the memory associated to a symbol.
     441             :     /// \param yymsg     Why this token is reclaimed.
     442             :     ///                  If null, print nothing.
     443             :     /// \param yysym     The symbol.
     444             :     template <typename Base>
     445             :     void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
     446             : 
     447             :   private:
     448             :     /// Type access provider for state based symbols.
     449             :     struct by_state
     450             :     {
     451             :       /// Default constructor.
     452             :       by_state ();
     453             : 
     454             :       /// The symbol type as needed by the constructor.
     455             :       typedef state_type kind_type;
     456             : 
     457             :       /// Constructor.
     458             :       by_state (kind_type s);
     459             : 
     460             :       /// Copy constructor.
     461             :       by_state (const by_state& other);
     462             : 
     463             :       /// Record that this symbol is empty.
     464             :       void clear ();
     465             : 
     466             :       /// Steal the symbol type from \a that.
     467             :       void move (by_state& that);
     468             : 
     469             :       /// The (internal) type number (corresponding to \a state).
     470             :       /// \a empty_symbol when empty.
     471             :       symbol_number_type type_get () const;
     472             : 
     473             :       /// The state number used to denote an empty symbol.
     474             :       enum { empty_state = -1 };
     475             : 
     476             :       /// The state.
     477             :       /// \a empty when empty.
     478             :       state_type state;
     479             :     };
     480             : 
     481             :     /// "Internal" symbol: element of the stack.
     482       21365 :     struct stack_symbol_type : basic_symbol<by_state>
     483             :     {
     484             :       /// Superclass.
     485             :       typedef basic_symbol<by_state> super_type;
     486             :       /// Construct an empty symbol.
     487             :       stack_symbol_type ();
     488             :       /// Steal the contents from \a sym to build this.
     489             :       stack_symbol_type (state_type s, symbol_type& sym);
     490             :       /// Assignment, needed by push_back.
     491             :       stack_symbol_type& operator= (const stack_symbol_type& that);
     492             :     };
     493             : 
     494             :     /// Stack type.
     495             :     typedef stack<stack_symbol_type> stack_type;
     496             : 
     497             :     /// The stack.
     498             :     stack_type yystack_;
     499             : 
     500             :     /// Push a new state on the stack.
     501             :     /// \param m    a debug message to display
     502             :     ///             if null, no trace is output.
     503             :     /// \param s    the symbol
     504             :     /// \warning the contents of \a s.value is stolen.
     505             :     void yypush_ (const char* m, stack_symbol_type& s);
     506             : 
     507             :     /// Push a new look ahead token on the state on the stack.
     508             :     /// \param m    a debug message to display
     509             :     ///             if null, no trace is output.
     510             :     /// \param s    the state
     511             :     /// \param sym  the symbol (for its value and location).
     512             :     /// \warning the contents of \a s.value is stolen.
     513             :     void yypush_ (const char* m, state_type s, symbol_type& sym);
     514             : 
     515             :     /// Pop \a n symbols the three stacks.
     516             :     void yypop_ (unsigned int n = 1);
     517             : 
     518             :     /// Constants.
     519             :     enum
     520             :     {
     521             :       yyeof_ = 0,
     522             :       yylast_ = 339,     ///< Last index in yytable_.
     523             :       yynnts_ = 39,  ///< Number of nonterminal symbols.
     524             :       yyfinal_ = 15, ///< Termination state number.
     525             :       yyterror_ = 1,
     526             :       yyerrcode_ = 256,
     527             :       yyntokens_ = 42  ///< Number of tokens.
     528             :     };
     529             : 
     530             : 
     531             :     // User arguments.
     532             :     Gspn_Reader& Reader;
     533             :   };
     534             : 
     535             : 
     536             : 
     537             : } // gspn
     538             : #line 539 "Gspn-parser.hh" // lalr1.cc:377
     539             : 
     540             : 
     541             : 
     542             : 
     543             : #endif // !YY_GSPN_GSPN_PARSER_HH_INCLUDED

Generated by: LCOV version 1.13