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 /home/jenkins/workspace/libelektra_PR-2949-JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q/build directory/src/plugins/yambi/parser.hpp
35 : ** Define the yambi::parser class.
36 : */
37 :
38 : // C++ LALR(1) parser skeleton written by Akim Demaille.
39 :
40 : #ifndef YY_YAMBI_HOME_JENKINS_WORKSPACE_LIBELEKTRA_PR_2949_JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q_BUILD_DIRECTORY_SRC_PLUGINS_YAMBI_PARSER_HPP_INCLUDED
41 : # define YY_YAMBI_HOME_JENKINS_WORKSPACE_LIBELEKTRA_PR_2949_JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q_BUILD_DIRECTORY_SRC_PLUGINS_YAMBI_PARSER_HPP_INCLUDED
42 : // // "%code requires" blocks.
43 : #line 39 "/home/jenkins/workspace/libelektra_PR-2949-JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q/build directory/src/plugins/yambi/parser.ypp" // lalr1.cc:377
44 :
45 : #include <string>
46 : class Driver;
47 : class Lexer;
48 :
49 : #line 50 "/home/jenkins/workspace/libelektra_PR-2949-JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q/build directory/src/plugins/yambi/parser.hpp" // lalr1.cc:377
50 :
51 : # include <cassert>
52 : # include <cstdlib> // std::abort
53 : # include <iostream>
54 : # include <stdexcept>
55 : # include <string>
56 : # include <vector>
57 : # include "stack.hh"
58 : # include "location.hh"
59 : #include <typeinfo>
60 : #ifndef YYASSERT
61 : # include <cassert>
62 : # define YYASSERT assert
63 : #endif
64 :
65 :
66 : #ifndef YY_ATTRIBUTE
67 : # if (defined __GNUC__ \
68 : && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
69 : || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
70 : # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
71 : # else
72 : # define YY_ATTRIBUTE(Spec) /* empty */
73 : # endif
74 : #endif
75 :
76 : #ifndef YY_ATTRIBUTE_PURE
77 : # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
78 : #endif
79 :
80 : #ifndef YY_ATTRIBUTE_UNUSED
81 : # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
82 : #endif
83 :
84 : #if !defined _Noreturn \
85 : && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
86 : # if defined _MSC_VER && 1200 <= _MSC_VER
87 : # define _Noreturn __declspec (noreturn)
88 : # else
89 : # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
90 : # endif
91 : #endif
92 :
93 : /* Suppress unused-variable warnings by "using" E. */
94 : #if ! defined lint || defined __GNUC__
95 : # define YYUSE(E) ((void) (E))
96 : #else
97 : # define YYUSE(E) /* empty */
98 : #endif
99 :
100 : #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
101 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
102 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
103 : _Pragma ("GCC diagnostic push") \
104 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
105 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
106 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
107 : _Pragma ("GCC diagnostic pop")
108 : #else
109 : # define YY_INITIAL_VALUE(Value) Value
110 : #endif
111 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
112 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
113 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
114 : #endif
115 : #ifndef YY_INITIAL_VALUE
116 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
117 : #endif
118 :
119 : /* Debug traces. */
120 : #ifndef YAMBIDEBUG
121 : # if defined YYDEBUG
122 : #if YYDEBUG
123 : # define YAMBIDEBUG 1
124 : # else
125 : # define YAMBIDEBUG 0
126 : # endif
127 : # else /* ! defined YYDEBUG */
128 : # define YAMBIDEBUG 1
129 : # endif /* ! defined YYDEBUG */
130 : #endif /* ! defined YAMBIDEBUG */
131 :
132 :
133 : namespace yambi {
134 : #line 135 "/home/jenkins/workspace/libelektra_PR-2949-JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q/build directory/src/plugins/yambi/parser.hpp" // lalr1.cc:377
135 :
136 :
137 :
138 : /// A char[S] buffer to store and retrieve objects.
139 : ///
140 : /// Sort of a variant, but does not keep track of the nature
141 : /// of the stored data, since that knowledge is available
142 : /// via the current state.
143 : template <size_t S>
144 : struct variant
145 : {
146 : /// Type of *this.
147 : typedef variant<S> self_type;
148 :
149 : /// Empty construction.
150 10698 : variant ()
151 10761 : : yytypeid_ (YY_NULLPTR)
152 : {}
153 :
154 : /// Construct and fill.
155 : template <typename T>
156 940 : variant (const T& t)
157 940 : : yytypeid_ (&typeid (T))
158 : {
159 : YYASSERT (sizeof (T) <= S);
160 940 : new (yyas_<T> ()) T (t);
161 : }
162 :
163 : /// Destruction, allowed only if empty.
164 : ~variant ()
165 : {
166 : YYASSERT (!yytypeid_);
167 : }
168 :
169 : /// Instantiate an empty \a T in here.
170 : template <typename T>
171 : T&
172 : build ()
173 : {
174 : YYASSERT (!yytypeid_);
175 : YYASSERT (sizeof (T) <= S);
176 3454 : yytypeid_ = & typeid (T);
177 6692 : return *new (yyas_<T> ()) T;
178 : }
179 :
180 : /// Instantiate a \a T in here from \a t.
181 : template <typename T>
182 : T&
183 : build (const T& t)
184 : {
185 : YYASSERT (!yytypeid_);
186 : YYASSERT (sizeof (T) <= S);
187 0 : yytypeid_ = & typeid (T);
188 0 : return *new (yyas_<T> ()) T (t);
189 : }
190 :
191 : /// Accessor to a built \a T.
192 : template <typename T>
193 : T&
194 : as ()
195 : {
196 : YYASSERT (*yytypeid_ == typeid (T));
197 : YYASSERT (sizeof (T) <= S);
198 11563 : return *yyas_<T> ();
199 : }
200 :
201 : /// Const accessor to a built \a T (for %printer).
202 : template <typename T>
203 : const T&
204 : as () const
205 : {
206 : YYASSERT (*yytypeid_ == typeid (T));
207 : YYASSERT (sizeof (T) <= S);
208 0 : return *yyas_<T> ();
209 : }
210 :
211 : /// Swap the content with \a other, of same type.
212 : ///
213 : /// Both variants must be built beforehand, because swapping the actual
214 : /// data requires reading it (with as()), and this is not possible on
215 : /// unconstructed variants: it would require some dynamic testing, which
216 : /// should not be the variant's responsability.
217 : /// Swapping between built and (possibly) non-built is done with
218 : /// variant::move ().
219 : template <typename T>
220 : void
221 : swap (self_type& other)
222 : {
223 : YYASSERT (yytypeid_);
224 : YYASSERT (*yytypeid_ == *other.yytypeid_);
225 9255 : std::swap (as<T> (), other.as<T> ());
226 : }
227 :
228 : /// Move the content of \a other to this.
229 : ///
230 : /// Destroys \a other.
231 : template <typename T>
232 : void
233 2977 : move (self_type& other)
234 : {
235 3085 : build<T> ();
236 3085 : swap<T> (other);
237 3085 : other.destroy<T> ();
238 2977 : }
239 :
240 : /// Copy the content of \a other to this.
241 : template <typename T>
242 : void
243 : copy (const self_type& other)
244 : {
245 0 : build<T> (other.as<T> ());
246 : }
247 :
248 : /// Destroy the stored \a T.
249 : template <typename T>
250 : void
251 : destroy ()
252 : {
253 8572 : as<T> ().~T ();
254 4394 : yytypeid_ = YY_NULLPTR;
255 : }
256 :
257 : private:
258 : /// Prohibit blind copies.
259 : self_type& operator=(const self_type&);
260 : variant (const self_type&);
261 :
262 : /// Accessor to raw memory as \a T.
263 : template <typename T>
264 : T*
265 : yyas_ ()
266 : {
267 15957 : void *yyp = yybuffer_.yyraw;
268 : return static_cast<T*> (yyp);
269 : }
270 :
271 : /// Const accessor to raw memory as \a T.
272 : template <typename T>
273 : const T*
274 : yyas_ () const
275 : {
276 0 : const void *yyp = yybuffer_.yyraw;
277 : return static_cast<const T*> (yyp);
278 : }
279 :
280 : union
281 : {
282 : /// Strongest alignment constraints.
283 : long double yyalign_me;
284 : /// A buffer large enough to store any of the semantic values.
285 : char yyraw[S];
286 : } yybuffer_;
287 :
288 : /// Whether the content is built: if defined, the name of the stored type.
289 : const std::type_info *yytypeid_;
290 : };
291 :
292 :
293 : /// A Bison parser.
294 : class Parser
295 : {
296 : public:
297 : #ifndef YAMBISTYPE
298 : /// An auxiliary type to compute the largest semantic type.
299 : union union_type
300 : {
301 : // child_comments_empty
302 : char dummy1[sizeof(bool)];
303 :
304 : // "start of document"
305 : // "end of document"
306 : // "comment"
307 : // "plain scalar"
308 : // "single quoted scalar"
309 : // "double quoted scalar"
310 : // "start of map"
311 : // "end of map"
312 : // "key"
313 : // "value"
314 : // "start of sequence"
315 : // "end of sequence"
316 : // "element"
317 : // scalar
318 : char dummy2[sizeof(std::string)];
319 : };
320 :
321 : /// Symbol semantic values.
322 : typedef variant<sizeof(union_type)> semantic_type;
323 : #else
324 : typedef YAMBISTYPE semantic_type;
325 : #endif
326 : /// Symbol locations.
327 : typedef location location_type;
328 :
329 : /// Syntax errors thrown from user actions.
330 : struct syntax_error : std::runtime_error
331 : {
332 : syntax_error (const location_type& l, const std::string& m);
333 : location_type location;
334 : };
335 :
336 : /// Tokens.
337 : struct token
338 : {
339 : enum yytokentype
340 : {
341 : END = 0,
342 : STREAM_START = 258,
343 : STREAM_END = 259,
344 : COMMENT = 260,
345 : PLAIN_SCALAR = 261,
346 : SINGLE_QUOTED_SCALAR = 262,
347 : DOUBLE_QUOTED_SCALAR = 263,
348 : MAP_START = 264,
349 : MAP_END = 265,
350 : KEY = 266,
351 : VALUE = 267,
352 : SEQUENCE_START = 268,
353 : SEQUENCE_END = 269,
354 : ELEMENT = 270
355 : };
356 : };
357 :
358 : /// (External) token type, as returned by yylex.
359 : typedef token::yytokentype token_type;
360 :
361 : /// Symbol type: an internal symbol number.
362 : typedef int symbol_number_type;
363 :
364 : /// The symbol type number to denote an empty symbol.
365 : enum { empty_symbol = -2 };
366 :
367 : /// Internal symbol number for tokens (subsumed by symbol_number_type).
368 : typedef unsigned char token_number_type;
369 :
370 : /// A complete symbol.
371 : ///
372 : /// Expects its Base type to provide access to the symbol type
373 : /// via type_get().
374 : ///
375 : /// Provide access to semantic value and location.
376 : template <typename Base>
377 : struct basic_symbol : Base
378 : {
379 : /// Alias to Base.
380 : typedef Base super_type;
381 :
382 : /// Default constructor.
383 : basic_symbol ();
384 :
385 : /// Copy constructor.
386 : basic_symbol (const basic_symbol& other);
387 :
388 : /// Constructor for valueless symbols, and symbols from each type.
389 :
390 : basic_symbol (typename Base::kind_type t, const location_type& l);
391 :
392 : basic_symbol (typename Base::kind_type t, const bool v, const location_type& l);
393 :
394 : basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
395 :
396 :
397 : /// Constructor for symbols with semantic value.
398 : basic_symbol (typename Base::kind_type t,
399 : const semantic_type& v,
400 : const location_type& l);
401 :
402 : /// Destroy the symbol.
403 : ~basic_symbol ();
404 :
405 : /// Destroy contents, and record that is empty.
406 : void clear ();
407 :
408 : /// Whether empty.
409 : bool empty () const;
410 :
411 : /// Destructive move, \a s is emptied into this.
412 : void move (basic_symbol& s);
413 :
414 : /// The semantic value.
415 : semantic_type value;
416 :
417 : /// The location.
418 : location_type location;
419 :
420 : private:
421 : /// Assignment operator.
422 : basic_symbol& operator= (const basic_symbol& other);
423 : };
424 :
425 : /// Type access provider for token (enum) based symbols.
426 : struct by_type
427 : {
428 : /// Default constructor.
429 : by_type ();
430 :
431 : /// Copy constructor.
432 : by_type (const by_type& other);
433 :
434 : /// The symbol type as needed by the constructor.
435 : typedef token_type kind_type;
436 :
437 : /// Constructor from (external) token numbers.
438 : by_type (kind_type t);
439 :
440 : /// Record that this symbol is empty.
441 : void clear ();
442 :
443 : /// Steal the symbol type from \a that.
444 : void move (by_type& that);
445 :
446 : /// The (internal) type number (corresponding to \a type).
447 : /// \a empty when empty.
448 : symbol_number_type type_get () const;
449 :
450 : /// The token.
451 : token_type token () const;
452 :
453 : /// The symbol type.
454 : /// \a empty_symbol when empty.
455 : /// An int, not token_number_type, to be able to store empty_symbol.
456 : int type;
457 : };
458 :
459 : /// "External" symbols: returned by the scanner.
460 : typedef basic_symbol<by_type> symbol_type;
461 :
462 : // Symbol constructors declarations.
463 : static inline
464 : symbol_type
465 : make_END (const location_type& l);
466 :
467 : static inline
468 : symbol_type
469 : make_STREAM_START (const std::string& v, const location_type& l);
470 :
471 : static inline
472 : symbol_type
473 : make_STREAM_END (const std::string& v, const location_type& l);
474 :
475 : static inline
476 : symbol_type
477 : make_COMMENT (const std::string& v, const location_type& l);
478 :
479 : static inline
480 : symbol_type
481 : make_PLAIN_SCALAR (const std::string& v, const location_type& l);
482 :
483 : static inline
484 : symbol_type
485 : make_SINGLE_QUOTED_SCALAR (const std::string& v, const location_type& l);
486 :
487 : static inline
488 : symbol_type
489 : make_DOUBLE_QUOTED_SCALAR (const std::string& v, const location_type& l);
490 :
491 : static inline
492 : symbol_type
493 : make_MAP_START (const std::string& v, const location_type& l);
494 :
495 : static inline
496 : symbol_type
497 : make_MAP_END (const std::string& v, const location_type& l);
498 :
499 : static inline
500 : symbol_type
501 : make_KEY (const std::string& v, const location_type& l);
502 :
503 : static inline
504 : symbol_type
505 : make_VALUE (const std::string& v, const location_type& l);
506 :
507 : static inline
508 : symbol_type
509 : make_SEQUENCE_START (const std::string& v, const location_type& l);
510 :
511 : static inline
512 : symbol_type
513 : make_SEQUENCE_END (const std::string& v, const location_type& l);
514 :
515 : static inline
516 : symbol_type
517 : make_ELEMENT (const std::string& v, const location_type& l);
518 :
519 :
520 : /// Build a parser object.
521 : Parser (Lexer& lexer_yyarg, Driver& driver_yyarg);
522 : virtual ~ Parser ();
523 :
524 : /// Parse.
525 : /// \returns 0 iff parsing succeeded.
526 : virtual int parse ();
527 :
528 : #if YAMBIDEBUG
529 : /// The current debugging stream.
530 : std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
531 : /// Set the current debugging stream.
532 : void set_debug_stream (std::ostream &);
533 :
534 : /// Type for debugging levels.
535 : typedef int debug_level_type;
536 : /// The current debugging level.
537 : debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
538 : /// Set the current debugging level.
539 : void set_debug_level (debug_level_type l);
540 : #endif
541 :
542 : /// Report a syntax error.
543 : /// \param loc where the syntax error is found.
544 : /// \param msg a description of the syntax error.
545 : virtual void error (const location_type& loc, const std::string& msg);
546 :
547 : /// Report a syntax error.
548 : void error (const syntax_error& err);
549 :
550 : private:
551 : /// This class is not copyable.
552 : Parser (const Parser &);
553 : Parser & operator= (const Parser &);
554 :
555 : /// State numbers.
556 : typedef int state_type;
557 :
558 : /// Generate an error message.
559 : /// \param yystate the state where the error occurred.
560 : /// \param yyla the lookahead token.
561 : virtual std::string yysyntax_error_ (state_type yystate,
562 : const symbol_type& yyla) const;
563 :
564 : /// Compute post-reduction state.
565 : /// \param yystate the current state
566 : /// \param yysym the nonterminal to push on the stack
567 : state_type yy_lr_goto_state_ (state_type yystate, int yysym);
568 :
569 : /// Whether the given \c yypact_ value indicates a defaulted state.
570 : /// \param yyvalue the value to check
571 : static bool yy_pact_value_is_default_ (int yyvalue);
572 :
573 : /// Whether the given \c yytable_ value indicates a syntax error.
574 : /// \param yyvalue the value to check
575 : static bool yy_table_value_is_error_ (int yyvalue);
576 :
577 : static const signed char yypact_ninf_;
578 : static const signed char yytable_ninf_;
579 :
580 : /// Convert a scanner token number \a t to a symbol number.
581 : static token_number_type yytranslate_ (token_type t);
582 :
583 : // Tables.
584 : // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
585 : // STATE-NUM.
586 : static const signed char yypact_[];
587 :
588 : // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
589 : // Performed when YYTABLE does not specify something else to do. Zero
590 : // means the default is an error.
591 : static const unsigned char yydefact_[];
592 :
593 : // YYPGOTO[NTERM-NUM].
594 : static const signed char yypgoto_[];
595 :
596 : // YYDEFGOTO[NTERM-NUM].
597 : static const signed char yydefgoto_[];
598 :
599 : // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
600 : // positive, shift that token. If negative, reduce the rule whose
601 : // number is the opposite. If YYTABLE_NINF, syntax error.
602 : static const signed char yytable_[];
603 :
604 : static const signed char yycheck_[];
605 :
606 : // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
607 : // symbol of state STATE-NUM.
608 : static const unsigned char yystos_[];
609 :
610 : // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
611 : static const unsigned char yyr1_[];
612 :
613 : // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
614 : static const unsigned char yyr2_[];
615 :
616 :
617 : /// Convert the symbol name \a n to a form suitable for a diagnostic.
618 : static std::string yytnamerr_ (const char *n);
619 :
620 :
621 : /// For a symbol, its name in clear.
622 : static const char* const yytname_[];
623 : #if YAMBIDEBUG
624 : // YYRLINE[YYN] -- Source line where rule number YYN was defined.
625 : static const unsigned char yyrline_[];
626 : /// Report on the debug stream that the rule \a r is going to be reduced.
627 : virtual void yy_reduce_print_ (int r);
628 : /// Print the state stack on the debug stream.
629 : virtual void yystack_print_ ();
630 :
631 : // Debugging.
632 : int yydebug_;
633 : std::ostream* yycdebug_;
634 :
635 : /// \brief Display a symbol type, value and location.
636 : /// \param yyo The output stream.
637 : /// \param yysym The symbol.
638 : template <typename Base>
639 : void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
640 : #endif
641 :
642 : /// \brief Reclaim the memory associated to a symbol.
643 : /// \param yymsg Why this token is reclaimed.
644 : /// If null, print nothing.
645 : /// \param yysym The symbol.
646 : template <typename Base>
647 : void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
648 :
649 : private:
650 : /// Type access provider for state based symbols.
651 : struct by_state
652 : {
653 : /// Default constructor.
654 : by_state ();
655 :
656 : /// The symbol type as needed by the constructor.
657 : typedef state_type kind_type;
658 :
659 : /// Constructor.
660 : by_state (kind_type s);
661 :
662 : /// Copy constructor.
663 : by_state (const by_state& other);
664 :
665 : /// Record that this symbol is empty.
666 : void clear ();
667 :
668 : /// Steal the symbol type from \a that.
669 : void move (by_state& that);
670 :
671 : /// The (internal) type number (corresponding to \a state).
672 : /// \a empty_symbol when empty.
673 : symbol_number_type type_get () const;
674 :
675 : /// The state number used to denote an empty symbol.
676 : enum { empty_state = -1 };
677 :
678 : /// The state.
679 : /// \a empty when empty.
680 : state_type state;
681 : };
682 :
683 : /// "Internal" symbol: element of the stack.
684 24752 : struct stack_symbol_type : basic_symbol<by_state>
685 : {
686 : /// Superclass.
687 : typedef basic_symbol<by_state> super_type;
688 : /// Construct an empty symbol.
689 : stack_symbol_type ();
690 : /// Steal the contents from \a sym to build this.
691 : stack_symbol_type (state_type s, symbol_type& sym);
692 : /// Assignment, needed by push_back.
693 : stack_symbol_type& operator= (const stack_symbol_type& that);
694 : };
695 :
696 : /// Stack type.
697 : typedef stack<stack_symbol_type> stack_type;
698 :
699 : /// The stack.
700 : stack_type yystack_;
701 :
702 : /// Push a new state on the stack.
703 : /// \param m a debug message to display
704 : /// if null, no trace is output.
705 : /// \param s the symbol
706 : /// \warning the contents of \a s.value is stolen.
707 : void yypush_ (const char* m, stack_symbol_type& s);
708 :
709 : /// Push a new look ahead token on the state on the stack.
710 : /// \param m a debug message to display
711 : /// if null, no trace is output.
712 : /// \param s the state
713 : /// \param sym the symbol (for its value and location).
714 : /// \warning the contents of \a s.value is stolen.
715 : void yypush_ (const char* m, state_type s, symbol_type& sym);
716 :
717 : /// Pop \a n symbols the three stacks.
718 : void yypop_ (unsigned int n = 1);
719 :
720 : /// Constants.
721 : enum
722 : {
723 : yyeof_ = 0,
724 : yylast_ = 45, ///< Last index in yytable_.
725 : yynnts_ = 20, ///< Number of nonterminal symbols.
726 : yyfinal_ = 9, ///< Termination state number.
727 : yyterror_ = 1,
728 : yyerrcode_ = 256,
729 : yyntokens_ = 16 ///< Number of tokens.
730 : };
731 :
732 :
733 : // User arguments.
734 : Lexer& lexer;
735 : Driver& driver;
736 : };
737 :
738 : // Symbol number corresponding to token number t.
739 : inline
740 : Parser ::token_number_type
741 : Parser ::yytranslate_ (token_type t)
742 : {
743 : static
744 : const token_number_type
745 : translate_table[] =
746 : {
747 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
748 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
749 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
750 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
751 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
752 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
753 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
754 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
755 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
756 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
757 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
758 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
760 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
763 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
764 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
765 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
766 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
767 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
768 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
769 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
770 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
771 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
772 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
773 : 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
774 : 15
775 : };
776 1003 : const unsigned int user_token_number_max_ = 270;
777 1003 : const token_number_type undef_token_ = 2;
778 :
779 940 : if (static_cast<int>(t) <= yyeof_)
780 : return yyeof_;
781 940 : else if (static_cast<unsigned int> (t) <= user_token_number_max_)
782 940 : return translate_table[t];
783 : else
784 : return undef_token_;
785 : }
786 :
787 : inline
788 : Parser ::syntax_error::syntax_error (const location_type& l, const std::string& m)
789 : : std::runtime_error (m)
790 : , location (l)
791 : {}
792 :
793 : // basic_symbol.
794 : template <typename Base>
795 : inline
796 6202 : Parser ::basic_symbol<Base>::basic_symbol ()
797 24808 : : value ()
798 : {}
799 :
800 : template <typename Base>
801 : inline
802 3482 : Parser ::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
803 : : Base (other)
804 : , value ()
805 10446 : , location (other.location)
806 : {
807 6964 : switch (other.type_get ())
808 : {
809 : case 22: // child_comments_empty
810 0 : value.copy< bool > (other.value);
811 : break;
812 :
813 : case 3: // "start of document"
814 : case 4: // "end of document"
815 : case 5: // "comment"
816 : case 6: // "plain scalar"
817 : case 7: // "single quoted scalar"
818 : case 8: // "double quoted scalar"
819 : case 9: // "start of map"
820 : case 10: // "end of map"
821 : case 11: // "key"
822 : case 12: // "value"
823 : case 13: // "start of sequence"
824 : case 14: // "end of sequence"
825 : case 15: // "element"
826 : case 26: // scalar
827 0 : value.copy< std::string > (other.value);
828 : break;
829 :
830 : default:
831 : break;
832 : }
833 :
834 3482 : }
835 :
836 :
837 : template <typename Base>
838 : inline
839 : Parser ::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
840 : : Base (t)
841 : , value ()
842 : , location (l)
843 : {
844 : (void) v;
845 : switch (this->type_get ())
846 : {
847 : case 22: // child_comments_empty
848 : value.copy< bool > (v);
849 : break;
850 :
851 : case 3: // "start of document"
852 : case 4: // "end of document"
853 : case 5: // "comment"
854 : case 6: // "plain scalar"
855 : case 7: // "single quoted scalar"
856 : case 8: // "double quoted scalar"
857 : case 9: // "start of map"
858 : case 10: // "end of map"
859 : case 11: // "key"
860 : case 12: // "value"
861 : case 13: // "start of sequence"
862 : case 14: // "end of sequence"
863 : case 15: // "element"
864 : case 26: // scalar
865 : value.copy< std::string > (v);
866 : break;
867 :
868 : default:
869 : break;
870 : }
871 : }
872 :
873 :
874 : // Implementation of basic_symbol constructor for each type.
875 :
876 : template <typename Base>
877 1014 : Parser ::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
878 : : Base (t)
879 : , value ()
880 3231 : , location (l)
881 : {}
882 :
883 : template <typename Base>
884 : Parser ::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const bool v, const location_type& l)
885 : : Base (t)
886 : , value (v)
887 : , location (l)
888 : {}
889 :
890 : template <typename Base>
891 940 : Parser ::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
892 : : Base (t)
893 : , value (v)
894 2820 : , location (l)
895 940 : {}
896 :
897 :
898 : template <typename Base>
899 : inline
900 : Parser ::basic_symbol<Base>::~basic_symbol ()
901 : {
902 11701 : clear ();
903 11701 : }
904 :
905 : template <typename Base>
906 : inline
907 : void
908 11753 : Parser ::basic_symbol<Base>::clear ()
909 : {
910 : // User destructor.
911 23506 : symbol_number_type yytype = this->type_get ();
912 11753 : basic_symbol<Base>& yysym = *this;
913 : (void) yysym;
914 : switch (yytype)
915 : {
916 : default:
917 : break;
918 : }
919 :
920 : // Type destructor.
921 11753 : switch (yytype)
922 : {
923 : case 22: // child_comments_empty
924 108 : value.template destroy< bool > ();
925 : break;
926 :
927 : case 3: // "start of document"
928 : case 4: // "end of document"
929 : case 5: // "comment"
930 : case 6: // "plain scalar"
931 : case 7: // "single quoted scalar"
932 : case 8: // "double quoted scalar"
933 : case 9: // "start of map"
934 : case 10: // "end of map"
935 : case 11: // "key"
936 : case 12: // "value"
937 : case 13: // "start of sequence"
938 : case 14: // "end of sequence"
939 : case 15: // "element"
940 : case 26: // scalar
941 1201 : value.template destroy< std::string > ();
942 : break;
943 :
944 : default:
945 : break;
946 : }
947 :
948 23506 : Base::clear ();
949 11753 : }
950 :
951 : template <typename Base>
952 : inline
953 : bool
954 : Parser ::basic_symbol<Base>::empty () const
955 : {
956 11872 : return Base::type_get () == empty_symbol;
957 : }
958 :
959 : template <typename Base>
960 : inline
961 : void
962 4485 : Parser ::basic_symbol<Base>::move (basic_symbol& s)
963 : {
964 8970 : super_type::move(s);
965 8970 : switch (this->type_get ())
966 : {
967 : case 22: // child_comments_empty
968 108 : value.move< bool > (s.value);
969 : break;
970 :
971 : case 3: // "start of document"
972 : case 4: // "end of document"
973 : case 5: // "comment"
974 : case 6: // "plain scalar"
975 : case 7: // "single quoted scalar"
976 : case 8: // "double quoted scalar"
977 : case 9: // "start of map"
978 : case 10: // "end of map"
979 : case 11: // "key"
980 : case 12: // "value"
981 : case 13: // "start of sequence"
982 : case 14: // "end of sequence"
983 : case 15: // "element"
984 : case 26: // scalar
985 2089 : value.move< std::string > (s.value);
986 2089 : break;
987 :
988 : default:
989 : break;
990 : }
991 :
992 4485 : location = s.location;
993 4485 : }
994 :
995 : // by_type.
996 : inline
997 63 : Parser ::by_type::by_type ()
998 63 : : type (empty_symbol)
999 : {}
1000 :
1001 : inline
1002 : Parser ::by_type::by_type (const by_type& other)
1003 : : type (other.type)
1004 : {}
1005 :
1006 : inline
1007 1003 : Parser ::by_type::by_type (token_type t)
1008 1003 : : type (yytranslate_ (t))
1009 : {}
1010 :
1011 : inline
1012 : void
1013 : Parser ::by_type::clear ()
1014 : {
1015 2121 : type = empty_symbol;
1016 : }
1017 :
1018 : inline
1019 : void
1020 : Parser ::by_type::move (by_type& that)
1021 : {
1022 1003 : type = that.type;
1023 1003 : that.clear ();
1024 : }
1025 :
1026 : inline
1027 : int
1028 : Parser ::by_type::type_get () const
1029 : {
1030 8095 : return type;
1031 : }
1032 :
1033 : inline
1034 : Parser ::token_type
1035 : Parser ::by_type::token () const
1036 : {
1037 : // YYTOKNUM[NUM] -- (External) token number corresponding to the
1038 : // (internal) symbol number NUM (which must be that of a token). */
1039 : static
1040 : const unsigned short int
1041 : yytoken_number_[] =
1042 : {
1043 : 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1044 : 265, 266, 267, 268, 269, 270
1045 : };
1046 : return static_cast<token_type> (yytoken_number_[type]);
1047 : }
1048 : // Implementation of make_symbol for each symbol type.
1049 : Parser ::symbol_type
1050 : Parser ::make_END (const location_type& l)
1051 : {
1052 63 : return symbol_type (token::END, l);
1053 : }
1054 :
1055 : Parser ::symbol_type
1056 63 : Parser ::make_STREAM_START (const std::string& v, const location_type& l)
1057 : {
1058 126 : return symbol_type (token::STREAM_START, v, l);
1059 : }
1060 :
1061 : Parser ::symbol_type
1062 63 : Parser ::make_STREAM_END (const std::string& v, const location_type& l)
1063 : {
1064 126 : return symbol_type (token::STREAM_END, v, l);
1065 : }
1066 :
1067 : Parser ::symbol_type
1068 24 : Parser ::make_COMMENT (const std::string& v, const location_type& l)
1069 : {
1070 48 : return symbol_type (token::COMMENT, v, l);
1071 : }
1072 :
1073 : Parser ::symbol_type
1074 212 : Parser ::make_PLAIN_SCALAR (const std::string& v, const location_type& l)
1075 : {
1076 424 : return symbol_type (token::PLAIN_SCALAR, v, l);
1077 : }
1078 :
1079 : Parser ::symbol_type
1080 2 : Parser ::make_SINGLE_QUOTED_SCALAR (const std::string& v, const location_type& l)
1081 : {
1082 4 : return symbol_type (token::SINGLE_QUOTED_SCALAR, v, l);
1083 : }
1084 :
1085 : Parser ::symbol_type
1086 65 : Parser ::make_DOUBLE_QUOTED_SCALAR (const std::string& v, const location_type& l)
1087 : {
1088 130 : return symbol_type (token::DOUBLE_QUOTED_SCALAR, v, l);
1089 : }
1090 :
1091 : Parser ::symbol_type
1092 57 : Parser ::make_MAP_START (const std::string& v, const location_type& l)
1093 : {
1094 114 : return symbol_type (token::MAP_START, v, l);
1095 : }
1096 :
1097 : Parser ::symbol_type
1098 57 : Parser ::make_MAP_END (const std::string& v, const location_type& l)
1099 : {
1100 114 : return symbol_type (token::MAP_END, v, l);
1101 : }
1102 :
1103 : Parser ::symbol_type
1104 108 : Parser ::make_KEY (const std::string& v, const location_type& l)
1105 : {
1106 216 : return symbol_type (token::KEY, v, l);
1107 : }
1108 :
1109 : Parser ::symbol_type
1110 108 : Parser ::make_VALUE (const std::string& v, const location_type& l)
1111 : {
1112 216 : return symbol_type (token::VALUE, v, l);
1113 : }
1114 :
1115 : Parser ::symbol_type
1116 42 : Parser ::make_SEQUENCE_START (const std::string& v, const location_type& l)
1117 : {
1118 84 : return symbol_type (token::SEQUENCE_START, v, l);
1119 : }
1120 :
1121 : Parser ::symbol_type
1122 42 : Parser ::make_SEQUENCE_END (const std::string& v, const location_type& l)
1123 : {
1124 84 : return symbol_type (token::SEQUENCE_END, v, l);
1125 : }
1126 :
1127 : Parser ::symbol_type
1128 97 : Parser ::make_ELEMENT (const std::string& v, const location_type& l)
1129 : {
1130 194 : return symbol_type (token::ELEMENT, v, l);
1131 : }
1132 :
1133 :
1134 :
1135 : } // yambi
1136 : #line 1137 "/home/jenkins/workspace/libelektra_PR-2949-JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q/build directory/src/plugins/yambi/parser.hpp" // lalr1.cc:377
1137 :
1138 :
1139 :
1140 :
1141 : #endif // !YY_YAMBI_HOME_JENKINS_WORKSPACE_LIBELEKTRA_PR_2949_JSVQFJNQUXFDDEIVMWX2NWLWVTIX5MLFKA62ACPFOA3QLNMROQ7Q_BUILD_DIRECTORY_SRC_PLUGINS_YAMBI_PARSER_HPP_INCLUDED
|