InfiniSQL  v0.1.2-alpha
Massive Scale Transaction Processing
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Larxer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Mark Travis <mtravis15432+src@gmail.com>
3  * All rights reserved. No warranty, explicit or implicit, provided.
4  *
5  * This file is part of InfiniSQL(tm).
6 
7  * InfiniSQL is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 3
9  * as published by the Free Software Foundation.
10  *
11  * InfiniSQL is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with InfiniSQL. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
29 #ifndef INFINISQLLARXER_H
30 #define INFINISQLLARXER_H
31 
32 #include "larx.h"
33 #include "Asts.h"
34 #include "gch.h"
35 #include "defs.h"
36 
49 class Larxer
50 {
51 public:
57  {
58  TYPE_NONE = 0,
61  TYPE_NOT = 3,
63  TYPE_eq = 5,
64  TYPE_ne = 6,
65  TYPE_lt = 7,
66  TYPE_gt = 8,
67  TYPE_lte = 9,
68  TYPE_gte = 10,
84  TYPE_ASC = 26,
85  TYPE_DESC = 27,
90  TYPE_WHERE = 32,
91  TYPE_AVG = 33,
92  TYPE_COUNT = 34,
93  TYPE_MAX = 35,
94  TYPE_MIN = 36,
95  TYPE_SUM = 37,
98  TYPE_ALL = 40,
101  TYPE_IN = 43,
102  TYPE_LIKE = 44,
106  TYPE_AND = 48,
107  TYPE_OR = 49,
114  TYPE_FROM = 57,
124  TYPE_SET = 67,
128  };
129 
135  {
137  std::string val;
138  };
139 
140 
151  Larxer(char *instr, class TransactionAgent *taPtr, class Schema *schemaPtr);
152  virtual ~Larxer();
153 
161  void pushstack(stacktypes_e type);
170  void pushstack(stacktypes_e type, int64_t val);
179  void pushstack(stacktypes_e type, long double val);
188  void pushstack(stacktypes_e type, const char *val);
197  void pushstack(stacktypes_e type, string &val);
203  void pushoperand(char operandtype);
210  void pushoperand(char operandtype, int64_t val);
217  void pushoperand(char operandtype, long double val);
224  void pushoperand(char operandtype, const char *val);
231  void pushaggregate(char aggregatetype, const char *val);
245  int64_t getintval(string &val);
253  long double getfloatval(string &val);
260  void eatstack(class TransactionAgent *taPtr, class Schema *schemaPtr);
265  void printstack();
266 
272  void consumeSelect(string &columns);
277  void consumeInsert();
282  void consumeUpdate();
287  void consumeDelete();
292  void consumeStoredProcedure();
299  class Ast *consumeExpression();
306  int64_t consumeSubquery();
311  void consumeInobject();
317  void consumeColumns(int64_t numcolumns);
322  void consumeFrom();
327  void consumeWhere();
332  void consumeGroupby();
337  void consumeHaving();
342  void consumeOrderby();
343 
344  std::stack<stackmember_s> parsedStack;
347 };
348 
349 #endif /* INFINISQLLARXER_H */