Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Positions for Bison parsers in C++ 00004 00005 Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00038 #ifndef BISON_POSITION_HH 00039 # define BISON_POSITION_HH 00040 00041 # include <iostream> 00042 # include <string> 00043 # include <algorithm> 00044 00045 00046 /* Line 37 of location.cc */ 00047 #line 14 "src/sql/server/sql_parser.ypp" 00048 namespace CoGaDB { namespace SQL { 00049 00050 /* Line 37 of location.cc */ 00051 #line 52 "/home/sebastian/gpudbms/trunk/cogadb/src/sql/server/position.hh" 00052 00053 class position 00054 { 00055 public: 00056 00058 position () 00059 : filename (0), line (1), column (1) 00060 { 00061 } 00062 00063 00065 inline void initialize (std::string* fn) 00066 { 00067 filename = fn; 00068 line = 1; 00069 column = 1; 00070 } 00071 00074 public: 00076 inline void lines (int count = 1) 00077 { 00078 column = 1; 00079 line += count; 00080 } 00081 00083 inline void columns (int count = 1) 00084 { 00085 column = std::max (1u, column + count); 00086 } 00089 public: 00091 std::string* filename; 00093 unsigned int line; 00095 unsigned int column; 00096 }; 00097 00099 inline const position& 00100 operator+= (position& res, const int width) 00101 { 00102 res.columns (width); 00103 return res; 00104 } 00105 00107 inline const position 00108 operator+ (const position& begin, const int width) 00109 { 00110 position res = begin; 00111 return res += width; 00112 } 00113 00115 inline const position& 00116 operator-= (position& res, const int width) 00117 { 00118 return res += -width; 00119 } 00120 00122 inline const position 00123 operator- (const position& begin, const int width) 00124 { 00125 return begin + -width; 00126 } 00127 00129 inline bool 00130 operator== (const position& pos1, const position& pos2) 00131 { 00132 return (pos1.line == pos2.line 00133 && pos1.column == pos2.column 00134 && (pos1.filename == pos2.filename 00135 || (pos1.filename && pos2.filename 00136 && *pos1.filename == *pos2.filename))); 00137 } 00138 00140 inline bool 00141 operator!= (const position& pos1, const position& pos2) 00142 { 00143 return !(pos1 == pos2); 00144 } 00145 00150 inline std::ostream& 00151 operator<< (std::ostream& ostr, const position& pos) 00152 { 00153 if (pos.filename) 00154 ostr << *pos.filename << ':'; 00155 return ostr << pos.line << '.' << pos.column; 00156 } 00157 00158 00159 /* Line 144 of location.cc */ 00160 #line 14 "src/sql/server/sql_parser.ypp" 00161 } } // CoGaDB::SQL 00162 00163 /* Line 144 of location.cc */ 00164 #line 165 "/home/sebastian/gpudbms/trunk/cogadb/src/sql/server/position.hh" 00165 #endif // not BISON_POSITION_HH