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.2.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2013 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:372
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:372
50 
51 
52 # include <vector>
53 # include <iostream>
54 # include <stdexcept>
55 # include <string>
58 
59 
60 #ifndef YY_ATTRIBUTE
61 # if (defined __GNUC__ \
62  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
63  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
64 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
65 # else
66 # define YY_ATTRIBUTE(Spec) /* empty */
67 # endif
68 #endif
69 
70 #ifndef YY_ATTRIBUTE_PURE
71 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
72 #endif
73 
74 #ifndef YY_ATTRIBUTE_UNUSED
75 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
76 #endif
77 
78 #if !defined _Noreturn \
79  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
80 # if defined _MSC_VER && 1200 <= _MSC_VER
81 # define _Noreturn __declspec (noreturn)
82 # else
83 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
84 # endif
85 #endif
86 
87 /* Suppress unused-variable warnings by "using" E. */
88 #if ! defined lint || defined __GNUC__
89 # define YYUSE(E) ((void) (E))
90 #else
91 # define YYUSE(E) /* empty */
92 #endif
93 
94 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
95 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
96 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
97  _Pragma ("GCC diagnostic push") \
98  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
99  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
100 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
101  _Pragma ("GCC diagnostic pop")
102 #else
103 # define YY_INITIAL_VALUE(Value) Value
104 #endif
105 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
106 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
107 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
108 #endif
109 #ifndef YY_INITIAL_VALUE
110 # define YY_INITIAL_VALUE(Value) /* Nothing. */
111 #endif
112 
113 /* Debug traces. */
114 #ifndef YYDEBUG
115 # define YYDEBUG 1
116 #endif
117 
118 #line 22 "blast-parser-parser.ypp" // lalr1.cc:372
119 namespace rostlab { namespace blast {
120 #line 121 "rostlab/blast-parser-parser.h" // lalr1.cc:372
121 
122 
123 
124 
125 
127  class parser
128  {
129  public:
130 #ifndef YYSTYPE
131  union semantic_type
133  {
134  #line 47 "/build/librostlab-blast-dkVTBJ/librostlab-blast-1.0.1/lib/blast-parser-parser.ypp" // lalr1.cc:372
135 
136  long int ival;
137  double dval;
138  std::string* sval;
139 
140 #line 141 "rostlab/blast-parser-parser.h" // lalr1.cc:372
141  };
142 #else
143  typedef YYSTYPE semantic_type;
144 #endif
145  typedef location location_type;
147 
149  struct syntax_error : std::runtime_error
150  {
151  syntax_error (const location_type& l, const std::string& m);
152  location_type location;
153  };
154 
156  struct token
157  {
159  {
160  END = 0,
162  REFERENCE = 259,
163  STRING = 260,
164  INT = 261,
165  DBL = 262,
166  SEARCHING = 263,
167  NOHITS = 264,
171  CONVERGED = 268,
172  TAIL = 269,
173  QUERYEQ = 270,
176  SCOREEQ = 273,
177  EXPECTEQ = 274,
178  METHODCOLON = 275,
180  POSITIVESEQ = 277,
181  GAPSEQ = 278,
182  STRANDEQ = 279,
183  FRAMEEQ = 280,
184  QUERYCOLON = 281,
186  };
187  };
188 
191 
193  typedef int symbol_number_type;
194 
196  typedef unsigned char token_number_type;
197 
204  template <typename Base>
205  struct basic_symbol : Base
206  {
208  typedef Base super_type;
209 
211  basic_symbol ();
212 
214  basic_symbol (const basic_symbol& other);
215 
217  basic_symbol (typename Base::kind_type t,
218  const location_type& l);
219 
221  basic_symbol (typename Base::kind_type t,
222  const semantic_type& v,
223  const location_type& l);
224 
225  ~basic_symbol ();
226 
228  void move (basic_symbol& s);
229 
231  semantic_type value;
232 
234  location_type location;
235 
236  private:
238  basic_symbol& operator= (const basic_symbol& other);
239  };
240 
242  struct by_type
243  {
245  by_type ();
246 
248  by_type (const by_type& other);
249 
251  typedef token_type kind_type;
252 
254  by_type (kind_type t);
255 
257  void move (by_type& that);
258 
261  symbol_number_type type_get () const;
262 
264  token_type token () const;
265 
266  enum { empty = 0 };
267 
270  token_number_type type;
271  };
272 
275 
276 
278  parser (rostlab::blast::parser_driver& drv_yyarg, void* yyscanner_yyarg);
279  virtual ~parser ();
280 
283  virtual int parse ();
284 
285 #if YYDEBUG
286  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
289  void set_debug_stream (std::ostream &);
290 
292  typedef int debug_level_type;
294  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
296  void set_debug_level (debug_level_type l);
297 #endif
298 
302  virtual void error (const location_type& loc, const std::string& msg);
303 
305  void error (const syntax_error& err);
306 
307  private:
309  parser (const parser&);
310  parser& operator= (const parser&);
311 
313  typedef int state_type;
314 
318  virtual std::string yysyntax_error_ (state_type yystate,
319  symbol_number_type yytoken) const;
320 
324  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
325 
328  static bool yy_pact_value_is_default_ (int yyvalue);
329 
332  static bool yy_table_value_is_error_ (int yyvalue);
333 
334  static const signed char yypact_ninf_;
335  static const signed char yytable_ninf_;
336 
338  static token_number_type yytranslate_ (int t);
339 
340  // Tables.
341  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
342  // STATE-NUM.
343  static const signed char yypact_[];
344 
345  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
346  // Performed when YYTABLE does not specify something else to do. Zero
347  // means the default is an error.
348  static const unsigned char yydefact_[];
349 
350  // YYPGOTO[NTERM-NUM].
351  static const signed char yypgoto_[];
352 
353  // YYDEFGOTO[NTERM-NUM].
354  static const signed char yydefgoto_[];
355 
356  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
357  // positive, shift that token. If negative, reduce the rule whose
358  // number is the opposite. If YYTABLE_NINF, syntax error.
359  static const unsigned char yytable_[];
360 
361  static const unsigned char yycheck_[];
362 
363  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
364  // symbol of state STATE-NUM.
365  static const unsigned char yystos_[];
366 
367  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
368  static const unsigned char yyr1_[];
369 
370  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
371  static const unsigned char yyr2_[];
372 
373 
375  static std::string yytnamerr_ (const char *n);
376 
377 
379  static const char* const yytname_[];
380 #if YYDEBUG
381  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
382  static const unsigned char yyrline_[];
384  virtual void yy_reduce_print_ (int r);
386  virtual void yystack_print_ ();
387 
388  // Debugging.
389  int yydebug_;
390  std::ostream* yycdebug_;
391 
395  template <typename Base>
396  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
397 #endif
398 
403  template <typename Base>
404  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
405 
406  private:
408  struct by_state
409  {
411  by_state ();
412 
414  typedef state_type kind_type;
415 
417  by_state (kind_type s);
418 
420  by_state (const by_state& other);
421 
423  void move (by_state& that);
424 
427  symbol_number_type type_get () const;
428 
429  enum { empty = 0 };
430 
432  state_type state;
433  };
434 
436  struct stack_symbol_type : basic_symbol<by_state>
437  {
439  typedef basic_symbol<by_state> super_type;
441  stack_symbol_type ();
443  stack_symbol_type (state_type s, symbol_type& sym);
445  stack_symbol_type& operator= (const stack_symbol_type& that);
446  };
447 
449  typedef stack<stack_symbol_type> stack_type;
450 
452  stack_type yystack_;
453 
459  void yypush_ (const char* m, stack_symbol_type& s);
460 
467  void yypush_ (const char* m, state_type s, symbol_type& sym);
468 
470  void yypop_ (unsigned int n = 1);
471 
472  // Constants.
473  enum
474  {
475  yyeof_ = 0,
476  yylast_ = 81,
477  yynnts_ = 24,
478  yyempty_ = -2,
479  yyfinal_ = 6,
480  yyterror_ = 1,
481  yyerrcode_ = 256,
482  yyntokens_ = 31
483  };
484 
485 
486  // User arguments.
488  void* yyscanner;
489  };
490 
491 
492 #line 22 "blast-parser-parser.ypp" // lalr1.cc:372
493 } } // rostlab::blast
494 #line 495 "rostlab/blast-parser-parser.h" // lalr1.cc:372
495 
496 
497 
498 
499 #endif // !YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
Type access provider for token (enum) based symbols.
virtual void error(const location_type &loc, const std::string &msg)
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
basic_symbol()
Default constructor.
parser(rostlab::blast::parser_driver &drv_yyarg, void *yyscanner_yyarg)
Build a parser object.
by_type()
Default constructor.
std::ostream & debug_stream() const YY_ATTRIBUTE_PURE
The current debugging stream.
void move(basic_symbol &s)
Destructive move, s is emptied into this.
syntax_error(const location_type &l, const std::string &m)
int debug_level_type
Type for debugging levels.
#define YY_ATTRIBUTE_PURE
location_type location
The location.
void set_debug_level(debug_level_type l)
Set the current debugging level.
debug_level_type debug_level() const YY_ATTRIBUTE_PURE
The current debugging level.
token::yytokentype token_type
(External) token type, as returned by yylex.
int symbol_number_type
Internal symbol number.
symbol_number_type type_get() const
token_type kind_type
The symbol type as needed by the constructor.
Syntax errors thrown from user actions.
location location_type
Symbol locations.
token_type token() const
The token.
semantic_type value
The semantic value.
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Blast (default, -m 0) output parser.
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
void move(by_type &that)
Steal the symbol type from that.