librostlab-blast 1.0.1
Loading...
Searching...
No Matches
blast-parser-parser.h
Go to the documentation of this file.
1// A Bison parser, made by GNU Bison 3.8.2.
2
3// Skeleton interface for Bison LALR(1) parsers in C++
4
5// Copyright (C) 2002-2015, 2018-2021 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 <https://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// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
42// especially those whose name start with YY_ or yy_. They are
43// private implementation details that can be changed or removed.
44
45#ifndef YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
46# define YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
47// "%code requires" blocks.
48#line 24 "blast-parser-parser.ypp"
49
50#include <string>
52namespace rostlab { namespace blast { class parser_driver; } }
53
54#line 55 "rostlab/blast-parser-parser.h"
55
56
57# include <cstdlib> // std::abort
58# include <iostream>
59# include <stdexcept>
60# include <string>
61# include <vector>
62
63#if defined __cplusplus
64# define YY_CPLUSPLUS __cplusplus
65#else
66# define YY_CPLUSPLUS 199711L
67#endif
68
69// Support move semantics when possible.
70#if 201103L <= YY_CPLUSPLUS
71# define YY_MOVE std::move
72# define YY_MOVE_OR_COPY move
73# define YY_MOVE_REF(Type) Type&&
74# define YY_RVREF(Type) Type&&
75# define YY_COPY(Type) Type
76#else
77# define YY_MOVE
78# define YY_MOVE_OR_COPY copy
79# define YY_MOVE_REF(Type) Type&
80# define YY_RVREF(Type) const Type&
81# define YY_COPY(Type) const Type&
82#endif
83
84// Support noexcept when possible.
85#if 201103L <= YY_CPLUSPLUS
86# define YY_NOEXCEPT noexcept
87# define YY_NOTHROW
88#else
89# define YY_NOEXCEPT
90# define YY_NOTHROW throw ()
91#endif
92
93// Support constexpr when possible.
94#if 201703 <= YY_CPLUSPLUS
95# define YY_CONSTEXPR constexpr
96#else
97# define YY_CONSTEXPR
98#endif
100
101
102#ifndef YY_ATTRIBUTE_PURE
103# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
104# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
105# else
106# define YY_ATTRIBUTE_PURE
107# endif
108#endif
109
110#ifndef YY_ATTRIBUTE_UNUSED
111# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
112# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
113# else
114# define YY_ATTRIBUTE_UNUSED
115# endif
116#endif
117
118/* Suppress unused-variable warnings by "using" E. */
119#if ! defined lint || defined __GNUC__
120# define YY_USE(E) ((void) (E))
121#else
122# define YY_USE(E) /* empty */
123#endif
124
125/* Suppress an incorrect diagnostic about yylval being uninitialized. */
126#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
127# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
128# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
129 _Pragma ("GCC diagnostic push") \
130 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
131# else
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# endif
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#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
151# define YY_IGNORE_USELESS_CAST_BEGIN \
152 _Pragma ("GCC diagnostic push") \
153 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
154# define YY_IGNORE_USELESS_CAST_END \
155 _Pragma ("GCC diagnostic pop")
156#endif
157#ifndef YY_IGNORE_USELESS_CAST_BEGIN
158# define YY_IGNORE_USELESS_CAST_BEGIN
159# define YY_IGNORE_USELESS_CAST_END
160#endif
161
162# ifndef YY_CAST
163# ifdef __cplusplus
164# define YY_CAST(Type, Val) static_cast<Type> (Val)
165# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
166# else
167# define YY_CAST(Type, Val) ((Type) (Val))
168# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
169# endif
170# endif
171# ifndef YY_NULLPTR
172# if defined __cplusplus
173# if 201103L <= __cplusplus
174# define YY_NULLPTR nullptr
175# else
176# define YY_NULLPTR 0
177# endif
178# else
179# define YY_NULLPTR ((void*)0)
180# endif
181# endif
182
183/* Debug traces. */
184#ifndef YYDEBUG
185# define YYDEBUG 1
186#endif
187
188#line 22 "blast-parser-parser.ypp"
189namespace rostlab { namespace blast {
190#line 191 "rostlab/blast-parser-parser.h"
191
192
193
194
196 class parser
197 {
198 public:
199#ifdef YYSTYPE
200# ifdef __GNUC__
201# pragma GCC message "bison: do not #define YYSTYPE in C++, use %define api.value.type"
202# endif
203 typedef YYSTYPE value_type;
204#else
207 {
208#line 47 "blast-parser-parser.ypp"
209
210 long int ival;
211 double dval;
212 std::string* sval;
213
214#line 215 "rostlab/blast-parser-parser.h"
215
216 };
217#endif
220
223
225 struct syntax_error : std::runtime_error
226 {
227 syntax_error (const location_type& l, const std::string& m)
228 : std::runtime_error (m)
229 , location (l)
230 {}
231
233 : std::runtime_error (s.what ())
234 , location (s.location)
235 {}
236
238
240 };
241
243 struct token
244 {
246 {
247 YYEMPTY = -2,
248 END = 0, // "end of file"
249 YYerror = 256, // error
250 YYUNDEF = 257, // "invalid token"
251 BLAST_VERSION = 258, // BLAST_VERSION
252 REFERENCE = 259, // REFERENCE
253 STRING = 260, // STRING
254 INT = 261, // INT
255 DBL = 262, // DBL
256 SEARCHING = 263, // SEARCHING
257 NOHITS = 264, // NOHITS
258 ONELINE_DESC_HEADER = 265, // ONELINE_DESC_HEADER
259 SEQ_FOUND_AGAIN = 266, // SEQ_FOUND_AGAIN
260 SEQ_FOUND_NEW = 267, // SEQ_FOUND_NEW
261 CONVERGED = 268, // CONVERGED
262 TAIL = 269, // TAIL
263 QUERYEQ = 270, // "Query="
264 DATABASECOLON = 271, // "Database:"
265 RESFROMROUND = 272, // "Results from round"
266 SCOREEQ = 273, // "Score ="
267 EXPECTEQ = 274, // "Expect ="
268 METHODCOLON = 275, // "Method:"
269 IDENTITIESEQ = 276, // "Identities ="
270 POSITIVESEQ = 277, // "Positives ="
271 GAPSEQ = 278, // "Gaps ="
272 STRANDEQ = 279, // "Strand ="
273 FRAMEEQ = 280, // "Frame ="
274 QUERYCOLON = 281, // "Query:"
275 SBJCTCOLON = 282 // "Sbjct:"
276 };
279 };
280
283
286
289 {
291 {
292 YYNTOKENS = 31,
293 S_YYEMPTY = -2,
294 S_YYEOF = 0, // "end of file"
295 S_YYerror = 1, // error
296 S_YYUNDEF = 2, // "invalid token"
297 S_BLAST_VERSION = 3, // BLAST_VERSION
298 S_REFERENCE = 4, // REFERENCE
299 S_STRING = 5, // STRING
300 S_INT = 6, // INT
301 S_DBL = 7, // DBL
302 S_SEARCHING = 8, // SEARCHING
303 S_NOHITS = 9, // NOHITS
304 S_ONELINE_DESC_HEADER = 10, // ONELINE_DESC_HEADER
305 S_SEQ_FOUND_AGAIN = 11, // SEQ_FOUND_AGAIN
306 S_SEQ_FOUND_NEW = 12, // SEQ_FOUND_NEW
307 S_CONVERGED = 13, // CONVERGED
308 S_TAIL = 14, // TAIL
309 S_QUERYEQ = 15, // "Query="
310 S_DATABASECOLON = 16, // "Database:"
311 S_RESFROMROUND = 17, // "Results from round"
312 S_SCOREEQ = 18, // "Score ="
313 S_EXPECTEQ = 19, // "Expect ="
314 S_METHODCOLON = 20, // "Method:"
315 S_IDENTITIESEQ = 21, // "Identities ="
316 S_POSITIVESEQ = 22, // "Positives ="
317 S_GAPSEQ = 23, // "Gaps ="
318 S_STRANDEQ = 24, // "Strand ="
319 S_FRAMEEQ = 25, // "Frame ="
320 S_QUERYCOLON = 26, // "Query:"
321 S_SBJCTCOLON = 27, // "Sbjct:"
322 S_28_ = 28, // '>'
323 S_29_ = 29, // '/'
324 S_30_0_ = 30, // '0'
325 S_YYACCEPT = 31, // $accept
326 S_input = 32, // input
327 S_references = 33, // references
328 S_query = 34, // query
329 S_database = 35, // database
330 S_rounds = 36, // rounds
331 S_round = 37, // round
332 S_38_1 = 38, // $@1
333 S_outcome = 39, // outcome
334 S_resfromround = 40, // resfromround
335 S_converged = 41, // converged
336 S_hits = 42, // hits
337 S_oneline_descs = 43, // oneline_descs
338 S_oneline_desc = 44, // oneline_desc
339 S_num = 45, // num
340 S_hit = 46, // hit
341 S_hit_header = 47, // hit_header
342 S_hsps = 48, // hsps
343 S_hsp = 49, // hsp
344 S_hsp_headerfields = 50, // hsp_headerfields
345 S_hsp_headerfield = 51, // hsp_headerfield
346 S_alitriples = 52, // alitriples
347 S_alitriple = 53, // alitriple
348 S_tail = 54 // tail
349 };
350 };
351
354
357
364 template <typename Base>
365 struct basic_symbol : Base
366 {
368 typedef Base super_type;
369
372 : value ()
373 , location ()
374 {}
375
376#if 201103L <= YY_CPLUSPLUS
379 : Base (std::move (that))
380 , value (std::move (that.value))
381 , location (std::move (that.location))
382 {}
383#endif
384
388 basic_symbol (typename Base::kind_type t,
390
392 basic_symbol (typename Base::kind_type t,
395
398 {
399 clear ();
400 }
401
402
403
406 {
407 Base::clear ();
408 }
409
411 std::string name () const YY_NOEXCEPT
412 {
413 return parser::symbol_name (this->kind ());
414 }
415
418
420 bool empty () const YY_NOEXCEPT;
421
423 void move (basic_symbol& s);
424
427
430
431 private:
432#if YY_CPLUSPLUS < 201103L
434 basic_symbol& operator= (const basic_symbol& that);
435#endif
436 };
437
439 struct by_kind
440 {
443
446
447#if 201103L <= YY_CPLUSPLUS
449 by_kind (by_kind&& that) YY_NOEXCEPT;
450#endif
451
454
457
458
459
462
464 void move (by_kind& that);
465
469
471 symbol_kind_type type_get () const YY_NOEXCEPT;
472
476 };
477
480
484
486 parser (rostlab::blast::parser_driver& drv_yyarg, void* yyscanner_yyarg);
487 virtual ~parser ();
488
489#if 201103L <= YY_CPLUSPLUS
491 parser (const parser&) = delete;
493 parser& operator= (const parser&) = delete;
494#endif
495
498 int operator() ();
499
502 virtual int parse ();
503
504#if YYDEBUG
506 std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
508 void set_debug_stream (std::ostream &);
509
511 typedef int debug_level_type;
515 void set_debug_level (debug_level_type l);
516#endif
517
521 virtual void error (const location_type& loc, const std::string& msg);
522
524 void error (const syntax_error& err);
525
528 static std::string symbol_name (symbol_kind_type yysymbol);
529
530
531
533 {
534 public:
535 context (const parser& yyparser, const symbol_type& yyla);
536 const symbol_type& lookahead () const YY_NOEXCEPT { return yyla_; }
537 symbol_kind_type token () const YY_NOEXCEPT { return yyla_.kind (); }
538 const location_type& location () const YY_NOEXCEPT { return yyla_.location; }
539
543 int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
544
545 private:
546 const parser& yyparser_;
547 const symbol_type& yyla_;
548 };
549
550 private:
551#if YY_CPLUSPLUS < 201103L
553 parser (const parser&);
555 parser& operator= (const parser&);
556#endif
557
558
560 typedef signed char state_type;
561
563 int yy_syntax_error_arguments_ (const context& yyctx,
564 symbol_kind_type yyarg[], int yyargn) const;
565
568 virtual std::string yysyntax_error_ (const context& yyctx) const;
572 static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
573
576 static bool yy_pact_value_is_default_ (int yyvalue) YY_NOEXCEPT;
577
580 static bool yy_table_value_is_error_ (int yyvalue) YY_NOEXCEPT;
581
582 static const signed char yypact_ninf_;
583 static const signed char yytable_ninf_;
584
588 static symbol_kind_type yytranslate_ (int t) YY_NOEXCEPT;
589
591 static std::string yytnamerr_ (const char *yystr);
592
594 static const char* const yytname_[];
595
596
597 // Tables.
598 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
599 // STATE-NUM.
600 static const signed char yypact_[];
601
602 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
603 // Performed when YYTABLE does not specify something else to do. Zero
604 // means the default is an error.
605 static const signed char yydefact_[];
606
607 // YYPGOTO[NTERM-NUM].
608 static const signed char yypgoto_[];
609
610 // YYDEFGOTO[NTERM-NUM].
611 static const signed char yydefgoto_[];
612
613 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
614 // positive, shift that token. If negative, reduce the rule whose
615 // number is the opposite. If YYTABLE_NINF, syntax error.
616 static const signed char yytable_[];
617
618 static const signed char yycheck_[];
619
620 // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
621 // state STATE-NUM.
622 static const signed char yystos_[];
623
624 // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
625 static const signed char yyr1_[];
626
627 // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.
628 static const signed char yyr2_[];
629
630
631#if YYDEBUG
632 // YYRLINE[YYN] -- Source line where rule number YYN was defined.
633 static const unsigned char yyrline_[];
635 virtual void yy_reduce_print_ (int r) const;
637 virtual void yy_stack_print_ () const;
638
640 int yydebug_;
642 std::ostream* yycdebug_;
643
647 template <typename Base>
648 void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
649#endif
650
655 template <typename Base>
656 void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
657
658 private:
660 struct by_state
661 {
663 by_state () YY_NOEXCEPT;
664
666 typedef state_type kind_type;
667
669 by_state (kind_type s) YY_NOEXCEPT;
670
672 by_state (const by_state& that) YY_NOEXCEPT;
673
675 void clear () YY_NOEXCEPT;
676
678 void move (by_state& that);
679
682 symbol_kind_type kind () const YY_NOEXCEPT;
683
686 enum { empty_state = 0 };
687
690 state_type state;
691 };
692
694 struct stack_symbol_type : basic_symbol<by_state>
695 {
697 typedef basic_symbol<by_state> super_type;
699 stack_symbol_type ();
701 stack_symbol_type (YY_RVREF (stack_symbol_type) that);
703 stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
704#if YY_CPLUSPLUS < 201103L
707 stack_symbol_type& operator= (stack_symbol_type& that);
708
711 stack_symbol_type& operator= (const stack_symbol_type& that);
712#endif
713 };
714
716 template <typename T, typename S = std::vector<T> >
717 class stack
718 {
719 public:
720 // Hide our reversed order.
721 typedef typename S::iterator iterator;
722 typedef typename S::const_iterator const_iterator;
723 typedef typename S::size_type size_type;
724 typedef typename std::ptrdiff_t index_type;
725
726 stack (size_type n = 200) YY_NOEXCEPT
727 : seq_ (n)
728 {}
729
730#if 201103L <= YY_CPLUSPLUS
732 stack (const stack&) = delete;
734 stack& operator= (const stack&) = delete;
735#endif
736
740 const T&
741 operator[] (index_type i) const
742 {
743 return seq_[size_type (size () - 1 - i)];
744 }
745
749 T&
750 operator[] (index_type i)
751 {
752 return seq_[size_type (size () - 1 - i)];
753 }
754
758 void
759 push (YY_MOVE_REF (T) t)
760 {
761 seq_.push_back (T ());
762 operator[] (0).move (t);
763 }
764
766 void
767 pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
768 {
769 for (; 0 < n; --n)
770 seq_.pop_back ();
771 }
772
774 void
775 clear () YY_NOEXCEPT
776 {
777 seq_.clear ();
778 }
779
781 index_type
782 size () const YY_NOEXCEPT
783 {
784 return index_type (seq_.size ());
785 }
786
788 const_iterator
789 begin () const YY_NOEXCEPT
790 {
791 return seq_.begin ();
792 }
793
795 const_iterator
796 end () const YY_NOEXCEPT
797 {
798 return seq_.end ();
799 }
800
802 class slice
803 {
804 public:
805 slice (const stack& stack, index_type range) YY_NOEXCEPT
806 : stack_ (stack)
807 , range_ (range)
808 {}
809
810 const T&
811 operator[] (index_type i) const
812 {
813 return stack_[range_ - i];
814 }
815
816 private:
817 const stack& stack_;
818 index_type range_;
819 };
820
821 private:
822#if YY_CPLUSPLUS < 201103L
824 stack (const stack&);
826 stack& operator= (const stack&);
827#endif
829 S seq_;
830 };
831
832
834 typedef stack<stack_symbol_type> stack_type;
835
837 stack_type yystack_;
838
844 void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
845
852 void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
853
855 void yypop_ (int n = 1) YY_NOEXCEPT;
856
858 enum
859 {
860 yylast_ = 81,
861 yynnts_ = 24,
862 yyfinal_ = 6
863 };
864
865
866 // User arguments.
868 void* yyscanner;
869
870 };
871
872
873#line 22 "blast-parser-parser.ypp"
874} } // rostlab::blast
875#line 876 "rostlab/blast-parser-parser.h"
876
877
878
879
880#endif // !YY_YY_ROSTLAB_BLAST_PARSER_PARSER_H_INCLUDED
#define YY_RVREF(Type)
#define YY_MOVE_REF(Type)
#define YY_NOEXCEPT
#define YY_ATTRIBUTE_PURE
#define YY_NOTHROW
Two points in a source file.
location(const position &b, const position &e)
Construct a location from b to e.
context(const parser &yyparser, const symbol_type &yyla)
int expected_tokens(symbol_kind_type yyarg[], int yyargn) const
const symbol_type & lookahead() const YY_NOEXCEPT
const location_type & location() const YY_NOEXCEPT
symbol_kind_type token() const YY_NOEXCEPT
Present a slice of the top of a stack.
slice(const stack &stack, index_type range) YY_NOEXCEPT
Blast (default, -m 0) output parser.
void error(const syntax_error &err)
Report a syntax error.
std::ostream & debug_stream() const YY_ATTRIBUTE_PURE
The current debugging stream.
token::token_kind_type token_kind_type
Token kind, as returned by yylex.
parser(rostlab::blast::parser_driver &drv_yyarg, void *yyscanner_yyarg)
Build a parser object.
int debug_level_type
Type for debugging levels.
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
virtual void error(const location_type &loc, const std::string &msg)
location location_type
Symbol locations.
token_kind_type token_type
Backward compatibility alias (Bison 3.6).
static std::string symbol_name(symbol_kind_type yysymbol)
static const symbol_kind_type YYNTOKENS
The number of tokens.
value_type semantic_type
Backward compatibility (Bison 3.8).
basic_symbol(typename Base::kind_type t, YY_MOVE_REF(location_type) l)
Constructor for valueless symbols.
std::string name() const YY_NOEXCEPT
The user-facing name of this symbol.
symbol_kind_type type_get() const YY_NOEXCEPT
Backward compatibility (Bison 3.6).
basic_symbol(typename Base::kind_type t, YY_RVREF(value_type) v, YY_RVREF(location_type) l)
Constructor for symbols with semantic value.
basic_symbol(const basic_symbol &that)
Copy constructor.
basic_symbol() YY_NOEXCEPT
Default constructor.
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Type access provider for token (enum) based symbols.
void clear() YY_NOEXCEPT
Record that this symbol is empty.
token_kind_type kind_type
The symbol kind as needed by the constructor.
by_kind() YY_NOEXCEPT
Default constructor.
by_kind(const by_kind &that) YY_NOEXCEPT
Copy constructor.
by_kind(kind_type t) YY_NOEXCEPT
Constructor from (external) token numbers.
"External" symbols: returned by the scanner.
Syntax errors thrown from user actions.
~syntax_error() YY_NOEXCEPT YY_NOTHROW
syntax_error(const location_type &l, const std::string &m)
token_kind_type yytokentype
Backward compatibility alias (Bison 3.6).