1// A Bison parser, made by GNU Bison 3.8.2.
2
3// Skeleton interface for Bison LALR(1) parsers in C++
4
5// Copyright (C) 2002-2015, 2018-2021 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 <https://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 QLParser.tab.hh
36 ** Define the QL::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_YY_QLPARSER_TAB_HH_INCLUDED
46# define YY_YY_QLPARSER_TAB_HH_INCLUDED
47// "%code requires" blocks.
48#line 33 "QLParser.yy"
49
50#include "QLParser.h"
51#include "DbeSession.h"
52#include "Expression.h"
53#include "Table.h"
54#include "i18n.h"
55
56#line 57 "QLParser.tab.hh"
57
58# include <cassert>
59# include <cstdlib> // std::abort
60# include <iostream>
61# include <stdexcept>
62# include <string>
63# include <vector>
64
65#if defined __cplusplus
66# define YY_CPLUSPLUS __cplusplus
67#else
68# define YY_CPLUSPLUS 199711L
69#endif
70
71// Support move semantics when possible.
72#if 201103L <= YY_CPLUSPLUS
73# define YY_MOVE           std::move
74# define YY_MOVE_OR_COPY   move
75# define YY_MOVE_REF(Type) Type&&
76# define YY_RVREF(Type)    Type&&
77# define YY_COPY(Type)     Type
78#else
79# define YY_MOVE
80# define YY_MOVE_OR_COPY   copy
81# define YY_MOVE_REF(Type) Type&
82# define YY_RVREF(Type)    const Type&
83# define YY_COPY(Type)     const Type&
84#endif
85
86// Support noexcept when possible.
87#if 201103L <= YY_CPLUSPLUS
88# define YY_NOEXCEPT noexcept
89# define YY_NOTHROW
90#else
91# define YY_NOEXCEPT
92# define YY_NOTHROW throw ()
93#endif
94
95// Support constexpr when possible.
96#if 201703 <= YY_CPLUSPLUS
97# define YY_CONSTEXPR constexpr
98#else
99# define YY_CONSTEXPR
100#endif
101
102#include <typeinfo>
103#ifndef YY_ASSERT
104# include <cassert>
105# define YY_ASSERT assert
106#endif
107
108
109#ifndef YY_ATTRIBUTE_PURE
110# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
111#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
112# else
113#  define YY_ATTRIBUTE_PURE
114# endif
115#endif
116
117#ifndef YY_ATTRIBUTE_UNUSED
118# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
119#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
120# else
121#  define YY_ATTRIBUTE_UNUSED
122# endif
123#endif
124
125/* Suppress unused-variable warnings by "using" E.  */
126#if ! defined lint || defined __GNUC__
127# define YY_USE(E) ((void) (E))
128#else
129# define YY_USE(E) /* empty */
130#endif
131
132/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
133#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
134# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
135#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
136    _Pragma ("GCC diagnostic push")                                     \
137    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
138# else
139#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
140    _Pragma ("GCC diagnostic push")                                     \
141    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
142    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
143# endif
144# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
145    _Pragma ("GCC diagnostic pop")
146#else
147# define YY_INITIAL_VALUE(Value) Value
148#endif
149#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
150# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
151# define YY_IGNORE_MAYBE_UNINITIALIZED_END
152#endif
153#ifndef YY_INITIAL_VALUE
154# define YY_INITIAL_VALUE(Value) /* Nothing. */
155#endif
156
157#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
158# define YY_IGNORE_USELESS_CAST_BEGIN                          \
159    _Pragma ("GCC diagnostic push")                            \
160    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
161# define YY_IGNORE_USELESS_CAST_END            \
162    _Pragma ("GCC diagnostic pop")
163#endif
164#ifndef YY_IGNORE_USELESS_CAST_BEGIN
165# define YY_IGNORE_USELESS_CAST_BEGIN
166# define YY_IGNORE_USELESS_CAST_END
167#endif
168
169# ifndef YY_CAST
170#  ifdef __cplusplus
171#   define YY_CAST(Type, Val) static_cast<Type> (Val)
172#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
173#  else
174#   define YY_CAST(Type, Val) ((Type) (Val))
175#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
176#  endif
177# endif
178# ifndef YY_NULLPTR
179#  if defined __cplusplus
180#   if 201103L <= __cplusplus
181#    define YY_NULLPTR nullptr
182#   else
183#    define YY_NULLPTR 0
184#   endif
185#  else
186#   define YY_NULLPTR ((void*)0)
187#  endif
188# endif
189
190/* Debug traces.  */
191#ifndef YYDEBUG
192# define YYDEBUG 0
193#endif
194
195#line 67 "QLParser.yy"
196namespace QL {
197#line 198 "QLParser.tab.hh"
198
199
200
201
202  /// A Bison parser.
203  class Parser
204  {
205  public:
206#ifdef YYSTYPE
207# ifdef __GNUC__
208#  pragma GCC message "bison: do not #define YYSTYPE in C++, use %define api.value.type"
209# endif
210    typedef YYSTYPE value_type;
211#else
212  /// A buffer to store and retrieve objects.
213  ///
214  /// Sort of a variant, but does not keep track of the nature
215  /// of the stored data, since that knowledge is available
216  /// via the current parser state.
217  class value_type
218  {
219  public:
220    /// Type of *this.
221    typedef value_type self_type;
222
223    /// Empty construction.
224    value_type () YY_NOEXCEPT
225      : yyraw_ ()
226      , yytypeid_ (YY_NULLPTR)
227    {}
228
229    /// Construct and fill.
230    template <typename T>
231    value_type (YY_RVREF (T) t)
232      : yytypeid_ (&typeid (T))
233    {
234      YY_ASSERT (sizeof (T) <= size);
235      new (yyas_<T> ()) T (YY_MOVE (t));
236    }
237
238#if 201103L <= YY_CPLUSPLUS
239    /// Non copyable.
240    value_type (const self_type&) = delete;
241    /// Non copyable.
242    self_type& operator= (const self_type&) = delete;
243#endif
244
245    /// Destruction, allowed only if empty.
246    ~value_type () YY_NOEXCEPT
247    {
248      YY_ASSERT (!yytypeid_);
249    }
250
251# if 201103L <= YY_CPLUSPLUS
252    /// Instantiate a \a T in here from \a t.
253    template <typename T, typename... U>
254    T&
255    emplace (U&&... u)
256    {
257      YY_ASSERT (!yytypeid_);
258      YY_ASSERT (sizeof (T) <= size);
259      yytypeid_ = & typeid (T);
260      return *new (yyas_<T> ()) T (std::forward <U>(u)...);
261    }
262# else
263    /// Instantiate an empty \a T in here.
264    template <typename T>
265    T&
266    emplace ()
267    {
268      YY_ASSERT (!yytypeid_);
269      YY_ASSERT (sizeof (T) <= size);
270      yytypeid_ = & typeid (T);
271      return *new (yyas_<T> ()) T ();
272    }
273
274    /// Instantiate a \a T in here from \a t.
275    template <typename T>
276    T&
277    emplace (const T& t)
278    {
279      YY_ASSERT (!yytypeid_);
280      YY_ASSERT (sizeof (T) <= size);
281      yytypeid_ = & typeid (T);
282      return *new (yyas_<T> ()) T (t);
283    }
284# endif
285
286    /// Instantiate an empty \a T in here.
287    /// Obsolete, use emplace.
288    template <typename T>
289    T&
290    build ()
291    {
292      return emplace<T> ();
293    }
294
295    /// Instantiate a \a T in here from \a t.
296    /// Obsolete, use emplace.
297    template <typename T>
298    T&
299    build (const T& t)
300    {
301      return emplace<T> (t);
302    }
303
304    /// Accessor to a built \a T.
305    template <typename T>
306    T&
307    as () YY_NOEXCEPT
308    {
309      YY_ASSERT (yytypeid_);
310      YY_ASSERT (*yytypeid_ == typeid (T));
311      YY_ASSERT (sizeof (T) <= size);
312      return *yyas_<T> ();
313    }
314
315    /// Const accessor to a built \a T (for %printer).
316    template <typename T>
317    const T&
318    as () const YY_NOEXCEPT
319    {
320      YY_ASSERT (yytypeid_);
321      YY_ASSERT (*yytypeid_ == typeid (T));
322      YY_ASSERT (sizeof (T) <= size);
323      return *yyas_<T> ();
324    }
325
326    /// Swap the content with \a that, of same type.
327    ///
328    /// Both variants must be built beforehand, because swapping the actual
329    /// data requires reading it (with as()), and this is not possible on
330    /// unconstructed variants: it would require some dynamic testing, which
331    /// should not be the variant's responsibility.
332    /// Swapping between built and (possibly) non-built is done with
333    /// self_type::move ().
334    template <typename T>
335    void
336    swap (self_type& that) YY_NOEXCEPT
337    {
338      YY_ASSERT (yytypeid_);
339      YY_ASSERT (*yytypeid_ == *that.yytypeid_);
340      std::swap (as<T> (), that.as<T> ());
341    }
342
343    /// Move the content of \a that to this.
344    ///
345    /// Destroys \a that.
346    template <typename T>
347    void
348    move (self_type& that)
349    {
350# if 201103L <= YY_CPLUSPLUS
351      emplace<T> (std::move (that.as<T> ()));
352# else
353      emplace<T> ();
354      swap<T> (that);
355# endif
356      that.destroy<T> ();
357    }
358
359# if 201103L <= YY_CPLUSPLUS
360    /// Move the content of \a that to this.
361    template <typename T>
362    void
363    move (self_type&& that)
364    {
365      emplace<T> (std::move (that.as<T> ()));
366      that.destroy<T> ();
367    }
368#endif
369
370    /// Copy the content of \a that to this.
371    template <typename T>
372    void
373    copy (const self_type& that)
374    {
375      emplace<T> (that.as<T> ());
376    }
377
378    /// Destroy the stored \a T.
379    template <typename T>
380    void
381    destroy ()
382    {
383      as<T> ().~T ();
384      yytypeid_ = YY_NULLPTR;
385    }
386
387  private:
388#if YY_CPLUSPLUS < 201103L
389    /// Non copyable.
390    value_type (const self_type&);
391    /// Non copyable.
392    self_type& operator= (const self_type&);
393#endif
394
395    /// Accessor to raw memory as \a T.
396    template <typename T>
397    T*
398    yyas_ () YY_NOEXCEPT
399    {
400      void *yyp = yyraw_;
401      return static_cast<T*> (yyp);
402     }
403
404    /// Const accessor to raw memory as \a T.
405    template <typename T>
406    const T*
407    yyas_ () const YY_NOEXCEPT
408    {
409      const void *yyp = yyraw_;
410      return static_cast<const T*> (yyp);
411     }
412
413    /// An auxiliary type to compute the largest semantic type.
414    union union_type
415    {
416      // exp
417      // term
418      char dummy1[sizeof (Expression *)];
419
420      // NAME
421      char dummy2[sizeof (std::string)];
422
423      // NUM
424      // FNAME
425      // JGROUP
426      // JPARENT
427      // QSTR
428      char dummy3[sizeof (uint64_t)];
429    };
430
431    /// The size of the largest semantic type.
432    enum { size = sizeof (union_type) };
433
434    /// A buffer to store semantic values.
435    union
436    {
437      /// Strongest alignment constraints.
438      long double yyalign_me_;
439      /// A buffer large enough to store any of the semantic values.
440      char yyraw_[size];
441    };
442
443    /// Whether the content is built: if defined, the name of the stored type.
444    const std::type_info *yytypeid_;
445  };
446
447#endif
448    /// Backward compatibility (Bison 3.8).
449    typedef value_type semantic_type;
450
451
452    /// Syntax errors thrown from user actions.
453    struct syntax_error : std::runtime_error
454    {
455      syntax_error (const std::string& m)
456        : std::runtime_error (m)
457      {}
458
459      syntax_error (const syntax_error& s)
460        : std::runtime_error (s.what ())
461      {}
462
463      ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
464    };
465
466    /// Token kinds.
467    struct token
468    {
469      enum token_kind_type
470      {
471        L_YYEMPTY = -2,
472    L_YYEOF = 0,                   // YYEOF
473    L_YYerror = 256,               // error
474    L_YYUNDEF = 257,               // "invalid token"
475    L_LPAR = 258,                  // "("
476    L_RPAR = 259,                  // ")"
477    L_HASPROP = 260,               // HASPROP
478    L_FILEIOVFD = 261,             // FILEIOVFD
479    L_NUM = 262,                   // NUM
480    L_FNAME = 263,                 // FNAME
481    L_JGROUP = 264,                // JGROUP
482    L_JPARENT = 265,               // JPARENT
483    L_QSTR = 266,                  // QSTR
484    L_NAME = 267,                  // NAME
485    L_IN = 268,                    // IN
486    L_SOME = 269,                  // SOME
487    L_ORDR = 270,                  // ORDR
488    L_COMMA = 271,                 // COMMA
489    L_QWE = 273,                   // QWE
490    L_COLON = 275,                 // COLON
491    L_AND = 277,                   // AND
492    L_OR = 279,                    // OR
493    L_EQV = 281,                   // EQV
494    L_NEQV = 282,                  // NEQV
495    L_BITAND = 283,                // BITAND
496    L_BITOR = 284,                 // BITOR
497    L_BITXOR = 285,                // BITXOR
498    L_EQ = 287,                    // EQ
499    L_NE = 289,                    // NE
500    L_LT = 291,                    // LT
501    L_GT = 293,                    // GT
502    L_LE = 295,                    // LE
503    L_GE = 297,                    // GE
504    L_LS = 299,                    // LS
505    L_RS = 301,                    // RS
506    L_ADD = 303,                   // ADD
507    L_MINUS = 305,                 // MINUS
508    L_MUL = 307,                   // MUL
509    L_DIV = 309,                   // DIV
510    L_REM = 311,                   // REM
511    L_DEG = 313,                   // DEG
512    L_NOT = 314,                   // NOT
513    L_BITNOT = 316                 // BITNOT
514      };
515      /// Backward compatibility alias (Bison 3.6).
516      typedef token_kind_type yytokentype;
517    };
518
519    /// Token kind, as returned by yylex.
520    typedef token::token_kind_type token_kind_type;
521
522    /// Backward compatibility alias (Bison 3.6).
523    typedef token_kind_type token_type;
524
525    /// Symbol kinds.
526    struct symbol_kind
527    {
528      enum symbol_kind_type
529      {
530        YYNTOKENS = 63, ///< Number of tokens.
531        S_YYEMPTY = -2,
532        S_YYEOF = 0,                             // YYEOF
533        S_YYerror = 1,                           // error
534        S_YYUNDEF = 2,                           // "invalid token"
535        S_LPAR = 3,                              // "("
536        S_RPAR = 4,                              // ")"
537        S_HASPROP = 5,                           // HASPROP
538        S_FILEIOVFD = 6,                         // FILEIOVFD
539        S_NUM = 7,                               // NUM
540        S_FNAME = 8,                             // FNAME
541        S_JGROUP = 9,                            // JGROUP
542        S_JPARENT = 10,                          // JPARENT
543        S_QSTR = 11,                             // QSTR
544        S_NAME = 12,                             // NAME
545        S_IN = 13,                               // IN
546        S_SOME = 14,                             // SOME
547        S_ORDR = 15,                             // ORDR
548        S_COMMA = 16,                            // COMMA
549        S_17_ = 17,                              // ","
550        S_QWE = 18,                              // QWE
551        S_19_ = 19,                              // "?"
552        S_COLON = 20,                            // COLON
553        S_21_ = 21,                              // ":"
554        S_AND = 22,                              // AND
555        S_23_ = 23,                              // "&&"
556        S_OR = 24,                               // OR
557        S_25_ = 25,                              // "|"
558        S_EQV = 26,                              // EQV
559        S_NEQV = 27,                             // NEQV
560        S_BITAND = 28,                           // BITAND
561        S_BITOR = 29,                            // BITOR
562        S_BITXOR = 30,                           // BITXOR
563        S_31_ = 31,                              // "^"
564        S_EQ = 32,                               // EQ
565        S_33_ = 33,                              // "="
566        S_NE = 34,                               // NE
567        S_35_ = 35,                              // "!="
568        S_LT = 36,                               // LT
569        S_37_ = 37,                              // "<"
570        S_GT = 38,                               // GT
571        S_39_ = 39,                              // ">"
572        S_LE = 40,                               // LE
573        S_41_ = 41,                              // "<="
574        S_GE = 42,                               // GE
575        S_43_ = 43,                              // ">="
576        S_LS = 44,                               // LS
577        S_45_ = 45,                              // "<<"
578        S_RS = 46,                               // RS
579        S_47_ = 47,                              // ">>"
580        S_ADD = 48,                              // ADD
581        S_49_ = 49,                              // "+"
582        S_MINUS = 50,                            // MINUS
583        S_51_ = 51,                              // "-"
584        S_MUL = 52,                              // MUL
585        S_53_ = 53,                              // "*"
586        S_DIV = 54,                              // DIV
587        S_55_ = 55,                              // "/"
588        S_REM = 56,                              // REM
589        S_57_ = 57,                              // "%"
590        S_DEG = 58,                              // DEG
591        S_NOT = 59,                              // NOT
592        S_60_ = 60,                              // "!"
593        S_BITNOT = 61,                           // BITNOT
594        S_62_ = 62,                              // "~"
595        S_YYACCEPT = 63,                         // $accept
596        S_S = 64,                                // S
597        S_exp = 65,                              // exp
598        S_term = 66                              // term
599      };
600    };
601
602    /// (Internal) symbol kind.
603    typedef symbol_kind::symbol_kind_type symbol_kind_type;
604
605    /// The number of tokens.
606    static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
607
608    /// A complete symbol.
609    ///
610    /// Expects its Base type to provide access to the symbol kind
611    /// via kind ().
612    ///
613    /// Provide access to semantic value.
614    template <typename Base>
615    struct basic_symbol : Base
616    {
617      /// Alias to Base.
618      typedef Base super_type;
619
620      /// Default constructor.
621      basic_symbol () YY_NOEXCEPT
622        : value ()
623      {}
624
625#if 201103L <= YY_CPLUSPLUS
626      /// Move constructor.
627      basic_symbol (basic_symbol&& that)
628        : Base (std::move (that))
629        , value ()
630      {
631        switch (this->kind ())
632    {
633      case symbol_kind::S_exp: // exp
634      case symbol_kind::S_term: // term
635        value.move< Expression * > (std::move (that.value));
636        break;
637
638      case symbol_kind::S_NAME: // NAME
639        value.move< std::string > (std::move (that.value));
640        break;
641
642      case symbol_kind::S_NUM: // NUM
643      case symbol_kind::S_FNAME: // FNAME
644      case symbol_kind::S_JGROUP: // JGROUP
645      case symbol_kind::S_JPARENT: // JPARENT
646      case symbol_kind::S_QSTR: // QSTR
647        value.move< uint64_t > (std::move (that.value));
648        break;
649
650      default:
651        break;
652    }
653
654      }
655#endif
656
657      /// Copy constructor.
658      basic_symbol (const basic_symbol& that);
659
660      /// Constructors for typed symbols.
661#if 201103L <= YY_CPLUSPLUS
662      basic_symbol (typename Base::kind_type t)
663        : Base (t)
664      {}
665#else
666      basic_symbol (typename Base::kind_type t)
667        : Base (t)
668      {}
669#endif
670
671#if 201103L <= YY_CPLUSPLUS
672      basic_symbol (typename Base::kind_type t, Expression *&& v)
673        : Base (t)
674        , value (std::move (v))
675      {}
676#else
677      basic_symbol (typename Base::kind_type t, const Expression *& v)
678        : Base (t)
679        , value (v)
680      {}
681#endif
682
683#if 201103L <= YY_CPLUSPLUS
684      basic_symbol (typename Base::kind_type t, std::string&& v)
685        : Base (t)
686        , value (std::move (v))
687      {}
688#else
689      basic_symbol (typename Base::kind_type t, const std::string& v)
690        : Base (t)
691        , value (v)
692      {}
693#endif
694
695#if 201103L <= YY_CPLUSPLUS
696      basic_symbol (typename Base::kind_type t, uint64_t&& v)
697        : Base (t)
698        , value (std::move (v))
699      {}
700#else
701      basic_symbol (typename Base::kind_type t, const uint64_t& v)
702        : Base (t)
703        , value (v)
704      {}
705#endif
706
707      /// Destroy the symbol.
708      ~basic_symbol ()
709      {
710        clear ();
711      }
712
713
714
715      /// Destroy contents, and record that is empty.
716      void clear () YY_NOEXCEPT
717      {
718        // User destructor.
719        symbol_kind_type yykind = this->kind ();
720        basic_symbol<Base>& yysym = *this;
721        (void) yysym;
722        switch (yykind)
723        {
724       default:
725          break;
726        }
727
728        // Value type destructor.
729switch (yykind)
730    {
731      case symbol_kind::S_exp: // exp
732      case symbol_kind::S_term: // term
733        value.template destroy< Expression * > ();
734        break;
735
736      case symbol_kind::S_NAME: // NAME
737        value.template destroy< std::string > ();
738        break;
739
740      case symbol_kind::S_NUM: // NUM
741      case symbol_kind::S_FNAME: // FNAME
742      case symbol_kind::S_JGROUP: // JGROUP
743      case symbol_kind::S_JPARENT: // JPARENT
744      case symbol_kind::S_QSTR: // QSTR
745        value.template destroy< uint64_t > ();
746        break;
747
748      default:
749        break;
750    }
751
752        Base::clear ();
753      }
754
755#if YYDEBUG || 0
756      /// The user-facing name of this symbol.
757      const char *name () const YY_NOEXCEPT
758      {
759        return Parser::symbol_name (this->kind ());
760      }
761#endif // #if YYDEBUG || 0
762
763
764      /// Backward compatibility (Bison 3.6).
765      symbol_kind_type type_get () const YY_NOEXCEPT;
766
767      /// Whether empty.
768      bool empty () const YY_NOEXCEPT;
769
770      /// Destructive move, \a s is emptied into this.
771      void move (basic_symbol& s);
772
773      /// The semantic value.
774      value_type value;
775
776    private:
777#if YY_CPLUSPLUS < 201103L
778      /// Assignment operator.
779      basic_symbol& operator= (const basic_symbol& that);
780#endif
781    };
782
783    /// Type access provider for token (enum) based symbols.
784    struct by_kind
785    {
786      /// The symbol kind as needed by the constructor.
787      typedef token_kind_type kind_type;
788
789      /// Default constructor.
790      by_kind () YY_NOEXCEPT;
791
792#if 201103L <= YY_CPLUSPLUS
793      /// Move constructor.
794      by_kind (by_kind&& that) YY_NOEXCEPT;
795#endif
796
797      /// Copy constructor.
798      by_kind (const by_kind& that) YY_NOEXCEPT;
799
800      /// Constructor from (external) token numbers.
801      by_kind (kind_type t) YY_NOEXCEPT;
802
803
804
805      /// Record that this symbol is empty.
806      void clear () YY_NOEXCEPT;
807
808      /// Steal the symbol kind from \a that.
809      void move (by_kind& that);
810
811      /// The (internal) type number (corresponding to \a type).
812      /// \a empty when empty.
813      symbol_kind_type kind () const YY_NOEXCEPT;
814
815      /// Backward compatibility (Bison 3.6).
816      symbol_kind_type type_get () const YY_NOEXCEPT;
817
818      /// The symbol kind.
819      /// \a S_YYEMPTY when empty.
820      symbol_kind_type kind_;
821    };
822
823    /// Backward compatibility for a private implementation detail (Bison 3.6).
824    typedef by_kind by_type;
825
826    /// "External" symbols: returned by the scanner.
827    struct symbol_type : basic_symbol<by_kind>
828    {
829      /// Superclass.
830      typedef basic_symbol<by_kind> super_type;
831
832      /// Empty symbol.
833      symbol_type () YY_NOEXCEPT {}
834
835      /// Constructor for valueless symbols, and symbols from each type.
836#if 201103L <= YY_CPLUSPLUS
837      symbol_type (int tok)
838        : super_type (token_kind_type (tok))
839#else
840      symbol_type (int tok)
841        : super_type (token_kind_type (tok))
842#endif
843      {
844#if !defined _MSC_VER || defined __clang__
845        YY_ASSERT (tok == token::L_YYEOF
846                   || (token::L_YYerror <= tok && tok <= token::L_FILEIOVFD)
847                   || (token::L_IN <= tok && tok <= 317));
848#endif
849      }
850#if 201103L <= YY_CPLUSPLUS
851      symbol_type (int tok, std::string v)
852        : super_type (token_kind_type (tok), std::move (v))
853#else
854      symbol_type (int tok, const std::string& v)
855        : super_type (token_kind_type (tok), v)
856#endif
857      {
858#if !defined _MSC_VER || defined __clang__
859        YY_ASSERT (tok == token::L_NAME);
860#endif
861      }
862#if 201103L <= YY_CPLUSPLUS
863      symbol_type (int tok, uint64_t v)
864        : super_type (token_kind_type (tok), std::move (v))
865#else
866      symbol_type (int tok, const uint64_t& v)
867        : super_type (token_kind_type (tok), v)
868#endif
869      {
870#if !defined _MSC_VER || defined __clang__
871        YY_ASSERT ((token::L_NUM <= tok && tok <= token::L_QSTR));
872#endif
873      }
874    };
875
876    /// Build a parser object.
877    Parser (QL::Result &result_yyarg);
878    virtual ~Parser ();
879
880#if 201103L <= YY_CPLUSPLUS
881    /// Non copyable.
882    Parser (const Parser&) = delete;
883    /// Non copyable.
884    Parser& operator= (const Parser&) = delete;
885#endif
886
887    /// Parse.  An alias for parse ().
888    /// \returns  0 iff parsing succeeded.
889    int operator() ();
890
891    /// Parse.
892    /// \returns  0 iff parsing succeeded.
893    virtual int parse ();
894
895#if YYDEBUG
896    /// The current debugging stream.
897    std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
898    /// Set the current debugging stream.
899    void set_debug_stream (std::ostream &);
900
901    /// Type for debugging levels.
902    typedef int debug_level_type;
903    /// The current debugging level.
904    debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
905    /// Set the current debugging level.
906    void set_debug_level (debug_level_type l);
907#endif
908
909    /// Report a syntax error.
910    /// \param msg    a description of the syntax error.
911    virtual void error (const std::string& msg);
912
913    /// Report a syntax error.
914    void error (const syntax_error& err);
915
916#if YYDEBUG || 0
917    /// The user-facing name of the symbol whose (internal) number is
918    /// YYSYMBOL.  No bounds checking.
919    static const char *symbol_name (symbol_kind_type yysymbol);
920#endif // #if YYDEBUG || 0
921
922
923    // Implementation of make_symbol for each token kind.
924#if 201103L <= YY_CPLUSPLUS
925      static
926      symbol_type
927      make_YYEOF ()
928      {
929        return symbol_type (token::L_YYEOF);
930      }
931#else
932      static
933      symbol_type
934      make_YYEOF ()
935      {
936        return symbol_type (token::L_YYEOF);
937      }
938#endif
939#if 201103L <= YY_CPLUSPLUS
940      static
941      symbol_type
942      make_YYerror ()
943      {
944        return symbol_type (token::L_YYerror);
945      }
946#else
947      static
948      symbol_type
949      make_YYerror ()
950      {
951        return symbol_type (token::L_YYerror);
952      }
953#endif
954#if 201103L <= YY_CPLUSPLUS
955      static
956      symbol_type
957      make_YYUNDEF ()
958      {
959        return symbol_type (token::L_YYUNDEF);
960      }
961#else
962      static
963      symbol_type
964      make_YYUNDEF ()
965      {
966        return symbol_type (token::L_YYUNDEF);
967      }
968#endif
969#if 201103L <= YY_CPLUSPLUS
970      static
971      symbol_type
972      make_LPAR ()
973      {
974        return symbol_type (token::L_LPAR);
975      }
976#else
977      static
978      symbol_type
979      make_LPAR ()
980      {
981        return symbol_type (token::L_LPAR);
982      }
983#endif
984#if 201103L <= YY_CPLUSPLUS
985      static
986      symbol_type
987      make_RPAR ()
988      {
989        return symbol_type (token::L_RPAR);
990      }
991#else
992      static
993      symbol_type
994      make_RPAR ()
995      {
996        return symbol_type (token::L_RPAR);
997      }
998#endif
999#if 201103L <= YY_CPLUSPLUS
1000      static
1001      symbol_type
1002      make_HASPROP ()
1003      {
1004        return symbol_type (token::L_HASPROP);
1005      }
1006#else
1007      static
1008      symbol_type
1009      make_HASPROP ()
1010      {
1011        return symbol_type (token::L_HASPROP);
1012      }
1013#endif
1014#if 201103L <= YY_CPLUSPLUS
1015      static
1016      symbol_type
1017      make_FILEIOVFD ()
1018      {
1019        return symbol_type (token::L_FILEIOVFD);
1020      }
1021#else
1022      static
1023      symbol_type
1024      make_FILEIOVFD ()
1025      {
1026        return symbol_type (token::L_FILEIOVFD);
1027      }
1028#endif
1029#if 201103L <= YY_CPLUSPLUS
1030      static
1031      symbol_type
1032      make_NUM (uint64_t v)
1033      {
1034        return symbol_type (token::L_NUM, std::move (v));
1035      }
1036#else
1037      static
1038      symbol_type
1039      make_NUM (const uint64_t& v)
1040      {
1041        return symbol_type (token::L_NUM, v);
1042      }
1043#endif
1044#if 201103L <= YY_CPLUSPLUS
1045      static
1046      symbol_type
1047      make_FNAME (uint64_t v)
1048      {
1049        return symbol_type (token::L_FNAME, std::move (v));
1050      }
1051#else
1052      static
1053      symbol_type
1054      make_FNAME (const uint64_t& v)
1055      {
1056        return symbol_type (token::L_FNAME, v);
1057      }
1058#endif
1059#if 201103L <= YY_CPLUSPLUS
1060      static
1061      symbol_type
1062      make_JGROUP (uint64_t v)
1063      {
1064        return symbol_type (token::L_JGROUP, std::move (v));
1065      }
1066#else
1067      static
1068      symbol_type
1069      make_JGROUP (const uint64_t& v)
1070      {
1071        return symbol_type (token::L_JGROUP, v);
1072      }
1073#endif
1074#if 201103L <= YY_CPLUSPLUS
1075      static
1076      symbol_type
1077      make_JPARENT (uint64_t v)
1078      {
1079        return symbol_type (token::L_JPARENT, std::move (v));
1080      }
1081#else
1082      static
1083      symbol_type
1084      make_JPARENT (const uint64_t& v)
1085      {
1086        return symbol_type (token::L_JPARENT, v);
1087      }
1088#endif
1089#if 201103L <= YY_CPLUSPLUS
1090      static
1091      symbol_type
1092      make_QSTR (uint64_t v)
1093      {
1094        return symbol_type (token::L_QSTR, std::move (v));
1095      }
1096#else
1097      static
1098      symbol_type
1099      make_QSTR (const uint64_t& v)
1100      {
1101        return symbol_type (token::L_QSTR, v);
1102      }
1103#endif
1104#if 201103L <= YY_CPLUSPLUS
1105      static
1106      symbol_type
1107      make_NAME (std::string v)
1108      {
1109        return symbol_type (token::L_NAME, std::move (v));
1110      }
1111#else
1112      static
1113      symbol_type
1114      make_NAME (const std::string& v)
1115      {
1116        return symbol_type (token::L_NAME, v);
1117      }
1118#endif
1119#if 201103L <= YY_CPLUSPLUS
1120      static
1121      symbol_type
1122      make_IN ()
1123      {
1124        return symbol_type (token::L_IN);
1125      }
1126#else
1127      static
1128      symbol_type
1129      make_IN ()
1130      {
1131        return symbol_type (token::L_IN);
1132      }
1133#endif
1134#if 201103L <= YY_CPLUSPLUS
1135      static
1136      symbol_type
1137      make_SOME ()
1138      {
1139        return symbol_type (token::L_SOME);
1140      }
1141#else
1142      static
1143      symbol_type
1144      make_SOME ()
1145      {
1146        return symbol_type (token::L_SOME);
1147      }
1148#endif
1149#if 201103L <= YY_CPLUSPLUS
1150      static
1151      symbol_type
1152      make_ORDR ()
1153      {
1154        return symbol_type (token::L_ORDR);
1155      }
1156#else
1157      static
1158      symbol_type
1159      make_ORDR ()
1160      {
1161        return symbol_type (token::L_ORDR);
1162      }
1163#endif
1164#if 201103L <= YY_CPLUSPLUS
1165      static
1166      symbol_type
1167      make_COMMA ()
1168      {
1169        return symbol_type (token::L_COMMA);
1170      }
1171#else
1172      static
1173      symbol_type
1174      make_COMMA ()
1175      {
1176        return symbol_type (token::L_COMMA);
1177      }
1178#endif
1179#if 201103L <= YY_CPLUSPLUS
1180      static
1181      symbol_type
1182      make_QWE ()
1183      {
1184        return symbol_type (token::L_QWE);
1185      }
1186#else
1187      static
1188      symbol_type
1189      make_QWE ()
1190      {
1191        return symbol_type (token::L_QWE);
1192      }
1193#endif
1194#if 201103L <= YY_CPLUSPLUS
1195      static
1196      symbol_type
1197      make_COLON ()
1198      {
1199        return symbol_type (token::L_COLON);
1200      }
1201#else
1202      static
1203      symbol_type
1204      make_COLON ()
1205      {
1206        return symbol_type (token::L_COLON);
1207      }
1208#endif
1209#if 201103L <= YY_CPLUSPLUS
1210      static
1211      symbol_type
1212      make_AND ()
1213      {
1214        return symbol_type (token::L_AND);
1215      }
1216#else
1217      static
1218      symbol_type
1219      make_AND ()
1220      {
1221        return symbol_type (token::L_AND);
1222      }
1223#endif
1224#if 201103L <= YY_CPLUSPLUS
1225      static
1226      symbol_type
1227      make_OR ()
1228      {
1229        return symbol_type (token::L_OR);
1230      }
1231#else
1232      static
1233      symbol_type
1234      make_OR ()
1235      {
1236        return symbol_type (token::L_OR);
1237      }
1238#endif
1239#if 201103L <= YY_CPLUSPLUS
1240      static
1241      symbol_type
1242      make_EQV ()
1243      {
1244        return symbol_type (token::L_EQV);
1245      }
1246#else
1247      static
1248      symbol_type
1249      make_EQV ()
1250      {
1251        return symbol_type (token::L_EQV);
1252      }
1253#endif
1254#if 201103L <= YY_CPLUSPLUS
1255      static
1256      symbol_type
1257      make_NEQV ()
1258      {
1259        return symbol_type (token::L_NEQV);
1260      }
1261#else
1262      static
1263      symbol_type
1264      make_NEQV ()
1265      {
1266        return symbol_type (token::L_NEQV);
1267      }
1268#endif
1269#if 201103L <= YY_CPLUSPLUS
1270      static
1271      symbol_type
1272      make_BITAND ()
1273      {
1274        return symbol_type (token::L_BITAND);
1275      }
1276#else
1277      static
1278      symbol_type
1279      make_BITAND ()
1280      {
1281        return symbol_type (token::L_BITAND);
1282      }
1283#endif
1284#if 201103L <= YY_CPLUSPLUS
1285      static
1286      symbol_type
1287      make_BITOR ()
1288      {
1289        return symbol_type (token::L_BITOR);
1290      }
1291#else
1292      static
1293      symbol_type
1294      make_BITOR ()
1295      {
1296        return symbol_type (token::L_BITOR);
1297      }
1298#endif
1299#if 201103L <= YY_CPLUSPLUS
1300      static
1301      symbol_type
1302      make_BITXOR ()
1303      {
1304        return symbol_type (token::L_BITXOR);
1305      }
1306#else
1307      static
1308      symbol_type
1309      make_BITXOR ()
1310      {
1311        return symbol_type (token::L_BITXOR);
1312      }
1313#endif
1314#if 201103L <= YY_CPLUSPLUS
1315      static
1316      symbol_type
1317      make_EQ ()
1318      {
1319        return symbol_type (token::L_EQ);
1320      }
1321#else
1322      static
1323      symbol_type
1324      make_EQ ()
1325      {
1326        return symbol_type (token::L_EQ);
1327      }
1328#endif
1329#if 201103L <= YY_CPLUSPLUS
1330      static
1331      symbol_type
1332      make_NE ()
1333      {
1334        return symbol_type (token::L_NE);
1335      }
1336#else
1337      static
1338      symbol_type
1339      make_NE ()
1340      {
1341        return symbol_type (token::L_NE);
1342      }
1343#endif
1344#if 201103L <= YY_CPLUSPLUS
1345      static
1346      symbol_type
1347      make_LT ()
1348      {
1349        return symbol_type (token::L_LT);
1350      }
1351#else
1352      static
1353      symbol_type
1354      make_LT ()
1355      {
1356        return symbol_type (token::L_LT);
1357      }
1358#endif
1359#if 201103L <= YY_CPLUSPLUS
1360      static
1361      symbol_type
1362      make_GT ()
1363      {
1364        return symbol_type (token::L_GT);
1365      }
1366#else
1367      static
1368      symbol_type
1369      make_GT ()
1370      {
1371        return symbol_type (token::L_GT);
1372      }
1373#endif
1374#if 201103L <= YY_CPLUSPLUS
1375      static
1376      symbol_type
1377      make_LE ()
1378      {
1379        return symbol_type (token::L_LE);
1380      }
1381#else
1382      static
1383      symbol_type
1384      make_LE ()
1385      {
1386        return symbol_type (token::L_LE);
1387      }
1388#endif
1389#if 201103L <= YY_CPLUSPLUS
1390      static
1391      symbol_type
1392      make_GE ()
1393      {
1394        return symbol_type (token::L_GE);
1395      }
1396#else
1397      static
1398      symbol_type
1399      make_GE ()
1400      {
1401        return symbol_type (token::L_GE);
1402      }
1403#endif
1404#if 201103L <= YY_CPLUSPLUS
1405      static
1406      symbol_type
1407      make_LS ()
1408      {
1409        return symbol_type (token::L_LS);
1410      }
1411#else
1412      static
1413      symbol_type
1414      make_LS ()
1415      {
1416        return symbol_type (token::L_LS);
1417      }
1418#endif
1419#if 201103L <= YY_CPLUSPLUS
1420      static
1421      symbol_type
1422      make_RS ()
1423      {
1424        return symbol_type (token::L_RS);
1425      }
1426#else
1427      static
1428      symbol_type
1429      make_RS ()
1430      {
1431        return symbol_type (token::L_RS);
1432      }
1433#endif
1434#if 201103L <= YY_CPLUSPLUS
1435      static
1436      symbol_type
1437      make_ADD ()
1438      {
1439        return symbol_type (token::L_ADD);
1440      }
1441#else
1442      static
1443      symbol_type
1444      make_ADD ()
1445      {
1446        return symbol_type (token::L_ADD);
1447      }
1448#endif
1449#if 201103L <= YY_CPLUSPLUS
1450      static
1451      symbol_type
1452      make_MINUS ()
1453      {
1454        return symbol_type (token::L_MINUS);
1455      }
1456#else
1457      static
1458      symbol_type
1459      make_MINUS ()
1460      {
1461        return symbol_type (token::L_MINUS);
1462      }
1463#endif
1464#if 201103L <= YY_CPLUSPLUS
1465      static
1466      symbol_type
1467      make_MUL ()
1468      {
1469        return symbol_type (token::L_MUL);
1470      }
1471#else
1472      static
1473      symbol_type
1474      make_MUL ()
1475      {
1476        return symbol_type (token::L_MUL);
1477      }
1478#endif
1479#if 201103L <= YY_CPLUSPLUS
1480      static
1481      symbol_type
1482      make_DIV ()
1483      {
1484        return symbol_type (token::L_DIV);
1485      }
1486#else
1487      static
1488      symbol_type
1489      make_DIV ()
1490      {
1491        return symbol_type (token::L_DIV);
1492      }
1493#endif
1494#if 201103L <= YY_CPLUSPLUS
1495      static
1496      symbol_type
1497      make_REM ()
1498      {
1499        return symbol_type (token::L_REM);
1500      }
1501#else
1502      static
1503      symbol_type
1504      make_REM ()
1505      {
1506        return symbol_type (token::L_REM);
1507      }
1508#endif
1509#if 201103L <= YY_CPLUSPLUS
1510      static
1511      symbol_type
1512      make_DEG ()
1513      {
1514        return symbol_type (token::L_DEG);
1515      }
1516#else
1517      static
1518      symbol_type
1519      make_DEG ()
1520      {
1521        return symbol_type (token::L_DEG);
1522      }
1523#endif
1524#if 201103L <= YY_CPLUSPLUS
1525      static
1526      symbol_type
1527      make_NOT ()
1528      {
1529        return symbol_type (token::L_NOT);
1530      }
1531#else
1532      static
1533      symbol_type
1534      make_NOT ()
1535      {
1536        return symbol_type (token::L_NOT);
1537      }
1538#endif
1539#if 201103L <= YY_CPLUSPLUS
1540      static
1541      symbol_type
1542      make_BITNOT ()
1543      {
1544        return symbol_type (token::L_BITNOT);
1545      }
1546#else
1547      static
1548      symbol_type
1549      make_BITNOT ()
1550      {
1551        return symbol_type (token::L_BITNOT);
1552      }
1553#endif
1554
1555
1556  private:
1557#if YY_CPLUSPLUS < 201103L
1558    /// Non copyable.
1559    Parser (const Parser&);
1560    /// Non copyable.
1561    Parser& operator= (const Parser&);
1562#endif
1563
1564
1565    /// Stored state numbers (used for stacks).
1566    typedef signed char state_type;
1567
1568    /// Compute post-reduction state.
1569    /// \param yystate   the current state
1570    /// \param yysym     the nonterminal to push on the stack
1571    static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
1572
1573    /// Whether the given \c yypact_ value indicates a defaulted state.
1574    /// \param yyvalue   the value to check
1575    static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT;
1576
1577    /// Whether the given \c yytable_ value indicates a syntax error.
1578    /// \param yyvalue   the value to check
1579    static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT;
1580
1581    static const signed char yypact_ninf_;
1582    static const signed char yytable_ninf_;
1583
1584    /// Convert a scanner token kind \a t to a symbol kind.
1585    /// In theory \a t should be a token_kind_type, but character literals
1586    /// are valid, yet not members of the token_kind_type enum.
1587    static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT;
1588
1589#if YYDEBUG || 0
1590    /// For a symbol, its name in clear.
1591    static const char* const yytname_[];
1592#endif // #if YYDEBUG || 0
1593
1594
1595    // Tables.
1596    // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1597    // STATE-NUM.
1598    static const short yypact_[];
1599
1600    // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1601    // Performed when YYTABLE does not specify something else to do.  Zero
1602    // means the default is an error.
1603    static const signed char yydefact_[];
1604
1605    // YYPGOTO[NTERM-NUM].
1606    static const signed char yypgoto_[];
1607
1608    // YYDEFGOTO[NTERM-NUM].
1609    static const signed char yydefgoto_[];
1610
1611    // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
1612    // positive, shift that token.  If negative, reduce the rule whose
1613    // number is the opposite.  If YYTABLE_NINF, syntax error.
1614    static const signed char yytable_[];
1615
1616    static const signed char yycheck_[];
1617
1618    // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1619    // state STATE-NUM.
1620    static const signed char yystos_[];
1621
1622    // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
1623    static const signed char yyr1_[];
1624
1625    // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.
1626    static const signed char yyr2_[];
1627
1628
1629#if YYDEBUG
1630    // YYRLINE[YYN] -- Source line where rule number YYN was defined.
1631    static const unsigned char yyrline_[];
1632    /// Report on the debug stream that the rule \a r is going to be reduced.
1633    virtual void yy_reduce_print_ (int r) const;
1634    /// Print the state stack on the debug stream.
1635    virtual void yy_stack_print_ () const;
1636
1637    /// Debugging level.
1638    int yydebug_;
1639    /// Debug stream.
1640    std::ostream* yycdebug_;
1641
1642    /// \brief Display a symbol kind, value and location.
1643    /// \param yyo    The output stream.
1644    /// \param yysym  The symbol.
1645    template <typename Base>
1646    void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
1647#endif
1648
1649    /// \brief Reclaim the memory associated to a symbol.
1650    /// \param yymsg     Why this token is reclaimed.
1651    ///                  If null, print nothing.
1652    /// \param yysym     The symbol.
1653    template <typename Base>
1654    void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
1655
1656  private:
1657    /// Type access provider for state based symbols.
1658    struct by_state
1659    {
1660      /// Default constructor.
1661      by_state () YY_NOEXCEPT;
1662
1663      /// The symbol kind as needed by the constructor.
1664      typedef state_type kind_type;
1665
1666      /// Constructor.
1667      by_state (kind_type s) YY_NOEXCEPT;
1668
1669      /// Copy constructor.
1670      by_state (const by_state& that) YY_NOEXCEPT;
1671
1672      /// Record that this symbol is empty.
1673      void clear () YY_NOEXCEPT;
1674
1675      /// Steal the symbol kind from \a that.
1676      void move (by_state& that);
1677
1678      /// The symbol kind (corresponding to \a state).
1679      /// \a symbol_kind::S_YYEMPTY when empty.
1680      symbol_kind_type kind () const YY_NOEXCEPT;
1681
1682      /// The state number used to denote an empty symbol.
1683      /// We use the initial state, as it does not have a value.
1684      enum { empty_state = 0 };
1685
1686      /// The state.
1687      /// \a empty when empty.
1688      state_type state;
1689    };
1690
1691    /// "Internal" symbol: element of the stack.
1692    struct stack_symbol_type : basic_symbol<by_state>
1693    {
1694      /// Superclass.
1695      typedef basic_symbol<by_state> super_type;
1696      /// Construct an empty symbol.
1697      stack_symbol_type ();
1698      /// Move or copy construction.
1699      stack_symbol_type (YY_RVREF (stack_symbol_type) that);
1700      /// Steal the contents from \a sym to build this.
1701      stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
1702#if YY_CPLUSPLUS < 201103L
1703      /// Assignment, needed by push_back by some old implementations.
1704      /// Moves the contents of that.
1705      stack_symbol_type& operator= (stack_symbol_type& that);
1706
1707      /// Assignment, needed by push_back by other implementations.
1708      /// Needed by some other old implementations.
1709      stack_symbol_type& operator= (const stack_symbol_type& that);
1710#endif
1711    };
1712
1713    /// A stack with random access from its top.
1714    template <typename T, typename S = std::vector<T> >
1715    class stack
1716    {
1717    public:
1718      // Hide our reversed order.
1719      typedef typename S::iterator iterator;
1720      typedef typename S::const_iterator const_iterator;
1721      typedef typename S::size_type size_type;
1722      typedef typename std::ptrdiff_t index_type;
1723
1724      stack (size_type n = 200) YY_NOEXCEPT
1725        : seq_ (n)
1726      {}
1727
1728#if 201103L <= YY_CPLUSPLUS
1729      /// Non copyable.
1730      stack (const stack&) = delete;
1731      /// Non copyable.
1732      stack& operator= (const stack&) = delete;
1733#endif
1734
1735      /// Random access.
1736      ///
1737      /// Index 0 returns the topmost element.
1738      const T&
1739      operator[] (index_type i) const
1740      {
1741        return seq_[size_type (size () - 1 - i)];
1742      }
1743
1744      /// Random access.
1745      ///
1746      /// Index 0 returns the topmost element.
1747      T&
1748      operator[] (index_type i)
1749      {
1750        return seq_[size_type (size () - 1 - i)];
1751      }
1752
1753      /// Steal the contents of \a t.
1754      ///
1755      /// Close to move-semantics.
1756      void
1757      push (YY_MOVE_REF (T) t)
1758      {
1759        seq_.push_back (T ());
1760        operator[] (0).move (t);
1761      }
1762
1763      /// Pop elements from the stack.
1764      void
1765      pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
1766      {
1767        for (; 0 < n; --n)
1768          seq_.pop_back ();
1769      }
1770
1771      /// Pop all elements from the stack.
1772      void
1773      clear () YY_NOEXCEPT
1774      {
1775        seq_.clear ();
1776      }
1777
1778      /// Number of elements on the stack.
1779      index_type
1780      size () const YY_NOEXCEPT
1781      {
1782        return index_type (seq_.size ());
1783      }
1784
1785      /// Iterator on top of the stack (going downwards).
1786      const_iterator
1787      begin () const YY_NOEXCEPT
1788      {
1789        return seq_.begin ();
1790      }
1791
1792      /// Bottom of the stack.
1793      const_iterator
1794      end () const YY_NOEXCEPT
1795      {
1796        return seq_.end ();
1797      }
1798
1799      /// Present a slice of the top of a stack.
1800      class slice
1801      {
1802      public:
1803        slice (const stack& stack, index_type range) YY_NOEXCEPT
1804          : stack_ (stack)
1805          , range_ (range)
1806        {}
1807
1808        const T&
1809        operator[] (index_type i) const
1810        {
1811          return stack_[range_ - i];
1812        }
1813
1814      private:
1815        const stack& stack_;
1816        index_type range_;
1817      };
1818
1819    private:
1820#if YY_CPLUSPLUS < 201103L
1821      /// Non copyable.
1822      stack (const stack&);
1823      /// Non copyable.
1824      stack& operator= (const stack&);
1825#endif
1826      /// The wrapped container.
1827      S seq_;
1828    };
1829
1830
1831    /// Stack type.
1832    typedef stack<stack_symbol_type> stack_type;
1833
1834    /// The stack.
1835    stack_type yystack_;
1836
1837    /// Push a new state on the stack.
1838    /// \param m    a debug message to display
1839    ///             if null, no trace is output.
1840    /// \param sym  the symbol
1841    /// \warning the contents of \a s.value is stolen.
1842    void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
1843
1844    /// Push a new look ahead token on the state on the stack.
1845    /// \param m    a debug message to display
1846    ///             if null, no trace is output.
1847    /// \param s    the state
1848    /// \param sym  the symbol (for its value and location).
1849    /// \warning the contents of \a sym.value is stolen.
1850    void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
1851
1852    /// Pop \a n symbols from the stack.
1853    void yypop_ (int n = 1) YY_NOEXCEPT;
1854
1855    /// Constants.
1856    enum
1857    {
1858      yylast_ = 279,     ///< Last index in yytable_.
1859      yynnts_ = 4,  ///< Number of nonterminal symbols.
1860      yyfinal_ = 24 ///< Termination state number.
1861    };
1862
1863
1864    // User arguments.
1865    QL::Result &result;
1866
1867  };
1868
1869  inline
1870  Parser::symbol_kind_type
1871  Parser::yytranslate_ (int t) YY_NOEXCEPT
1872  {
1873    // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
1874    // TOKEN-NUM as returned by yylex.
1875    static
1876    const signed char
1877    translate_table[] =
1878    {
1879       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1880       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1881       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1882       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1883       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1884       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1885       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1886       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1887       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1888       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1889       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1890       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1891       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1892       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1893       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1894       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1895       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1896       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1897       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1898       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1899       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1900       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1901       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1902       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1903       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1904       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1905       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1906      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1907      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1908      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1909      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1910      55,    56,    57,    58,    59,    60,    61,    62
1911    };
1912    // Last valid token kind.
1913    const int code_max = 317;
1914
1915    if (t <= 0)
1916      return symbol_kind::S_YYEOF;
1917    else if (t <= code_max)
1918      return static_cast <symbol_kind_type> (translate_table[t]);
1919    else
1920      return symbol_kind::S_YYUNDEF;
1921  }
1922
1923  // basic_symbol.
1924  template <typename Base>
1925  Parser::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
1926    : Base (that)
1927    , value ()
1928  {
1929    switch (this->kind ())
1930    {
1931      case symbol_kind::S_exp: // exp
1932      case symbol_kind::S_term: // term
1933        value.copy< Expression * > (YY_MOVE (that.value));
1934        break;
1935
1936      case symbol_kind::S_NAME: // NAME
1937        value.copy< std::string > (YY_MOVE (that.value));
1938        break;
1939
1940      case symbol_kind::S_NUM: // NUM
1941      case symbol_kind::S_FNAME: // FNAME
1942      case symbol_kind::S_JGROUP: // JGROUP
1943      case symbol_kind::S_JPARENT: // JPARENT
1944      case symbol_kind::S_QSTR: // QSTR
1945        value.copy< uint64_t > (YY_MOVE (that.value));
1946        break;
1947
1948      default:
1949        break;
1950    }
1951
1952  }
1953
1954
1955
1956
1957  template <typename Base>
1958  Parser::symbol_kind_type
1959  Parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
1960  {
1961    return this->kind ();
1962  }
1963
1964
1965  template <typename Base>
1966  bool
1967  Parser::basic_symbol<Base>::empty () const YY_NOEXCEPT
1968  {
1969    return this->kind () == symbol_kind::S_YYEMPTY;
1970  }
1971
1972  template <typename Base>
1973  void
1974  Parser::basic_symbol<Base>::move (basic_symbol& s)
1975  {
1976    super_type::move (s);
1977    switch (this->kind ())
1978    {
1979      case symbol_kind::S_exp: // exp
1980      case symbol_kind::S_term: // term
1981        value.move< Expression * > (YY_MOVE (s.value));
1982        break;
1983
1984      case symbol_kind::S_NAME: // NAME
1985        value.move< std::string > (YY_MOVE (s.value));
1986        break;
1987
1988      case symbol_kind::S_NUM: // NUM
1989      case symbol_kind::S_FNAME: // FNAME
1990      case symbol_kind::S_JGROUP: // JGROUP
1991      case symbol_kind::S_JPARENT: // JPARENT
1992      case symbol_kind::S_QSTR: // QSTR
1993        value.move< uint64_t > (YY_MOVE (s.value));
1994        break;
1995
1996      default:
1997        break;
1998    }
1999
2000  }
2001
2002  // by_kind.
2003  inline
2004  Parser::by_kind::by_kind () YY_NOEXCEPT
2005    : kind_ (symbol_kind::S_YYEMPTY)
2006  {}
2007
2008#if 201103L <= YY_CPLUSPLUS
2009  inline
2010  Parser::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT
2011    : kind_ (that.kind_)
2012  {
2013    that.clear ();
2014  }
2015#endif
2016
2017  inline
2018  Parser::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT
2019    : kind_ (that.kind_)
2020  {}
2021
2022  inline
2023  Parser::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT
2024    : kind_ (yytranslate_ (t))
2025  {}
2026
2027
2028
2029  inline
2030  void
2031  Parser::by_kind::clear () YY_NOEXCEPT
2032  {
2033    kind_ = symbol_kind::S_YYEMPTY;
2034  }
2035
2036  inline
2037  void
2038  Parser::by_kind::move (by_kind& that)
2039  {
2040    kind_ = that.kind_;
2041    that.clear ();
2042  }
2043
2044  inline
2045  Parser::symbol_kind_type
2046  Parser::by_kind::kind () const YY_NOEXCEPT
2047  {
2048    return kind_;
2049  }
2050
2051
2052  inline
2053  Parser::symbol_kind_type
2054  Parser::by_kind::type_get () const YY_NOEXCEPT
2055  {
2056    return this->kind ();
2057  }
2058
2059
2060#line 67 "QLParser.yy"
2061} // QL
2062#line 2063 "QLParser.tab.hh"
2063
2064
2065
2066
2067#endif // !YY_YY_QLPARSER_TAB_HH_INCLUDED
2068