spot  2.8
parsetl.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.3.2.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015, 2018-2019 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 
39 // C++ LALR(1) parser skeleton written by Akim Demaille.
40 
41 // Undocumented macros, especially those whose name start with YY_,
42 // are private implementation details. Do not rely on them.
43 
44 #ifndef YY_TLYY_PARSETL_HH_INCLUDED
45 # define YY_TLYY_PARSETL_HH_INCLUDED
46 // // "%code requires" blocks.
47 #line 36 "parsetl.yy" // lalr1.cc:401
48 
49 #include "config.h"
50 #include <string>
51 #include <sstream>
52 #include <spot/tl/parse.hh>
53 #include <spot/tl/formula.hh>
54 #include <spot/tl/print.hh>
55 
56  struct minmax_t { unsigned min, max; };
57 
58 #line 59 "parsetl.hh" // lalr1.cc:401
59 
60 
61 # include <cstdlib> // std::abort
62 # include <iostream>
63 # include <stdexcept>
64 # include <string>
65 # include <vector>
66 
67 #if defined __cplusplus
68 # define YY_CPLUSPLUS __cplusplus
69 #else
70 # define YY_CPLUSPLUS 199711L
71 #endif
72 
73 // Support move semantics when possible.
74 #if 201103L <= YY_CPLUSPLUS
75 # define YY_MOVE std::move
76 # define YY_MOVE_OR_COPY move
77 # define YY_MOVE_REF(Type) Type&&
78 # define YY_RVREF(Type) Type&&
79 # define YY_COPY(Type) Type
80 #else
81 # define YY_MOVE
82 # define YY_MOVE_OR_COPY copy
83 # define YY_MOVE_REF(Type) Type&
84 # define YY_RVREF(Type) const Type&
85 # define YY_COPY(Type) const Type&
86 #endif
87 
88 // Support noexcept when possible.
89 #if 201103L <= YY_CPLUSPLUS
90 # define YY_NOEXCEPT noexcept
91 # define YY_NOTHROW
92 #else
93 # define YY_NOEXCEPT
94 # define YY_NOTHROW throw ()
95 #endif
96 
97 // Support constexpr when possible.
98 #if 201703 <= YY_CPLUSPLUS
99 # define YY_CONSTEXPR constexpr
100 #else
101 # define YY_CONSTEXPR
102 #endif
103 
104 
105 
106 #ifndef YY_ATTRIBUTE
107 # if (defined __GNUC__ \
108  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
109  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
110 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
111 # else
112 # define YY_ATTRIBUTE(Spec) /* empty */
113 # endif
114 #endif
115 
116 #ifndef YY_ATTRIBUTE_PURE
117 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
118 #endif
119 
120 #ifndef YY_ATTRIBUTE_UNUSED
121 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
122 #endif
123 
124 /* Suppress unused-variable warnings by "using" E. */
125 #if ! defined lint || defined __GNUC__
126 # define YYUSE(E) ((void) (E))
127 #else
128 # define YYUSE(E) /* empty */
129 #endif
130 
131 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
132 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
133 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
134  _Pragma ("GCC diagnostic push") \
135  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
136  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
137 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
138  _Pragma ("GCC diagnostic pop")
139 #else
140 # define YY_INITIAL_VALUE(Value) Value
141 #endif
142 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
143 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
144 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
145 #endif
146 #ifndef YY_INITIAL_VALUE
147 # define YY_INITIAL_VALUE(Value) /* Nothing. */
148 #endif
149 
150 # ifndef YY_NULLPTR
151 # if defined __cplusplus
152 # if 201103L <= __cplusplus
153 # define YY_NULLPTR nullptr
154 # else
155 # define YY_NULLPTR 0
156 # endif
157 # else
158 # define YY_NULLPTR ((void*)0)
159 # endif
160 # endif
161 
162 /* Debug traces. */
163 #ifndef YYDEBUG
164 # define YYDEBUG 1
165 #endif
166 
167 
168 namespace tlyy {
169 #line 170 "parsetl.hh" // lalr1.cc:401
170 
171 
172 
174  class parser
175  {
176  public:
177 #ifndef YYSTYPE
178  union semantic_type
180  {
181  #line 51 "parsetl.yy" // lalr1.cc:401
182 
183  std::string* str;
184  const spot::fnode* ltl;
185  unsigned num;
186  minmax_t minmax;
187 
188 #line 189 "parsetl.hh" // lalr1.cc:401
189  };
190 #else
191  typedef YYSTYPE semantic_type;
192 #endif
193  typedef spot::location location_type;
195 
197  struct syntax_error : std::runtime_error
198  {
199  syntax_error (const location_type& l, const std::string& m)
200  : std::runtime_error (m)
201  , location (l)
202  {}
203 
204  syntax_error (const syntax_error& s)
205  : std::runtime_error (s.what ())
206  , location (s.location)
207  {}
208 
209  ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
210 
211  location_type location;
212  };
213 
215  struct token
216  {
217  enum yytokentype
218  {
219  START_LTL = 258,
220  START_LBT = 259,
221  START_SERE = 260,
222  START_BOOL = 261,
223  PAR_OPEN = 262,
224  PAR_CLOSE = 263,
225  PAR_BLOCK = 264,
226  BRA_BLOCK = 265,
227  BRA_BANG_BLOCK = 266,
228  BRACE_OPEN = 267,
229  BRACE_CLOSE = 268,
230  BRACE_BANG_CLOSE = 269,
231  OP_OR = 270,
232  OP_XOR = 271,
233  OP_AND = 272,
234  OP_SHORT_AND = 273,
235  OP_IMPLIES = 274,
236  OP_EQUIV = 275,
237  OP_U = 276,
238  OP_R = 277,
239  OP_W = 278,
240  OP_M = 279,
241  OP_F = 280,
242  OP_G = 281,
243  OP_X = 282,
244  OP_NOT = 283,
245  OP_XREP = 284,
246  OP_FREP = 285,
247  OP_GREP = 286,
248  OP_STAR = 287,
249  OP_BSTAR = 288,
250  OP_BFSTAR = 289,
251  OP_PLUS = 290,
252  OP_FPLUS = 291,
253  OP_STAR_OPEN = 292,
254  OP_FSTAR_OPEN = 293,
255  OP_EQUAL_OPEN = 294,
256  OP_GOTO_OPEN = 295,
257  OP_SQBKT_CLOSE = 296,
258  OP_SQBKT_NUM = 297,
259  OP_UNBOUNDED = 298,
260  OP_SQBKT_SEP = 299,
261  OP_UCONCAT = 300,
262  OP_ECONCAT = 301,
263  OP_UCONCAT_NONO = 302,
264  OP_ECONCAT_NONO = 303,
265  OP_FIRST_MATCH = 304,
266  ATOMIC_PROP = 305,
267  OP_CONCAT = 306,
268  OP_FUSION = 307,
269  CONST_TRUE = 308,
270  CONST_FALSE = 309,
271  END_OF_INPUT = 310,
272  OP_POST_NEG = 311,
273  OP_POST_POS = 312,
274  OP_DELAY_N = 313,
275  OP_DELAY_OPEN = 314,
276  OP_DELAY_PLUS = 315,
277  OP_DELAY_STAR = 316
278  };
279  };
280 
282  typedef token::yytokentype token_type;
283 
285  typedef int symbol_number_type;
286 
288  enum { empty_symbol = -2 };
289 
291  typedef unsigned char token_number_type;
292 
299  template <typename Base>
300  struct basic_symbol : Base
301  {
303  typedef Base super_type;
304 
307  : value ()
308  , location ()
309  {}
310 
311 #if 201103L <= YY_CPLUSPLUS
312  basic_symbol (basic_symbol&& that);
314 #endif
315 
317  basic_symbol (const basic_symbol& that);
319  basic_symbol (typename Base::kind_type t,
320  YY_MOVE_REF (location_type) l);
321 
323  basic_symbol (typename Base::kind_type t,
324  YY_RVREF (semantic_type) v,
325  YY_RVREF (location_type) l);
326 
329  {
330  clear ();
331  }
332 
334  void clear ()
335  {
336  Base::clear ();
337  }
338 
340  bool empty () const YY_NOEXCEPT;
341 
343  void move (basic_symbol& s);
344 
346  semantic_type value;
347 
349  location_type location;
350 
351  private:
352 #if YY_CPLUSPLUS < 201103L
353  basic_symbol& operator= (const basic_symbol& that);
355 #endif
356  };
357 
359  struct by_type
360  {
362  by_type ();
363 
364 #if 201103L <= YY_CPLUSPLUS
365  by_type (by_type&& that);
367 #endif
368 
370  by_type (const by_type& that);
371 
373  typedef token_type kind_type;
374 
376  by_type (kind_type t);
377 
379  void clear ();
380 
382  void move (by_type& that);
383 
386  symbol_number_type type_get () const YY_NOEXCEPT;
387 
389  token_type token () const YY_NOEXCEPT;
390 
394  int type;
395  };
396 
399  {};
400 
402  parser (spot::parse_error_list &error_list_yyarg, spot::environment &parse_environment_yyarg, spot::formula &result_yyarg);
403  virtual ~parser ();
404 
407  int operator() ();
408 
411  virtual int parse ();
412 
413 #if YYDEBUG
414  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
417  void set_debug_stream (std::ostream &);
418 
420  typedef int debug_level_type;
422  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
424  void set_debug_level (debug_level_type l);
425 #endif
426 
430  virtual void error (const location_type& loc, const std::string& msg);
431 
433  void error (const syntax_error& err);
434 
435 
436 
437  private:
439  parser (const parser&);
440  parser& operator= (const parser&);
441 
443  typedef int state_type;
444 
448  virtual std::string yysyntax_error_ (state_type yystate,
449  const symbol_type& yyla) const;
450 
454  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
455 
458  static bool yy_pact_value_is_default_ (int yyvalue);
459 
462  static bool yy_table_value_is_error_ (int yyvalue);
463 
464  static const signed char yypact_ninf_;
465  static const signed char yytable_ninf_;
466 
468  static token_number_type yytranslate_ (int t);
469 
470  // Tables.
471  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
472  // STATE-NUM.
473  static const short yypact_[];
474 
475  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
476  // Performed when YYTABLE does not specify something else to do. Zero
477  // means the default is an error.
478  static const unsigned char yydefact_[];
479 
480  // YYPGOTO[NTERM-NUM].
481  static const short yypgoto_[];
482 
483  // YYDEFGOTO[NTERM-NUM].
484  static const short yydefgoto_[];
485 
486  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
487  // positive, shift that token. If negative, reduce the rule whose
488  // number is the opposite. If YYTABLE_NINF, syntax error.
489  static const short yytable_[];
490 
491  static const short yycheck_[];
492 
493  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
494  // symbol of state STATE-NUM.
495  static const unsigned char yystos_[];
496 
497  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
498  static const unsigned char yyr1_[];
499 
500  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
501  static const unsigned char yyr2_[];
502 
503 
505  static std::string yytnamerr_ (const char *n);
506 
507 
509  static const char* const yytname_[];
510 #if YYDEBUG
511  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
512  static const unsigned short yyrline_[];
514  virtual void yy_reduce_print_ (int r);
516  virtual void yystack_print_ ();
517 
519  int yydebug_;
521  std::ostream* yycdebug_;
522 
526  template <typename Base>
527  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
528 #endif
529 
534  template <typename Base>
535  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
536 
537  private:
539  struct by_state
540  {
542  by_state () YY_NOEXCEPT;
543 
545  typedef state_type kind_type;
546 
548  by_state (kind_type s) YY_NOEXCEPT;
549 
551  by_state (const by_state& that) YY_NOEXCEPT;
552 
554  void clear () YY_NOEXCEPT;
555 
557  void move (by_state& that);
558 
561  symbol_number_type type_get () const YY_NOEXCEPT;
562 
564  enum { empty_state = -1 };
565 
568  state_type state;
569  };
570 
572  struct stack_symbol_type : basic_symbol<by_state>
573  {
575  typedef basic_symbol<by_state> super_type;
577  stack_symbol_type ();
579  stack_symbol_type (YY_RVREF (stack_symbol_type) that);
581  stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
582 #if YY_CPLUSPLUS < 201103L
583  stack_symbol_type& operator= (stack_symbol_type& that);
586 #endif
587  };
588 
590  template <typename T, typename S = std::vector<T> >
591  class stack
592  {
593  public:
594  // Hide our reversed order.
595  typedef typename S::reverse_iterator iterator;
596  typedef typename S::const_reverse_iterator const_iterator;
597  typedef typename S::size_type size_type;
598 
599  stack (size_type n = 200)
600  : seq_ (n)
601  {}
602 
606  T&
607  operator[] (size_type i)
608  {
609  return seq_[size () - 1 - i];
610  }
611 
615  T&
616  operator[] (int i)
617  {
618  return operator[] (size_type (i));
619  }
620 
624  const T&
625  operator[] (size_type i) const
626  {
627  return seq_[size () - 1 - i];
628  }
629 
633  const T&
634  operator[] (int i) const
635  {
636  return operator[] (size_type (i));
637  }
638 
642  void
643  push (YY_MOVE_REF (T) t)
644  {
645  seq_.push_back (T ());
646  operator[] (0).move (t);
647  }
648 
650  void
651  pop (int n = 1) YY_NOEXCEPT
652  {
653  for (; 0 < n; --n)
654  seq_.pop_back ();
655  }
656 
658  void
659  clear () YY_NOEXCEPT
660  {
661  seq_.clear ();
662  }
663 
665  size_type
666  size () const YY_NOEXCEPT
667  {
668  return seq_.size ();
669  }
670 
672  const_iterator
673  begin () const YY_NOEXCEPT
674  {
675  return seq_.rbegin ();
676  }
677 
679  const_iterator
680  end () const YY_NOEXCEPT
681  {
682  return seq_.rend ();
683  }
684 
686  class slice
687  {
688  public:
689  slice (const stack& stack, int range)
690  : stack_ (stack)
691  , range_ (range)
692  {}
693 
694  const T&
695  operator[] (int i) const
696  {
697  return stack_[range_ - i];
698  }
699 
700  private:
701  const stack& stack_;
702  int range_;
703  };
704 
705  private:
706  stack (const stack&);
707  stack& operator= (const stack&);
709  S seq_;
710  };
711 
712 
714  typedef stack<stack_symbol_type> stack_type;
715 
717  stack_type yystack_;
718 
724  void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
725 
732  void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
733 
735  void yypop_ (int n = 1);
736 
738  enum
739  {
740  yyeof_ = 0,
741  yylast_ = 2167,
742  yynnts_ = 22,
743  yyfinal_ = 78,
744  yyterror_ = 1,
745  yyerrcode_ = 256,
746  yyntokens_ = 78
747  };
748 
749 
750  // User arguments.
751  spot::parse_error_list &error_list;
752  spot::environment &parse_environment;
753  spot::formula &result;
754  };
755 
756 
757 
758 } // tlyy
759 #line 760 "parsetl.hh" // lalr1.cc:401
760 
761 
762 
763 
764 #endif // !YY_TLYY_PARSETL_HH_INCLUDED
spot::location location_type
Symbol locations.
Definition: parsetl.hh:194
Definition: parsetl.hh:168
Symbol semantic values.
Definition: parsetl.hh:179
Type access provider for token (enum) based symbols.
Definition: parsetl.hh:359
An environment that describes atomic propositions.
Definition: environment.hh:32
Present a slice of the top of a stack.
Definition: parsetl.hh:686
"External" symbols: returned by the scanner.
Definition: parsetl.hh:398
LTL/PSL formula interface.
A Bison parser.
Definition: parsetl.hh:174
semantic_type value
The semantic value.
Definition: parsetl.hh:346
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parsetl.hh:285
Main class for temporal logic formula.
Definition: formula.hh:686
token_type kind_type
The symbol type as needed by the constructor.
Definition: parsetl.hh:373
std::list< one_parse_error > parse_error_list
A list of parser diagnostics, as filled by parse.
Definition: parse.hh:42
location_type location
The location.
Definition: parsetl.hh:349
basic_symbol()
Default constructor.
Definition: parsetl.hh:306
void clear()
Destroy contents, and record that is empty.
Definition: parsetl.hh:334
int debug_level_type
Type for debugging levels.
Definition: parsetl.hh:420
Tokens.
Definition: parsetl.hh:215
~basic_symbol()
Destroy the symbol.
Definition: parsetl.hh:328
Definition: parsetl.hh:56
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parsetl.hh:282
Definition: parsetl.hh:300
Actual storage for formula nodes.
Definition: formula.hh:110
Definition: parseaut.hh:445
Syntax errors thrown from user actions.
Definition: parsetl.hh:197
Base super_type
Alias to Base.
Definition: parsetl.hh:303
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parsetl.hh:291

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.8.13