spot  2.8.3
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_NOT = 283,
253  OP_XREP = 284,
254  OP_FREP = 285,
255  OP_GREP = 286,
256  OP_STAR = 287,
257  OP_BSTAR = 288,
258  OP_BFSTAR = 289,
259  OP_PLUS = 290,
260  OP_FPLUS = 291,
261  OP_STAR_OPEN = 292,
262  OP_FSTAR_OPEN = 293,
263  OP_EQUAL_OPEN = 294,
264  OP_GOTO_OPEN = 295,
265  OP_SQBKT_CLOSE = 296,
266  OP_SQBKT_NUM = 297,
267  OP_UNBOUNDED = 298,
268  OP_SQBKT_SEP = 299,
269  OP_UCONCAT = 300,
270  OP_ECONCAT = 301,
271  OP_UCONCAT_NONO = 302,
272  OP_ECONCAT_NONO = 303,
273  OP_FIRST_MATCH = 304,
274  ATOMIC_PROP = 305,
275  OP_CONCAT = 306,
276  OP_FUSION = 307,
277  CONST_TRUE = 308,
278  CONST_FALSE = 309,
279  END_OF_INPUT = 310,
280  OP_POST_NEG = 311,
281  OP_POST_POS = 312,
282  OP_DELAY_N = 313,
283  OP_DELAY_OPEN = 314,
284  OP_DELAY_PLUS = 315,
285  OP_DELAY_STAR = 316
286  };
287  };
288 
290  typedef token::yytokentype token_type;
291 
293  typedef int symbol_number_type;
294 
296  enum { empty_symbol = -2 };
297 
299  typedef unsigned char token_number_type;
300 
307  template <typename Base>
308  struct basic_symbol : Base
309  {
311  typedef Base super_type;
312 
315  : value ()
316  , location ()
317  {}
318 
319 #if 201103L <= YY_CPLUSPLUS
320  basic_symbol (basic_symbol&& that);
322 #endif
323 
325  basic_symbol (const basic_symbol& that);
327  basic_symbol (typename Base::kind_type t,
328  YY_MOVE_REF (location_type) l);
329 
331  basic_symbol (typename Base::kind_type t,
332  YY_RVREF (semantic_type) v,
333  YY_RVREF (location_type) l);
334 
337  {
338  clear ();
339  }
340 
342  void clear ()
343  {
344  Base::clear ();
345  }
346 
348  bool empty () const YY_NOEXCEPT;
349 
351  void move (basic_symbol& s);
352 
354  semantic_type value;
355 
357  location_type location;
358 
359  private:
360 #if YY_CPLUSPLUS < 201103L
361  basic_symbol& operator= (const basic_symbol& that);
363 #endif
364  };
365 
367  struct by_type
368  {
370  by_type ();
371 
372 #if 201103L <= YY_CPLUSPLUS
373  by_type (by_type&& that);
375 #endif
376 
378  by_type (const by_type& that);
379 
381  typedef token_type kind_type;
382 
384  by_type (kind_type t);
385 
387  void clear ();
388 
390  void move (by_type& that);
391 
394  symbol_number_type type_get () const YY_NOEXCEPT;
395 
397  token_type token () const YY_NOEXCEPT;
398 
402  int type;
403  };
404 
407  {};
408 
410  parser (spot::parse_error_list &error_list_yyarg, spot::environment &parse_environment_yyarg, spot::formula &result_yyarg);
411  virtual ~parser ();
412 
415  int operator() ();
416 
419  virtual int parse ();
420 
421 #if TLYYDEBUG
422  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
425  void set_debug_stream (std::ostream &);
426 
428  typedef int debug_level_type;
430  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
432  void set_debug_level (debug_level_type l);
433 #endif
434 
438  virtual void error (const location_type& loc, const std::string& msg);
439 
441  void error (const syntax_error& err);
442 
443 
444 
445  private:
447  parser (const parser&);
448  parser& operator= (const parser&);
449 
451  typedef int state_type;
452 
456  virtual std::string yysyntax_error_ (state_type yystate,
457  const symbol_type& yyla) const;
458 
462  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
463 
466  static bool yy_pact_value_is_default_ (int yyvalue);
467 
470  static bool yy_table_value_is_error_ (int yyvalue);
471 
472  static const signed char yypact_ninf_;
473  static const signed char yytable_ninf_;
474 
476  static token_number_type yytranslate_ (int t);
477 
478  // Tables.
479  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
480  // STATE-NUM.
481  static const short yypact_[];
482 
483  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
484  // Performed when YYTABLE does not specify something else to do. Zero
485  // means the default is an error.
486  static const unsigned char yydefact_[];
487 
488  // YYPGOTO[NTERM-NUM].
489  static const short yypgoto_[];
490 
491  // YYDEFGOTO[NTERM-NUM].
492  static const short yydefgoto_[];
493 
494  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
495  // positive, shift that token. If negative, reduce the rule whose
496  // number is the opposite. If YYTABLE_NINF, syntax error.
497  static const short yytable_[];
498 
499  static const short yycheck_[];
500 
501  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
502  // symbol of state STATE-NUM.
503  static const unsigned char yystos_[];
504 
505  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
506  static const unsigned char yyr1_[];
507 
508  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
509  static const unsigned char yyr2_[];
510 
511 
513  static std::string yytnamerr_ (const char *n);
514 
515 
517  static const char* const yytname_[];
518 #if TLYYDEBUG
519  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
520  static const unsigned short yyrline_[];
522  virtual void yy_reduce_print_ (int r);
524  virtual void yystack_print_ ();
525 
527  int yydebug_;
529  std::ostream* yycdebug_;
530 
534  template <typename Base>
535  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
536 #endif
537 
542  template <typename Base>
543  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
544 
545  private:
547  struct by_state
548  {
550  by_state () YY_NOEXCEPT;
551 
553  typedef state_type kind_type;
554 
556  by_state (kind_type s) YY_NOEXCEPT;
557 
559  by_state (const by_state& that) YY_NOEXCEPT;
560 
562  void clear () YY_NOEXCEPT;
563 
565  void move (by_state& that);
566 
569  symbol_number_type type_get () const YY_NOEXCEPT;
570 
572  enum { empty_state = -1 };
573 
576  state_type state;
577  };
578 
580  struct stack_symbol_type : basic_symbol<by_state>
581  {
583  typedef basic_symbol<by_state> super_type;
585  stack_symbol_type ();
587  stack_symbol_type (YY_RVREF (stack_symbol_type) that);
589  stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
590 #if YY_CPLUSPLUS < 201103L
591  stack_symbol_type& operator= (stack_symbol_type& that);
594 #endif
595  };
596 
598  template <typename T, typename S = std::vector<T> >
599  class stack
600  {
601  public:
602  // Hide our reversed order.
603  typedef typename S::reverse_iterator iterator;
604  typedef typename S::const_reverse_iterator const_iterator;
605  typedef typename S::size_type size_type;
606 
607  stack (size_type n = 200)
608  : seq_ (n)
609  {}
610 
614  T&
615  operator[] (size_type i)
616  {
617  return seq_[size () - 1 - i];
618  }
619 
623  T&
624  operator[] (int i)
625  {
626  return operator[] (size_type (i));
627  }
628 
632  const T&
633  operator[] (size_type i) const
634  {
635  return seq_[size () - 1 - i];
636  }
637 
641  const T&
642  operator[] (int i) const
643  {
644  return operator[] (size_type (i));
645  }
646 
650  void
651  push (YY_MOVE_REF (T) t)
652  {
653  seq_.push_back (T ());
654  operator[] (0).move (t);
655  }
656 
658  void
659  pop (int n = 1) YY_NOEXCEPT
660  {
661  for (; 0 < n; --n)
662  seq_.pop_back ();
663  }
664 
666  void
667  clear () YY_NOEXCEPT
668  {
669  seq_.clear ();
670  }
671 
673  size_type
674  size () const YY_NOEXCEPT
675  {
676  return seq_.size ();
677  }
678 
680  const_iterator
681  begin () const YY_NOEXCEPT
682  {
683  return seq_.rbegin ();
684  }
685 
687  const_iterator
688  end () const YY_NOEXCEPT
689  {
690  return seq_.rend ();
691  }
692 
694  class slice
695  {
696  public:
697  slice (const stack& stack, int range)
698  : stack_ (stack)
699  , range_ (range)
700  {}
701 
702  const T&
703  operator[] (int i) const
704  {
705  return stack_[range_ - i];
706  }
707 
708  private:
709  const stack& stack_;
710  int range_;
711  };
712 
713  private:
714  stack (const stack&);
715  stack& operator= (const stack&);
717  S seq_;
718  };
719 
720 
722  typedef stack<stack_symbol_type> stack_type;
723 
725  stack_type yystack_;
726 
732  void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
733 
740  void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
741 
743  void yypop_ (int n = 1);
744 
746  enum
747  {
748  yyeof_ = 0,
749  yylast_ = 2167,
750  yynnts_ = 22,
751  yyfinal_ = 78,
752  yyterror_ = 1,
753  yyerrcode_ = 256,
754  yyntokens_ = 78
755  };
756 
757 
758  // User arguments.
759  spot::parse_error_list &error_list;
760  spot::environment &parse_environment;
761  spot::formula &result;
762  };
763 
764 
765 
766 } // tlyy
767 #line 768 "parsetl.hh" // lalr1.cc:401
768 
769 
770 
771 
772 #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:367
An environment that describes atomic propositions.
Definition: environment.hh:32
Present a slice of the top of a stack.
Definition: parsetl.hh:694
"External" symbols: returned by the scanner.
Definition: parsetl.hh:406
LTL/PSL formula interface.
A Bison parser.
Definition: parsetl.hh:182
semantic_type value
The semantic value.
Definition: parsetl.hh:354
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parsetl.hh:293
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:381
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:357
basic_symbol()
Default constructor.
Definition: parsetl.hh:314
void clear()
Destroy contents, and record that is empty.
Definition: parsetl.hh:342
int debug_level_type
Type for debugging levels.
Definition: parsetl.hh:428
Tokens.
Definition: parsetl.hh:223
~basic_symbol()
Destroy the symbol.
Definition: parsetl.hh:336
Definition: parsetl.hh:56
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parsetl.hh:290
Definition: parsetl.hh:308
Actual storage for formula nodes.
Definition: formula.hh:110
Definition: parseaut.hh:453
Syntax errors thrown from user actions.
Definition: parsetl.hh:205
Base super_type
Alias to Base.
Definition: parsetl.hh:311
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parsetl.hh:299

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