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

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Mon Jul 29 2019 10:30:37 for spot by doxygen 1.8.13