Aprepro 5.0x
Loading...
Searching...
No Matches
aprepro_parser.h
Go to the documentation of this file.
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 ** \file aprepro_parser.h
35 ** Define the SEAMS::parser class.
36 */
37
38// C++ LALR(1) parser skeleton written by Akim Demaille.
39
40// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
41// especially those whose name start with YY_ or yy_. They are
42// private implementation details that can be changed or removed.
43
44#ifndef YY_SEAMS_APREPRO_PARSER_H_INCLUDED
45#define YY_SEAMS_APREPRO_PARSER_H_INCLUDED
46
47#include <cstdlib> // std::abort
48#include <iostream>
49#include <stdexcept>
50#include <string>
51#include <vector>
52
53#if defined __cplusplus
54#define YY_CPLUSPLUS __cplusplus
55#else
56#define YY_CPLUSPLUS 199711L
57#endif
58
59// Support move semantics when possible.
60#if 201103L <= YY_CPLUSPLUS
61#define YY_MOVE std::move
62#define YY_MOVE_OR_COPY move
63#define YY_MOVE_REF(Type) Type &&
64#define YY_RVREF(Type) Type &&
65#define YY_COPY(Type) Type
66#else
67#define YY_MOVE
68#define YY_MOVE_OR_COPY copy
69#define YY_MOVE_REF(Type) Type &
70#define YY_RVREF(Type) const Type &
71#define YY_COPY(Type) const Type &
72#endif
73
74// Support noexcept when possible.
75#if 201103L <= YY_CPLUSPLUS
76#define YY_NOEXCEPT noexcept
77#define YY_NOTHROW
78#else
79#define YY_NOEXCEPT
80#define YY_NOTHROW throw()
81#endif
82
83// Support constexpr when possible.
84#if 201703 <= YY_CPLUSPLUS
85#define YY_CONSTEXPR constexpr
86#else
87#define YY_CONSTEXPR
88#endif
89
90#ifndef YY_ATTRIBUTE_PURE
91#if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
92#define YY_ATTRIBUTE_PURE __attribute__((__pure__))
93#else
94#define YY_ATTRIBUTE_PURE
95#endif
96#endif
97
98#ifndef YY_ATTRIBUTE_UNUSED
99#if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
100#define YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
101#else
102#define YY_ATTRIBUTE_UNUSED
103#endif
104#endif
105
106/* Suppress unused-variable warnings by "using" E. */
107#if !defined lint || defined __GNUC__
108#define YY_USE(E) ((void)(E))
109#else
110#define YY_USE(E) /* empty */
111#endif
112
113/* Suppress an incorrect diagnostic about yylval being uninitialized. */
114#if defined __GNUC__ && !defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
115#if __GNUC__ * 100 + __GNUC_MINOR__ < 407
116#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
117 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
118#else
119#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
120 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
121 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
122#endif
123#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
124#else
125#define YY_INITIAL_VALUE(Value) Value
126#endif
127#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
128#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
129#define YY_IGNORE_MAYBE_UNINITIALIZED_END
130#endif
131#ifndef YY_INITIAL_VALUE
132#define YY_INITIAL_VALUE(Value) /* Nothing. */
133#endif
134
135#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__
136#define YY_IGNORE_USELESS_CAST_BEGIN \
137 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
138#define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop")
139#endif
140#ifndef YY_IGNORE_USELESS_CAST_BEGIN
141#define YY_IGNORE_USELESS_CAST_BEGIN
142#define YY_IGNORE_USELESS_CAST_END
143#endif
144
145#ifndef YY_CAST
146#ifdef __cplusplus
147#define YY_CAST(Type, Val) static_cast<Type>(Val)
148#define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type>(Val)
149#else
150#define YY_CAST(Type, Val) ((Type)(Val))
151#define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val))
152#endif
153#endif
154#ifndef YY_NULLPTR
155#if defined __cplusplus
156#if 201103L <= __cplusplus
157#define YY_NULLPTR nullptr
158#else
159#define YY_NULLPTR 0
160#endif
161#else
162#define YY_NULLPTR ((void *)0)
163#endif
164#endif
165
166/* Debug traces. */
167#ifndef SEAMSDEBUG
168#if defined YYDEBUG
169#if YYDEBUG
170#define SEAMSDEBUG 1
171#else
172#define SEAMSDEBUG 0
173#endif
174#else /* ! defined YYDEBUG */
175#define SEAMSDEBUG 1
176#endif /* ! defined YYDEBUG */
177#endif /* ! defined SEAMSDEBUG */
178
179namespace SEAMS {
180
181 /// A Bison parser.
182 class Parser
183 {
184 public:
185#ifdef SEAMSSTYPE
186#ifdef __GNUC__
187#pragma GCC message "bison: do not #define SEAMSSTYPE in C++, use %define api.value.type"
188#endif
189 typedef SEAMSSTYPE value_type;
190#else
191 /// Symbol semantic values.
193
194 double val; /* For returning numbers. */
195 struct symrec *tptr; /* For returning symbol-table pointers */
196 char *string; /* For returning quoted strings */
197 struct array *arrval; /* For returning arrays */
198 };
199#endif
200 /// Backward compatibility (Bison 3.8).
202
203 /// Syntax errors thrown from user actions.
204 struct syntax_error : std::runtime_error
205 {
206 syntax_error(const std::string &m) : std::runtime_error(m) {}
207
208 syntax_error(const syntax_error &s) : std::runtime_error(s.what()) {}
209
211 };
212
213 /// Token kinds.
214 struct token
215 {
217 SEAMSEMPTY = -2,
218 END = 0, // "end of file"
219 SEAMSerror = 256, // error
220 SEAMSUNDEF = 257, // "invalid token"
221 NUM = 258, // NUM
222 QSTRING = 259, // QSTRING
223 UNDVAR = 260, // UNDVAR
224 VAR = 261, // VAR
225 SVAR = 262, // SVAR
226 IMMVAR = 263, // IMMVAR
227 IMMSVAR = 264, // IMMSVAR
228 AVAR = 265, // AVAR
229 FNCT = 266, // FNCT
230 SFNCT = 267, // SFNCT
231 AFNCT = 268, // AFNCT
232 COMMA = 269, // COMMA
233 LPAR = 270, // LPAR
234 RPAR = 271, // RPAR
235 LBRACK = 272, // LBRACK
236 RBRACK = 273, // RBRACK
237 LBRACE = 274, // LBRACE
238 RBRACE = 275, // RBRACE
239 SEMI = 276, // SEMI
240 EQUAL = 277, // EQUAL
241 EQ_PLUS = 278, // EQ_PLUS
242 EQ_MINUS = 279, // EQ_MINUS
243 EQ_TIME = 280, // EQ_TIME
244 EQ_DIV = 281, // EQ_DIV
245 EQ_POW = 282, // EQ_POW
246 QUEST = 283, // QUEST
247 COLON = 284, // COLON
248 LOR = 285, // LOR
249 LAND = 286, // LAND
250 LT = 287, // LT
251 GT = 288, // GT
252 LE = 289, // LE
253 GE = 290, // GE
254 EQ = 291, // EQ
255 NE = 292, // NE
256 PLU = 293, // PLU
257 SUB = 294, // SUB
258 DIV = 295, // DIV
259 TIM = 296, // TIM
260 MOD = 297, // MOD
261 UNARY = 298, // UNARY
262 NOT = 299, // NOT
263 POW = 300, // POW
264 INC = 301, // INC
265 DEC = 302, // DEC
266 CONCAT = 303 // CONCAT
267 };
268 /// Backward compatibility alias (Bison 3.6).
270 };
271
272 /// Token kind, as returned by yylex.
274
275 /// Backward compatibility alias (Bison 3.6).
277
278 /// Symbol kinds.
280 {
282 YYNTOKENS = 50, ///< Number of tokens.
283 S_YYEMPTY = -2,
284 S_YYEOF = 0, // "end of file"
285 S_YYerror = 1, // error
286 S_YYUNDEF = 2, // "invalid token"
287 S_NUM = 3, // NUM
288 S_QSTRING = 4, // QSTRING
289 S_UNDVAR = 5, // UNDVAR
290 S_VAR = 6, // VAR
291 S_SVAR = 7, // SVAR
292 S_IMMVAR = 8, // IMMVAR
293 S_IMMSVAR = 9, // IMMSVAR
294 S_AVAR = 10, // AVAR
295 S_FNCT = 11, // FNCT
296 S_SFNCT = 12, // SFNCT
297 S_AFNCT = 13, // AFNCT
298 S_COMMA = 14, // COMMA
299 S_LPAR = 15, // LPAR
300 S_RPAR = 16, // RPAR
301 S_LBRACK = 17, // LBRACK
302 S_RBRACK = 18, // RBRACK
303 S_LBRACE = 19, // LBRACE
304 S_RBRACE = 20, // RBRACE
305 S_SEMI = 21, // SEMI
306 S_EQUAL = 22, // EQUAL
307 S_EQ_PLUS = 23, // EQ_PLUS
308 S_EQ_MINUS = 24, // EQ_MINUS
309 S_EQ_TIME = 25, // EQ_TIME
310 S_EQ_DIV = 26, // EQ_DIV
311 S_EQ_POW = 27, // EQ_POW
312 S_QUEST = 28, // QUEST
313 S_COLON = 29, // COLON
314 S_LOR = 30, // LOR
315 S_LAND = 31, // LAND
316 S_LT = 32, // LT
317 S_GT = 33, // GT
318 S_LE = 34, // LE
319 S_GE = 35, // GE
320 S_EQ = 36, // EQ
321 S_NE = 37, // NE
322 S_PLU = 38, // PLU
323 S_SUB = 39, // SUB
324 S_DIV = 40, // DIV
325 S_TIM = 41, // TIM
326 S_MOD = 42, // MOD
327 S_UNARY = 43, // UNARY
328 S_NOT = 44, // NOT
329 S_POW = 45, // POW
330 S_INC = 46, // INC
331 S_DEC = 47, // DEC
332 S_CONCAT = 48, // CONCAT
333 S_49_n_ = 49, // '\n'
334 S_YYACCEPT = 50, // $accept
335 S_input = 51, // input
336 S_line = 52, // line
337 S_bool = 53, // bool
338 S_aexp = 54, // aexp
339 S_sexp = 55, // sexp
340 S_exp = 56 // exp
341 };
342 };
343
344 /// (Internal) symbol kind.
346
347 /// The number of tokens.
349
350 /// A complete symbol.
351 ///
352 /// Expects its Base type to provide access to the symbol kind
353 /// via kind ().
354 ///
355 /// Provide access to semantic value.
356 template <typename Base> struct basic_symbol : Base
357 {
358 /// Alias to Base.
359 typedef Base super_type;
360
361 /// Default constructor.
363
364#if 201103L <= YY_CPLUSPLUS
365 /// Move constructor.
366 basic_symbol(basic_symbol &&that) : Base(std::move(that)), value(std::move(that.value)) {}
367#endif
368
369 /// Copy constructor.
370 basic_symbol(const basic_symbol &that);
371 /// Constructor for valueless symbols.
372 basic_symbol(typename Base::kind_type t);
373
374 /// Constructor for symbols with semantic value.
375 basic_symbol(typename Base::kind_type t, YY_RVREF(value_type) v);
376
377 /// Destroy the symbol.
378 ~basic_symbol() { clear(); }
379
380 /// Destroy contents, and record that is empty.
381 void clear() YY_NOEXCEPT { Base::clear(); }
382
383 /// The user-facing name of this symbol.
384 std::string name() const YY_NOEXCEPT { return Parser::symbol_name(this->kind()); }
385
386 /// Backward compatibility (Bison 3.6).
387 symbol_kind_type type_get() const YY_NOEXCEPT;
388
389 /// Whether empty.
390 bool empty() const YY_NOEXCEPT;
391
392 /// Destructive move, \a s is emptied into this.
393 void move(basic_symbol &s);
394
395 /// The semantic value.
397
398 private:
399#if YY_CPLUSPLUS < 201103L
400 /// Assignment operator.
402#endif
403 };
404
405 /// Type access provider for token (enum) based symbols.
406 struct by_kind
407 {
408 /// The symbol kind as needed by the constructor.
410
411 /// Default constructor.
413
414#if 201103L <= YY_CPLUSPLUS
415 /// Move constructor.
417#endif
418
419 /// Copy constructor.
420 by_kind(const by_kind &that) YY_NOEXCEPT;
421
422 /// Constructor from (external) token numbers.
424
425 /// Record that this symbol is empty.
426 void clear() YY_NOEXCEPT;
427
428 /// Steal the symbol kind from \a that.
429 void move(by_kind &that);
430
431 /// The (internal) type number (corresponding to \a type).
432 /// \a empty when empty.
433 symbol_kind_type kind() const YY_NOEXCEPT;
434
435 /// Backward compatibility (Bison 3.6).
436 symbol_kind_type type_get() const YY_NOEXCEPT;
437
438 /// The symbol kind.
439 /// \a S_YYEMPTY when empty.
441 };
442
443 /// Backward compatibility for a private implementation detail (Bison 3.6).
445
446 /// "External" symbols: returned by the scanner.
448 {
449 };
450
451 /// Build a parser object.
452 Parser(class Aprepro &aprepro_yyarg);
453 virtual ~Parser();
454
455#if 201103L <= YY_CPLUSPLUS
456 /// Non copyable.
457 Parser(const Parser &) = delete;
458 /// Non copyable.
459 Parser &operator=(const Parser &) = delete;
460#endif
461
462 /// Parse. An alias for parse ().
463 /// \returns 0 iff parsing succeeded.
464 int operator()();
465
466 /// Parse.
467 /// \returns 0 iff parsing succeeded.
468 virtual int parse();
469
470#if SEAMSDEBUG
471 /// The current debugging stream.
472 std::ostream &debug_stream() const YY_ATTRIBUTE_PURE;
473 /// Set the current debugging stream.
474 void set_debug_stream(std::ostream &);
475
476 /// Type for debugging levels.
477 typedef int debug_level_type;
478 /// The current debugging level.
479 debug_level_type debug_level() const YY_ATTRIBUTE_PURE;
480 /// Set the current debugging level.
481 void set_debug_level(debug_level_type l);
482#endif
483
484 /// Report a syntax error.
485 /// \param msg a description of the syntax error.
486 virtual void error(const std::string &msg);
487
488 /// Report a syntax error.
489 void error(const syntax_error &err);
490
491 /// The user-facing name of the symbol whose (internal) number is
492 /// YYSYMBOL. No bounds checking.
493 static std::string symbol_name(symbol_kind_type yysymbol);
494
496 {
497 public:
498 context(const Parser &yyparser, const symbol_type &yyla);
499 const symbol_type &lookahead() const YY_NOEXCEPT { return yyla_; }
500 symbol_kind_type token() const YY_NOEXCEPT { return yyla_.kind(); }
501 /// Put in YYARG at most YYARGN of the expected tokens, and return the
502 /// number of tokens stored in YYARG. If YYARG is null, return the
503 /// number of expected tokens (guaranteed to be less than YYNTOKENS).
504 int expected_tokens(symbol_kind_type yyarg[], int yyargn) const;
505
506 private:
509 };
510
511 private:
512#if YY_CPLUSPLUS < 201103L
513 /// Non copyable.
514 Parser(const Parser &);
515 /// Non copyable.
517#endif
518
519 /// Stored state numbers (used for stacks).
520 typedef short state_type;
521
522 /// The arguments of the error message.
523 int yy_syntax_error_arguments_(const context &yyctx, symbol_kind_type yyarg[],
524 int yyargn) const;
525
526 /// Generate an error message.
527 /// \param yyctx the context in which the error occurred.
528 virtual std::string yysyntax_error_(const context &yyctx) const;
529 /// Compute post-reduction state.
530 /// \param yystate the current state
531 /// \param yysym the nonterminal to push on the stack
532 static state_type yy_lr_goto_state_(state_type yystate, int yysym);
533
534 /// Whether the given \c yypact_ value indicates a defaulted state.
535 /// \param yyvalue the value to check
536 static bool yy_pact_value_is_default_(int yyvalue) YY_NOEXCEPT;
537
538 /// Whether the given \c yytable_ value indicates a syntax error.
539 /// \param yyvalue the value to check
540 static bool yy_table_value_is_error_(int yyvalue) YY_NOEXCEPT;
541
542 static const signed char yypact_ninf_;
543 static const signed char yytable_ninf_;
544
545 /// Convert a scanner token kind \a t to a symbol kind.
546 /// In theory \a t should be a token_kind_type, but character literals
547 /// are valid, yet not members of the token_kind_type enum.
548 static symbol_kind_type yytranslate_(int t) YY_NOEXCEPT;
549
550 /// Convert the symbol name \a n to a form suitable for a diagnostic.
551 static std::string yytnamerr_(const char *yystr);
552
553 /// For a symbol, its name in clear.
554 static const char *const yytname_[];
555
556 // Tables.
557 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
558 // STATE-NUM.
559 static const short yypact_[];
560
561 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
562 // Performed when YYTABLE does not specify something else to do. Zero
563 // means the default is an error.
564 static const unsigned char yydefact_[];
565
566 // YYPGOTO[NTERM-NUM].
567 static const short yypgoto_[];
568
569 // YYDEFGOTO[NTERM-NUM].
570 static const unsigned char yydefgoto_[];
571
572 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
573 // positive, shift that token. If negative, reduce the rule whose
574 // number is the opposite. If YYTABLE_NINF, syntax error.
575 static const short yytable_[];
576
577 static const short yycheck_[];
578
579 // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
580 // state STATE-NUM.
581 static const signed char yystos_[];
582
583 // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
584 static const signed char yyr1_[];
585
586 // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.
587 static const signed char yyr2_[];
588
589#if SEAMSDEBUG
590 // YYRLINE[YYN] -- Source line where rule number YYN was defined.
591 static const short yyrline_[];
592 /// Report on the debug stream that the rule \a r is going to be reduced.
593 virtual void yy_reduce_print_(int r) const;
594 /// Print the state stack on the debug stream.
595 virtual void yy_stack_print_() const;
596
597 /// Debugging level.
598 int yydebug_;
599 /// Debug stream.
600 std::ostream *yycdebug_;
601
602 /// \brief Display a symbol kind, value and location.
603 /// \param yyo The output stream.
604 /// \param yysym The symbol.
605 template <typename Base>
606 void yy_print_(std::ostream &yyo, const basic_symbol<Base> &yysym) const;
607#endif
608
609 /// \brief Reclaim the memory associated to a symbol.
610 /// \param yymsg Why this token is reclaimed.
611 /// If null, print nothing.
612 /// \param yysym The symbol.
613 template <typename Base> void yy_destroy_(const char *yymsg, basic_symbol<Base> &yysym) const;
614
615 private:
616 /// Type access provider for state based symbols.
617 struct by_state
618 {
619 /// Default constructor.
621
622 /// The symbol kind as needed by the constructor.
624
625 /// Constructor.
627
628 /// Copy constructor.
629 by_state(const by_state &that) YY_NOEXCEPT;
630
631 /// Record that this symbol is empty.
632 void clear() YY_NOEXCEPT;
633
634 /// Steal the symbol kind from \a that.
635 void move(by_state &that);
636
637 /// The symbol kind (corresponding to \a state).
638 /// \a symbol_kind::S_YYEMPTY when empty.
639 symbol_kind_type kind() const YY_NOEXCEPT;
640
641 /// The state number used to denote an empty symbol.
642 /// We use the initial state, as it does not have a value.
643 enum { empty_state = 0 };
644
645 /// The state.
646 /// \a empty when empty.
648 };
649
650 /// "Internal" symbol: element of the stack.
652 {
653 /// Superclass.
655 /// Construct an empty symbol.
657 /// Move or copy construction.
659 /// Steal the contents from \a sym to build this.
661#if YY_CPLUSPLUS < 201103L
662 /// Assignment, needed by push_back by some old implementations.
663 /// Moves the contents of that.
664 stack_symbol_type &operator=(stack_symbol_type &that);
665
666 /// Assignment, needed by push_back by other implementations.
667 /// Needed by some other old implementations.
668 stack_symbol_type &operator=(const stack_symbol_type &that);
669#endif
670 };
671
672 /// A stack with random access from its top.
673 template <typename T, typename S = std::vector<T>> class stack
674 {
675 public:
676 // Hide our reversed order.
677 typedef typename S::iterator iterator;
678 typedef typename S::const_iterator const_iterator;
679 typedef typename S::size_type size_type;
680 typedef typename std::ptrdiff_t index_type;
681
682 stack(size_type n = 200) YY_NOEXCEPT : seq_(n) {}
683
684#if 201103L <= YY_CPLUSPLUS
685 /// Non copyable.
686 stack(const stack &) = delete;
687 /// Non copyable.
688 stack &operator=(const stack &) = delete;
689#endif
690
691 /// Random access.
692 ///
693 /// Index 0 returns the topmost element.
694 const T &operator[](index_type i) const { return seq_[size_type(size() - 1 - i)]; }
695
696 /// Random access.
697 ///
698 /// Index 0 returns the topmost element.
699 T &operator[](index_type i) { return seq_[size_type(size() - 1 - i)]; }
700
701 /// Steal the contents of \a t.
702 ///
703 /// Close to move-semantics.
704 void push(YY_MOVE_REF(T) t)
705 {
706 seq_.push_back(T());
707 operator[](0).move(t);
708 }
709
710 /// Pop elements from the stack.
711 void pop(std::ptrdiff_t n = 1) YY_NOEXCEPT
712 {
713 for (; 0 < n; --n)
714 seq_.pop_back();
715 }
716
717 /// Pop all elements from the stack.
718 void clear() YY_NOEXCEPT { seq_.clear(); }
719
720 /// Number of elements on the stack.
721 index_type size() const YY_NOEXCEPT { return index_type(seq_.size()); }
722
723 /// Iterator on top of the stack (going downwards).
724 const_iterator begin() const YY_NOEXCEPT { return seq_.begin(); }
725
726 /// Bottom of the stack.
727 const_iterator end() const YY_NOEXCEPT { return seq_.end(); }
728
729 /// Present a slice of the top of a stack.
730 class slice
731 {
732 public:
733 slice(const stack &stack, index_type range) YY_NOEXCEPT : stack_(stack), range_(range) {}
734
735 const T &operator[](index_type i) const { return stack_[range_ - i]; }
736
737 private:
738 const stack &stack_;
740 };
741
742 private:
743#if YY_CPLUSPLUS < 201103L
744 /// Non copyable.
745 stack(const stack &);
746 /// Non copyable.
748#endif
749 /// The wrapped container.
751 };
752
753 /// Stack type.
755
756 /// The stack.
758
759 /// Push a new state on the stack.
760 /// \param m a debug message to display
761 /// if null, no trace is output.
762 /// \param sym the symbol
763 /// \warning the contents of \a s.value is stolen.
764 void yypush_(const char *m, YY_MOVE_REF(stack_symbol_type) sym);
765
766 /// Push a new look ahead token on the state on the stack.
767 /// \param m a debug message to display
768 /// if null, no trace is output.
769 /// \param s the state
770 /// \param sym the symbol (for its value and location).
771 /// \warning the contents of \a sym.value is stolen.
772 void yypush_(const char *m, state_type s, YY_MOVE_REF(symbol_type) sym);
773
774 /// Pop \a n symbols from the stack.
775 void yypop_(int n = 1) YY_NOEXCEPT;
776
777 /// Constants.
778 enum {
779 yylast_ = 2057, ///< Last index in yytable_.
780 yynnts_ = 7, ///< Number of nonterminal symbols.
781 yyfinal_ = 2 ///< Termination state number.
782 };
783
784 // User arguments.
786 };
787
788} // namespace SEAMS
789
790#endif // !YY_SEAMS_APREPRO_PARSER_H_INCLUDED
#define YY_RVREF(Type)
Definition aprepro_parser.h:70
#define YY_MOVE_REF(Type)
Definition aprepro_parser.h:69
#define YY_NOEXCEPT
Definition aprepro_parser.h:79
#define YY_ATTRIBUTE_PURE
Definition aprepro_parser.h:94
#define YY_NOTHROW
Definition aprepro_parser.h:80
Definition aprepro.h:90
Definition aprepro_parser.h:496
const symbol_type & lookahead() const YY_NOEXCEPT
Definition aprepro_parser.h:499
symbol_kind_type token() const YY_NOEXCEPT
Definition aprepro_parser.h:500
const symbol_type & yyla_
Definition aprepro_parser.h:508
const Parser & yyparser_
Definition aprepro_parser.h:507
Present a slice of the top of a stack.
Definition aprepro_parser.h:731
slice(const stack &stack, index_type range) YY_NOEXCEPT
Definition aprepro_parser.h:733
const T & operator[](index_type i) const
Definition aprepro_parser.h:735
index_type range_
Definition aprepro_parser.h:739
const stack & stack_
Definition aprepro_parser.h:738
A stack with random access from its top.
Definition aprepro_parser.h:674
stack & operator=(const stack &)
Non copyable.
S::const_iterator const_iterator
Definition aprepro_parser.h:678
S::iterator iterator
Definition aprepro_parser.h:677
T & operator[](index_type i)
Definition aprepro_parser.h:699
S::size_type size_type
Definition aprepro_parser.h:679
const_iterator begin() const YY_NOEXCEPT
Iterator on top of the stack (going downwards).
Definition aprepro_parser.h:724
void push(YY_MOVE_REF(T) t)
Definition aprepro_parser.h:704
const_iterator end() const YY_NOEXCEPT
Bottom of the stack.
Definition aprepro_parser.h:727
void pop(std::ptrdiff_t n=1) YY_NOEXCEPT
Pop elements from the stack.
Definition aprepro_parser.h:711
const T & operator[](index_type i) const
Definition aprepro_parser.h:694
stack(size_type n=200) YY_NOEXCEPT
Definition aprepro_parser.h:682
std::ptrdiff_t index_type
Definition aprepro_parser.h:680
stack(const stack &)
Non copyable.
index_type size() const YY_NOEXCEPT
Number of elements on the stack.
Definition aprepro_parser.h:721
void clear() YY_NOEXCEPT
Pop all elements from the stack.
Definition aprepro_parser.h:718
S seq_
The wrapped container.
Definition aprepro_parser.h:750
A Bison parser.
Definition aprepro_parser.h:183
token_kind_type token_type
Backward compatibility alias (Bison 3.6).
Definition aprepro_parser.h:276
Parser & operator=(const Parser &)
Non copyable.
stack_type yystack_
The stack.
Definition aprepro_parser.h:757
static const signed char yytable_ninf_
Definition aprepro_parser.h:543
static const symbol_kind_type YYNTOKENS
The number of tokens.
Definition aprepro_parser.h:348
token::token_kind_type token_kind_type
Token kind, as returned by yylex.
Definition aprepro_parser.h:273
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
Definition aprepro_parser.h:345
short state_type
Stored state numbers (used for stacks).
Definition aprepro_parser.h:520
class Aprepro & aprepro
Definition aprepro_parser.h:785
static const signed char yypact_ninf_
Definition aprepro_parser.h:542
value_type semantic_type
Backward compatibility (Bison 3.8).
Definition aprepro_parser.h:201
stack< stack_symbol_type > stack_type
Stack type.
Definition aprepro_parser.h:754
Parser(const Parser &)
Non copyable.
Definition apr_aprepro.cc:57
Definition aprepro_parser.h:357
Base super_type
Alias to Base.
Definition aprepro_parser.h:359
~basic_symbol()
Destroy the symbol.
Definition aprepro_parser.h:378
std::string name() const YY_NOEXCEPT
The user-facing name of this symbol.
Definition aprepro_parser.h:384
basic_symbol() YY_NOEXCEPT
Default constructor.
Definition aprepro_parser.h:362
basic_symbol & operator=(const basic_symbol &that)
Assignment operator.
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Definition aprepro_parser.h:381
Type access provider for token (enum) based symbols.
Definition aprepro_parser.h:407
token_kind_type kind_type
The symbol kind as needed by the constructor.
Definition aprepro_parser.h:409
Type access provider for state based symbols.
Definition aprepro_parser.h:618
state_type kind_type
The symbol kind as needed by the constructor.
Definition aprepro_parser.h:623
state_type state
Definition aprepro_parser.h:647
"Internal" symbol: element of the stack.
Definition aprepro_parser.h:652
basic_symbol< by_state > super_type
Superclass.
Definition aprepro_parser.h:654
Symbol kinds.
Definition aprepro_parser.h:280
symbol_kind_type
Definition aprepro_parser.h:281
@ YYNTOKENS
Number of tokens.
Definition aprepro_parser.h:282
"External" symbols: returned by the scanner.
Definition aprepro_parser.h:448
Syntax errors thrown from user actions.
Definition aprepro_parser.h:205
syntax_error(const syntax_error &s)
Definition aprepro_parser.h:208
~syntax_error() YY_NOEXCEPT YY_NOTHROW
Definition apr_parser.cc:176
syntax_error(const std::string &m)
Definition aprepro_parser.h:206
Token kinds.
Definition aprepro_parser.h:215
token_kind_type
Definition aprepro_parser.h:216
token_kind_type yytokentype
Backward compatibility alias (Bison 3.6).
Definition aprepro_parser.h:269
Definition apr_symrec.h:17
Definition apr_symrec.h:26
Symbol semantic values.
Definition aprepro_parser.h:192
double val
Definition aprepro_parser.h:194
struct symrec * tptr
Definition aprepro_parser.h:195
char * string
Definition aprepro_parser.h:196
struct array * arrval
Definition aprepro_parser.h:197