1 // A Bison parser, made by GNU Bison 3.7.4.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015, 2018-2020 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 /**
35  ** \file StepFile/step.tab.hxx
36  ** Define the step::parser class.
37  */
38 
39 // C++ LALR(1) parser skeleton written by Akim Demaille.
40 
41 // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
42 // especially those whose name start with YY_ or yy_.  They are
43 // private implementation details that can be changed or removed.
44 
45 #ifndef YY_STEP_STEPFILE_STEP_TAB_HXX_INCLUDED
46 # define YY_STEP_STEPFILE_STEP_TAB_HXX_INCLUDED
47 // "%code requires" blocks.
48 
49 // This file is part of Open CASCADE Technology software library.
50 // This file is generated, do not modify it directly; edit source file step.yacc instead.
51 
52 #include <StepFile_ReadData.hxx>
53 namespace step {
54   class scanner;
55 };
56 
57 #ifdef _MSC_VER
58 // disable MSVC warning C4522: 'step::parser::stack_symbol_type': multiple assignment operators
59 #pragma warning(disable: 4522)
60 // disable MSVC warning C4512: 'step::parser::stack::slice' : assignment operator could not be generated
61 #pragma warning(disable: 4512)
62 #endif
63 
64 
65 
66 
67 # include <cstdlib> // std::abort
68 # include <iostream>
69 # include <stdexcept>
70 # include <string>
71 # include <vector>
72 
73 #if defined __cplusplus
74 # define YY_CPLUSPLUS __cplusplus
75 #else
76 # define YY_CPLUSPLUS 199711L
77 #endif
78 
79 // Support move semantics when possible.
80 #if 201103L <= YY_CPLUSPLUS
81 # define YY_MOVE           std::move
82 # define YY_MOVE_OR_COPY   move
83 # define YY_MOVE_REF(Type) Type&&
84 # define YY_RVREF(Type)    Type&&
85 # define YY_COPY(Type)     Type
86 #else
87 # define YY_MOVE
88 # define YY_MOVE_OR_COPY   copy
89 # define YY_MOVE_REF(Type) Type&
90 # define YY_RVREF(Type)    const Type&
91 # define YY_COPY(Type)     const Type&
92 #endif
93 
94 // Support noexcept when possible.
95 #if 201103L <= YY_CPLUSPLUS
96 # define YY_NOEXCEPT noexcept
97 # define YY_NOTHROW
98 #else
99 # define YY_NOEXCEPT
100 # define YY_NOTHROW throw ()
101 #endif
102 
103 // Support constexpr when possible.
104 #if 201703 <= YY_CPLUSPLUS
105 # define YY_CONSTEXPR constexpr
106 #else
107 # define YY_CONSTEXPR
108 #endif
109 
110 
111 
112 #ifndef YY_ATTRIBUTE_PURE
113 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
114 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
115 # else
116 #  define YY_ATTRIBUTE_PURE
117 # endif
118 #endif
119 
120 #ifndef YY_ATTRIBUTE_UNUSED
121 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
122 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
123 # else
124 #  define YY_ATTRIBUTE_UNUSED
125 # endif
126 #endif
127 
128 /* Suppress unused-variable warnings by "using" E.  */
129 #if ! defined lint || defined __GNUC__
130 # define YYUSE(E) ((void) (E))
131 #else
132 # define YYUSE(E) /* empty */
133 #endif
134 
135 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
136 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
137 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
138     _Pragma ("GCC diagnostic push")                                     \
139     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
140     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
141 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
142     _Pragma ("GCC diagnostic pop")
143 #else
144 # define YY_INITIAL_VALUE(Value) Value
145 #endif
146 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
147 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
148 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
149 #endif
150 #ifndef YY_INITIAL_VALUE
151 # define YY_INITIAL_VALUE(Value) /* Nothing. */
152 #endif
153 
154 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
155 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
156     _Pragma ("GCC diagnostic push")                            \
157     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
158 # define YY_IGNORE_USELESS_CAST_END            \
159     _Pragma ("GCC diagnostic pop")
160 #endif
161 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
162 # define YY_IGNORE_USELESS_CAST_BEGIN
163 # define YY_IGNORE_USELESS_CAST_END
164 #endif
165 
166 # ifndef YY_CAST
167 #  ifdef __cplusplus
168 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
169 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
170 #  else
171 #   define YY_CAST(Type, Val) ((Type) (Val))
172 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
173 #  endif
174 # endif
175 # ifndef YY_NULLPTR
176 #  if defined __cplusplus
177 #   if 201103L <= __cplusplus
178 #    define YY_NULLPTR nullptr
179 #   else
180 #    define YY_NULLPTR 0
181 #   endif
182 #  else
183 #   define YY_NULLPTR ((void*)0)
184 #  endif
185 # endif
186 
187 /* Debug traces.  */
188 #ifndef YYDEBUG
189 # define YYDEBUG 0
190 #endif
191 
192 namespace step {
193 
194 
195 
196 
197   /// A Bison parser.
198   class parser
199   {
200   public:
201 #ifndef YYSTYPE
202     /// Symbol semantic values.
203     typedef int semantic_type;
204 #else
205     typedef YYSTYPE semantic_type;
206 #endif
207 
208     /// Syntax errors thrown from user actions.
209     struct syntax_error : std::runtime_error
210     {
syntax_errorstep::parser::syntax_error211       syntax_error (const std::string& m)
212         : std::runtime_error (m)
213       {}
214 
syntax_errorstep::parser::syntax_error215       syntax_error (const syntax_error& s)
216         : std::runtime_error (s.what ())
217       {}
218 
219       ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
220     };
221 
222     /// Token kinds.
223     struct token
224     {
225       enum token_kind_type
226       {
227         YYEMPTY = -2,
228     YYEOF = 0,                     // "end of file"
229     YYerror = 256,                 // error
230     YYUNDEF = 257,                 // "invalid token"
231     STEP = 258,                    // STEP
232     HEADER = 259,                  // HEADER
233     ENDSEC = 260,                  // ENDSEC
234     DATA = 261,                    // DATA
235     ENDSTEP = 262,                 // ENDSTEP
236     SCOPE = 263,                   // SCOPE
237     ENDSCOPE = 264,                // ENDSCOPE
238     ENTITY = 265,                  // ENTITY
239     TYPE = 266,                    // TYPE
240     INTEGER = 267,                 // INTEGER
241     FLOAT = 268,                   // FLOAT
242     IDENT = 269,                   // IDENT
243     TEXT = 270,                    // TEXT
244     NONDEF = 271,                  // NONDEF
245     ENUM = 272,                    // ENUM
246     HEXA = 273,                    // HEXA
247     QUID = 274                     // QUID
248       };
249       /// Backward compatibility alias (Bison 3.6).
250       typedef token_kind_type yytokentype;
251     };
252 
253     /// Token kind, as returned by yylex.
254     typedef token::yytokentype token_kind_type;
255 
256     /// Backward compatibility alias (Bison 3.6).
257     typedef token_kind_type token_type;
258 
259     /// Symbol kinds.
260     struct symbol_kind
261     {
262       enum symbol_kind_type
263       {
264         YYNTOKENS = 27, ///< Number of tokens.
265         S_YYEMPTY = -2,
266         S_YYEOF = 0,                             // "end of file"
267         S_YYerror = 1,                           // error
268         S_YYUNDEF = 2,                           // "invalid token"
269         S_STEP = 3,                              // STEP
270         S_HEADER = 4,                            // HEADER
271         S_ENDSEC = 5,                            // ENDSEC
272         S_DATA = 6,                              // DATA
273         S_ENDSTEP = 7,                           // ENDSTEP
274         S_SCOPE = 8,                             // SCOPE
275         S_ENDSCOPE = 9,                          // ENDSCOPE
276         S_ENTITY = 10,                           // ENTITY
277         S_TYPE = 11,                             // TYPE
278         S_INTEGER = 12,                          // INTEGER
279         S_FLOAT = 13,                            // FLOAT
280         S_IDENT = 14,                            // IDENT
281         S_TEXT = 15,                             // TEXT
282         S_NONDEF = 16,                           // NONDEF
283         S_ENUM = 17,                             // ENUM
284         S_HEXA = 18,                             // HEXA
285         S_QUID = 19,                             // QUID
286         S_20_ = 20,                              // ' '
287         S_21_ = 21,                              // ';'
288         S_22_ = 22,                              // '('
289         S_23_ = 23,                              // ')'
290         S_24_ = 24,                              // ','
291         S_25_ = 25,                              // '='
292         S_26_ = 26,                              // '/'
293         S_YYACCEPT = 27,                         // $accept
294         S_finvide = 28,                          // finvide
295         S_finstep = 29,                          // finstep
296         S_stepf1 = 30,                           // stepf1
297         S_stepf2 = 31,                           // stepf2
298         S_stepf3 = 32,                           // stepf3
299         S_stepf = 33,                            // stepf
300         S_headl = 34,                            // headl
301         S_headent = 35,                          // headent
302         S_endhead = 36,                          // endhead
303         S_unarg = 37,                            // unarg
304         S_listype = 38,                          // listype
305         S_deblist = 39,                          // deblist
306         S_finlist = 40,                          // finlist
307         S_listarg = 41,                          // listarg
308         S_arglist = 42,                          // arglist
309         S_model = 43,                            // model
310         S_bloc = 44,                             // bloc
311         S_plex = 45,                             // plex
312         S_unent = 46,                            // unent
313         S_debscop = 47,                          // debscop
314         S_unid = 48,                             // unid
315         S_export = 49,                           // export
316         S_debexp = 50,                           // debexp
317         S_finscop = 51,                          // finscop
318         S_entlab = 52,                           // entlab
319         S_enttype = 53                           // enttype
320       };
321     };
322 
323     /// (Internal) symbol kind.
324     typedef symbol_kind::symbol_kind_type symbol_kind_type;
325 
326     /// The number of tokens.
327     static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
328 
329     /// A complete symbol.
330     ///
331     /// Expects its Base type to provide access to the symbol kind
332     /// via kind ().
333     ///
334     /// Provide access to semantic value.
335     template <typename Base>
336     struct basic_symbol : Base
337     {
338       /// Alias to Base.
339       typedef Base super_type;
340 
341       /// Default constructor.
basic_symbolstep::parser::basic_symbol342       basic_symbol ()
343         : value ()
344       {}
345 
346 #if 201103L <= YY_CPLUSPLUS
347       /// Move constructor.
basic_symbolstep::parser::basic_symbol348       basic_symbol (basic_symbol&& that)
349         : Base (std::move (that))
350         , value (std::move (that.value))
351       {}
352 #endif
353 
354       /// Copy constructor.
355       basic_symbol (const basic_symbol& that);
356       /// Constructor for valueless symbols.
357       basic_symbol (typename Base::kind_type t);
358 
359       /// Constructor for symbols with semantic value.
360       basic_symbol (typename Base::kind_type t,
361                     YY_RVREF (semantic_type) v);
362 
363       /// Destroy the symbol.
~basic_symbolstep::parser::basic_symbol364       ~basic_symbol ()
365       {
366         clear ();
367       }
368 
369       /// Destroy contents, and record that is empty.
clearstep::parser::basic_symbol370       void clear ()
371       {
372         Base::clear ();
373       }
374 
375       /// The user-facing name of this symbol.
namestep::parser::basic_symbol376       std::string name () const YY_NOEXCEPT
377       {
378         return parser::symbol_name (this->kind ());
379       }
380 
381       /// Backward compatibility (Bison 3.6).
382       symbol_kind_type type_get () const YY_NOEXCEPT;
383 
384       /// Whether empty.
385       bool empty () const YY_NOEXCEPT;
386 
387       /// Destructive move, \a s is emptied into this.
388       void move (basic_symbol& s);
389 
390       /// The semantic value.
391       semantic_type value;
392 
393     private:
394 #if YY_CPLUSPLUS < 201103L
395       /// Assignment operator.
396       basic_symbol& operator= (const basic_symbol& that);
397 #endif
398     };
399 
400     /// Type access provider for token (enum) based symbols.
401     struct by_kind
402     {
403       /// Default constructor.
404       by_kind ();
405 
406 #if 201103L <= YY_CPLUSPLUS
407       /// Move constructor.
408       by_kind (by_kind&& that);
409 #endif
410 
411       /// Copy constructor.
412       by_kind (const by_kind& that);
413 
414       /// The symbol kind as needed by the constructor.
415       typedef token_kind_type kind_type;
416 
417       /// Constructor from (external) token numbers.
418       by_kind (kind_type t);
419 
420       /// Record that this symbol is empty.
421       void clear ();
422 
423       /// Steal the symbol kind from \a that.
424       void move (by_kind& that);
425 
426       /// The (internal) type number (corresponding to \a type).
427       /// \a empty when empty.
428       symbol_kind_type kind () const YY_NOEXCEPT;
429 
430       /// Backward compatibility (Bison 3.6).
431       symbol_kind_type type_get () const YY_NOEXCEPT;
432 
433       /// The symbol kind.
434       /// \a S_YYEMPTY when empty.
435       symbol_kind_type kind_;
436     };
437 
438     /// Backward compatibility for a private implementation detail (Bison 3.6).
439     typedef by_kind by_type;
440 
441     /// "External" symbols: returned by the scanner.
442     struct symbol_type : basic_symbol<by_kind>
443     {};
444 
445     /// Build a parser object.
446     parser (step::scanner* scanner_yyarg);
447     virtual ~parser ();
448 
449 #if 201103L <= YY_CPLUSPLUS
450     /// Non copyable.
451     parser (const parser&) = delete;
452     /// Non copyable.
453     parser& operator= (const parser&) = delete;
454 #endif
455 
456     /// Parse.  An alias for parse ().
457     /// \returns  0 iff parsing succeeded.
458     int operator() ();
459 
460     /// Parse.
461     /// \returns  0 iff parsing succeeded.
462     virtual int parse ();
463 
464 #if YYDEBUG
465     /// The current debugging stream.
466     std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
467     /// Set the current debugging stream.
468     void set_debug_stream (std::ostream &);
469 
470     /// Type for debugging levels.
471     typedef int debug_level_type;
472     /// The current debugging level.
473     debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
474     /// Set the current debugging level.
475     void set_debug_level (debug_level_type l);
476 #endif
477 
478     /// Report a syntax error.
479     /// \param msg    a description of the syntax error.
480     virtual void error (const std::string& msg);
481 
482     /// Report a syntax error.
483     void error (const syntax_error& err);
484 
485     /// The user-facing name of the symbol whose (internal) number is
486     /// YYSYMBOL.  No bounds checking.
487     static std::string symbol_name (symbol_kind_type yysymbol);
488 
489 
490 
491     class context
492     {
493     public:
494       context (const parser& yyparser, const symbol_type& yyla);
lookahead() const495       const symbol_type& lookahead () const { return yyla_; }
token() const496       symbol_kind_type token () const { return yyla_.kind (); }
497       /// Put in YYARG at most YYARGN of the expected tokens, and return the
498       /// number of tokens stored in YYARG.  If YYARG is null, return the
499       /// number of expected tokens (guaranteed to be less than YYNTOKENS).
500       int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
501 
502     private:
503       const parser& yyparser_;
504       const symbol_type& yyla_;
505     };
506 
507   private:
508 #if YY_CPLUSPLUS < 201103L
509     /// Non copyable.
510     parser (const parser&);
511     /// Non copyable.
512     parser& operator= (const parser&);
513 #endif
514 
515 
516     /// Stored state numbers (used for stacks).
517     typedef signed char state_type;
518 
519     /// The arguments of the error message.
520     int yy_syntax_error_arguments_ (const context& yyctx,
521                                     symbol_kind_type yyarg[], int yyargn) const;
522 
523     /// Generate an error message.
524     /// \param yyctx     the context in which the error occurred.
525     virtual std::string yysyntax_error_ (const context& yyctx) const;
526     /// Compute post-reduction state.
527     /// \param yystate   the current state
528     /// \param yysym     the nonterminal to push on the stack
529     static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
530 
531     /// Whether the given \c yypact_ value indicates a defaulted state.
532     /// \param yyvalue   the value to check
533     static bool yy_pact_value_is_default_ (int yyvalue);
534 
535     /// Whether the given \c yytable_ value indicates a syntax error.
536     /// \param yyvalue   the value to check
537     static bool yy_table_value_is_error_ (int yyvalue);
538 
539     static const signed char yypact_ninf_;
540     static const signed char yytable_ninf_;
541 
542     /// Convert a scanner token kind \a t to a symbol kind.
543     /// In theory \a t should be a token_kind_type, but character literals
544     /// are valid, yet not members of the token_type enum.
545     static symbol_kind_type yytranslate_ (int t);
546 
547     /// Convert the symbol name \a n to a form suitable for a diagnostic.
548     static std::string yytnamerr_ (const char *yystr);
549 
550     /// For a symbol, its name in clear.
551     static const char* const yytname_[];
552 
553 
554     // Tables.
555     // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
556     // STATE-NUM.
557     static const signed char yypact_[];
558 
559     // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
560     // Performed when YYTABLE does not specify something else to do.  Zero
561     // means the default is an error.
562     static const signed char yydefact_[];
563 
564     // YYPGOTO[NTERM-NUM].
565     static const signed char yypgoto_[];
566 
567     // YYDEFGOTO[NTERM-NUM].
568     static const signed char yydefgoto_[];
569 
570     // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
571     // positive, shift that token.  If negative, reduce the rule whose
572     // number is the opposite.  If YYTABLE_NINF, syntax error.
573     static const signed char yytable_[];
574 
575     static const signed char yycheck_[];
576 
577     // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
578     // symbol of state STATE-NUM.
579     static const signed char yystos_[];
580 
581     // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
582     static const signed char yyr1_[];
583 
584     // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
585     static const signed char yyr2_[];
586 
587 
588 #if YYDEBUG
589     // YYRLINE[YYN] -- Source line where rule number YYN was defined.
590     static const unsigned char yyrline_[];
591     /// Report on the debug stream that the rule \a r is going to be reduced.
592     virtual void yy_reduce_print_ (int r) const;
593     /// Print the state stack on the debug stream.
594     virtual void yy_stack_print_ () const;
595 
596     /// Debugging level.
597     int yydebug_;
598     /// Debug stream.
599     std::ostream* yycdebug_;
600 
601     /// \brief Display a symbol kind, value and location.
602     /// \param yyo    The output stream.
603     /// \param yysym  The symbol.
604     template <typename Base>
605     void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
606 #endif
607 
608     /// \brief Reclaim the memory associated to a symbol.
609     /// \param yymsg     Why this token is reclaimed.
610     ///                  If null, print nothing.
611     /// \param yysym     The symbol.
612     template <typename Base>
613     void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
614 
615   private:
616     /// Type access provider for state based symbols.
617     struct by_state
618     {
619       /// Default constructor.
620       by_state () YY_NOEXCEPT;
621 
622       /// The symbol kind as needed by the constructor.
623       typedef state_type kind_type;
624 
625       /// Constructor.
626       by_state (kind_type s) YY_NOEXCEPT;
627 
628       /// Copy constructor.
629       by_state (const by_state& that) YY_NOEXCEPT;
630 
631       /// Record that this symbol is empty.
632       void clear () YY_NOEXCEPT;
633 
634       /// Steal the symbol kind from \a that.
635       void move (by_state& that);
636 
637       /// The symbol kind (corresponding to \a state).
638       /// \a symbol_kind::S_YYEMPTY when empty.
639       symbol_kind_type kind () const YY_NOEXCEPT;
640 
641       /// The state number used to denote an empty symbol.
642       /// We use the initial state, as it does not have a value.
643       enum { empty_state = 0 };
644 
645       /// The state.
646       /// \a empty when empty.
647       state_type state;
648     };
649 
650     /// "Internal" symbol: element of the stack.
651     struct stack_symbol_type : basic_symbol<by_state>
652     {
653       /// Superclass.
654       typedef basic_symbol<by_state> super_type;
655       /// Construct an empty symbol.
656       stack_symbol_type ();
657       /// Move or copy construction.
658       stack_symbol_type (YY_RVREF (stack_symbol_type) that);
659       /// Steal the contents from \a sym to build this.
660       stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
661 #if YY_CPLUSPLUS < 201103L
662       /// Assignment, needed by push_back by some old implementations.
663       /// Moves the contents of that.
664       stack_symbol_type& operator= (stack_symbol_type& that);
665 
666       /// Assignment, needed by push_back by other implementations.
667       /// Needed by some other old implementations.
668       stack_symbol_type& operator= (const stack_symbol_type& that);
669 #endif
670     };
671 
672     /// A stack with random access from its top.
673     template <typename T, typename S = std::vector<T> >
674     class stack
675     {
676     public:
677       // Hide our reversed order.
678       typedef typename S::iterator iterator;
679       typedef typename S::const_iterator const_iterator;
680       typedef typename S::size_type size_type;
681       typedef typename std::ptrdiff_t index_type;
682 
stack(size_type n=200)683       stack (size_type n = 200)
684         : seq_ (n)
685       {}
686 
687 #if 201103L <= YY_CPLUSPLUS
688       /// Non copyable.
689       stack (const stack&) = delete;
690       /// Non copyable.
691       stack& operator= (const stack&) = delete;
692 #endif
693 
694       /// Random access.
695       ///
696       /// Index 0 returns the topmost element.
697       const T&
operator [](index_type i) const698       operator[] (index_type i) const
699       {
700         return seq_[size_type (size () - 1 - i)];
701       }
702 
703       /// Random access.
704       ///
705       /// Index 0 returns the topmost element.
706       T&
operator [](index_type i)707       operator[] (index_type i)
708       {
709         return seq_[size_type (size () - 1 - i)];
710       }
711 
712       /// Steal the contents of \a t.
713       ///
714       /// Close to move-semantics.
715       void
push(YY_MOVE_REF (T)t)716       push (YY_MOVE_REF (T) t)
717       {
718         seq_.push_back (T ());
719         operator[] (0).move (t);
720       }
721 
722       /// Pop elements from the stack.
723       void
pop(std::ptrdiff_t n=1)724       pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
725       {
726         for (; 0 < n; --n)
727           seq_.pop_back ();
728       }
729 
730       /// Pop all elements from the stack.
731       void
clear()732       clear () YY_NOEXCEPT
733       {
734         seq_.clear ();
735       }
736 
737       /// Number of elements on the stack.
738       index_type
size() const739       size () const YY_NOEXCEPT
740       {
741         return index_type (seq_.size ());
742       }
743 
744       /// Iterator on top of the stack (going downwards).
745       const_iterator
begin() const746       begin () const YY_NOEXCEPT
747       {
748         return seq_.begin ();
749       }
750 
751       /// Bottom of the stack.
752       const_iterator
end() const753       end () const YY_NOEXCEPT
754       {
755         return seq_.end ();
756       }
757 
758       /// Present a slice of the top of a stack.
759       class slice
760       {
761       public:
slice(const stack & stack,index_type range)762         slice (const stack& stack, index_type range)
763           : stack_ (stack)
764           , range_ (range)
765         {}
766 
767         const T&
operator [](index_type i) const768         operator[] (index_type i) const
769         {
770           return stack_[range_ - i];
771         }
772 
773       private:
774         const stack& stack_;
775         index_type range_;
776       };
777 
778     private:
779 #if YY_CPLUSPLUS < 201103L
780       /// Non copyable.
781       stack (const stack&);
782       /// Non copyable.
783       stack& operator= (const stack&);
784 #endif
785       /// The wrapped container.
786       S seq_;
787     };
788 
789 
790     /// Stack type.
791     typedef stack<stack_symbol_type> stack_type;
792 
793     /// The stack.
794     stack_type yystack_;
795 
796     /// Push a new state on the stack.
797     /// \param m    a debug message to display
798     ///             if null, no trace is output.
799     /// \param sym  the symbol
800     /// \warning the contents of \a s.value is stolen.
801     void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
802 
803     /// Push a new look ahead token on the state on the stack.
804     /// \param m    a debug message to display
805     ///             if null, no trace is output.
806     /// \param s    the state
807     /// \param sym  the symbol (for its value and location).
808     /// \warning the contents of \a sym.value is stolen.
809     void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
810 
811     /// Pop \a n symbols from the stack.
812     void yypop_ (int n = 1);
813 
814     /// Constants.
815     enum
816     {
817       yylast_ = 82,     ///< Last index in yytable_.
818       yynnts_ = 27,  ///< Number of nonterminal symbols.
819       yyfinal_ = 7 ///< Termination state number.
820     };
821 
822 
823     // User arguments.
824     step::scanner* scanner;
825 
826   };
827 
828 
829 } // step
830 
831 
832 // "%code provides" blocks.
833 
834 // Define stepFlexLexer class by inclusion of FlexLexer.h,
835 // but only if this has not been done yet, to avoid redefinition
836 #if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
837 #define yyFlexLexer stepFlexLexer
838 #include "FlexLexer.h"
839 #endif
840 
841 namespace step {
842 
843     // To feed data back to bison, the yylex method needs yylval and
844     // yylloc parameters. Since the stepFlexLexer class is defined in the
845     // system header <FlexLexer.h> the signature of its yylex() method
846     // can not be changed anymore. This makes it necessary to derive a
847     // scanner class that provides a method with the desired signature:
848 
849     class scanner : public stepFlexLexer
850     {
851     public:
852       explicit scanner(StepFile_ReadData* theDataModel, std::istream* in = 0, std::ostream* out = 0);
853 
854       int lex(step::parser::semantic_type* yylval);
855 
856       StepFile_ReadData* myDataModel;
857     };
858 
859 };
860 
861 
862 
863 #endif // !YY_STEP_STEPFILE_STEP_TAB_HXX_INCLUDED
864