spot  2.9.2
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 TLYYDEBUG
164 # if defined YYDEBUG
165 #if YYDEBUG
166 # define TLYYDEBUG 1
167 # else
168 # define TLYYDEBUG 0
169 # endif
170 # else /* ! defined YYDEBUG */
171 # define TLYYDEBUG 1
172 # endif /* ! defined YYDEBUG */
173 #endif /* ! defined TLYYDEBUG */
174 
175 
176 namespace tlyy {
177 #line 178 "parsetl.hh" // lalr1.cc:401
178 
179 
180 
182  class parser
183  {
184  public:
185 #ifndef TLYYSTYPE
186  union semantic_type
188  {
189  #line 52 "parsetl.yy" // lalr1.cc:401
190 
191  std::string* str;
192  const spot::fnode* ltl;
193  unsigned num;
194  minmax_t minmax;
195 
196 #line 197 "parsetl.hh" // lalr1.cc:401
197  };
198 #else
199  typedef TLYYSTYPE semantic_type;
200 #endif
201  typedef spot::location location_type;
203 
205  struct syntax_error : std::runtime_error
206  {
207  syntax_error (const location_type& l, const std::string& m)
208  : std::runtime_error (m)
209  , location (l)
210  {}
211 
212  syntax_error (const syntax_error& s)
213  : std::runtime_error (s.what ())
214  , location (s.location)
215  {}
216 
217  ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
218 
219  location_type location;
220  };
221 
223  struct token
224  {
225  enum yytokentype
226  {
227  START_LTL = 258,
228  START_LBT = 259,
229  START_SERE = 260,
230  START_BOOL = 261,
231  PAR_OPEN = 262,
232  PAR_CLOSE = 263,
233  PAR_BLOCK = 264,
234  BRA_BLOCK = 265,
235  BRA_BANG_BLOCK = 266,
236  BRACE_OPEN = 267,
237  BRACE_CLOSE = 268,
238  BRACE_BANG_CLOSE = 269,
239  OP_OR = 270,
240  OP_XOR = 271,
241  OP_AND = 272,
242  OP_SHORT_AND = 273,
243  OP_IMPLIES = 274,
244  OP_EQUIV = 275,
245  OP_U = 276,
246  OP_R = 277,
247  OP_W = 278,
248  OP_M = 279,
249  OP_F = 280,
250  OP_G = 281,
251  OP_X = 282,
252  OP_STRONG_X = 283,
253  OP_NOT = 284,
254  OP_XREP = 285,
255  OP_FREP = 286,
256  OP_GREP = 287,
257  OP_STAR = 288,
258  OP_BSTAR = 289,
259  OP_BFSTAR = 290,
260  OP_PLUS = 291,
261  OP_FPLUS = 292,
262  OP_STAR_OPEN = 293,
263  OP_FSTAR_OPEN = 294,
264  OP_EQUAL_OPEN = 295,
265  OP_GOTO_OPEN = 296,
266  OP_SQBKT_CLOSE = 297,
267  OP_SQBKT_STRONG_CLOSE = 298,
268  OP_SQBKT_NUM = 299,
269  OP_UNBOUNDED = 300,
270  OP_SQBKT_SEP = 301,
271  OP_UCONCAT = 302,
272  OP_ECONCAT = 303,
273  OP_UCONCAT_NONO = 304,
274  OP_ECONCAT_NONO = 305,
275  OP_FIRST_MATCH = 306,
276  ATOMIC_PROP = 307,
277  OP_CONCAT = 308,
278  OP_FUSION = 309,
279  CONST_TRUE = 310,
280  CONST_FALSE = 311,
281  END_OF_INPUT = 312,
282  OP_POST_NEG = 313,
283  OP_POST_POS = 314,
284  OP_DELAY_N = 315,
285  OP_DELAY_OPEN = 316,
286  OP_DELAY_PLUS = 317,
287  OP_DELAY_STAR = 318
288  };
289  };
290 
292  typedef token::yytokentype token_type;
293 
295  typedef int symbol_number_type;
296 
298  enum { empty_symbol = -2 };
299 
301  typedef unsigned char token_number_type;
302 
309  template <typename Base>
310  struct basic_symbol : Base
311  {
313  typedef Base super_type;
314 
317  : value ()
318  , location ()
319  {}
320 
321 #if 201103L <= YY_CPLUSPLUS
322  basic_symbol (basic_symbol&& that);
324 #endif
325 
327  basic_symbol (const basic_symbol& that);
329  basic_symbol (typename Base::kind_type t,
330  YY_MOVE_REF (location_type) l);
331 
333  basic_symbol (typename Base::kind_type t,
334  YY_RVREF (semantic_type) v,
335  YY_RVREF (location_type) l);
336 
339  {
340  clear ();
341  }
342 
344  void clear ()
345  {
346  Base::clear ();
347  }
348 
350  bool empty () const YY_NOEXCEPT;
351 
353  void move (basic_symbol& s);
354 
356  semantic_type value;
357 
359  location_type location;
360 
361  private:
362 #if YY_CPLUSPLUS < 201103L
363  basic_symbol& operator= (const basic_symbol& that);
365 #endif
366  };
367 
369  struct by_type
370  {
372  by_type ();
373 
374 #if 201103L <= YY_CPLUSPLUS
375  by_type (by_type&& that);
377 #endif
378 
380  by_type (const by_type& that);
381 
383  typedef token_type kind_type;
384 
386  by_type (kind_type t);
387 
389  void clear ();
390 
392  void move (by_type& that);
393 
396  symbol_number_type type_get () const YY_NOEXCEPT;
397 
399  token_type token () const YY_NOEXCEPT;
400 
404  int type;
405  };
406 
409  {};
410 
412  parser (spot::parse_error_list &error_list_yyarg, spot::environment &parse_environment_yyarg, spot::formula &result_yyarg);
413  virtual ~parser ();
414 
417  int operator() ();
418 
421  virtual int parse ();
422 
423 #if TLYYDEBUG
424  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
427  void set_debug_stream (std::ostream &);
428 
430  typedef int debug_level_type;
432  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
434  void set_debug_level (debug_level_type l);
435 #endif
436 
440  virtual void error (const location_type& loc, const std::string& msg);
441 
443  void error (const syntax_error& err);
444 
445 
446 
447  private:
449  parser (const parser&);
450  parser& operator= (const parser&);
451 
453  typedef int state_type;
454 
458  virtual std::string yysyntax_error_ (state_type yystate,
459  const symbol_type& yyla) const;
460 
464  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
465 
468  static bool yy_pact_value_is_default_ (int yyvalue);
469 
472  static bool yy_table_value_is_error_ (int yyvalue);
473 
474  static const signed char yypact_ninf_;
475  static const signed char yytable_ninf_;
476 
478  static token_number_type yytranslate_ (int t);
479 
480  // Tables.
481  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
482  // STATE-NUM.
483  static const short yypact_[];
484 
485  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
486  // Performed when YYTABLE does not specify something else to do. Zero
487  // means the default is an error.
488  static const unsigned char yydefact_[];
489 
490  // YYPGOTO[NTERM-NUM].
491  static const short yypgoto_[];
492 
493  // YYDEFGOTO[NTERM-NUM].
494  static const short yydefgoto_[];
495 
496  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
497  // positive, shift that token. If negative, reduce the rule whose
498  // number is the opposite. If YYTABLE_NINF, syntax error.
499  static const short yytable_[];
500 
501  static const short yycheck_[];
502 
503  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
504  // symbol of state STATE-NUM.
505  static const unsigned char yystos_[];
506 
507  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
508  static const unsigned char yyr1_[];
509 
510  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
511  static const unsigned char yyr2_[];
512 
513 
515  static std::string yytnamerr_ (const char *n);
516 
517 
519  static const char* const yytname_[];
520 #if TLYYDEBUG
521  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
522  static const unsigned short yyrline_[];
524  virtual void yy_reduce_print_ (int r);
526  virtual void yystack_print_ ();
527 
529  int yydebug_;
531  std::ostream* yycdebug_;
532 
536  template <typename Base>
537  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
538 #endif
539 
544  template <typename Base>
545  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
546 
547  private:
549  struct by_state
550  {
552  by_state () YY_NOEXCEPT;
553 
555  typedef state_type kind_type;
556 
558  by_state (kind_type s) YY_NOEXCEPT;
559 
561  by_state (const by_state& that) YY_NOEXCEPT;
562 
564  void clear () YY_NOEXCEPT;
565 
567  void move (by_state& that);
568 
571  symbol_number_type type_get () const YY_NOEXCEPT;
572 
574  enum { empty_state = -1 };
575 
578  state_type state;
579  };
580 
582  struct stack_symbol_type : basic_symbol<by_state>
583  {
585  typedef basic_symbol<by_state> super_type;
587  stack_symbol_type ();
589  stack_symbol_type (YY_RVREF (stack_symbol_type) that);
591  stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
592 #if YY_CPLUSPLUS < 201103L
593  stack_symbol_type& operator= (stack_symbol_type& that);
596 #endif
597  };
598 
600  template <typename T, typename S = std::vector<T> >
601  class stack
602  {
603  public:
604  // Hide our reversed order.
605  typedef typename S::reverse_iterator iterator;
606  typedef typename S::const_reverse_iterator const_iterator;
607  typedef typename S::size_type size_type;
608 
609  stack (size_type n = 200)
610  : seq_ (n)
611  {}
612 
616  T&
617  operator[] (size_type i)
618  {
619  return seq_[size () - 1 - i];
620  }
621 
625  T&
626  operator[] (int i)
627  {
628  return operator[] (size_type (i));
629  }
630 
634  const T&
635  operator[] (size_type i) const
636  {
637  return seq_[size () - 1 - i];
638  }
639 
643  const T&
644  operator[] (int i) const
645  {
646  return operator[] (size_type (i));
647  }
648 
652  void
653  push (YY_MOVE_REF (T) t)
654  {
655  seq_.push_back (T ());
656  operator[] (0).move (t);
657  }
658 
660  void
661  pop (int n = 1) YY_NOEXCEPT
662  {
663  for (; 0 < n; --n)
664  seq_.pop_back ();
665  }
666 
668  void
669  clear () YY_NOEXCEPT
670  {
671  seq_.clear ();
672  }
673 
675  size_type
676  size () const YY_NOEXCEPT
677  {
678  return seq_.size ();
679  }
680 
682  const_iterator
683  begin () const YY_NOEXCEPT
684  {
685  return seq_.rbegin ();
686  }
687 
689  const_iterator
690  end () const YY_NOEXCEPT
691  {
692  return seq_.rend ();
693  }
694 
696  class slice
697  {
698  public:
699  slice (const stack& stack, int range)
700  : stack_ (stack)
701  , range_ (range)
702  {}
703 
704  const T&
705  operator[] (int i) const
706  {
707  return stack_[range_ - i];
708  }
709 
710  private:
711  const stack& stack_;
712  int range_;
713  };
714 
715  private:
716  stack (const stack&);
717  stack& operator= (const stack&);
719  S seq_;
720  };
721 
722 
724  typedef stack<stack_symbol_type> stack_type;
725 
727  stack_type yystack_;
728 
734  void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
735 
742  void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
743 
745  void yypop_ (int n = 1);
746 
748  enum
749  {
750  yyeof_ = 0,
751  yylast_ = 2370,
752  yynnts_ = 22,
753  yyfinal_ = 79,
754  yyterror_ = 1,
755  yyerrcode_ = 256,
756  yyntokens_ = 80
757  };
758 
759 
760  // User arguments.
761  spot::parse_error_list &error_list;
762  spot::environment &parse_environment;
763  spot::formula &result;
764  };
765 
766 
767 
768 } // tlyy
769 #line 770 "parsetl.hh" // lalr1.cc:401
770 
771 
772 
773 
774 #endif // !YY_TLYY_PARSETL_HH_INCLUDED
spot::location location_type
Symbol locations.
Definition: parsetl.hh:202
Definition: parsetl.hh:176
Symbol semantic values.
Definition: parsetl.hh:187
Type access provider for token (enum) based symbols.
Definition: parsetl.hh:369
An environment that describes atomic propositions.
Definition: environment.hh:32
Present a slice of the top of a stack.
Definition: parsetl.hh:696
"External" symbols: returned by the scanner.
Definition: parsetl.hh:408
LTL/PSL formula interface.
A Bison parser.
Definition: parsetl.hh:182
semantic_type value
The semantic value.
Definition: parsetl.hh:356
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parsetl.hh:295
Main class for temporal logic formula.
Definition: formula.hh:714
token_type kind_type
The symbol type as needed by the constructor.
Definition: parsetl.hh:383
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:359
basic_symbol()
Default constructor.
Definition: parsetl.hh:316
void clear()
Destroy contents, and record that is empty.
Definition: parsetl.hh:344
int debug_level_type
Type for debugging levels.
Definition: parsetl.hh:430
Tokens.
Definition: parsetl.hh:223
~basic_symbol()
Destroy the symbol.
Definition: parsetl.hh:338
Definition: parsetl.hh:56
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parsetl.hh:292
Definition: parsetl.hh:310
Actual storage for formula nodes.
Definition: formula.hh:127
Definition: parseaut.hh:453
Syntax errors thrown from user actions.
Definition: parsetl.hh:205
Base super_type
Alias to Base.
Definition: parsetl.hh:313
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parsetl.hh:301

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