librostlab-blast  1.0.1
blast-parser-parser.h
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015 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 
38 // C++ LALR(1) parser skeleton written by Akim Demaille.
39 
40 #ifndef YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
41 # define YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
42 // // "%code requires" blocks.
43 #line 24 "blast-parser-parser.ypp" // lalr1.cc:377
44 
45 #include <string>
46 #include "rostlab/blast-result.h"
47 namespace rostlab { namespace blast { class parser_driver; } }
48 
49 #line 50 "rostlab/blast-parser-parser.h" // lalr1.cc:377
50 
51 
52 # include <cstdlib> // std::abort
53 # include <iostream>
54 # include <stdexcept>
55 # include <string>
56 # include <vector>
59 
60 
61 #ifndef YY_ATTRIBUTE
62 # if (defined __GNUC__ \
63  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
64  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
65 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
66 # else
67 # define YY_ATTRIBUTE(Spec) /* empty */
68 # endif
69 #endif
70 
71 #ifndef YY_ATTRIBUTE_PURE
72 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
73 #endif
74 
75 #ifndef YY_ATTRIBUTE_UNUSED
76 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
77 #endif
78 
79 #if !defined _Noreturn \
80  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
81 # if defined _MSC_VER && 1200 <= _MSC_VER
82 # define _Noreturn __declspec (noreturn)
83 # else
84 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
85 # endif
86 #endif
87 
88 /* Suppress unused-variable warnings by "using" E. */
89 #if ! defined lint || defined __GNUC__
90 # define YYUSE(E) ((void) (E))
91 #else
92 # define YYUSE(E) /* empty */
93 #endif
94 
95 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
96 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
97 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
98  _Pragma ("GCC diagnostic push") \
99  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
100  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
101 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
102  _Pragma ("GCC diagnostic pop")
103 #else
104 # define YY_INITIAL_VALUE(Value) Value
105 #endif
106 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
107 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
108 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
109 #endif
110 #ifndef YY_INITIAL_VALUE
111 # define YY_INITIAL_VALUE(Value) /* Nothing. */
112 #endif
113 
114 /* Debug traces. */
115 #ifndef YYDEBUG
116 # define YYDEBUG 1
117 #endif
118 
119 #line 22 "blast-parser-parser.ypp" // lalr1.cc:377
120 namespace rostlab { namespace blast {
121 #line 122 "rostlab/blast-parser-parser.h" // lalr1.cc:377
122 
123 
124 
125 
126 
128  class parser
129  {
130  public:
131 #ifndef YYSTYPE
132  union semantic_type
134  {
135  #line 47 "/build/librostlab-blast-1.0.1/lib/blast-parser-parser.ypp" // lalr1.cc:377
136 
137  long int ival;
138  double dval;
139  std::string* sval;
140 
141 #line 142 "rostlab/blast-parser-parser.h" // lalr1.cc:377
142  };
143 #else
144  typedef YYSTYPE semantic_type;
145 #endif
146  typedef location location_type;
148 
150  struct syntax_error : std::runtime_error
151  {
152  syntax_error (const location_type& l, const std::string& m);
153  location_type location;
154  };
155 
157  struct token
158  {
160  {
161  END = 0,
162  BLAST_VERSION = 258,
163  REFERENCE = 259,
164  STRING = 260,
165  INT = 261,
166  DBL = 262,
167  SEARCHING = 263,
168  NOHITS = 264,
169  ONELINE_DESC_HEADER = 265,
170  SEQ_FOUND_AGAIN = 266,
171  SEQ_FOUND_NEW = 267,
172  CONVERGED = 268,
173  TAIL = 269,
174  QUERYEQ = 270,
175  DATABASECOLON = 271,
176  RESFROMROUND = 272,
177  SCOREEQ = 273,
178  EXPECTEQ = 274,
179  METHODCOLON = 275,
180  IDENTITIESEQ = 276,
181  POSITIVESEQ = 277,
182  GAPSEQ = 278,
183  STRANDEQ = 279,
184  FRAMEEQ = 280,
185  QUERYCOLON = 281,
186  SBJCTCOLON = 282
187  };
188  };
189 
192 
194  typedef int symbol_number_type;
195 
197  enum { empty_symbol = -2 };
198 
200  typedef unsigned char token_number_type;
201 
208  template <typename Base>
209  struct basic_symbol : Base
210  {
212  typedef Base super_type;
213 
215  basic_symbol ();
216 
218  basic_symbol (const basic_symbol& other);
219 
221  basic_symbol (typename Base::kind_type t,
222  const location_type& l);
223 
225  basic_symbol (typename Base::kind_type t,
226  const semantic_type& v,
227  const location_type& l);
228 
230  ~basic_symbol ();
231 
233  void clear ();
234 
236  bool empty () const;
237 
239  void move (basic_symbol& s);
240 
242  semantic_type value;
243 
245  location_type location;
246 
247  private:
249  basic_symbol& operator= (const basic_symbol& other);
250  };
251 
253  struct by_type
254  {
256  by_type ();
257 
259  by_type (const by_type& other);
260 
262  typedef token_type kind_type;
263 
265  by_type (kind_type t);
266 
268  void clear ();
269 
271  void move (by_type& that);
272 
275  symbol_number_type type_get () const;
276 
278  token_type token () const;
279 
283  int type;
284  };
285 
288 
289 
291  parser (rostlab::blast::parser_driver& drv_yyarg, void* yyscanner_yyarg);
292  virtual ~parser ();
293 
296  virtual int parse ();
297 
298 #if YYDEBUG
299  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
302  void set_debug_stream (std::ostream &);
303 
305  typedef int debug_level_type;
307  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
309  void set_debug_level (debug_level_type l);
310 #endif
311 
315  virtual void error (const location_type& loc, const std::string& msg);
316 
318  void error (const syntax_error& err);
319 
320  private:
322  parser (const parser&);
323  parser& operator= (const parser&);
324 
326  typedef int state_type;
327 
331  virtual std::string yysyntax_error_ (state_type yystate,
332  const symbol_type& yyla) const;
333 
337  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
338 
341  static bool yy_pact_value_is_default_ (int yyvalue);
342 
345  static bool yy_table_value_is_error_ (int yyvalue);
346 
347  static const signed char yypact_ninf_;
348  static const signed char yytable_ninf_;
349 
351  static token_number_type yytranslate_ (int t);
352 
353  // Tables.
354  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
355  // STATE-NUM.
356  static const signed char yypact_[];
357 
358  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
359  // Performed when YYTABLE does not specify something else to do. Zero
360  // means the default is an error.
361  static const unsigned char yydefact_[];
362 
363  // YYPGOTO[NTERM-NUM].
364  static const signed char yypgoto_[];
365 
366  // YYDEFGOTO[NTERM-NUM].
367  static const signed char yydefgoto_[];
368 
369  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
370  // positive, shift that token. If negative, reduce the rule whose
371  // number is the opposite. If YYTABLE_NINF, syntax error.
372  static const unsigned char yytable_[];
373 
374  static const unsigned char yycheck_[];
375 
376  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
377  // symbol of state STATE-NUM.
378  static const unsigned char yystos_[];
379 
380  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
381  static const unsigned char yyr1_[];
382 
383  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
384  static const unsigned char yyr2_[];
385 
386 
388  static std::string yytnamerr_ (const char *n);
389 
390 
392  static const char* const yytname_[];
393 #if YYDEBUG
394  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
395  static const unsigned char yyrline_[];
397  virtual void yy_reduce_print_ (int r);
399  virtual void yystack_print_ ();
400 
401  // Debugging.
402  int yydebug_;
403  std::ostream* yycdebug_;
404 
408  template <typename Base>
409  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
410 #endif
411 
416  template <typename Base>
417  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
418 
419  private:
421  struct by_state
422  {
424  by_state ();
425 
427  typedef state_type kind_type;
428 
430  by_state (kind_type s);
431 
433  by_state (const by_state& other);
434 
436  void clear ();
437 
439  void move (by_state& that);
440 
443  symbol_number_type type_get () const;
444 
446  enum { empty_state = -1 };
447 
450  state_type state;
451  };
452 
454  struct stack_symbol_type : basic_symbol<by_state>
455  {
457  typedef basic_symbol<by_state> super_type;
459  stack_symbol_type ();
461  stack_symbol_type (state_type s, symbol_type& sym);
463  stack_symbol_type& operator= (const stack_symbol_type& that);
464  };
465 
468 
470  stack_type yystack_;
471 
477  void yypush_ (const char* m, stack_symbol_type& s);
478 
485  void yypush_ (const char* m, state_type s, symbol_type& sym);
486 
488  void yypop_ (unsigned int n = 1);
489 
491  enum
492  {
493  yyeof_ = 0,
494  yylast_ = 81,
495  yynnts_ = 24,
496  yyfinal_ = 6,
497  yyterror_ = 1,
498  yyerrcode_ = 256,
499  yyntokens_ = 31
500  };
501 
502 
503  // User arguments.
505  void* yyscanner;
506  };
507 
508 
509 #line 22 "blast-parser-parser.ypp" // lalr1.cc:377
510 } } // rostlab::blast
511 #line 512 "rostlab/blast-parser-parser.h" // lalr1.cc:377
512 
513 
514 
515 
516 #endif // !YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
Type access provider for token (enum) based symbols.
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
int debug_level_type
Type for debugging levels.
#define YY_ATTRIBUTE_PURE
location_type location
The location.
token::yytokentype token_type
(External) token type, as returned by yylex.
int symbol_number_type
Symbol type: an internal symbol number.
token_type kind_type
The symbol type as needed by the constructor.
Syntax errors thrown from user actions.
semantic_type value
The semantic value.
Blast (default, -m 0) output parser.
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.