ztsdb
parser_utils.hpp
1 // (C) 2016 Leonardo Silvestri
2 //
3 // This file is part of ztsdb.
4 //
5 // ztsdb is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // ztsdb is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with ztsdb. If not, see <http://www.gnu.org/licenses/>.
17 
18 
19 #include <unordered_map>
20 #include "parser.hpp" // bison generated
21 
22 namespace ztsdb {
23 
24  const std::map<int, string> op_to_string = {
25  {yy::parser::token::GT, ">"},
26  {yy::parser::token::GE, ">="},
27  {yy::parser::token::LT, "<"},
28  {yy::parser::token::LE, "<="},
29  {yy::parser::token::EQ, "=="},
30  {yy::parser::token::NE, "!="},
31  {yy::parser::token::AND, "&"},
32  {yy::parser::token::OR, "|"},
33  {yy::parser::token::AND2, "&&"},
34  {yy::parser::token::OR2, "||"},
35  {yy::parser::token::PLUS, "+"},
36  {yy::parser::token::MINUS, "-"},
37  {yy::parser::token::MUL, "*"},
38  {yy::parser::token::DIV, "/"},
39  {yy::parser::token::POWER, "^"},
40  {yy::parser::token::NOT, "!"},
41  {yy::parser::token::UMINUS, "-"},
42  {yy::parser::token::UPLUS, "+"},
43  {yy::parser::token::UNOT, "!"},
44  {yy::parser::token::COLON, ":"}
45  };
46 
47 }
parser.hpp