├── .gitignore ├── LICENSE ├── README.md ├── setup.py └── sql4pandas ├── SQLite.g4 ├── SQLite.tokens ├── SQLiteLexer.py ├── SQLiteLexer.tokens ├── SQLiteListener.py ├── SQLiteParser.py ├── __init__.py ├── sql4pandas.py ├── sqlparser.py └── tests.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[ocd] 2 | build 3 | dist 4 | Thumbs.db 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, keeganmccallum 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the sql4pandas nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | sql4pandas 2 | ===== 3 | 4 | Efficient SQL bindings for the pandas data analysis library. Compile and execute sql queries directly on pandas data frames without copying to an external database. Written in pure python (no C extensions), but as it operates directly on pandas dataframes and uses numexpr for further optimizations, is quite efficient compared to other pandas sql modules. 5 | 6 | 7 | # Capabilities 8 | 9 | ## SELECT/SELECT INTO Statements: 10 | - FROM, WHERE, GROUP BY, ORDER BY Clauses 11 | - LEFT, INNER, RIGHT and OUTER JOINS 12 | - CASE Statements 13 | - Basic functions(ie. SUM, MIN, MAX... works with almost any native pandas aggregate function) 14 | - Standard Comparators (ie. <, >, =, !=, <>), 'AND' and 'OR' to chain 15 | - Comparators and arithmetic operations efficiently implemented using numexpr, making them faster and more memory efficient than vanilla python 16 | - aliasing for column names 17 | - nested queries 18 | - arithmetic operations(+, -, /, *...etc) 19 | 20 | # TODO 21 | - more functions, such as ISNULL statements 22 | - other statement types such as UPDATE, INSERT, DELETE etc 23 | - '?' templating 24 | - performance optimizations 25 | - Syntax checking, validation and explicit error handling for sql errors 26 | 27 | # DEPENDENCIES 28 | - pandas 13.0+ 29 | - numpy 1.8.0+ 30 | - numexpr 31 | - sqlparse 0.1.1+ 32 | - Tested on Python 2.7.x (untested but should work with Python 3+) 33 | 34 | # EXAMPLES 35 | 36 | >>> import pandas as pd 37 | >>> import numpy as np 38 | >>> from sql4pandas import PandasCursor 39 | 40 | >>> tbl1 = pd.DataFrame(np.random.randn(1000, 5) * 50, 41 | columns=['a', 'b', 'c', 'd', 'e']) 42 | >>> tbl2 = tbl1.copy() 43 | >>> crs = PandasCursor({'tbl1': tbl1, 'tbl2': tbl2}) 44 | >>> crs.execute("""SELECT 45 | CASE 46 | WHEN SUM(tbl1.e) > 0 47 | THEN SUM(tbl1.e) 48 | ELSE SUM(tbl2.a) 49 | END AS rand, 50 | MIN(tbl1.b) as min, 51 | CASE 52 | WHEN MIN(tbl1.c) < 0 53 | THEN MIN(tbl1.c) 54 | WHEN MAX(tbl2.b) > 0 55 | THEN MAX(tbl1.e) 56 | ELSE SUM(tbl1.b) 57 | END as crazy 58 | FROM tbl2 59 | LEFT JOIN tbl1 60 | ON tbl2.e = tbl1.e 61 | WHERE tbl1.a > 0 AND tbl2.b < 0 62 | GROUP BY tbl1.a, tbl2.b 63 | ORDER BY SUM(tbl1.d)""") 64 | >>> crs.fetchall() 65 | 66 | rand crazy min 67 | 68 | 87 13.980633 -39.880526 -39.880526 69 | 103 23.435746 -18.989008 -18.989008 70 | 166 40.677965 -47.603296 -40.139092 71 | 140 41.618153 -58.673183 -17.608048 72 | 138 20.019576 -40.846443 -14.799018 73 | 136 31.455437 -50.511226 -6.454728 74 | 217 27.721144 -61.249085 -61.249085 75 | 223 57.908348 -32.912267 -32.912267 76 | 207 17.242646 -1.511570 -55.993560 77 | 267 6.517910 -9.434497 -9.434497 78 | 259 18.807235 -98.790074 -81.566930 79 | 9 2.951997 -89.245030 -39.208345 80 | 274 132.999115 -88.597205 -88.597205 81 | 122 28.638471 -91.373880 -50.638201 82 | ... ... ... 83 | 84 | [277 rows x 3 columns] 85 | 86 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | setup(name='sql4pandas', 3 | version='0.0.1', 4 | packages=['sql4pandas'] 5 | ) 6 | -------------------------------------------------------------------------------- /sql4pandas/SQLite.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2014 by Bart Kiers 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * Project : sqlite-parser; an ANTLR4 grammar for SQLite 28 | * https://github.com/bkiers/sqlite-parser 29 | * Developed by : Bart Kiers, bart@big-o.nl 30 | */ 31 | grammar SQLite; 32 | 33 | parse 34 | : ( sql_stmt_list | error )* EOF 35 | ; 36 | 37 | error 38 | : UNEXPECTED_CHAR 39 | { 40 | throw new RuntimeException("UNEXPECTED_CHAR=" + $UNEXPECTED_CHAR.text); 41 | } 42 | ; 43 | 44 | sql_stmt_list 45 | : ';'* sql_stmt ( ';'+ sql_stmt )* ';'* 46 | ; 47 | 48 | sql_stmt 49 | : ( K_EXPLAIN ( K_QUERY K_PLAN )? )? ( alter_table_stmt 50 | | analyze_stmt 51 | | attach_stmt 52 | | begin_stmt 53 | | commit_stmt 54 | | compound_select_stmt 55 | | create_index_stmt 56 | | create_table_stmt 57 | | create_trigger_stmt 58 | | create_view_stmt 59 | | create_virtual_table_stmt 60 | | delete_stmt 61 | | delete_stmt_limited 62 | | detach_stmt 63 | | drop_index_stmt 64 | | drop_table_stmt 65 | | drop_trigger_stmt 66 | | drop_view_stmt 67 | | factored_select_stmt 68 | | insert_stmt 69 | | pragma_stmt 70 | | reindex_stmt 71 | | release_stmt 72 | | rollback_stmt 73 | | savepoint_stmt 74 | | simple_select_stmt 75 | | select_stmt 76 | | update_stmt 77 | | update_stmt_limited 78 | | vacuum_stmt ) 79 | ; 80 | 81 | alter_table_stmt 82 | : K_ALTER K_TABLE ( database_name '.' )? table_name 83 | ( K_RENAME K_TO new_table_name 84 | | K_ADD K_COLUMN? column_def 85 | ) 86 | ; 87 | 88 | analyze_stmt 89 | : K_ANALYZE ( database_name | table_or_index_name | database_name '.' table_or_index_name )? 90 | ; 91 | 92 | attach_stmt 93 | : K_ATTACH K_DATABASE? expr K_AS database_name 94 | ; 95 | 96 | begin_stmt 97 | : K_BEGIN ( K_DEFERRED | K_IMMEDIATE | K_EXCLUSIVE )? ( K_TRANSACTION transaction_name? )? 98 | ; 99 | 100 | commit_stmt 101 | : ( K_COMMIT | K_END ) ( K_TRANSACTION transaction_name? )? 102 | ; 103 | 104 | compound_select_stmt 105 | : ( K_WITH K_RECURSIVE? common_table_expression ( ',' common_table_expression )* )? 106 | select_core ( ( K_UNION K_ALL? | K_INTERSECT | K_EXCEPT ) select_core )+ 107 | ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 108 | ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? 109 | ; 110 | 111 | create_index_stmt 112 | : K_CREATE K_UNIQUE? K_INDEX ( K_IF K_NOT K_EXISTS )? 113 | ( database_name '.' )? index_name K_ON table_name '(' indexed_column ( ',' indexed_column )* ')' 114 | ( K_WHERE expr )? 115 | ; 116 | 117 | create_table_stmt 118 | : K_CREATE ( K_TEMP | K_TEMPORARY )? K_TABLE ( K_IF K_NOT K_EXISTS )? 119 | ( database_name '.' )? table_name 120 | ( '(' column_def ( ',' column_def )* ( ',' table_constraint )* ')' ( K_WITHOUT IDENTIFIER )? 121 | | K_AS select_stmt 122 | ) 123 | ; 124 | 125 | create_trigger_stmt 126 | : K_CREATE ( K_TEMP | K_TEMPORARY )? K_TRIGGER ( K_IF K_NOT K_EXISTS )? 127 | ( database_name '.' )? trigger_name ( K_BEFORE | K_AFTER | K_INSTEAD K_OF )? 128 | ( K_DELETE | K_INSERT | K_UPDATE ( K_OF column_name ( ',' column_name )* )? ) K_ON ( database_name '.' )? table_name 129 | ( K_FOR K_EACH K_ROW )? ( K_WHEN expr )? 130 | K_BEGIN ( ( update_stmt | insert_stmt | delete_stmt | select_stmt ) ';' )+ K_END 131 | ; 132 | 133 | create_view_stmt 134 | : K_CREATE ( K_TEMP | K_TEMPORARY )? K_VIEW ( K_IF K_NOT K_EXISTS )? 135 | ( database_name '.' )? view_name K_AS select_stmt 136 | ; 137 | 138 | create_virtual_table_stmt 139 | : K_CREATE K_VIRTUAL K_TABLE ( K_IF K_NOT K_EXISTS )? 140 | ( database_name '.' )? table_name 141 | K_USING module_name ( '(' module_argument ( ',' module_argument )* ')' )? 142 | ; 143 | 144 | delete_stmt 145 | : with_clause? K_DELETE K_FROM qualified_table_name 146 | ( K_WHERE expr )? 147 | ; 148 | 149 | delete_stmt_limited 150 | : with_clause? K_DELETE K_FROM qualified_table_name 151 | ( K_WHERE expr )? 152 | ( ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 153 | K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? 154 | )? 155 | ; 156 | 157 | detach_stmt 158 | : K_DETACH K_DATABASE? database_name 159 | ; 160 | 161 | drop_index_stmt 162 | : K_DROP K_INDEX ( K_IF K_EXISTS )? ( database_name '.' )? index_name 163 | ; 164 | 165 | drop_table_stmt 166 | : K_DROP K_TABLE ( K_IF K_EXISTS )? ( database_name '.' )? table_name 167 | ; 168 | 169 | drop_trigger_stmt 170 | : K_DROP K_TRIGGER ( K_IF K_EXISTS )? ( database_name '.' )? trigger_name 171 | ; 172 | 173 | drop_view_stmt 174 | : K_DROP K_VIEW ( K_IF K_EXISTS )? ( database_name '.' )? view_name 175 | ; 176 | 177 | factored_select_stmt 178 | : ( K_WITH K_RECURSIVE? common_table_expression ( ',' common_table_expression )* )? 179 | select_core ( compound_operator select_core )* 180 | ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 181 | ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? 182 | ; 183 | 184 | insert_stmt 185 | : with_clause? ( K_INSERT 186 | | K_REPLACE 187 | | K_INSERT K_OR K_REPLACE 188 | | K_INSERT K_OR K_ROLLBACK 189 | | K_INSERT K_OR K_ABORT 190 | | K_INSERT K_OR K_FAIL 191 | | K_INSERT K_OR K_IGNORE ) K_INTO 192 | ( database_name '.' )? table_name ( '(' column_name ( ',' column_name )* ')' )? 193 | ( K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* 194 | | select_stmt 195 | | K_DEFAULT K_VALUES 196 | ) 197 | ; 198 | 199 | pragma_stmt 200 | : K_PRAGMA ( database_name '.' )? pragma_name ( '=' pragma_value 201 | | '(' pragma_value ')' )? 202 | ; 203 | 204 | reindex_stmt 205 | : K_REINDEX ( collation_name 206 | | ( database_name '.' )? ( table_name | index_name ) 207 | )? 208 | ; 209 | 210 | release_stmt 211 | : K_RELEASE K_SAVEPOINT? savepoint_name 212 | ; 213 | 214 | rollback_stmt 215 | : K_ROLLBACK ( K_TRANSACTION transaction_name? )? ( K_TO K_SAVEPOINT? savepoint_name )? 216 | ; 217 | 218 | savepoint_stmt 219 | : K_SAVEPOINT savepoint_name 220 | ; 221 | 222 | simple_select_stmt 223 | : ( K_WITH K_RECURSIVE? common_table_expression ( ',' common_table_expression )* )? 224 | select_core ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 225 | ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? 226 | ; 227 | 228 | select_stmt 229 | : ( K_WITH K_RECURSIVE? common_table_expression ( ',' common_table_expression )* )? 230 | select_or_values ( compound_operator select_or_values )* 231 | ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 232 | ( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )? 233 | ; 234 | 235 | select_or_values 236 | : K_SELECT ( K_DISTINCT | K_ALL )? result_column ( ',' result_column )* 237 | ( K_FROM ( table_or_subquery ( ',' table_or_subquery )* | join_clause ) )? 238 | ( K_WHERE expr )? 239 | ( K_GROUP K_BY expr ( ',' expr )* ( K_HAVING expr )? )? 240 | | K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* 241 | ; 242 | 243 | update_stmt 244 | : with_clause? K_UPDATE ( K_OR K_ROLLBACK 245 | | K_OR K_ABORT 246 | | K_OR K_REPLACE 247 | | K_OR K_FAIL 248 | | K_OR K_IGNORE )? qualified_table_name 249 | K_SET column_name '=' expr ( ',' column_name '=' expr )* ( K_WHERE expr )? 250 | ; 251 | 252 | update_stmt_limited 253 | : with_clause? K_UPDATE ( K_OR K_ROLLBACK 254 | | K_OR K_ABORT 255 | | K_OR K_REPLACE 256 | | K_OR K_FAIL 257 | | K_OR K_IGNORE )? qualified_table_name 258 | K_SET column_name '=' expr ( ',' column_name '=' expr )* ( K_WHERE expr )? 259 | ( ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )? 260 | K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? 261 | )? 262 | ; 263 | 264 | vacuum_stmt 265 | : K_VACUUM 266 | ; 267 | 268 | column_def 269 | : column_name type_name? column_constraint* 270 | ; 271 | 272 | type_name 273 | : name+ ( '(' signed_number ')' 274 | | '(' signed_number ',' signed_number ')' )? 275 | ; 276 | 277 | column_constraint 278 | : ( K_CONSTRAINT name )? 279 | ( K_PRIMARY K_KEY ( K_ASC | K_DESC )? conflict_clause K_AUTOINCREMENT? 280 | | K_NOT? K_NULL conflict_clause 281 | | K_UNIQUE conflict_clause 282 | | K_CHECK '(' expr ')' 283 | | K_DEFAULT (signed_number | literal_value | '(' expr ')') 284 | | K_COLLATE collation_name 285 | | foreign_key_clause 286 | ) 287 | ; 288 | 289 | conflict_clause 290 | : ( K_ON K_CONFLICT ( K_ROLLBACK 291 | | K_ABORT 292 | | K_FAIL 293 | | K_IGNORE 294 | | K_REPLACE 295 | ) 296 | )? 297 | ; 298 | 299 | /* 300 | SQLite understands the following binary operators, in order from highest to 301 | lowest precedence: 302 | 303 | || 304 | * / % 305 | + - 306 | << >> & | 307 | < <= > >= 308 | = == != <> IS IS NOT IN LIKE GLOB MATCH REGEXP 309 | AND 310 | OR 311 | */ 312 | expr 313 | : literal_value 314 | | BIND_PARAMETER 315 | | ( ( database_name '.' )? table_name '.' )? column_name 316 | | unary_operator expr 317 | | expr '||' expr 318 | | expr ( '*' | '/' | '%' ) expr 319 | | expr ( '+' | '-' ) expr 320 | | expr ( '<<' | '>>' | '&' | '|' ) expr 321 | | expr ( '<' | '<=' | '>' | '>=' ) expr 322 | | expr ( '=' | '==' | '!=' | '<>' | K_IS | K_IS K_NOT | K_IN | K_LIKE | K_GLOB | K_MATCH | K_REGEXP ) expr 323 | | expr K_AND expr 324 | | expr K_OR expr 325 | | function_name '(' ( K_DISTINCT? expr ( ',' expr )* | '*' )? ')' 326 | | '(' expr ')' 327 | | K_CAST '(' expr K_AS type_name ')' 328 | | expr K_COLLATE collation_name 329 | | expr K_NOT? ( K_LIKE | K_GLOB | K_REGEXP | K_MATCH ) expr ( K_ESCAPE expr )? 330 | | expr ( K_ISNULL | K_NOTNULL | K_NOT K_NULL ) 331 | | expr K_IS K_NOT? expr 332 | | expr K_NOT? K_BETWEEN expr K_AND expr 333 | | expr K_NOT? K_IN ( '(' ( select_stmt 334 | | expr ( ',' expr )* 335 | )? 336 | ')' 337 | | ( database_name '.' )? table_name ) 338 | | ( ( K_NOT )? K_EXISTS )? '(' select_stmt ')' 339 | | K_CASE expr? ( K_WHEN expr K_THEN expr )+ ( K_ELSE expr )? K_END 340 | | raise_function 341 | ; 342 | 343 | foreign_key_clause 344 | : K_REFERENCES foreign_table ( '(' column_name ( ',' column_name )* ')' )? 345 | ( ( K_ON ( K_DELETE | K_UPDATE ) ( K_SET K_NULL 346 | | K_SET K_DEFAULT 347 | | K_CASCADE 348 | | K_RESTRICT 349 | | K_NO K_ACTION ) 350 | | K_MATCH name 351 | ) 352 | )* 353 | ( K_NOT? K_DEFERRABLE ( K_INITIALLY K_DEFERRED | K_INITIALLY K_IMMEDIATE )? )? 354 | ; 355 | 356 | raise_function 357 | : K_RAISE '(' ( K_IGNORE 358 | | ( K_ROLLBACK | K_ABORT | K_FAIL ) ',' error_message ) 359 | ')' 360 | ; 361 | 362 | indexed_column 363 | : column_name ( K_COLLATE collation_name )? ( K_ASC | K_DESC )? 364 | ; 365 | 366 | table_constraint 367 | : ( K_CONSTRAINT name )? 368 | ( ( K_PRIMARY K_KEY | K_UNIQUE ) '(' indexed_column ( ',' indexed_column )* ')' conflict_clause 369 | | K_CHECK '(' expr ')' 370 | | K_FOREIGN K_KEY '(' column_name ( ',' column_name )* ')' foreign_key_clause 371 | ) 372 | ; 373 | 374 | with_clause 375 | : K_WITH K_RECURSIVE? cte_table_name K_AS '(' select_stmt ')' ( ',' cte_table_name K_AS '(' select_stmt ')' )* 376 | ; 377 | 378 | qualified_table_name 379 | : ( database_name '.' )? table_name ( K_INDEXED K_BY index_name 380 | | K_NOT K_INDEXED )? 381 | ; 382 | 383 | ordering_term 384 | : expr ( K_COLLATE collation_name )? ( K_ASC | K_DESC )? 385 | ; 386 | 387 | pragma_value 388 | : signed_number 389 | | name 390 | | STRING_LITERAL 391 | ; 392 | 393 | common_table_expression 394 | : table_name ( '(' column_name ( ',' column_name )* ')' )? K_AS '(' select_stmt ')' 395 | ; 396 | 397 | result_column 398 | : '*' 399 | | table_name '.' '*' 400 | | expr ( K_AS? column_alias )? 401 | ; 402 | 403 | table_or_subquery 404 | : ( database_name '.' )? table_name ( K_AS? table_alias )? 405 | ( K_INDEXED K_BY index_name 406 | | K_NOT K_INDEXED )? 407 | | '(' ( table_or_subquery ( ',' table_or_subquery )* 408 | | join_clause ) 409 | ')' ( K_AS? table_alias )? 410 | | '(' select_stmt ')' ( K_AS? table_alias )? 411 | ; 412 | 413 | join_clause 414 | : table_or_subquery ( join_operator table_or_subquery join_constraint )* 415 | ; 416 | 417 | join_operator 418 | : ',' 419 | | K_NATURAL? ( K_LEFT K_OUTER? | K_INNER | K_CROSS )? K_JOIN 420 | ; 421 | 422 | join_constraint 423 | : ( K_ON expr 424 | | K_USING '(' column_name ( ',' column_name )* ')' )? 425 | ; 426 | 427 | select_core 428 | : K_SELECT ( K_DISTINCT | K_ALL )? result_column ( ',' result_column )* 429 | ( K_FROM ( table_or_subquery ( ',' table_or_subquery )* | join_clause ) )? 430 | ( K_WHERE expr )? 431 | ( K_GROUP K_BY expr ( ',' expr )* ( K_HAVING expr )? )? 432 | | K_VALUES '(' expr ( ',' expr )* ')' ( ',' '(' expr ( ',' expr )* ')' )* 433 | ; 434 | 435 | compound_operator 436 | : K_UNION 437 | | K_UNION K_ALL 438 | | K_INTERSECT 439 | | K_EXCEPT 440 | ; 441 | 442 | cte_table_name 443 | : table_name ( '(' column_name ( ',' column_name )* ')' )? 444 | ; 445 | 446 | signed_number 447 | : ( '+' | '-' )? NUMERIC_LITERAL 448 | ; 449 | 450 | literal_value 451 | : NUMERIC_LITERAL 452 | | STRING_LITERAL 453 | | BLOB_LITERAL 454 | | K_NULL 455 | | K_CURRENT_TIME 456 | | K_CURRENT_DATE 457 | | K_CURRENT_TIMESTAMP 458 | ; 459 | 460 | unary_operator 461 | : '-' 462 | | '+' 463 | | '~' 464 | | K_NOT 465 | ; 466 | 467 | error_message 468 | : STRING_LITERAL 469 | ; 470 | 471 | module_argument // TODO check what exactly is permitted here 472 | : expr 473 | | column_def 474 | ; 475 | 476 | column_alias 477 | : IDENTIFIER 478 | | STRING_LITERAL 479 | ; 480 | 481 | keyword 482 | : K_ABORT 483 | | K_ACTION 484 | | K_ADD 485 | | K_AFTER 486 | | K_ALL 487 | | K_ALTER 488 | | K_ANALYZE 489 | | K_AND 490 | | K_AS 491 | | K_ASC 492 | | K_ATTACH 493 | | K_AUTOINCREMENT 494 | | K_BEFORE 495 | | K_BEGIN 496 | | K_BETWEEN 497 | | K_BY 498 | | K_CASCADE 499 | | K_CASE 500 | | K_CAST 501 | | K_CHECK 502 | | K_COLLATE 503 | | K_COLUMN 504 | | K_COMMIT 505 | | K_CONFLICT 506 | | K_CONSTRAINT 507 | | K_CREATE 508 | | K_CROSS 509 | | K_CURRENT_DATE 510 | | K_CURRENT_TIME 511 | | K_CURRENT_TIMESTAMP 512 | | K_DATABASE 513 | | K_DEFAULT 514 | | K_DEFERRABLE 515 | | K_DEFERRED 516 | | K_DELETE 517 | | K_DESC 518 | | K_DETACH 519 | | K_DISTINCT 520 | | K_DROP 521 | | K_EACH 522 | | K_ELSE 523 | | K_END 524 | | K_ESCAPE 525 | | K_EXCEPT 526 | | K_EXCLUSIVE 527 | | K_EXISTS 528 | | K_EXPLAIN 529 | | K_FAIL 530 | | K_FOR 531 | | K_FOREIGN 532 | | K_FROM 533 | | K_FULL 534 | | K_GLOB 535 | | K_GROUP 536 | | K_HAVING 537 | | K_IF 538 | | K_IGNORE 539 | | K_IMMEDIATE 540 | | K_IN 541 | | K_INDEX 542 | | K_INDEXED 543 | | K_INITIALLY 544 | | K_INNER 545 | | K_INSERT 546 | | K_INSTEAD 547 | | K_INTERSECT 548 | | K_INTO 549 | | K_IS 550 | | K_ISNULL 551 | | K_JOIN 552 | | K_KEY 553 | | K_LEFT 554 | | K_LIKE 555 | | K_LIMIT 556 | | K_MATCH 557 | | K_NATURAL 558 | | K_NO 559 | | K_NOT 560 | | K_NOTNULL 561 | | K_NULL 562 | | K_OF 563 | | K_OFFSET 564 | | K_ON 565 | | K_OR 566 | | K_ORDER 567 | | K_OUTER 568 | | K_PLAN 569 | | K_PRAGMA 570 | | K_PRIMARY 571 | | K_QUERY 572 | | K_RAISE 573 | | K_RECURSIVE 574 | | K_REFERENCES 575 | | K_REGEXP 576 | | K_REINDEX 577 | | K_RELEASE 578 | | K_RENAME 579 | | K_REPLACE 580 | | K_RESTRICT 581 | | K_RIGHT 582 | | K_ROLLBACK 583 | | K_ROW 584 | | K_SAVEPOINT 585 | | K_SELECT 586 | | K_SET 587 | | K_TABLE 588 | | K_TEMP 589 | | K_TEMPORARY 590 | | K_THEN 591 | | K_TO 592 | | K_TRANSACTION 593 | | K_TRIGGER 594 | | K_UNION 595 | | K_UNIQUE 596 | | K_UPDATE 597 | | K_USING 598 | | K_VACUUM 599 | | K_VALUES 600 | | K_VIEW 601 | | K_VIRTUAL 602 | | K_WHEN 603 | | K_WHERE 604 | | K_WITH 605 | | K_WITHOUT 606 | ; 607 | 608 | // TODO check all names below 609 | 610 | name 611 | : any_name 612 | ; 613 | 614 | function_name 615 | : any_name 616 | ; 617 | 618 | database_name 619 | : any_name 620 | ; 621 | 622 | table_name 623 | : any_name 624 | ; 625 | 626 | table_or_index_name 627 | : any_name 628 | ; 629 | 630 | new_table_name 631 | : any_name 632 | ; 633 | 634 | column_name 635 | : any_name 636 | ; 637 | 638 | collation_name 639 | : any_name 640 | ; 641 | 642 | foreign_table 643 | : any_name 644 | ; 645 | 646 | index_name 647 | : any_name 648 | ; 649 | 650 | trigger_name 651 | : any_name 652 | ; 653 | 654 | view_name 655 | : any_name 656 | ; 657 | 658 | module_name 659 | : any_name 660 | ; 661 | 662 | pragma_name 663 | : any_name 664 | ; 665 | 666 | savepoint_name 667 | : any_name 668 | ; 669 | 670 | table_alias 671 | : any_name 672 | ; 673 | 674 | transaction_name 675 | : any_name 676 | ; 677 | 678 | any_name 679 | : IDENTIFIER 680 | | keyword 681 | | STRING_LITERAL 682 | | '(' any_name ')' 683 | ; 684 | 685 | SCOL : ';'; 686 | DOT : '.'; 687 | OPEN_PAR : '('; 688 | CLOSE_PAR : ')'; 689 | COMMA : ','; 690 | ASSIGN : '='; 691 | STAR : '*'; 692 | PLUS : '+'; 693 | MINUS : '-'; 694 | TILDE : '~'; 695 | PIPE2 : '||'; 696 | DIV : '/'; 697 | MOD : '%'; 698 | LT2 : '<<'; 699 | GT2 : '>>'; 700 | AMP : '&'; 701 | PIPE : '|'; 702 | LT : '<'; 703 | LT_EQ : '<='; 704 | GT : '>'; 705 | GT_EQ : '>='; 706 | EQ : '=='; 707 | NOT_EQ1 : '!='; 708 | NOT_EQ2 : '<>'; 709 | 710 | // http://www.sqlite.org/lang_keywords.html 711 | K_ABORT : A B O R T; 712 | K_ACTION : A C T I O N; 713 | K_ADD : A D D; 714 | K_AFTER : A F T E R; 715 | K_ALL : A L L; 716 | K_ALTER : A L T E R; 717 | K_ANALYZE : A N A L Y Z E; 718 | K_AND : A N D; 719 | K_AS : A S; 720 | K_ASC : A S C; 721 | K_ATTACH : A T T A C H; 722 | K_AUTOINCREMENT : A U T O I N C R E M E N T; 723 | K_BEFORE : B E F O R E; 724 | K_BEGIN : B E G I N; 725 | K_BETWEEN : B E T W E E N; 726 | K_BY : B Y; 727 | K_CASCADE : C A S C A D E; 728 | K_CASE : C A S E; 729 | K_CAST : C A S T; 730 | K_CHECK : C H E C K; 731 | K_COLLATE : C O L L A T E; 732 | K_COLUMN : C O L U M N; 733 | K_COMMIT : C O M M I T; 734 | K_CONFLICT : C O N F L I C T; 735 | K_CONSTRAINT : C O N S T R A I N T; 736 | K_CREATE : C R E A T E; 737 | K_CROSS : C R O S S; 738 | K_CURRENT_DATE : C U R R E N T '_' D A T E; 739 | K_CURRENT_TIME : C U R R E N T '_' T I M E; 740 | K_CURRENT_TIMESTAMP : C U R R E N T '_' T I M E S T A M P; 741 | K_DATABASE : D A T A B A S E; 742 | K_DEFAULT : D E F A U L T; 743 | K_DEFERRABLE : D E F E R R A B L E; 744 | K_DEFERRED : D E F E R R E D; 745 | K_DELETE : D E L E T E; 746 | K_DESC : D E S C; 747 | K_DETACH : D E T A C H; 748 | K_DISTINCT : D I S T I N C T; 749 | K_DROP : D R O P; 750 | K_EACH : E A C H; 751 | K_ELSE : E L S E; 752 | K_END : E N D; 753 | K_ESCAPE : E S C A P E; 754 | K_EXCEPT : E X C E P T; 755 | K_EXCLUSIVE : E X C L U S I V E; 756 | K_EXISTS : E X I S T S; 757 | K_EXPLAIN : E X P L A I N; 758 | K_FAIL : F A I L; 759 | K_FOR : F O R; 760 | K_FOREIGN : F O R E I G N; 761 | K_FROM : F R O M; 762 | K_FULL : F U L L; 763 | K_GLOB : G L O B; 764 | K_GROUP : G R O U P; 765 | K_HAVING : H A V I N G; 766 | K_IF : I F; 767 | K_IGNORE : I G N O R E; 768 | K_IMMEDIATE : I M M E D I A T E; 769 | K_IN : I N; 770 | K_INDEX : I N D E X; 771 | K_INDEXED : I N D E X E D; 772 | K_INITIALLY : I N I T I A L L Y; 773 | K_INNER : I N N E R; 774 | K_INSERT : I N S E R T; 775 | K_INSTEAD : I N S T E A D; 776 | K_INTERSECT : I N T E R S E C T; 777 | K_INTO : I N T O; 778 | K_IS : I S; 779 | K_ISNULL : I S N U L L; 780 | K_JOIN : J O I N; 781 | K_KEY : K E Y; 782 | K_LEFT : L E F T; 783 | K_LIKE : L I K E; 784 | K_LIMIT : L I M I T; 785 | K_MATCH : M A T C H; 786 | K_NATURAL : N A T U R A L; 787 | K_NO : N O; 788 | K_NOT : N O T; 789 | K_NOTNULL : N O T N U L L; 790 | K_NULL : N U L L; 791 | K_OF : O F; 792 | K_OFFSET : O F F S E T; 793 | K_ON : O N; 794 | K_OR : O R; 795 | K_ORDER : O R D E R; 796 | K_OUTER : O U T E R; 797 | K_PLAN : P L A N; 798 | K_PRAGMA : P R A G M A; 799 | K_PRIMARY : P R I M A R Y; 800 | K_QUERY : Q U E R Y; 801 | K_RAISE : R A I S E; 802 | K_RECURSIVE : R E C U R S I V E; 803 | K_REFERENCES : R E F E R E N C E S; 804 | K_REGEXP : R E G E X P; 805 | K_REINDEX : R E I N D E X; 806 | K_RELEASE : R E L E A S E; 807 | K_RENAME : R E N A M E; 808 | K_REPLACE : R E P L A C E; 809 | K_RESTRICT : R E S T R I C T; 810 | K_RIGHT : R I G H T; 811 | K_ROLLBACK : R O L L B A C K; 812 | K_ROW : R O W; 813 | K_SAVEPOINT : S A V E P O I N T; 814 | K_SELECT : S E L E C T; 815 | K_SET : S E T; 816 | K_TABLE : T A B L E; 817 | K_TEMP : T E M P; 818 | K_TEMPORARY : T E M P O R A R Y; 819 | K_THEN : T H E N; 820 | K_TO : T O; 821 | K_TRANSACTION : T R A N S A C T I O N; 822 | K_TRIGGER : T R I G G E R; 823 | K_UNION : U N I O N; 824 | K_UNIQUE : U N I Q U E; 825 | K_UPDATE : U P D A T E; 826 | K_USING : U S I N G; 827 | K_VACUUM : V A C U U M; 828 | K_VALUES : V A L U E S; 829 | K_VIEW : V I E W; 830 | K_VIRTUAL : V I R T U A L; 831 | K_WHEN : W H E N; 832 | K_WHERE : W H E R E; 833 | K_WITH : W I T H; 834 | K_WITHOUT : W I T H O U T; 835 | 836 | IDENTIFIER 837 | : '"' (~'"' | '""')* '"' 838 | | '`' (~'`' | '``')* '`' 839 | | '[' ~']'* ']' 840 | | [a-zA-Z_] [a-zA-Z_0-9]* // TODO check: needs more chars in set 841 | ; 842 | 843 | NUMERIC_LITERAL 844 | : DIGIT+ ( '.' DIGIT* )? ( E [-+]? DIGIT+ )? 845 | | '.' DIGIT+ ( E [-+]? DIGIT+ )? 846 | ; 847 | 848 | BIND_PARAMETER 849 | : '?' DIGIT* 850 | | [:@$] IDENTIFIER 851 | ; 852 | 853 | STRING_LITERAL 854 | : '\'' ( ~'\'' | '\'\'' )* '\'' 855 | ; 856 | 857 | BLOB_LITERAL 858 | : X STRING_LITERAL 859 | ; 860 | 861 | SINGLE_LINE_COMMENT 862 | : '--' ~[\r\n]* -> channel(HIDDEN) 863 | ; 864 | 865 | MULTILINE_COMMENT 866 | : '/*' .*? ( '*/' | EOF ) -> channel(HIDDEN) 867 | ; 868 | 869 | SPACES 870 | : [ \u000B\t\r\n] -> channel(HIDDEN) 871 | ; 872 | 873 | UNEXPECTED_CHAR 874 | : . 875 | ; 876 | 877 | fragment DIGIT : [0-9]; 878 | 879 | fragment A : [aA]; 880 | fragment B : [bB]; 881 | fragment C : [cC]; 882 | fragment D : [dD]; 883 | fragment E : [eE]; 884 | fragment F : [fF]; 885 | fragment G : [gG]; 886 | fragment H : [hH]; 887 | fragment I : [iI]; 888 | fragment J : [jJ]; 889 | fragment K : [kK]; 890 | fragment L : [lL]; 891 | fragment M : [mM]; 892 | fragment N : [nN]; 893 | fragment O : [oO]; 894 | fragment P : [pP]; 895 | fragment Q : [qQ]; 896 | fragment R : [rR]; 897 | fragment S : [sS]; 898 | fragment T : [tT]; 899 | fragment U : [uU]; 900 | fragment V : [vV]; 901 | fragment W : [wW]; 902 | fragment X : [xX]; 903 | fragment Y : [yY]; 904 | fragment Z : [zZ]; 905 | -------------------------------------------------------------------------------- /sql4pandas/SQLite.tokens: -------------------------------------------------------------------------------- 1 | SCOL=1 2 | DOT=2 3 | OPEN_PAR=3 4 | CLOSE_PAR=4 5 | COMMA=5 6 | ASSIGN=6 7 | STAR=7 8 | PLUS=8 9 | MINUS=9 10 | TILDE=10 11 | PIPE2=11 12 | DIV=12 13 | MOD=13 14 | LT2=14 15 | GT2=15 16 | AMP=16 17 | PIPE=17 18 | LT=18 19 | LT_EQ=19 20 | GT=20 21 | GT_EQ=21 22 | EQ=22 23 | NOT_EQ1=23 24 | NOT_EQ2=24 25 | K_ABORT=25 26 | K_ACTION=26 27 | K_ADD=27 28 | K_AFTER=28 29 | K_ALL=29 30 | K_ALTER=30 31 | K_ANALYZE=31 32 | K_AND=32 33 | K_AS=33 34 | K_ASC=34 35 | K_ATTACH=35 36 | K_AUTOINCREMENT=36 37 | K_BEFORE=37 38 | K_BEGIN=38 39 | K_BETWEEN=39 40 | K_BY=40 41 | K_CASCADE=41 42 | K_CASE=42 43 | K_CAST=43 44 | K_CHECK=44 45 | K_COLLATE=45 46 | K_COLUMN=46 47 | K_COMMIT=47 48 | K_CONFLICT=48 49 | K_CONSTRAINT=49 50 | K_CREATE=50 51 | K_CROSS=51 52 | K_CURRENT_DATE=52 53 | K_CURRENT_TIME=53 54 | K_CURRENT_TIMESTAMP=54 55 | K_DATABASE=55 56 | K_DEFAULT=56 57 | K_DEFERRABLE=57 58 | K_DEFERRED=58 59 | K_DELETE=59 60 | K_DESC=60 61 | K_DETACH=61 62 | K_DISTINCT=62 63 | K_DROP=63 64 | K_EACH=64 65 | K_ELSE=65 66 | K_END=66 67 | K_ESCAPE=67 68 | K_EXCEPT=68 69 | K_EXCLUSIVE=69 70 | K_EXISTS=70 71 | K_EXPLAIN=71 72 | K_FAIL=72 73 | K_FOR=73 74 | K_FOREIGN=74 75 | K_FROM=75 76 | K_FULL=76 77 | K_GLOB=77 78 | K_GROUP=78 79 | K_HAVING=79 80 | K_IF=80 81 | K_IGNORE=81 82 | K_IMMEDIATE=82 83 | K_IN=83 84 | K_INDEX=84 85 | K_INDEXED=85 86 | K_INITIALLY=86 87 | K_INNER=87 88 | K_INSERT=88 89 | K_INSTEAD=89 90 | K_INTERSECT=90 91 | K_INTO=91 92 | K_IS=92 93 | K_ISNULL=93 94 | K_JOIN=94 95 | K_KEY=95 96 | K_LEFT=96 97 | K_LIKE=97 98 | K_LIMIT=98 99 | K_MATCH=99 100 | K_NATURAL=100 101 | K_NO=101 102 | K_NOT=102 103 | K_NOTNULL=103 104 | K_NULL=104 105 | K_OF=105 106 | K_OFFSET=106 107 | K_ON=107 108 | K_OR=108 109 | K_ORDER=109 110 | K_OUTER=110 111 | K_PLAN=111 112 | K_PRAGMA=112 113 | K_PRIMARY=113 114 | K_QUERY=114 115 | K_RAISE=115 116 | K_RECURSIVE=116 117 | K_REFERENCES=117 118 | K_REGEXP=118 119 | K_REINDEX=119 120 | K_RELEASE=120 121 | K_RENAME=121 122 | K_REPLACE=122 123 | K_RESTRICT=123 124 | K_RIGHT=124 125 | K_ROLLBACK=125 126 | K_ROW=126 127 | K_SAVEPOINT=127 128 | K_SELECT=128 129 | K_SET=129 130 | K_TABLE=130 131 | K_TEMP=131 132 | K_TEMPORARY=132 133 | K_THEN=133 134 | K_TO=134 135 | K_TRANSACTION=135 136 | K_TRIGGER=136 137 | K_UNION=137 138 | K_UNIQUE=138 139 | K_UPDATE=139 140 | K_USING=140 141 | K_VACUUM=141 142 | K_VALUES=142 143 | K_VIEW=143 144 | K_VIRTUAL=144 145 | K_WHEN=145 146 | K_WHERE=146 147 | K_WITH=147 148 | K_WITHOUT=148 149 | IDENTIFIER=149 150 | NUMERIC_LITERAL=150 151 | BIND_PARAMETER=151 152 | STRING_LITERAL=152 153 | BLOB_LITERAL=153 154 | SINGLE_LINE_COMMENT=154 155 | MULTILINE_COMMENT=155 156 | SPACES=156 157 | UNEXPECTED_CHAR=157 158 | ';'=1 159 | '.'=2 160 | '('=3 161 | ')'=4 162 | ','=5 163 | '='=6 164 | '*'=7 165 | '+'=8 166 | '-'=9 167 | '~'=10 168 | '||'=11 169 | '/'=12 170 | '%'=13 171 | '<<'=14 172 | '>>'=15 173 | '&'=16 174 | '|'=17 175 | '<'=18 176 | '<='=19 177 | '>'=20 178 | '>='=21 179 | '=='=22 180 | '!='=23 181 | '<>'=24 182 | -------------------------------------------------------------------------------- /sql4pandas/SQLiteLexer.py: -------------------------------------------------------------------------------- 1 | # Generated from SQLite.g4 by ANTLR 4.5.3 2 | # encoding: utf-8 3 | from __future__ import print_function 4 | from antlr4 import * 5 | from io import StringIO 6 | 7 | 8 | def serializedATN(): 9 | with StringIO() as buf: 10 | buf.write(u"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2") 11 | buf.write(u"\u009f\u05ae\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6") 12 | buf.write(u"\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t") 13 | buf.write(u"\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4") 14 | buf.write(u"\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27") 15 | buf.write(u"\t\27\4\30\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t") 16 | buf.write(u"\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"") 17 | buf.write(u"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4") 18 | buf.write(u"+\t+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62") 19 | buf.write(u"\t\62\4\63\t\63\4\64\t\64\4\65\t\65\4\66\t\66\4\67\t") 20 | buf.write(u"\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4") 21 | buf.write(u"@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH") 22 | buf.write(u"\4I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\t") 23 | buf.write(u"Q\4R\tR\4S\tS\4T\tT\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z") 24 | buf.write(u"\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4`\t`\4a\ta\4b\t") 25 | buf.write(u"b\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k") 26 | buf.write(u"\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4") 27 | buf.write(u"t\tt\4u\tu\4v\tv\4w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|") 28 | buf.write(u"\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080\4\u0081\t\u0081") 29 | buf.write(u"\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085") 30 | buf.write(u"\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088") 31 | buf.write(u"\4\u0089\t\u0089\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c") 32 | buf.write(u"\t\u008c\4\u008d\t\u008d\4\u008e\t\u008e\4\u008f\t\u008f") 33 | buf.write(u"\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092\4\u0093") 34 | buf.write(u"\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096") 35 | buf.write(u"\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a") 36 | buf.write(u"\t\u009a\4\u009b\t\u009b\4\u009c\t\u009c\4\u009d\t\u009d") 37 | buf.write(u"\4\u009e\t\u009e\4\u009f\t\u009f\4\u00a0\t\u00a0\4\u00a1") 38 | buf.write(u"\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3\4\u00a4\t\u00a4") 39 | buf.write(u"\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7\4\u00a8") 40 | buf.write(u"\t\u00a8\4\u00a9\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab") 41 | buf.write(u"\4\u00ac\t\u00ac\4\u00ad\t\u00ad\4\u00ae\t\u00ae\4\u00af") 42 | buf.write(u"\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1\4\u00b2\t\u00b2") 43 | buf.write(u"\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5\t\u00b5\4\u00b6") 44 | buf.write(u"\t\u00b6\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9") 45 | buf.write(u"\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b") 46 | buf.write(u"\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3") 47 | buf.write(u"\16\3\16\3\17\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22") 48 | buf.write(u"\3\22\3\23\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3") 49 | buf.write(u"\26\3\27\3\27\3\27\3\30\3\30\3\30\3\31\3\31\3\31\3\32") 50 | buf.write(u"\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3") 51 | buf.write(u"\33\3\33\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\35") 52 | buf.write(u"\3\35\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3") 53 | buf.write(u"\37\3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3!\3\"\3\"\3\"\3") 54 | buf.write(u"#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3%\3%\3%") 55 | buf.write(u"\3%\3%\3%\3%\3%\3%\3%\3&\3&\3&\3&\3&\3&\3&\3\'\3\'\3") 56 | buf.write(u"\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3*\3") 57 | buf.write(u"*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3,\3,\3,\3,\3,\3-") 58 | buf.write(u"\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3.\3/\3/\3/\3/\3") 59 | buf.write(u"/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\61\3\61") 60 | buf.write(u"\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3") 61 | buf.write(u"\62\3\62\3\62\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3\63") 62 | buf.write(u"\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\64\3") 63 | buf.write(u"\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65") 64 | buf.write(u"\3\65\3\65\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3") 65 | buf.write(u"\66\3\66\3\66\3\66\3\66\3\67\3\67\3\67\3\67\3\67\3\67") 66 | buf.write(u"\3\67\3\67\3\67\3\67\3\67\3\67\3\67\3\67\3\67\3\67\3") 67 | buf.write(u"\67\3\67\38\38\38\38\38\38\38\38\38\39\39\39\39\39\3") 68 | buf.write(u"9\39\39\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3;\3;\3;\3;") 69 | buf.write(u"\3;\3;\3;\3;\3;\3<\3<\3<\3<\3<\3<\3<\3=\3=\3=\3=\3=\3") 70 | buf.write(u">\3>\3>\3>\3>\3>\3>\3?\3?\3?\3?\3?\3?\3?\3?\3?\3@\3@") 71 | buf.write(u"\3@\3@\3@\3A\3A\3A\3A\3A\3B\3B\3B\3B\3B\3C\3C\3C\3C\3") 72 | buf.write(u"D\3D\3D\3D\3D\3D\3D\3E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3F") 73 | buf.write(u"\3F\3F\3F\3F\3F\3F\3G\3G\3G\3G\3G\3G\3G\3H\3H\3H\3H\3") 74 | buf.write(u"H\3H\3H\3H\3I\3I\3I\3I\3I\3J\3J\3J\3J\3K\3K\3K\3K\3K") 75 | buf.write(u"\3K\3K\3K\3L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3N\3N\3N\3N\3") 76 | buf.write(u"N\3O\3O\3O\3O\3O\3O\3P\3P\3P\3P\3P\3P\3P\3Q\3Q\3Q\3R") 77 | buf.write(u"\3R\3R\3R\3R\3R\3R\3S\3S\3S\3S\3S\3S\3S\3S\3S\3S\3T\3") 78 | buf.write(u"T\3T\3U\3U\3U\3U\3U\3U\3V\3V\3V\3V\3V\3V\3V\3V\3W\3W") 79 | buf.write(u"\3W\3W\3W\3W\3W\3W\3W\3W\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3") 80 | buf.write(u"Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3[\3[") 81 | buf.write(u"\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3]\3]\3]\3^\3^\3^\3") 82 | buf.write(u"^\3^\3^\3^\3_\3_\3_\3_\3_\3`\3`\3`\3`\3a\3a\3a\3a\3a") 83 | buf.write(u"\3b\3b\3b\3b\3b\3c\3c\3c\3c\3c\3c\3d\3d\3d\3d\3d\3d\3") 84 | buf.write(u"e\3e\3e\3e\3e\3e\3e\3e\3f\3f\3f\3g\3g\3g\3g\3h\3h\3h") 85 | buf.write(u"\3h\3h\3h\3h\3h\3i\3i\3i\3i\3i\3j\3j\3j\3k\3k\3k\3k\3") 86 | buf.write(u"k\3k\3k\3l\3l\3l\3m\3m\3m\3n\3n\3n\3n\3n\3n\3o\3o\3o") 87 | buf.write(u"\3o\3o\3o\3p\3p\3p\3p\3p\3q\3q\3q\3q\3q\3q\3q\3r\3r\3") 88 | buf.write(u"r\3r\3r\3r\3r\3r\3s\3s\3s\3s\3s\3s\3t\3t\3t\3t\3t\3t") 89 | buf.write(u"\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\3v\3v\3v\3v\3v\3v\3v\3") 90 | buf.write(u"v\3v\3v\3v\3w\3w\3w\3w\3w\3w\3w\3x\3x\3x\3x\3x\3x\3x") 91 | buf.write(u"\3x\3y\3y\3y\3y\3y\3y\3y\3y\3z\3z\3z\3z\3z\3z\3z\3{\3") 92 | buf.write(u"{\3{\3{\3{\3{\3{\3{\3|\3|\3|\3|\3|\3|\3|\3|\3|\3}\3}") 93 | buf.write(u"\3}\3}\3}\3}\3~\3~\3~\3~\3~\3~\3~\3~\3~\3\177\3\177\3") 94 | buf.write(u"\177\3\177\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3") 95 | buf.write(u"\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0081\3\u0081") 96 | buf.write(u"\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0082\3\u0082") 97 | buf.write(u"\3\u0082\3\u0082\3\u0083\3\u0083\3\u0083\3\u0083\3\u0083") 98 | buf.write(u"\3\u0083\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0085") 99 | buf.write(u"\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085") 100 | buf.write(u"\3\u0085\3\u0085\3\u0086\3\u0086\3\u0086\3\u0086\3\u0086") 101 | buf.write(u"\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088\3\u0088") 102 | buf.write(u"\3\u0088\3\u0088\3\u0088\3\u0088\3\u0088\3\u0088\3\u0088") 103 | buf.write(u"\3\u0088\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089") 104 | buf.write(u"\3\u0089\3\u0089\3\u008a\3\u008a\3\u008a\3\u008a\3\u008a") 105 | buf.write(u"\3\u008a\3\u008b\3\u008b\3\u008b\3\u008b\3\u008b\3\u008b") 106 | buf.write(u"\3\u008b\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c") 107 | buf.write(u"\3\u008c\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d") 108 | buf.write(u"\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e") 109 | buf.write(u"\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f") 110 | buf.write(u"\3\u0090\3\u0090\3\u0090\3\u0090\3\u0090\3\u0091\3\u0091") 111 | buf.write(u"\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\3\u0092") 112 | buf.write(u"\3\u0092\3\u0092\3\u0092\3\u0092\3\u0093\3\u0093\3\u0093") 113 | buf.write(u"\3\u0093\3\u0093\3\u0093\3\u0094\3\u0094\3\u0094\3\u0094") 114 | buf.write(u"\3\u0094\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095") 115 | buf.write(u"\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0096\7\u0096") 116 | buf.write(u"\u04f2\n\u0096\f\u0096\16\u0096\u04f5\13\u0096\3\u0096") 117 | buf.write(u"\3\u0096\3\u0096\3\u0096\3\u0096\7\u0096\u04fc\n\u0096") 118 | buf.write(u"\f\u0096\16\u0096\u04ff\13\u0096\3\u0096\3\u0096\3\u0096") 119 | buf.write(u"\7\u0096\u0504\n\u0096\f\u0096\16\u0096\u0507\13\u0096") 120 | buf.write(u"\3\u0096\3\u0096\3\u0096\7\u0096\u050c\n\u0096\f\u0096") 121 | buf.write(u"\16\u0096\u050f\13\u0096\5\u0096\u0511\n\u0096\3\u0097") 122 | buf.write(u"\6\u0097\u0514\n\u0097\r\u0097\16\u0097\u0515\3\u0097") 123 | buf.write(u"\3\u0097\7\u0097\u051a\n\u0097\f\u0097\16\u0097\u051d") 124 | buf.write(u"\13\u0097\5\u0097\u051f\n\u0097\3\u0097\3\u0097\5\u0097") 125 | buf.write(u"\u0523\n\u0097\3\u0097\6\u0097\u0526\n\u0097\r\u0097") 126 | buf.write(u"\16\u0097\u0527\5\u0097\u052a\n\u0097\3\u0097\3\u0097") 127 | buf.write(u"\6\u0097\u052e\n\u0097\r\u0097\16\u0097\u052f\3\u0097") 128 | buf.write(u"\3\u0097\5\u0097\u0534\n\u0097\3\u0097\6\u0097\u0537") 129 | buf.write(u"\n\u0097\r\u0097\16\u0097\u0538\5\u0097\u053b\n\u0097") 130 | buf.write(u"\5\u0097\u053d\n\u0097\3\u0098\3\u0098\7\u0098\u0541") 131 | buf.write(u"\n\u0098\f\u0098\16\u0098\u0544\13\u0098\3\u0098\3\u0098") 132 | buf.write(u"\5\u0098\u0548\n\u0098\3\u0099\3\u0099\3\u0099\3\u0099") 133 | buf.write(u"\7\u0099\u054e\n\u0099\f\u0099\16\u0099\u0551\13\u0099") 134 | buf.write(u"\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a\3\u009b\3\u009b") 135 | buf.write(u"\3\u009b\3\u009b\7\u009b\u055c\n\u009b\f\u009b\16\u009b") 136 | buf.write(u"\u055f\13\u009b\3\u009b\3\u009b\3\u009c\3\u009c\3\u009c") 137 | buf.write(u"\3\u009c\7\u009c\u0567\n\u009c\f\u009c\16\u009c\u056a") 138 | buf.write(u"\13\u009c\3\u009c\3\u009c\3\u009c\5\u009c\u056f\n\u009c") 139 | buf.write(u"\3\u009c\3\u009c\3\u009d\3\u009d\3\u009d\3\u009d\3\u009e") 140 | buf.write(u"\3\u009e\3\u009f\3\u009f\3\u00a0\3\u00a0\3\u00a1\3\u00a1") 141 | buf.write(u"\3\u00a2\3\u00a2\3\u00a3\3\u00a3\3\u00a4\3\u00a4\3\u00a5") 142 | buf.write(u"\3\u00a5\3\u00a6\3\u00a6\3\u00a7\3\u00a7\3\u00a8\3\u00a8") 143 | buf.write(u"\3\u00a9\3\u00a9\3\u00aa\3\u00aa\3\u00ab\3\u00ab\3\u00ac") 144 | buf.write(u"\3\u00ac\3\u00ad\3\u00ad\3\u00ae\3\u00ae\3\u00af\3\u00af") 145 | buf.write(u"\3\u00b0\3\u00b0\3\u00b1\3\u00b1\3\u00b2\3\u00b2\3\u00b3") 146 | buf.write(u"\3\u00b3\3\u00b4\3\u00b4\3\u00b5\3\u00b5\3\u00b6\3\u00b6") 147 | buf.write(u"\3\u00b7\3\u00b7\3\u00b8\3\u00b8\3\u00b9\3\u00b9\3\u0568") 148 | buf.write(u"\2\u00ba\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25") 149 | buf.write(u"\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26") 150 | buf.write(u"+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C") 151 | buf.write(u"#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66") 152 | buf.write(u"k\67m8o9q:s;u{?}@\177A\u0081B\u0083C\u0085D\u0087") 153 | buf.write(u"E\u0089F\u008bG\u008dH\u008fI\u0091J\u0093K\u0095L\u0097") 154 | buf.write(u"M\u0099N\u009bO\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7") 155 | buf.write(u"U\u00a9V\u00abW\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7") 156 | buf.write(u"]\u00b9^\u00bb_\u00bd`\u00bfa\u00c1b\u00c3c\u00c5d\u00c7") 157 | buf.write(u"e\u00c9f\u00cbg\u00cdh\u00cfi\u00d1j\u00d3k\u00d5l\u00d7") 158 | buf.write(u"m\u00d9n\u00dbo\u00ddp\u00dfq\u00e1r\u00e3s\u00e5t\u00e7") 159 | buf.write(u"u\u00e9v\u00ebw\u00edx\u00efy\u00f1z\u00f3{\u00f5|\u00f7") 160 | buf.write(u"}\u00f9~\u00fb\177\u00fd\u0080\u00ff\u0081\u0101\u0082") 161 | buf.write(u"\u0103\u0083\u0105\u0084\u0107\u0085\u0109\u0086\u010b") 162 | buf.write(u"\u0087\u010d\u0088\u010f\u0089\u0111\u008a\u0113\u008b") 163 | buf.write(u"\u0115\u008c\u0117\u008d\u0119\u008e\u011b\u008f\u011d") 164 | buf.write(u"\u0090\u011f\u0091\u0121\u0092\u0123\u0093\u0125\u0094") 165 | buf.write(u"\u0127\u0095\u0129\u0096\u012b\u0097\u012d\u0098\u012f") 166 | buf.write(u"\u0099\u0131\u009a\u0133\u009b\u0135\u009c\u0137\u009d") 167 | buf.write(u"\u0139\u009e\u013b\u009f\u013d\2\u013f\2\u0141\2\u0143") 168 | buf.write(u"\2\u0145\2\u0147\2\u0149\2\u014b\2\u014d\2\u014f\2\u0151") 169 | buf.write(u"\2\u0153\2\u0155\2\u0157\2\u0159\2\u015b\2\u015d\2\u015f") 170 | buf.write(u"\2\u0161\2\u0163\2\u0165\2\u0167\2\u0169\2\u016b\2\u016d") 171 | buf.write(u"\2\u016f\2\u0171\2\3\2\'\3\2$$\3\2bb\3\2__\5\2C\\aac") 172 | buf.write(u"|\6\2\62;C\\aac|\4\2--//\5\2&&<\2\2\u018f\u0190\7>\2\2\u0190\36\3\2\2\2\u0191") 294 | buf.write(u"\u0192\7@\2\2\u0192\u0193\7@\2\2\u0193 \3\2\2\2\u0194") 295 | buf.write(u"\u0195\7(\2\2\u0195\"\3\2\2\2\u0196\u0197\7~\2\2\u0197") 296 | buf.write(u"$\3\2\2\2\u0198\u0199\7>\2\2\u0199&\3\2\2\2\u019a\u019b") 297 | buf.write(u"\7>\2\2\u019b\u019c\7?\2\2\u019c(\3\2\2\2\u019d\u019e") 298 | buf.write(u"\7@\2\2\u019e*\3\2\2\2\u019f\u01a0\7@\2\2\u01a0\u01a1") 299 | buf.write(u"\7?\2\2\u01a1,\3\2\2\2\u01a2\u01a3\7?\2\2\u01a3\u01a4") 300 | buf.write(u"\7?\2\2\u01a4.\3\2\2\2\u01a5\u01a6\7#\2\2\u01a6\u01a7") 301 | buf.write(u"\7?\2\2\u01a7\60\3\2\2\2\u01a8\u01a9\7>\2\2\u01a9\u01aa") 302 | buf.write(u"\7@\2\2\u01aa\62\3\2\2\2\u01ab\u01ac\5\u013f\u00a0\2") 303 | buf.write(u"\u01ac\u01ad\5\u0141\u00a1\2\u01ad\u01ae\5\u015b\u00ae") 304 | buf.write(u"\2\u01ae\u01af\5\u0161\u00b1\2\u01af\u01b0\5\u0165\u00b3") 305 | buf.write(u"\2\u01b0\64\3\2\2\2\u01b1\u01b2\5\u013f\u00a0\2\u01b2") 306 | buf.write(u"\u01b3\5\u0143\u00a2\2\u01b3\u01b4\5\u0165\u00b3\2\u01b4") 307 | buf.write(u"\u01b5\5\u014f\u00a8\2\u01b5\u01b6\5\u015b\u00ae\2\u01b6") 308 | buf.write(u"\u01b7\5\u0159\u00ad\2\u01b7\66\3\2\2\2\u01b8\u01b9\5") 309 | buf.write(u"\u013f\u00a0\2\u01b9\u01ba\5\u0145\u00a3\2\u01ba\u01bb") 310 | buf.write(u"\5\u0145\u00a3\2\u01bb8\3\2\2\2\u01bc\u01bd\5\u013f\u00a0") 311 | buf.write(u"\2\u01bd\u01be\5\u0149\u00a5\2\u01be\u01bf\5\u0165\u00b3") 312 | buf.write(u"\2\u01bf\u01c0\5\u0147\u00a4\2\u01c0\u01c1\5\u0161\u00b1") 313 | buf.write(u"\2\u01c1:\3\2\2\2\u01c2\u01c3\5\u013f\u00a0\2\u01c3\u01c4") 314 | buf.write(u"\5\u0155\u00ab\2\u01c4\u01c5\5\u0155\u00ab\2\u01c5<\3") 315 | buf.write(u"\2\2\2\u01c6\u01c7\5\u013f\u00a0\2\u01c7\u01c8\5\u0155") 316 | buf.write(u"\u00ab\2\u01c8\u01c9\5\u0165\u00b3\2\u01c9\u01ca\5\u0147") 317 | buf.write(u"\u00a4\2\u01ca\u01cb\5\u0161\u00b1\2\u01cb>\3\2\2\2\u01cc") 318 | buf.write(u"\u01cd\5\u013f\u00a0\2\u01cd\u01ce\5\u0159\u00ad\2\u01ce") 319 | buf.write(u"\u01cf\5\u013f\u00a0\2\u01cf\u01d0\5\u0155\u00ab\2\u01d0") 320 | buf.write(u"\u01d1\5\u016f\u00b8\2\u01d1\u01d2\5\u0171\u00b9\2\u01d2") 321 | buf.write(u"\u01d3\5\u0147\u00a4\2\u01d3@\3\2\2\2\u01d4\u01d5\5\u013f") 322 | buf.write(u"\u00a0\2\u01d5\u01d6\5\u0159\u00ad\2\u01d6\u01d7\5\u0145") 323 | buf.write(u"\u00a3\2\u01d7B\3\2\2\2\u01d8\u01d9\5\u013f\u00a0\2\u01d9") 324 | buf.write(u"\u01da\5\u0163\u00b2\2\u01daD\3\2\2\2\u01db\u01dc\5\u013f") 325 | buf.write(u"\u00a0\2\u01dc\u01dd\5\u0163\u00b2\2\u01dd\u01de\5\u0143") 326 | buf.write(u"\u00a2\2\u01deF\3\2\2\2\u01df\u01e0\5\u013f\u00a0\2\u01e0") 327 | buf.write(u"\u01e1\5\u0165\u00b3\2\u01e1\u01e2\5\u0165\u00b3\2\u01e2") 328 | buf.write(u"\u01e3\5\u013f\u00a0\2\u01e3\u01e4\5\u0143\u00a2\2\u01e4") 329 | buf.write(u"\u01e5\5\u014d\u00a7\2\u01e5H\3\2\2\2\u01e6\u01e7\5\u013f") 330 | buf.write(u"\u00a0\2\u01e7\u01e8\5\u0167\u00b4\2\u01e8\u01e9\5\u0165") 331 | buf.write(u"\u00b3\2\u01e9\u01ea\5\u015b\u00ae\2\u01ea\u01eb\5\u014f") 332 | buf.write(u"\u00a8\2\u01eb\u01ec\5\u0159\u00ad\2\u01ec\u01ed\5\u0143") 333 | buf.write(u"\u00a2\2\u01ed\u01ee\5\u0161\u00b1\2\u01ee\u01ef\5\u0147") 334 | buf.write(u"\u00a4\2\u01ef\u01f0\5\u0157\u00ac\2\u01f0\u01f1\5\u0147") 335 | buf.write(u"\u00a4\2\u01f1\u01f2\5\u0159\u00ad\2\u01f2\u01f3\5\u0165") 336 | buf.write(u"\u00b3\2\u01f3J\3\2\2\2\u01f4\u01f5\5\u0141\u00a1\2\u01f5") 337 | buf.write(u"\u01f6\5\u0147\u00a4\2\u01f6\u01f7\5\u0149\u00a5\2\u01f7") 338 | buf.write(u"\u01f8\5\u015b\u00ae\2\u01f8\u01f9\5\u0161\u00b1\2\u01f9") 339 | buf.write(u"\u01fa\5\u0147\u00a4\2\u01faL\3\2\2\2\u01fb\u01fc\5\u0141") 340 | buf.write(u"\u00a1\2\u01fc\u01fd\5\u0147\u00a4\2\u01fd\u01fe\5\u014b") 341 | buf.write(u"\u00a6\2\u01fe\u01ff\5\u014f\u00a8\2\u01ff\u0200\5\u0159") 342 | buf.write(u"\u00ad\2\u0200N\3\2\2\2\u0201\u0202\5\u0141\u00a1\2\u0202") 343 | buf.write(u"\u0203\5\u0147\u00a4\2\u0203\u0204\5\u0165\u00b3\2\u0204") 344 | buf.write(u"\u0205\5\u016b\u00b6\2\u0205\u0206\5\u0147\u00a4\2\u0206") 345 | buf.write(u"\u0207\5\u0147\u00a4\2\u0207\u0208\5\u0159\u00ad\2\u0208") 346 | buf.write(u"P\3\2\2\2\u0209\u020a\5\u0141\u00a1\2\u020a\u020b\5\u016f") 347 | buf.write(u"\u00b8\2\u020bR\3\2\2\2\u020c\u020d\5\u0143\u00a2\2\u020d") 348 | buf.write(u"\u020e\5\u013f\u00a0\2\u020e\u020f\5\u0163\u00b2\2\u020f") 349 | buf.write(u"\u0210\5\u0143\u00a2\2\u0210\u0211\5\u013f\u00a0\2\u0211") 350 | buf.write(u"\u0212\5\u0145\u00a3\2\u0212\u0213\5\u0147\u00a4\2\u0213") 351 | buf.write(u"T\3\2\2\2\u0214\u0215\5\u0143\u00a2\2\u0215\u0216\5\u013f") 352 | buf.write(u"\u00a0\2\u0216\u0217\5\u0163\u00b2\2\u0217\u0218\5\u0147") 353 | buf.write(u"\u00a4\2\u0218V\3\2\2\2\u0219\u021a\5\u0143\u00a2\2\u021a") 354 | buf.write(u"\u021b\5\u013f\u00a0\2\u021b\u021c\5\u0163\u00b2\2\u021c") 355 | buf.write(u"\u021d\5\u0165\u00b3\2\u021dX\3\2\2\2\u021e\u021f\5\u0143") 356 | buf.write(u"\u00a2\2\u021f\u0220\5\u014d\u00a7\2\u0220\u0221\5\u0147") 357 | buf.write(u"\u00a4\2\u0221\u0222\5\u0143\u00a2\2\u0222\u0223\5\u0153") 358 | buf.write(u"\u00aa\2\u0223Z\3\2\2\2\u0224\u0225\5\u0143\u00a2\2\u0225") 359 | buf.write(u"\u0226\5\u015b\u00ae\2\u0226\u0227\5\u0155\u00ab\2\u0227") 360 | buf.write(u"\u0228\5\u0155\u00ab\2\u0228\u0229\5\u013f\u00a0\2\u0229") 361 | buf.write(u"\u022a\5\u0165\u00b3\2\u022a\u022b\5\u0147\u00a4\2\u022b") 362 | buf.write(u"\\\3\2\2\2\u022c\u022d\5\u0143\u00a2\2\u022d\u022e\5") 363 | buf.write(u"\u015b\u00ae\2\u022e\u022f\5\u0155\u00ab\2\u022f\u0230") 364 | buf.write(u"\5\u0167\u00b4\2\u0230\u0231\5\u0157\u00ac\2\u0231\u0232") 365 | buf.write(u"\5\u0159\u00ad\2\u0232^\3\2\2\2\u0233\u0234\5\u0143\u00a2") 366 | buf.write(u"\2\u0234\u0235\5\u015b\u00ae\2\u0235\u0236\5\u0157\u00ac") 367 | buf.write(u"\2\u0236\u0237\5\u0157\u00ac\2\u0237\u0238\5\u014f\u00a8") 368 | buf.write(u"\2\u0238\u0239\5\u0165\u00b3\2\u0239`\3\2\2\2\u023a\u023b") 369 | buf.write(u"\5\u0143\u00a2\2\u023b\u023c\5\u015b\u00ae\2\u023c\u023d") 370 | buf.write(u"\5\u0159\u00ad\2\u023d\u023e\5\u0149\u00a5\2\u023e\u023f") 371 | buf.write(u"\5\u0155\u00ab\2\u023f\u0240\5\u014f\u00a8\2\u0240\u0241") 372 | buf.write(u"\5\u0143\u00a2\2\u0241\u0242\5\u0165\u00b3\2\u0242b\3") 373 | buf.write(u"\2\2\2\u0243\u0244\5\u0143\u00a2\2\u0244\u0245\5\u015b") 374 | buf.write(u"\u00ae\2\u0245\u0246\5\u0159\u00ad\2\u0246\u0247\5\u0163") 375 | buf.write(u"\u00b2\2\u0247\u0248\5\u0165\u00b3\2\u0248\u0249\5\u0161") 376 | buf.write(u"\u00b1\2\u0249\u024a\5\u013f\u00a0\2\u024a\u024b\5\u014f") 377 | buf.write(u"\u00a8\2\u024b\u024c\5\u0159\u00ad\2\u024c\u024d\5\u0165") 378 | buf.write(u"\u00b3\2\u024dd\3\2\2\2\u024e\u024f\5\u0143\u00a2\2\u024f") 379 | buf.write(u"\u0250\5\u0161\u00b1\2\u0250\u0251\5\u0147\u00a4\2\u0251") 380 | buf.write(u"\u0252\5\u013f\u00a0\2\u0252\u0253\5\u0165\u00b3\2\u0253") 381 | buf.write(u"\u0254\5\u0147\u00a4\2\u0254f\3\2\2\2\u0255\u0256\5\u0143") 382 | buf.write(u"\u00a2\2\u0256\u0257\5\u0161\u00b1\2\u0257\u0258\5\u015b") 383 | buf.write(u"\u00ae\2\u0258\u0259\5\u0163\u00b2\2\u0259\u025a\5\u0163") 384 | buf.write(u"\u00b2\2\u025ah\3\2\2\2\u025b\u025c\5\u0143\u00a2\2\u025c") 385 | buf.write(u"\u025d\5\u0167\u00b4\2\u025d\u025e\5\u0161\u00b1\2\u025e") 386 | buf.write(u"\u025f\5\u0161\u00b1\2\u025f\u0260\5\u0147\u00a4\2\u0260") 387 | buf.write(u"\u0261\5\u0159\u00ad\2\u0261\u0262\5\u0165\u00b3\2\u0262") 388 | buf.write(u"\u0263\7a\2\2\u0263\u0264\5\u0145\u00a3\2\u0264\u0265") 389 | buf.write(u"\5\u013f\u00a0\2\u0265\u0266\5\u0165\u00b3\2\u0266\u0267") 390 | buf.write(u"\5\u0147\u00a4\2\u0267j\3\2\2\2\u0268\u0269\5\u0143\u00a2") 391 | buf.write(u"\2\u0269\u026a\5\u0167\u00b4\2\u026a\u026b\5\u0161\u00b1") 392 | buf.write(u"\2\u026b\u026c\5\u0161\u00b1\2\u026c\u026d\5\u0147\u00a4") 393 | buf.write(u"\2\u026d\u026e\5\u0159\u00ad\2\u026e\u026f\5\u0165\u00b3") 394 | buf.write(u"\2\u026f\u0270\7a\2\2\u0270\u0271\5\u0165\u00b3\2\u0271") 395 | buf.write(u"\u0272\5\u014f\u00a8\2\u0272\u0273\5\u0157\u00ac\2\u0273") 396 | buf.write(u"\u0274\5\u0147\u00a4\2\u0274l\3\2\2\2\u0275\u0276\5\u0143") 397 | buf.write(u"\u00a2\2\u0276\u0277\5\u0167\u00b4\2\u0277\u0278\5\u0161") 398 | buf.write(u"\u00b1\2\u0278\u0279\5\u0161\u00b1\2\u0279\u027a\5\u0147") 399 | buf.write(u"\u00a4\2\u027a\u027b\5\u0159\u00ad\2\u027b\u027c\5\u0165") 400 | buf.write(u"\u00b3\2\u027c\u027d\7a\2\2\u027d\u027e\5\u0165\u00b3") 401 | buf.write(u"\2\u027e\u027f\5\u014f\u00a8\2\u027f\u0280\5\u0157\u00ac") 402 | buf.write(u"\2\u0280\u0281\5\u0147\u00a4\2\u0281\u0282\5\u0163\u00b2") 403 | buf.write(u"\2\u0282\u0283\5\u0165\u00b3\2\u0283\u0284\5\u013f\u00a0") 404 | buf.write(u"\2\u0284\u0285\5\u0157\u00ac\2\u0285\u0286\5\u015d\u00af") 405 | buf.write(u"\2\u0286n\3\2\2\2\u0287\u0288\5\u0145\u00a3\2\u0288\u0289") 406 | buf.write(u"\5\u013f\u00a0\2\u0289\u028a\5\u0165\u00b3\2\u028a\u028b") 407 | buf.write(u"\5\u013f\u00a0\2\u028b\u028c\5\u0141\u00a1\2\u028c\u028d") 408 | buf.write(u"\5\u013f\u00a0\2\u028d\u028e\5\u0163\u00b2\2\u028e\u028f") 409 | buf.write(u"\5\u0147\u00a4\2\u028fp\3\2\2\2\u0290\u0291\5\u0145\u00a3") 410 | buf.write(u"\2\u0291\u0292\5\u0147\u00a4\2\u0292\u0293\5\u0149\u00a5") 411 | buf.write(u"\2\u0293\u0294\5\u013f\u00a0\2\u0294\u0295\5\u0167\u00b4") 412 | buf.write(u"\2\u0295\u0296\5\u0155\u00ab\2\u0296\u0297\5\u0165\u00b3") 413 | buf.write(u"\2\u0297r\3\2\2\2\u0298\u0299\5\u0145\u00a3\2\u0299\u029a") 414 | buf.write(u"\5\u0147\u00a4\2\u029a\u029b\5\u0149\u00a5\2\u029b\u029c") 415 | buf.write(u"\5\u0147\u00a4\2\u029c\u029d\5\u0161\u00b1\2\u029d\u029e") 416 | buf.write(u"\5\u0161\u00b1\2\u029e\u029f\5\u013f\u00a0\2\u029f\u02a0") 417 | buf.write(u"\5\u0141\u00a1\2\u02a0\u02a1\5\u0155\u00ab\2\u02a1\u02a2") 418 | buf.write(u"\5\u0147\u00a4\2\u02a2t\3\2\2\2\u02a3\u02a4\5\u0145\u00a3") 419 | buf.write(u"\2\u02a4\u02a5\5\u0147\u00a4\2\u02a5\u02a6\5\u0149\u00a5") 420 | buf.write(u"\2\u02a6\u02a7\5\u0147\u00a4\2\u02a7\u02a8\5\u0161\u00b1") 421 | buf.write(u"\2\u02a8\u02a9\5\u0161\u00b1\2\u02a9\u02aa\5\u0147\u00a4") 422 | buf.write(u"\2\u02aa\u02ab\5\u0145\u00a3\2\u02abv\3\2\2\2\u02ac\u02ad") 423 | buf.write(u"\5\u0145\u00a3\2\u02ad\u02ae\5\u0147\u00a4\2\u02ae\u02af") 424 | buf.write(u"\5\u0155\u00ab\2\u02af\u02b0\5\u0147\u00a4\2\u02b0\u02b1") 425 | buf.write(u"\5\u0165\u00b3\2\u02b1\u02b2\5\u0147\u00a4\2\u02b2x\3") 426 | buf.write(u"\2\2\2\u02b3\u02b4\5\u0145\u00a3\2\u02b4\u02b5\5\u0147") 427 | buf.write(u"\u00a4\2\u02b5\u02b6\5\u0163\u00b2\2\u02b6\u02b7\5\u0143") 428 | buf.write(u"\u00a2\2\u02b7z\3\2\2\2\u02b8\u02b9\5\u0145\u00a3\2\u02b9") 429 | buf.write(u"\u02ba\5\u0147\u00a4\2\u02ba\u02bb\5\u0165\u00b3\2\u02bb") 430 | buf.write(u"\u02bc\5\u013f\u00a0\2\u02bc\u02bd\5\u0143\u00a2\2\u02bd") 431 | buf.write(u"\u02be\5\u014d\u00a7\2\u02be|\3\2\2\2\u02bf\u02c0\5\u0145") 432 | buf.write(u"\u00a3\2\u02c0\u02c1\5\u014f\u00a8\2\u02c1\u02c2\5\u0163") 433 | buf.write(u"\u00b2\2\u02c2\u02c3\5\u0165\u00b3\2\u02c3\u02c4\5\u014f") 434 | buf.write(u"\u00a8\2\u02c4\u02c5\5\u0159\u00ad\2\u02c5\u02c6\5\u0143") 435 | buf.write(u"\u00a2\2\u02c6\u02c7\5\u0165\u00b3\2\u02c7~\3\2\2\2\u02c8") 436 | buf.write(u"\u02c9\5\u0145\u00a3\2\u02c9\u02ca\5\u0161\u00b1\2\u02ca") 437 | buf.write(u"\u02cb\5\u015b\u00ae\2\u02cb\u02cc\5\u015d\u00af\2\u02cc") 438 | buf.write(u"\u0080\3\2\2\2\u02cd\u02ce\5\u0147\u00a4\2\u02ce\u02cf") 439 | buf.write(u"\5\u013f\u00a0\2\u02cf\u02d0\5\u0143\u00a2\2\u02d0\u02d1") 440 | buf.write(u"\5\u014d\u00a7\2\u02d1\u0082\3\2\2\2\u02d2\u02d3\5\u0147") 441 | buf.write(u"\u00a4\2\u02d3\u02d4\5\u0155\u00ab\2\u02d4\u02d5\5\u0163") 442 | buf.write(u"\u00b2\2\u02d5\u02d6\5\u0147\u00a4\2\u02d6\u0084\3\2") 443 | buf.write(u"\2\2\u02d7\u02d8\5\u0147\u00a4\2\u02d8\u02d9\5\u0159") 444 | buf.write(u"\u00ad\2\u02d9\u02da\5\u0145\u00a3\2\u02da\u0086\3\2") 445 | buf.write(u"\2\2\u02db\u02dc\5\u0147\u00a4\2\u02dc\u02dd\5\u0163") 446 | buf.write(u"\u00b2\2\u02dd\u02de\5\u0143\u00a2\2\u02de\u02df\5\u013f") 447 | buf.write(u"\u00a0\2\u02df\u02e0\5\u015d\u00af\2\u02e0\u02e1\5\u0147") 448 | buf.write(u"\u00a4\2\u02e1\u0088\3\2\2\2\u02e2\u02e3\5\u0147\u00a4") 449 | buf.write(u"\2\u02e3\u02e4\5\u016d\u00b7\2\u02e4\u02e5\5\u0143\u00a2") 450 | buf.write(u"\2\u02e5\u02e6\5\u0147\u00a4\2\u02e6\u02e7\5\u015d\u00af") 451 | buf.write(u"\2\u02e7\u02e8\5\u0165\u00b3\2\u02e8\u008a\3\2\2\2\u02e9") 452 | buf.write(u"\u02ea\5\u0147\u00a4\2\u02ea\u02eb\5\u016d\u00b7\2\u02eb") 453 | buf.write(u"\u02ec\5\u0143\u00a2\2\u02ec\u02ed\5\u0155\u00ab\2\u02ed") 454 | buf.write(u"\u02ee\5\u0167\u00b4\2\u02ee\u02ef\5\u0163\u00b2\2\u02ef") 455 | buf.write(u"\u02f0\5\u014f\u00a8\2\u02f0\u02f1\5\u0169\u00b5\2\u02f1") 456 | buf.write(u"\u02f2\5\u0147\u00a4\2\u02f2\u008c\3\2\2\2\u02f3\u02f4") 457 | buf.write(u"\5\u0147\u00a4\2\u02f4\u02f5\5\u016d\u00b7\2\u02f5\u02f6") 458 | buf.write(u"\5\u014f\u00a8\2\u02f6\u02f7\5\u0163\u00b2\2\u02f7\u02f8") 459 | buf.write(u"\5\u0165\u00b3\2\u02f8\u02f9\5\u0163\u00b2\2\u02f9\u008e") 460 | buf.write(u"\3\2\2\2\u02fa\u02fb\5\u0147\u00a4\2\u02fb\u02fc\5\u016d") 461 | buf.write(u"\u00b7\2\u02fc\u02fd\5\u015d\u00af\2\u02fd\u02fe\5\u0155") 462 | buf.write(u"\u00ab\2\u02fe\u02ff\5\u013f\u00a0\2\u02ff\u0300\5\u014f") 463 | buf.write(u"\u00a8\2\u0300\u0301\5\u0159\u00ad\2\u0301\u0090\3\2") 464 | buf.write(u"\2\2\u0302\u0303\5\u0149\u00a5\2\u0303\u0304\5\u013f") 465 | buf.write(u"\u00a0\2\u0304\u0305\5\u014f\u00a8\2\u0305\u0306\5\u0155") 466 | buf.write(u"\u00ab\2\u0306\u0092\3\2\2\2\u0307\u0308\5\u0149\u00a5") 467 | buf.write(u"\2\u0308\u0309\5\u015b\u00ae\2\u0309\u030a\5\u0161\u00b1") 468 | buf.write(u"\2\u030a\u0094\3\2\2\2\u030b\u030c\5\u0149\u00a5\2\u030c") 469 | buf.write(u"\u030d\5\u015b\u00ae\2\u030d\u030e\5\u0161\u00b1\2\u030e") 470 | buf.write(u"\u030f\5\u0147\u00a4\2\u030f\u0310\5\u014f\u00a8\2\u0310") 471 | buf.write(u"\u0311\5\u014b\u00a6\2\u0311\u0312\5\u0159\u00ad\2\u0312") 472 | buf.write(u"\u0096\3\2\2\2\u0313\u0314\5\u0149\u00a5\2\u0314\u0315") 473 | buf.write(u"\5\u0161\u00b1\2\u0315\u0316\5\u015b\u00ae\2\u0316\u0317") 474 | buf.write(u"\5\u0157\u00ac\2\u0317\u0098\3\2\2\2\u0318\u0319\5\u0149") 475 | buf.write(u"\u00a5\2\u0319\u031a\5\u0167\u00b4\2\u031a\u031b\5\u0155") 476 | buf.write(u"\u00ab\2\u031b\u031c\5\u0155\u00ab\2\u031c\u009a\3\2") 477 | buf.write(u"\2\2\u031d\u031e\5\u014b\u00a6\2\u031e\u031f\5\u0155") 478 | buf.write(u"\u00ab\2\u031f\u0320\5\u015b\u00ae\2\u0320\u0321\5\u0141") 479 | buf.write(u"\u00a1\2\u0321\u009c\3\2\2\2\u0322\u0323\5\u014b\u00a6") 480 | buf.write(u"\2\u0323\u0324\5\u0161\u00b1\2\u0324\u0325\5\u015b\u00ae") 481 | buf.write(u"\2\u0325\u0326\5\u0167\u00b4\2\u0326\u0327\5\u015d\u00af") 482 | buf.write(u"\2\u0327\u009e\3\2\2\2\u0328\u0329\5\u014d\u00a7\2\u0329") 483 | buf.write(u"\u032a\5\u013f\u00a0\2\u032a\u032b\5\u0169\u00b5\2\u032b") 484 | buf.write(u"\u032c\5\u014f\u00a8\2\u032c\u032d\5\u0159\u00ad\2\u032d") 485 | buf.write(u"\u032e\5\u014b\u00a6\2\u032e\u00a0\3\2\2\2\u032f\u0330") 486 | buf.write(u"\5\u014f\u00a8\2\u0330\u0331\5\u0149\u00a5\2\u0331\u00a2") 487 | buf.write(u"\3\2\2\2\u0332\u0333\5\u014f\u00a8\2\u0333\u0334\5\u014b") 488 | buf.write(u"\u00a6\2\u0334\u0335\5\u0159\u00ad\2\u0335\u0336\5\u015b") 489 | buf.write(u"\u00ae\2\u0336\u0337\5\u0161\u00b1\2\u0337\u0338\5\u0147") 490 | buf.write(u"\u00a4\2\u0338\u00a4\3\2\2\2\u0339\u033a\5\u014f\u00a8") 491 | buf.write(u"\2\u033a\u033b\5\u0157\u00ac\2\u033b\u033c\5\u0157\u00ac") 492 | buf.write(u"\2\u033c\u033d\5\u0147\u00a4\2\u033d\u033e\5\u0145\u00a3") 493 | buf.write(u"\2\u033e\u033f\5\u014f\u00a8\2\u033f\u0340\5\u013f\u00a0") 494 | buf.write(u"\2\u0340\u0341\5\u0165\u00b3\2\u0341\u0342\5\u0147\u00a4") 495 | buf.write(u"\2\u0342\u00a6\3\2\2\2\u0343\u0344\5\u014f\u00a8\2\u0344") 496 | buf.write(u"\u0345\5\u0159\u00ad\2\u0345\u00a8\3\2\2\2\u0346\u0347") 497 | buf.write(u"\5\u014f\u00a8\2\u0347\u0348\5\u0159\u00ad\2\u0348\u0349") 498 | buf.write(u"\5\u0145\u00a3\2\u0349\u034a\5\u0147\u00a4\2\u034a\u034b") 499 | buf.write(u"\5\u016d\u00b7\2\u034b\u00aa\3\2\2\2\u034c\u034d\5\u014f") 500 | buf.write(u"\u00a8\2\u034d\u034e\5\u0159\u00ad\2\u034e\u034f\5\u0145") 501 | buf.write(u"\u00a3\2\u034f\u0350\5\u0147\u00a4\2\u0350\u0351\5\u016d") 502 | buf.write(u"\u00b7\2\u0351\u0352\5\u0147\u00a4\2\u0352\u0353\5\u0145") 503 | buf.write(u"\u00a3\2\u0353\u00ac\3\2\2\2\u0354\u0355\5\u014f\u00a8") 504 | buf.write(u"\2\u0355\u0356\5\u0159\u00ad\2\u0356\u0357\5\u014f\u00a8") 505 | buf.write(u"\2\u0357\u0358\5\u0165\u00b3\2\u0358\u0359\5\u014f\u00a8") 506 | buf.write(u"\2\u0359\u035a\5\u013f\u00a0\2\u035a\u035b\5\u0155\u00ab") 507 | buf.write(u"\2\u035b\u035c\5\u0155\u00ab\2\u035c\u035d\5\u016f\u00b8") 508 | buf.write(u"\2\u035d\u00ae\3\2\2\2\u035e\u035f\5\u014f\u00a8\2\u035f") 509 | buf.write(u"\u0360\5\u0159\u00ad\2\u0360\u0361\5\u0159\u00ad\2\u0361") 510 | buf.write(u"\u0362\5\u0147\u00a4\2\u0362\u0363\5\u0161\u00b1\2\u0363") 511 | buf.write(u"\u00b0\3\2\2\2\u0364\u0365\5\u014f\u00a8\2\u0365\u0366") 512 | buf.write(u"\5\u0159\u00ad\2\u0366\u0367\5\u0163\u00b2\2\u0367\u0368") 513 | buf.write(u"\5\u0147\u00a4\2\u0368\u0369\5\u0161\u00b1\2\u0369\u036a") 514 | buf.write(u"\5\u0165\u00b3\2\u036a\u00b2\3\2\2\2\u036b\u036c\5\u014f") 515 | buf.write(u"\u00a8\2\u036c\u036d\5\u0159\u00ad\2\u036d\u036e\5\u0163") 516 | buf.write(u"\u00b2\2\u036e\u036f\5\u0165\u00b3\2\u036f\u0370\5\u0147") 517 | buf.write(u"\u00a4\2\u0370\u0371\5\u013f\u00a0\2\u0371\u0372\5\u0145") 518 | buf.write(u"\u00a3\2\u0372\u00b4\3\2\2\2\u0373\u0374\5\u014f\u00a8") 519 | buf.write(u"\2\u0374\u0375\5\u0159\u00ad\2\u0375\u0376\5\u0165\u00b3") 520 | buf.write(u"\2\u0376\u0377\5\u0147\u00a4\2\u0377\u0378\5\u0161\u00b1") 521 | buf.write(u"\2\u0378\u0379\5\u0163\u00b2\2\u0379\u037a\5\u0147\u00a4") 522 | buf.write(u"\2\u037a\u037b\5\u0143\u00a2\2\u037b\u037c\5\u0165\u00b3") 523 | buf.write(u"\2\u037c\u00b6\3\2\2\2\u037d\u037e\5\u014f\u00a8\2\u037e") 524 | buf.write(u"\u037f\5\u0159\u00ad\2\u037f\u0380\5\u0165\u00b3\2\u0380") 525 | buf.write(u"\u0381\5\u015b\u00ae\2\u0381\u00b8\3\2\2\2\u0382\u0383") 526 | buf.write(u"\5\u014f\u00a8\2\u0383\u0384\5\u0163\u00b2\2\u0384\u00ba") 527 | buf.write(u"\3\2\2\2\u0385\u0386\5\u014f\u00a8\2\u0386\u0387\5\u0163") 528 | buf.write(u"\u00b2\2\u0387\u0388\5\u0159\u00ad\2\u0388\u0389\5\u0167") 529 | buf.write(u"\u00b4\2\u0389\u038a\5\u0155\u00ab\2\u038a\u038b\5\u0155") 530 | buf.write(u"\u00ab\2\u038b\u00bc\3\2\2\2\u038c\u038d\5\u0151\u00a9") 531 | buf.write(u"\2\u038d\u038e\5\u015b\u00ae\2\u038e\u038f\5\u014f\u00a8") 532 | buf.write(u"\2\u038f\u0390\5\u0159\u00ad\2\u0390\u00be\3\2\2\2\u0391") 533 | buf.write(u"\u0392\5\u0153\u00aa\2\u0392\u0393\5\u0147\u00a4\2\u0393") 534 | buf.write(u"\u0394\5\u016f\u00b8\2\u0394\u00c0\3\2\2\2\u0395\u0396") 535 | buf.write(u"\5\u0155\u00ab\2\u0396\u0397\5\u0147\u00a4\2\u0397\u0398") 536 | buf.write(u"\5\u0149\u00a5\2\u0398\u0399\5\u0165\u00b3\2\u0399\u00c2") 537 | buf.write(u"\3\2\2\2\u039a\u039b\5\u0155\u00ab\2\u039b\u039c\5\u014f") 538 | buf.write(u"\u00a8\2\u039c\u039d\5\u0153\u00aa\2\u039d\u039e\5\u0147") 539 | buf.write(u"\u00a4\2\u039e\u00c4\3\2\2\2\u039f\u03a0\5\u0155\u00ab") 540 | buf.write(u"\2\u03a0\u03a1\5\u014f\u00a8\2\u03a1\u03a2\5\u0157\u00ac") 541 | buf.write(u"\2\u03a2\u03a3\5\u014f\u00a8\2\u03a3\u03a4\5\u0165\u00b3") 542 | buf.write(u"\2\u03a4\u00c6\3\2\2\2\u03a5\u03a6\5\u0157\u00ac\2\u03a6") 543 | buf.write(u"\u03a7\5\u013f\u00a0\2\u03a7\u03a8\5\u0165\u00b3\2\u03a8") 544 | buf.write(u"\u03a9\5\u0143\u00a2\2\u03a9\u03aa\5\u014d\u00a7\2\u03aa") 545 | buf.write(u"\u00c8\3\2\2\2\u03ab\u03ac\5\u0159\u00ad\2\u03ac\u03ad") 546 | buf.write(u"\5\u013f\u00a0\2\u03ad\u03ae\5\u0165\u00b3\2\u03ae\u03af") 547 | buf.write(u"\5\u0167\u00b4\2\u03af\u03b0\5\u0161\u00b1\2\u03b0\u03b1") 548 | buf.write(u"\5\u013f\u00a0\2\u03b1\u03b2\5\u0155\u00ab\2\u03b2\u00ca") 549 | buf.write(u"\3\2\2\2\u03b3\u03b4\5\u0159\u00ad\2\u03b4\u03b5\5\u015b") 550 | buf.write(u"\u00ae\2\u03b5\u00cc\3\2\2\2\u03b6\u03b7\5\u0159\u00ad") 551 | buf.write(u"\2\u03b7\u03b8\5\u015b\u00ae\2\u03b8\u03b9\5\u0165\u00b3") 552 | buf.write(u"\2\u03b9\u00ce\3\2\2\2\u03ba\u03bb\5\u0159\u00ad\2\u03bb") 553 | buf.write(u"\u03bc\5\u015b\u00ae\2\u03bc\u03bd\5\u0165\u00b3\2\u03bd") 554 | buf.write(u"\u03be\5\u0159\u00ad\2\u03be\u03bf\5\u0167\u00b4\2\u03bf") 555 | buf.write(u"\u03c0\5\u0155\u00ab\2\u03c0\u03c1\5\u0155\u00ab\2\u03c1") 556 | buf.write(u"\u00d0\3\2\2\2\u03c2\u03c3\5\u0159\u00ad\2\u03c3\u03c4") 557 | buf.write(u"\5\u0167\u00b4\2\u03c4\u03c5\5\u0155\u00ab\2\u03c5\u03c6") 558 | buf.write(u"\5\u0155\u00ab\2\u03c6\u00d2\3\2\2\2\u03c7\u03c8\5\u015b") 559 | buf.write(u"\u00ae\2\u03c8\u03c9\5\u0149\u00a5\2\u03c9\u00d4\3\2") 560 | buf.write(u"\2\2\u03ca\u03cb\5\u015b\u00ae\2\u03cb\u03cc\5\u0149") 561 | buf.write(u"\u00a5\2\u03cc\u03cd\5\u0149\u00a5\2\u03cd\u03ce\5\u0163") 562 | buf.write(u"\u00b2\2\u03ce\u03cf\5\u0147\u00a4\2\u03cf\u03d0\5\u0165") 563 | buf.write(u"\u00b3\2\u03d0\u00d6\3\2\2\2\u03d1\u03d2\5\u015b\u00ae") 564 | buf.write(u"\2\u03d2\u03d3\5\u0159\u00ad\2\u03d3\u00d8\3\2\2\2\u03d4") 565 | buf.write(u"\u03d5\5\u015b\u00ae\2\u03d5\u03d6\5\u0161\u00b1\2\u03d6") 566 | buf.write(u"\u00da\3\2\2\2\u03d7\u03d8\5\u015b\u00ae\2\u03d8\u03d9") 567 | buf.write(u"\5\u0161\u00b1\2\u03d9\u03da\5\u0145\u00a3\2\u03da\u03db") 568 | buf.write(u"\5\u0147\u00a4\2\u03db\u03dc\5\u0161\u00b1\2\u03dc\u00dc") 569 | buf.write(u"\3\2\2\2\u03dd\u03de\5\u015b\u00ae\2\u03de\u03df\5\u0167") 570 | buf.write(u"\u00b4\2\u03df\u03e0\5\u0165\u00b3\2\u03e0\u03e1\5\u0147") 571 | buf.write(u"\u00a4\2\u03e1\u03e2\5\u0161\u00b1\2\u03e2\u00de\3\2") 572 | buf.write(u"\2\2\u03e3\u03e4\5\u015d\u00af\2\u03e4\u03e5\5\u0155") 573 | buf.write(u"\u00ab\2\u03e5\u03e6\5\u013f\u00a0\2\u03e6\u03e7\5\u0159") 574 | buf.write(u"\u00ad\2\u03e7\u00e0\3\2\2\2\u03e8\u03e9\5\u015d\u00af") 575 | buf.write(u"\2\u03e9\u03ea\5\u0161\u00b1\2\u03ea\u03eb\5\u013f\u00a0") 576 | buf.write(u"\2\u03eb\u03ec\5\u014b\u00a6\2\u03ec\u03ed\5\u0157\u00ac") 577 | buf.write(u"\2\u03ed\u03ee\5\u013f\u00a0\2\u03ee\u00e2\3\2\2\2\u03ef") 578 | buf.write(u"\u03f0\5\u015d\u00af\2\u03f0\u03f1\5\u0161\u00b1\2\u03f1") 579 | buf.write(u"\u03f2\5\u014f\u00a8\2\u03f2\u03f3\5\u0157\u00ac\2\u03f3") 580 | buf.write(u"\u03f4\5\u013f\u00a0\2\u03f4\u03f5\5\u0161\u00b1\2\u03f5") 581 | buf.write(u"\u03f6\5\u016f\u00b8\2\u03f6\u00e4\3\2\2\2\u03f7\u03f8") 582 | buf.write(u"\5\u015f\u00b0\2\u03f8\u03f9\5\u0167\u00b4\2\u03f9\u03fa") 583 | buf.write(u"\5\u0147\u00a4\2\u03fa\u03fb\5\u0161\u00b1\2\u03fb\u03fc") 584 | buf.write(u"\5\u016f\u00b8\2\u03fc\u00e6\3\2\2\2\u03fd\u03fe\5\u0161") 585 | buf.write(u"\u00b1\2\u03fe\u03ff\5\u013f\u00a0\2\u03ff\u0400\5\u014f") 586 | buf.write(u"\u00a8\2\u0400\u0401\5\u0163\u00b2\2\u0401\u0402\5\u0147") 587 | buf.write(u"\u00a4\2\u0402\u00e8\3\2\2\2\u0403\u0404\5\u0161\u00b1") 588 | buf.write(u"\2\u0404\u0405\5\u0147\u00a4\2\u0405\u0406\5\u0143\u00a2") 589 | buf.write(u"\2\u0406\u0407\5\u0167\u00b4\2\u0407\u0408\5\u0161\u00b1") 590 | buf.write(u"\2\u0408\u0409\5\u0163\u00b2\2\u0409\u040a\5\u014f\u00a8") 591 | buf.write(u"\2\u040a\u040b\5\u0169\u00b5\2\u040b\u040c\5\u0147\u00a4") 592 | buf.write(u"\2\u040c\u00ea\3\2\2\2\u040d\u040e\5\u0161\u00b1\2\u040e") 593 | buf.write(u"\u040f\5\u0147\u00a4\2\u040f\u0410\5\u0149\u00a5\2\u0410") 594 | buf.write(u"\u0411\5\u0147\u00a4\2\u0411\u0412\5\u0161\u00b1\2\u0412") 595 | buf.write(u"\u0413\5\u0147\u00a4\2\u0413\u0414\5\u0159\u00ad\2\u0414") 596 | buf.write(u"\u0415\5\u0143\u00a2\2\u0415\u0416\5\u0147\u00a4\2\u0416") 597 | buf.write(u"\u0417\5\u0163\u00b2\2\u0417\u00ec\3\2\2\2\u0418\u0419") 598 | buf.write(u"\5\u0161\u00b1\2\u0419\u041a\5\u0147\u00a4\2\u041a\u041b") 599 | buf.write(u"\5\u014b\u00a6\2\u041b\u041c\5\u0147\u00a4\2\u041c\u041d") 600 | buf.write(u"\5\u016d\u00b7\2\u041d\u041e\5\u015d\u00af\2\u041e\u00ee") 601 | buf.write(u"\3\2\2\2\u041f\u0420\5\u0161\u00b1\2\u0420\u0421\5\u0147") 602 | buf.write(u"\u00a4\2\u0421\u0422\5\u014f\u00a8\2\u0422\u0423\5\u0159") 603 | buf.write(u"\u00ad\2\u0423\u0424\5\u0145\u00a3\2\u0424\u0425\5\u0147") 604 | buf.write(u"\u00a4\2\u0425\u0426\5\u016d\u00b7\2\u0426\u00f0\3\2") 605 | buf.write(u"\2\2\u0427\u0428\5\u0161\u00b1\2\u0428\u0429\5\u0147") 606 | buf.write(u"\u00a4\2\u0429\u042a\5\u0155\u00ab\2\u042a\u042b\5\u0147") 607 | buf.write(u"\u00a4\2\u042b\u042c\5\u013f\u00a0\2\u042c\u042d\5\u0163") 608 | buf.write(u"\u00b2\2\u042d\u042e\5\u0147\u00a4\2\u042e\u00f2\3\2") 609 | buf.write(u"\2\2\u042f\u0430\5\u0161\u00b1\2\u0430\u0431\5\u0147") 610 | buf.write(u"\u00a4\2\u0431\u0432\5\u0159\u00ad\2\u0432\u0433\5\u013f") 611 | buf.write(u"\u00a0\2\u0433\u0434\5\u0157\u00ac\2\u0434\u0435\5\u0147") 612 | buf.write(u"\u00a4\2\u0435\u00f4\3\2\2\2\u0436\u0437\5\u0161\u00b1") 613 | buf.write(u"\2\u0437\u0438\5\u0147\u00a4\2\u0438\u0439\5\u015d\u00af") 614 | buf.write(u"\2\u0439\u043a\5\u0155\u00ab\2\u043a\u043b\5\u013f\u00a0") 615 | buf.write(u"\2\u043b\u043c\5\u0143\u00a2\2\u043c\u043d\5\u0147\u00a4") 616 | buf.write(u"\2\u043d\u00f6\3\2\2\2\u043e\u043f\5\u0161\u00b1\2\u043f") 617 | buf.write(u"\u0440\5\u0147\u00a4\2\u0440\u0441\5\u0163\u00b2\2\u0441") 618 | buf.write(u"\u0442\5\u0165\u00b3\2\u0442\u0443\5\u0161\u00b1\2\u0443") 619 | buf.write(u"\u0444\5\u014f\u00a8\2\u0444\u0445\5\u0143\u00a2\2\u0445") 620 | buf.write(u"\u0446\5\u0165\u00b3\2\u0446\u00f8\3\2\2\2\u0447\u0448") 621 | buf.write(u"\5\u0161\u00b1\2\u0448\u0449\5\u014f\u00a8\2\u0449\u044a") 622 | buf.write(u"\5\u014b\u00a6\2\u044a\u044b\5\u014d\u00a7\2\u044b\u044c") 623 | buf.write(u"\5\u0165\u00b3\2\u044c\u00fa\3\2\2\2\u044d\u044e\5\u0161") 624 | buf.write(u"\u00b1\2\u044e\u044f\5\u015b\u00ae\2\u044f\u0450\5\u0155") 625 | buf.write(u"\u00ab\2\u0450\u0451\5\u0155\u00ab\2\u0451\u0452\5\u0141") 626 | buf.write(u"\u00a1\2\u0452\u0453\5\u013f\u00a0\2\u0453\u0454\5\u0143") 627 | buf.write(u"\u00a2\2\u0454\u0455\5\u0153\u00aa\2\u0455\u00fc\3\2") 628 | buf.write(u"\2\2\u0456\u0457\5\u0161\u00b1\2\u0457\u0458\5\u015b") 629 | buf.write(u"\u00ae\2\u0458\u0459\5\u016b\u00b6\2\u0459\u00fe\3\2") 630 | buf.write(u"\2\2\u045a\u045b\5\u0163\u00b2\2\u045b\u045c\5\u013f") 631 | buf.write(u"\u00a0\2\u045c\u045d\5\u0169\u00b5\2\u045d\u045e\5\u0147") 632 | buf.write(u"\u00a4\2\u045e\u045f\5\u015d\u00af\2\u045f\u0460\5\u015b") 633 | buf.write(u"\u00ae\2\u0460\u0461\5\u014f\u00a8\2\u0461\u0462\5\u0159") 634 | buf.write(u"\u00ad\2\u0462\u0463\5\u0165\u00b3\2\u0463\u0100\3\2") 635 | buf.write(u"\2\2\u0464\u0465\5\u0163\u00b2\2\u0465\u0466\5\u0147") 636 | buf.write(u"\u00a4\2\u0466\u0467\5\u0155\u00ab\2\u0467\u0468\5\u0147") 637 | buf.write(u"\u00a4\2\u0468\u0469\5\u0143\u00a2\2\u0469\u046a\5\u0165") 638 | buf.write(u"\u00b3\2\u046a\u0102\3\2\2\2\u046b\u046c\5\u0163\u00b2") 639 | buf.write(u"\2\u046c\u046d\5\u0147\u00a4\2\u046d\u046e\5\u0165\u00b3") 640 | buf.write(u"\2\u046e\u0104\3\2\2\2\u046f\u0470\5\u0165\u00b3\2\u0470") 641 | buf.write(u"\u0471\5\u013f\u00a0\2\u0471\u0472\5\u0141\u00a1\2\u0472") 642 | buf.write(u"\u0473\5\u0155\u00ab\2\u0473\u0474\5\u0147\u00a4\2\u0474") 643 | buf.write(u"\u0106\3\2\2\2\u0475\u0476\5\u0165\u00b3\2\u0476\u0477") 644 | buf.write(u"\5\u0147\u00a4\2\u0477\u0478\5\u0157\u00ac\2\u0478\u0479") 645 | buf.write(u"\5\u015d\u00af\2\u0479\u0108\3\2\2\2\u047a\u047b\5\u0165") 646 | buf.write(u"\u00b3\2\u047b\u047c\5\u0147\u00a4\2\u047c\u047d\5\u0157") 647 | buf.write(u"\u00ac\2\u047d\u047e\5\u015d\u00af\2\u047e\u047f\5\u015b") 648 | buf.write(u"\u00ae\2\u047f\u0480\5\u0161\u00b1\2\u0480\u0481\5\u013f") 649 | buf.write(u"\u00a0\2\u0481\u0482\5\u0161\u00b1\2\u0482\u0483\5\u016f") 650 | buf.write(u"\u00b8\2\u0483\u010a\3\2\2\2\u0484\u0485\5\u0165\u00b3") 651 | buf.write(u"\2\u0485\u0486\5\u014d\u00a7\2\u0486\u0487\5\u0147\u00a4") 652 | buf.write(u"\2\u0487\u0488\5\u0159\u00ad\2\u0488\u010c\3\2\2\2\u0489") 653 | buf.write(u"\u048a\5\u0165\u00b3\2\u048a\u048b\5\u015b\u00ae\2\u048b") 654 | buf.write(u"\u010e\3\2\2\2\u048c\u048d\5\u0165\u00b3\2\u048d\u048e") 655 | buf.write(u"\5\u0161\u00b1\2\u048e\u048f\5\u013f\u00a0\2\u048f\u0490") 656 | buf.write(u"\5\u0159\u00ad\2\u0490\u0491\5\u0163\u00b2\2\u0491\u0492") 657 | buf.write(u"\5\u013f\u00a0\2\u0492\u0493\5\u0143\u00a2\2\u0493\u0494") 658 | buf.write(u"\5\u0165\u00b3\2\u0494\u0495\5\u014f\u00a8\2\u0495\u0496") 659 | buf.write(u"\5\u015b\u00ae\2\u0496\u0497\5\u0159\u00ad\2\u0497\u0110") 660 | buf.write(u"\3\2\2\2\u0498\u0499\5\u0165\u00b3\2\u0499\u049a\5\u0161") 661 | buf.write(u"\u00b1\2\u049a\u049b\5\u014f\u00a8\2\u049b\u049c\5\u014b") 662 | buf.write(u"\u00a6\2\u049c\u049d\5\u014b\u00a6\2\u049d\u049e\5\u0147") 663 | buf.write(u"\u00a4\2\u049e\u049f\5\u0161\u00b1\2\u049f\u0112\3\2") 664 | buf.write(u"\2\2\u04a0\u04a1\5\u0167\u00b4\2\u04a1\u04a2\5\u0159") 665 | buf.write(u"\u00ad\2\u04a2\u04a3\5\u014f\u00a8\2\u04a3\u04a4\5\u015b") 666 | buf.write(u"\u00ae\2\u04a4\u04a5\5\u0159\u00ad\2\u04a5\u0114\3\2") 667 | buf.write(u"\2\2\u04a6\u04a7\5\u0167\u00b4\2\u04a7\u04a8\5\u0159") 668 | buf.write(u"\u00ad\2\u04a8\u04a9\5\u014f\u00a8\2\u04a9\u04aa\5\u015f") 669 | buf.write(u"\u00b0\2\u04aa\u04ab\5\u0167\u00b4\2\u04ab\u04ac\5\u0147") 670 | buf.write(u"\u00a4\2\u04ac\u0116\3\2\2\2\u04ad\u04ae\5\u0167\u00b4") 671 | buf.write(u"\2\u04ae\u04af\5\u015d\u00af\2\u04af\u04b0\5\u0145\u00a3") 672 | buf.write(u"\2\u04b0\u04b1\5\u013f\u00a0\2\u04b1\u04b2\5\u0165\u00b3") 673 | buf.write(u"\2\u04b2\u04b3\5\u0147\u00a4\2\u04b3\u0118\3\2\2\2\u04b4") 674 | buf.write(u"\u04b5\5\u0167\u00b4\2\u04b5\u04b6\5\u0163\u00b2\2\u04b6") 675 | buf.write(u"\u04b7\5\u014f\u00a8\2\u04b7\u04b8\5\u0159\u00ad\2\u04b8") 676 | buf.write(u"\u04b9\5\u014b\u00a6\2\u04b9\u011a\3\2\2\2\u04ba\u04bb") 677 | buf.write(u"\5\u0169\u00b5\2\u04bb\u04bc\5\u013f\u00a0\2\u04bc\u04bd") 678 | buf.write(u"\5\u0143\u00a2\2\u04bd\u04be\5\u0167\u00b4\2\u04be\u04bf") 679 | buf.write(u"\5\u0167\u00b4\2\u04bf\u04c0\5\u0157\u00ac\2\u04c0\u011c") 680 | buf.write(u"\3\2\2\2\u04c1\u04c2\5\u0169\u00b5\2\u04c2\u04c3\5\u013f") 681 | buf.write(u"\u00a0\2\u04c3\u04c4\5\u0155\u00ab\2\u04c4\u04c5\5\u0167") 682 | buf.write(u"\u00b4\2\u04c5\u04c6\5\u0147\u00a4\2\u04c6\u04c7\5\u0163") 683 | buf.write(u"\u00b2\2\u04c7\u011e\3\2\2\2\u04c8\u04c9\5\u0169\u00b5") 684 | buf.write(u"\2\u04c9\u04ca\5\u014f\u00a8\2\u04ca\u04cb\5\u0147\u00a4") 685 | buf.write(u"\2\u04cb\u04cc\5\u016b\u00b6\2\u04cc\u0120\3\2\2\2\u04cd") 686 | buf.write(u"\u04ce\5\u0169\u00b5\2\u04ce\u04cf\5\u014f\u00a8\2\u04cf") 687 | buf.write(u"\u04d0\5\u0161\u00b1\2\u04d0\u04d1\5\u0165\u00b3\2\u04d1") 688 | buf.write(u"\u04d2\5\u0167\u00b4\2\u04d2\u04d3\5\u013f\u00a0\2\u04d3") 689 | buf.write(u"\u04d4\5\u0155\u00ab\2\u04d4\u0122\3\2\2\2\u04d5\u04d6") 690 | buf.write(u"\5\u016b\u00b6\2\u04d6\u04d7\5\u014d\u00a7\2\u04d7\u04d8") 691 | buf.write(u"\5\u0147\u00a4\2\u04d8\u04d9\5\u0159\u00ad\2\u04d9\u0124") 692 | buf.write(u"\3\2\2\2\u04da\u04db\5\u016b\u00b6\2\u04db\u04dc\5\u014d") 693 | buf.write(u"\u00a7\2\u04dc\u04dd\5\u0147\u00a4\2\u04dd\u04de\5\u0161") 694 | buf.write(u"\u00b1\2\u04de\u04df\5\u0147\u00a4\2\u04df\u0126\3\2") 695 | buf.write(u"\2\2\u04e0\u04e1\5\u016b\u00b6\2\u04e1\u04e2\5\u014f") 696 | buf.write(u"\u00a8\2\u04e2\u04e3\5\u0165\u00b3\2\u04e3\u04e4\5\u014d") 697 | buf.write(u"\u00a7\2\u04e4\u0128\3\2\2\2\u04e5\u04e6\5\u016b\u00b6") 698 | buf.write(u"\2\u04e6\u04e7\5\u014f\u00a8\2\u04e7\u04e8\5\u0165\u00b3") 699 | buf.write(u"\2\u04e8\u04e9\5\u014d\u00a7\2\u04e9\u04ea\5\u015b\u00ae") 700 | buf.write(u"\2\u04ea\u04eb\5\u0167\u00b4\2\u04eb\u04ec\5\u0165\u00b3") 701 | buf.write(u"\2\u04ec\u012a\3\2\2\2\u04ed\u04f3\7$\2\2\u04ee\u04f2") 702 | buf.write(u"\n\2\2\2\u04ef\u04f0\7$\2\2\u04f0\u04f2\7$\2\2\u04f1") 703 | buf.write(u"\u04ee\3\2\2\2\u04f1\u04ef\3\2\2\2\u04f2\u04f5\3\2\2") 704 | buf.write(u"\2\u04f3\u04f1\3\2\2\2\u04f3\u04f4\3\2\2\2\u04f4\u04f6") 705 | buf.write(u"\3\2\2\2\u04f5\u04f3\3\2\2\2\u04f6\u0511\7$\2\2\u04f7") 706 | buf.write(u"\u04fd\7b\2\2\u04f8\u04fc\n\3\2\2\u04f9\u04fa\7b\2\2") 707 | buf.write(u"\u04fa\u04fc\7b\2\2\u04fb\u04f8\3\2\2\2\u04fb\u04f9\3") 708 | buf.write(u"\2\2\2\u04fc\u04ff\3\2\2\2\u04fd\u04fb\3\2\2\2\u04fd") 709 | buf.write(u"\u04fe\3\2\2\2\u04fe\u0500\3\2\2\2\u04ff\u04fd\3\2\2") 710 | buf.write(u"\2\u0500\u0511\7b\2\2\u0501\u0505\7]\2\2\u0502\u0504") 711 | buf.write(u"\n\4\2\2\u0503\u0502\3\2\2\2\u0504\u0507\3\2\2\2\u0505") 712 | buf.write(u"\u0503\3\2\2\2\u0505\u0506\3\2\2\2\u0506\u0508\3\2\2") 713 | buf.write(u"\2\u0507\u0505\3\2\2\2\u0508\u0511\7_\2\2\u0509\u050d") 714 | buf.write(u"\t\5\2\2\u050a\u050c\t\6\2\2\u050b\u050a\3\2\2\2\u050c") 715 | buf.write(u"\u050f\3\2\2\2\u050d\u050b\3\2\2\2\u050d\u050e\3\2\2") 716 | buf.write(u"\2\u050e\u0511\3\2\2\2\u050f\u050d\3\2\2\2\u0510\u04ed") 717 | buf.write(u"\3\2\2\2\u0510\u04f7\3\2\2\2\u0510\u0501\3\2\2\2\u0510") 718 | buf.write(u"\u0509\3\2\2\2\u0511\u012c\3\2\2\2\u0512\u0514\5\u013d") 719 | buf.write(u"\u009f\2\u0513\u0512\3\2\2\2\u0514\u0515\3\2\2\2\u0515") 720 | buf.write(u"\u0513\3\2\2\2\u0515\u0516\3\2\2\2\u0516\u051e\3\2\2") 721 | buf.write(u"\2\u0517\u051b\7\60\2\2\u0518\u051a\5\u013d\u009f\2\u0519") 722 | buf.write(u"\u0518\3\2\2\2\u051a\u051d\3\2\2\2\u051b\u0519\3\2\2") 723 | buf.write(u"\2\u051b\u051c\3\2\2\2\u051c\u051f\3\2\2\2\u051d\u051b") 724 | buf.write(u"\3\2\2\2\u051e\u0517\3\2\2\2\u051e\u051f\3\2\2\2\u051f") 725 | buf.write(u"\u0529\3\2\2\2\u0520\u0522\5\u0147\u00a4\2\u0521\u0523") 726 | buf.write(u"\t\7\2\2\u0522\u0521\3\2\2\2\u0522\u0523\3\2\2\2\u0523") 727 | buf.write(u"\u0525\3\2\2\2\u0524\u0526\5\u013d\u009f\2\u0525\u0524") 728 | buf.write(u"\3\2\2\2\u0526\u0527\3\2\2\2\u0527\u0525\3\2\2\2\u0527") 729 | buf.write(u"\u0528\3\2\2\2\u0528\u052a\3\2\2\2\u0529\u0520\3\2\2") 730 | buf.write(u"\2\u0529\u052a\3\2\2\2\u052a\u053d\3\2\2\2\u052b\u052d") 731 | buf.write(u"\7\60\2\2\u052c\u052e\5\u013d\u009f\2\u052d\u052c\3\2") 732 | buf.write(u"\2\2\u052e\u052f\3\2\2\2\u052f\u052d\3\2\2\2\u052f\u0530") 733 | buf.write(u"\3\2\2\2\u0530\u053a\3\2\2\2\u0531\u0533\5\u0147\u00a4") 734 | buf.write(u"\2\u0532\u0534\t\7\2\2\u0533\u0532\3\2\2\2\u0533\u0534") 735 | buf.write(u"\3\2\2\2\u0534\u0536\3\2\2\2\u0535\u0537\5\u013d\u009f") 736 | buf.write(u"\2\u0536\u0535\3\2\2\2\u0537\u0538\3\2\2\2\u0538\u0536") 737 | buf.write(u"\3\2\2\2\u0538\u0539\3\2\2\2\u0539\u053b\3\2\2\2\u053a") 738 | buf.write(u"\u0531\3\2\2\2\u053a\u053b\3\2\2\2\u053b\u053d\3\2\2") 739 | buf.write(u"\2\u053c\u0513\3\2\2\2\u053c\u052b\3\2\2\2\u053d\u012e") 740 | buf.write(u"\3\2\2\2\u053e\u0542\7A\2\2\u053f\u0541\5\u013d\u009f") 741 | buf.write(u"\2\u0540\u053f\3\2\2\2\u0541\u0544\3\2\2\2\u0542\u0540") 742 | buf.write(u"\3\2\2\2\u0542\u0543\3\2\2\2\u0543\u0548\3\2\2\2\u0544") 743 | buf.write(u"\u0542\3\2\2\2\u0545\u0546\t\b\2\2\u0546\u0548\5\u012b") 744 | buf.write(u"\u0096\2\u0547\u053e\3\2\2\2\u0547\u0545\3\2\2\2\u0548") 745 | buf.write(u"\u0130\3\2\2\2\u0549\u054f\7)\2\2\u054a\u054e\n\t\2\2") 746 | buf.write(u"\u054b\u054c\7)\2\2\u054c\u054e\7)\2\2\u054d\u054a\3") 747 | buf.write(u"\2\2\2\u054d\u054b\3\2\2\2\u054e\u0551\3\2\2\2\u054f") 748 | buf.write(u"\u054d\3\2\2\2\u054f\u0550\3\2\2\2\u0550\u0552\3\2\2") 749 | buf.write(u"\2\u0551\u054f\3\2\2\2\u0552\u0553\7)\2\2\u0553\u0132") 750 | buf.write(u"\3\2\2\2\u0554\u0555\5\u016d\u00b7\2\u0555\u0556\5\u0131") 751 | buf.write(u"\u0099\2\u0556\u0134\3\2\2\2\u0557\u0558\7/\2\2\u0558") 752 | buf.write(u"\u0559\7/\2\2\u0559\u055d\3\2\2\2\u055a\u055c\n\n\2\2") 753 | buf.write(u"\u055b\u055a\3\2\2\2\u055c\u055f\3\2\2\2\u055d\u055b") 754 | buf.write(u"\3\2\2\2\u055d\u055e\3\2\2\2\u055e\u0560\3\2\2\2\u055f") 755 | buf.write(u"\u055d\3\2\2\2\u0560\u0561\b\u009b\2\2\u0561\u0136\3") 756 | buf.write(u"\2\2\2\u0562\u0563\7\61\2\2\u0563\u0564\7,\2\2\u0564") 757 | buf.write(u"\u0568\3\2\2\2\u0565\u0567\13\2\2\2\u0566\u0565\3\2\2") 758 | buf.write(u"\2\u0567\u056a\3\2\2\2\u0568\u0569\3\2\2\2\u0568\u0566") 759 | buf.write(u"\3\2\2\2\u0569\u056e\3\2\2\2\u056a\u0568\3\2\2\2\u056b") 760 | buf.write(u"\u056c\7,\2\2\u056c\u056f\7\61\2\2\u056d\u056f\7\2\2") 761 | buf.write(u"\3\u056e\u056b\3\2\2\2\u056e\u056d\3\2\2\2\u056f\u0570") 762 | buf.write(u"\3\2\2\2\u0570\u0571\b\u009c\2\2\u0571\u0138\3\2\2\2") 763 | buf.write(u"\u0572\u0573\t\13\2\2\u0573\u0574\3\2\2\2\u0574\u0575") 764 | buf.write(u"\b\u009d\2\2\u0575\u013a\3\2\2\2\u0576\u0577\13\2\2\2") 765 | buf.write(u"\u0577\u013c\3\2\2\2\u0578\u0579\t\f\2\2\u0579\u013e") 766 | buf.write(u"\3\2\2\2\u057a\u057b\t\r\2\2\u057b\u0140\3\2\2\2\u057c") 767 | buf.write(u"\u057d\t\16\2\2\u057d\u0142\3\2\2\2\u057e\u057f\t\17") 768 | buf.write(u"\2\2\u057f\u0144\3\2\2\2\u0580\u0581\t\20\2\2\u0581\u0146") 769 | buf.write(u"\3\2\2\2\u0582\u0583\t\21\2\2\u0583\u0148\3\2\2\2\u0584") 770 | buf.write(u"\u0585\t\22\2\2\u0585\u014a\3\2\2\2\u0586\u0587\t\23") 771 | buf.write(u"\2\2\u0587\u014c\3\2\2\2\u0588\u0589\t\24\2\2\u0589\u014e") 772 | buf.write(u"\3\2\2\2\u058a\u058b\t\25\2\2\u058b\u0150\3\2\2\2\u058c") 773 | buf.write(u"\u058d\t\26\2\2\u058d\u0152\3\2\2\2\u058e\u058f\t\27") 774 | buf.write(u"\2\2\u058f\u0154\3\2\2\2\u0590\u0591\t\30\2\2\u0591\u0156") 775 | buf.write(u"\3\2\2\2\u0592\u0593\t\31\2\2\u0593\u0158\3\2\2\2\u0594") 776 | buf.write(u"\u0595\t\32\2\2\u0595\u015a\3\2\2\2\u0596\u0597\t\33") 777 | buf.write(u"\2\2\u0597\u015c\3\2\2\2\u0598\u0599\t\34\2\2\u0599\u015e") 778 | buf.write(u"\3\2\2\2\u059a\u059b\t\35\2\2\u059b\u0160\3\2\2\2\u059c") 779 | buf.write(u"\u059d\t\36\2\2\u059d\u0162\3\2\2\2\u059e\u059f\t\37") 780 | buf.write(u"\2\2\u059f\u0164\3\2\2\2\u05a0\u05a1\t \2\2\u05a1\u0166") 781 | buf.write(u"\3\2\2\2\u05a2\u05a3\t!\2\2\u05a3\u0168\3\2\2\2\u05a4") 782 | buf.write(u"\u05a5\t\"\2\2\u05a5\u016a\3\2\2\2\u05a6\u05a7\t#\2\2") 783 | buf.write(u"\u05a7\u016c\3\2\2\2\u05a8\u05a9\t$\2\2\u05a9\u016e\3") 784 | buf.write(u"\2\2\2\u05aa\u05ab\t%\2\2\u05ab\u0170\3\2\2\2\u05ac\u05ad") 785 | buf.write(u"\t&\2\2\u05ad\u0172\3\2\2\2\34\2\u04f1\u04f3\u04fb\u04fd") 786 | buf.write(u"\u0505\u050d\u0510\u0515\u051b\u051e\u0522\u0527\u0529") 787 | buf.write(u"\u052f\u0533\u0538\u053a\u053c\u0542\u0547\u054d\u054f") 788 | buf.write(u"\u055d\u0568\u056e\3\2\3\2") 789 | return buf.getvalue() 790 | 791 | 792 | class SQLiteLexer(Lexer): 793 | 794 | atn = ATNDeserializer().deserialize(serializedATN()) 795 | 796 | decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] 797 | 798 | 799 | SCOL = 1 800 | DOT = 2 801 | OPEN_PAR = 3 802 | CLOSE_PAR = 4 803 | COMMA = 5 804 | ASSIGN = 6 805 | STAR = 7 806 | PLUS = 8 807 | MINUS = 9 808 | TILDE = 10 809 | PIPE2 = 11 810 | DIV = 12 811 | MOD = 13 812 | LT2 = 14 813 | GT2 = 15 814 | AMP = 16 815 | PIPE = 17 816 | LT = 18 817 | LT_EQ = 19 818 | GT = 20 819 | GT_EQ = 21 820 | EQ = 22 821 | NOT_EQ1 = 23 822 | NOT_EQ2 = 24 823 | K_ABORT = 25 824 | K_ACTION = 26 825 | K_ADD = 27 826 | K_AFTER = 28 827 | K_ALL = 29 828 | K_ALTER = 30 829 | K_ANALYZE = 31 830 | K_AND = 32 831 | K_AS = 33 832 | K_ASC = 34 833 | K_ATTACH = 35 834 | K_AUTOINCREMENT = 36 835 | K_BEFORE = 37 836 | K_BEGIN = 38 837 | K_BETWEEN = 39 838 | K_BY = 40 839 | K_CASCADE = 41 840 | K_CASE = 42 841 | K_CAST = 43 842 | K_CHECK = 44 843 | K_COLLATE = 45 844 | K_COLUMN = 46 845 | K_COMMIT = 47 846 | K_CONFLICT = 48 847 | K_CONSTRAINT = 49 848 | K_CREATE = 50 849 | K_CROSS = 51 850 | K_CURRENT_DATE = 52 851 | K_CURRENT_TIME = 53 852 | K_CURRENT_TIMESTAMP = 54 853 | K_DATABASE = 55 854 | K_DEFAULT = 56 855 | K_DEFERRABLE = 57 856 | K_DEFERRED = 58 857 | K_DELETE = 59 858 | K_DESC = 60 859 | K_DETACH = 61 860 | K_DISTINCT = 62 861 | K_DROP = 63 862 | K_EACH = 64 863 | K_ELSE = 65 864 | K_END = 66 865 | K_ESCAPE = 67 866 | K_EXCEPT = 68 867 | K_EXCLUSIVE = 69 868 | K_EXISTS = 70 869 | K_EXPLAIN = 71 870 | K_FAIL = 72 871 | K_FOR = 73 872 | K_FOREIGN = 74 873 | K_FROM = 75 874 | K_FULL = 76 875 | K_GLOB = 77 876 | K_GROUP = 78 877 | K_HAVING = 79 878 | K_IF = 80 879 | K_IGNORE = 81 880 | K_IMMEDIATE = 82 881 | K_IN = 83 882 | K_INDEX = 84 883 | K_INDEXED = 85 884 | K_INITIALLY = 86 885 | K_INNER = 87 886 | K_INSERT = 88 887 | K_INSTEAD = 89 888 | K_INTERSECT = 90 889 | K_INTO = 91 890 | K_IS = 92 891 | K_ISNULL = 93 892 | K_JOIN = 94 893 | K_KEY = 95 894 | K_LEFT = 96 895 | K_LIKE = 97 896 | K_LIMIT = 98 897 | K_MATCH = 99 898 | K_NATURAL = 100 899 | K_NO = 101 900 | K_NOT = 102 901 | K_NOTNULL = 103 902 | K_NULL = 104 903 | K_OF = 105 904 | K_OFFSET = 106 905 | K_ON = 107 906 | K_OR = 108 907 | K_ORDER = 109 908 | K_OUTER = 110 909 | K_PLAN = 111 910 | K_PRAGMA = 112 911 | K_PRIMARY = 113 912 | K_QUERY = 114 913 | K_RAISE = 115 914 | K_RECURSIVE = 116 915 | K_REFERENCES = 117 916 | K_REGEXP = 118 917 | K_REINDEX = 119 918 | K_RELEASE = 120 919 | K_RENAME = 121 920 | K_REPLACE = 122 921 | K_RESTRICT = 123 922 | K_RIGHT = 124 923 | K_ROLLBACK = 125 924 | K_ROW = 126 925 | K_SAVEPOINT = 127 926 | K_SELECT = 128 927 | K_SET = 129 928 | K_TABLE = 130 929 | K_TEMP = 131 930 | K_TEMPORARY = 132 931 | K_THEN = 133 932 | K_TO = 134 933 | K_TRANSACTION = 135 934 | K_TRIGGER = 136 935 | K_UNION = 137 936 | K_UNIQUE = 138 937 | K_UPDATE = 139 938 | K_USING = 140 939 | K_VACUUM = 141 940 | K_VALUES = 142 941 | K_VIEW = 143 942 | K_VIRTUAL = 144 943 | K_WHEN = 145 944 | K_WHERE = 146 945 | K_WITH = 147 946 | K_WITHOUT = 148 947 | IDENTIFIER = 149 948 | NUMERIC_LITERAL = 150 949 | BIND_PARAMETER = 151 950 | STRING_LITERAL = 152 951 | BLOB_LITERAL = 153 952 | SINGLE_LINE_COMMENT = 154 953 | MULTILINE_COMMENT = 155 954 | SPACES = 156 955 | UNEXPECTED_CHAR = 157 956 | 957 | modeNames = [ u"DEFAULT_MODE" ] 958 | 959 | literalNames = [ u"", 960 | u"';'", u"'.'", u"'('", u"')'", u"','", u"'='", u"'*'", u"'+'", 961 | u"'-'", u"'~'", u"'||'", u"'/'", u"'%'", u"'<<'", u"'>>'", u"'&'", 962 | u"'|'", u"'<'", u"'<='", u"'>'", u"'>='", u"'=='", u"'!='", 963 | u"'<>'" ] 964 | 965 | symbolicNames = [ u"", 966 | u"SCOL", u"DOT", u"OPEN_PAR", u"CLOSE_PAR", u"COMMA", u"ASSIGN", 967 | u"STAR", u"PLUS", u"MINUS", u"TILDE", u"PIPE2", u"DIV", u"MOD", 968 | u"LT2", u"GT2", u"AMP", u"PIPE", u"LT", u"LT_EQ", u"GT", u"GT_EQ", 969 | u"EQ", u"NOT_EQ1", u"NOT_EQ2", u"K_ABORT", u"K_ACTION", u"K_ADD", 970 | u"K_AFTER", u"K_ALL", u"K_ALTER", u"K_ANALYZE", u"K_AND", u"K_AS", 971 | u"K_ASC", u"K_ATTACH", u"K_AUTOINCREMENT", u"K_BEFORE", u"K_BEGIN", 972 | u"K_BETWEEN", u"K_BY", u"K_CASCADE", u"K_CASE", u"K_CAST", u"K_CHECK", 973 | u"K_COLLATE", u"K_COLUMN", u"K_COMMIT", u"K_CONFLICT", u"K_CONSTRAINT", 974 | u"K_CREATE", u"K_CROSS", u"K_CURRENT_DATE", u"K_CURRENT_TIME", 975 | u"K_CURRENT_TIMESTAMP", u"K_DATABASE", u"K_DEFAULT", u"K_DEFERRABLE", 976 | u"K_DEFERRED", u"K_DELETE", u"K_DESC", u"K_DETACH", u"K_DISTINCT", 977 | u"K_DROP", u"K_EACH", u"K_ELSE", u"K_END", u"K_ESCAPE", u"K_EXCEPT", 978 | u"K_EXCLUSIVE", u"K_EXISTS", u"K_EXPLAIN", u"K_FAIL", u"K_FOR", 979 | u"K_FOREIGN", u"K_FROM", u"K_FULL", u"K_GLOB", u"K_GROUP", u"K_HAVING", 980 | u"K_IF", u"K_IGNORE", u"K_IMMEDIATE", u"K_IN", u"K_INDEX", u"K_INDEXED", 981 | u"K_INITIALLY", u"K_INNER", u"K_INSERT", u"K_INSTEAD", u"K_INTERSECT", 982 | u"K_INTO", u"K_IS", u"K_ISNULL", u"K_JOIN", u"K_KEY", u"K_LEFT", 983 | u"K_LIKE", u"K_LIMIT", u"K_MATCH", u"K_NATURAL", u"K_NO", u"K_NOT", 984 | u"K_NOTNULL", u"K_NULL", u"K_OF", u"K_OFFSET", u"K_ON", u"K_OR", 985 | u"K_ORDER", u"K_OUTER", u"K_PLAN", u"K_PRAGMA", u"K_PRIMARY", 986 | u"K_QUERY", u"K_RAISE", u"K_RECURSIVE", u"K_REFERENCES", u"K_REGEXP", 987 | u"K_REINDEX", u"K_RELEASE", u"K_RENAME", u"K_REPLACE", u"K_RESTRICT", 988 | u"K_RIGHT", u"K_ROLLBACK", u"K_ROW", u"K_SAVEPOINT", u"K_SELECT", 989 | u"K_SET", u"K_TABLE", u"K_TEMP", u"K_TEMPORARY", u"K_THEN", 990 | u"K_TO", u"K_TRANSACTION", u"K_TRIGGER", u"K_UNION", u"K_UNIQUE", 991 | u"K_UPDATE", u"K_USING", u"K_VACUUM", u"K_VALUES", u"K_VIEW", 992 | u"K_VIRTUAL", u"K_WHEN", u"K_WHERE", u"K_WITH", u"K_WITHOUT", 993 | u"IDENTIFIER", u"NUMERIC_LITERAL", u"BIND_PARAMETER", u"STRING_LITERAL", 994 | u"BLOB_LITERAL", u"SINGLE_LINE_COMMENT", u"MULTILINE_COMMENT", 995 | u"SPACES", u"UNEXPECTED_CHAR" ] 996 | 997 | ruleNames = [ u"SCOL", u"DOT", u"OPEN_PAR", u"CLOSE_PAR", u"COMMA", 998 | u"ASSIGN", u"STAR", u"PLUS", u"MINUS", u"TILDE", u"PIPE2", 999 | u"DIV", u"MOD", u"LT2", u"GT2", u"AMP", u"PIPE", u"LT", 1000 | u"LT_EQ", u"GT", u"GT_EQ", u"EQ", u"NOT_EQ1", u"NOT_EQ2", 1001 | u"K_ABORT", u"K_ACTION", u"K_ADD", u"K_AFTER", u"K_ALL", 1002 | u"K_ALTER", u"K_ANALYZE", u"K_AND", u"K_AS", u"K_ASC", 1003 | u"K_ATTACH", u"K_AUTOINCREMENT", u"K_BEFORE", u"K_BEGIN", 1004 | u"K_BETWEEN", u"K_BY", u"K_CASCADE", u"K_CASE", u"K_CAST", 1005 | u"K_CHECK", u"K_COLLATE", u"K_COLUMN", u"K_COMMIT", u"K_CONFLICT", 1006 | u"K_CONSTRAINT", u"K_CREATE", u"K_CROSS", u"K_CURRENT_DATE", 1007 | u"K_CURRENT_TIME", u"K_CURRENT_TIMESTAMP", u"K_DATABASE", 1008 | u"K_DEFAULT", u"K_DEFERRABLE", u"K_DEFERRED", u"K_DELETE", 1009 | u"K_DESC", u"K_DETACH", u"K_DISTINCT", u"K_DROP", u"K_EACH", 1010 | u"K_ELSE", u"K_END", u"K_ESCAPE", u"K_EXCEPT", u"K_EXCLUSIVE", 1011 | u"K_EXISTS", u"K_EXPLAIN", u"K_FAIL", u"K_FOR", u"K_FOREIGN", 1012 | u"K_FROM", u"K_FULL", u"K_GLOB", u"K_GROUP", u"K_HAVING", 1013 | u"K_IF", u"K_IGNORE", u"K_IMMEDIATE", u"K_IN", u"K_INDEX", 1014 | u"K_INDEXED", u"K_INITIALLY", u"K_INNER", u"K_INSERT", 1015 | u"K_INSTEAD", u"K_INTERSECT", u"K_INTO", u"K_IS", u"K_ISNULL", 1016 | u"K_JOIN", u"K_KEY", u"K_LEFT", u"K_LIKE", u"K_LIMIT", 1017 | u"K_MATCH", u"K_NATURAL", u"K_NO", u"K_NOT", u"K_NOTNULL", 1018 | u"K_NULL", u"K_OF", u"K_OFFSET", u"K_ON", u"K_OR", u"K_ORDER", 1019 | u"K_OUTER", u"K_PLAN", u"K_PRAGMA", u"K_PRIMARY", u"K_QUERY", 1020 | u"K_RAISE", u"K_RECURSIVE", u"K_REFERENCES", u"K_REGEXP", 1021 | u"K_REINDEX", u"K_RELEASE", u"K_RENAME", u"K_REPLACE", 1022 | u"K_RESTRICT", u"K_RIGHT", u"K_ROLLBACK", u"K_ROW", u"K_SAVEPOINT", 1023 | u"K_SELECT", u"K_SET", u"K_TABLE", u"K_TEMP", u"K_TEMPORARY", 1024 | u"K_THEN", u"K_TO", u"K_TRANSACTION", u"K_TRIGGER", u"K_UNION", 1025 | u"K_UNIQUE", u"K_UPDATE", u"K_USING", u"K_VACUUM", u"K_VALUES", 1026 | u"K_VIEW", u"K_VIRTUAL", u"K_WHEN", u"K_WHERE", u"K_WITH", 1027 | u"K_WITHOUT", u"IDENTIFIER", u"NUMERIC_LITERAL", u"BIND_PARAMETER", 1028 | u"STRING_LITERAL", u"BLOB_LITERAL", u"SINGLE_LINE_COMMENT", 1029 | u"MULTILINE_COMMENT", u"SPACES", u"UNEXPECTED_CHAR", u"DIGIT", 1030 | u"A", u"B", u"C", u"D", u"E", u"F", u"G", u"H", u"I", 1031 | u"J", u"K", u"L", u"M", u"N", u"O", u"P", u"Q", u"R", 1032 | u"S", u"T", u"U", u"V", u"W", u"X", u"Y", u"Z" ] 1033 | 1034 | grammarFileName = u"SQLite.g4" 1035 | 1036 | def __init__(self, input=None): 1037 | super(SQLiteLexer, self).__init__(input) 1038 | self.checkVersion("4.5.3") 1039 | self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) 1040 | self._actions = None 1041 | self._predicates = None 1042 | 1043 | 1044 | -------------------------------------------------------------------------------- /sql4pandas/SQLiteLexer.tokens: -------------------------------------------------------------------------------- 1 | SCOL=1 2 | DOT=2 3 | OPEN_PAR=3 4 | CLOSE_PAR=4 5 | COMMA=5 6 | ASSIGN=6 7 | STAR=7 8 | PLUS=8 9 | MINUS=9 10 | TILDE=10 11 | PIPE2=11 12 | DIV=12 13 | MOD=13 14 | LT2=14 15 | GT2=15 16 | AMP=16 17 | PIPE=17 18 | LT=18 19 | LT_EQ=19 20 | GT=20 21 | GT_EQ=21 22 | EQ=22 23 | NOT_EQ1=23 24 | NOT_EQ2=24 25 | K_ABORT=25 26 | K_ACTION=26 27 | K_ADD=27 28 | K_AFTER=28 29 | K_ALL=29 30 | K_ALTER=30 31 | K_ANALYZE=31 32 | K_AND=32 33 | K_AS=33 34 | K_ASC=34 35 | K_ATTACH=35 36 | K_AUTOINCREMENT=36 37 | K_BEFORE=37 38 | K_BEGIN=38 39 | K_BETWEEN=39 40 | K_BY=40 41 | K_CASCADE=41 42 | K_CASE=42 43 | K_CAST=43 44 | K_CHECK=44 45 | K_COLLATE=45 46 | K_COLUMN=46 47 | K_COMMIT=47 48 | K_CONFLICT=48 49 | K_CONSTRAINT=49 50 | K_CREATE=50 51 | K_CROSS=51 52 | K_CURRENT_DATE=52 53 | K_CURRENT_TIME=53 54 | K_CURRENT_TIMESTAMP=54 55 | K_DATABASE=55 56 | K_DEFAULT=56 57 | K_DEFERRABLE=57 58 | K_DEFERRED=58 59 | K_DELETE=59 60 | K_DESC=60 61 | K_DETACH=61 62 | K_DISTINCT=62 63 | K_DROP=63 64 | K_EACH=64 65 | K_ELSE=65 66 | K_END=66 67 | K_ESCAPE=67 68 | K_EXCEPT=68 69 | K_EXCLUSIVE=69 70 | K_EXISTS=70 71 | K_EXPLAIN=71 72 | K_FAIL=72 73 | K_FOR=73 74 | K_FOREIGN=74 75 | K_FROM=75 76 | K_FULL=76 77 | K_GLOB=77 78 | K_GROUP=78 79 | K_HAVING=79 80 | K_IF=80 81 | K_IGNORE=81 82 | K_IMMEDIATE=82 83 | K_IN=83 84 | K_INDEX=84 85 | K_INDEXED=85 86 | K_INITIALLY=86 87 | K_INNER=87 88 | K_INSERT=88 89 | K_INSTEAD=89 90 | K_INTERSECT=90 91 | K_INTO=91 92 | K_IS=92 93 | K_ISNULL=93 94 | K_JOIN=94 95 | K_KEY=95 96 | K_LEFT=96 97 | K_LIKE=97 98 | K_LIMIT=98 99 | K_MATCH=99 100 | K_NATURAL=100 101 | K_NO=101 102 | K_NOT=102 103 | K_NOTNULL=103 104 | K_NULL=104 105 | K_OF=105 106 | K_OFFSET=106 107 | K_ON=107 108 | K_OR=108 109 | K_ORDER=109 110 | K_OUTER=110 111 | K_PLAN=111 112 | K_PRAGMA=112 113 | K_PRIMARY=113 114 | K_QUERY=114 115 | K_RAISE=115 116 | K_RECURSIVE=116 117 | K_REFERENCES=117 118 | K_REGEXP=118 119 | K_REINDEX=119 120 | K_RELEASE=120 121 | K_RENAME=121 122 | K_REPLACE=122 123 | K_RESTRICT=123 124 | K_RIGHT=124 125 | K_ROLLBACK=125 126 | K_ROW=126 127 | K_SAVEPOINT=127 128 | K_SELECT=128 129 | K_SET=129 130 | K_TABLE=130 131 | K_TEMP=131 132 | K_TEMPORARY=132 133 | K_THEN=133 134 | K_TO=134 135 | K_TRANSACTION=135 136 | K_TRIGGER=136 137 | K_UNION=137 138 | K_UNIQUE=138 139 | K_UPDATE=139 140 | K_USING=140 141 | K_VACUUM=141 142 | K_VALUES=142 143 | K_VIEW=143 144 | K_VIRTUAL=144 145 | K_WHEN=145 146 | K_WHERE=146 147 | K_WITH=147 148 | K_WITHOUT=148 149 | IDENTIFIER=149 150 | NUMERIC_LITERAL=150 151 | BIND_PARAMETER=151 152 | STRING_LITERAL=152 153 | BLOB_LITERAL=153 154 | SINGLE_LINE_COMMENT=154 155 | MULTILINE_COMMENT=155 156 | SPACES=156 157 | UNEXPECTED_CHAR=157 158 | ';'=1 159 | '.'=2 160 | '('=3 161 | ')'=4 162 | ','=5 163 | '='=6 164 | '*'=7 165 | '+'=8 166 | '-'=9 167 | '~'=10 168 | '||'=11 169 | '/'=12 170 | '%'=13 171 | '<<'=14 172 | '>>'=15 173 | '&'=16 174 | '|'=17 175 | '<'=18 176 | '<='=19 177 | '>'=20 178 | '>='=21 179 | '=='=22 180 | '!='=23 181 | '<>'=24 182 | -------------------------------------------------------------------------------- /sql4pandas/SQLiteListener.py: -------------------------------------------------------------------------------- 1 | # Generated from SQLite.g4 by ANTLR 4.5.3 2 | from antlr4 import * 3 | 4 | # This class defines a complete listener for a parse tree produced by SQLiteParser. 5 | class SQLiteListener(ParseTreeListener): 6 | 7 | # Enter a parse tree produced by SQLiteParser#parse. 8 | def enterParse(self, ctx): 9 | pass 10 | 11 | # Exit a parse tree produced by SQLiteParser#parse. 12 | def exitParse(self, ctx): 13 | pass 14 | 15 | 16 | # Enter a parse tree produced by SQLiteParser#error. 17 | def enterError(self, ctx): 18 | pass 19 | 20 | # Exit a parse tree produced by SQLiteParser#error. 21 | def exitError(self, ctx): 22 | pass 23 | 24 | 25 | # Enter a parse tree produced by SQLiteParser#sql_stmt_list. 26 | def enterSql_stmt_list(self, ctx): 27 | pass 28 | 29 | # Exit a parse tree produced by SQLiteParser#sql_stmt_list. 30 | def exitSql_stmt_list(self, ctx): 31 | pass 32 | 33 | 34 | # Enter a parse tree produced by SQLiteParser#sql_stmt. 35 | def enterSql_stmt(self, ctx): 36 | pass 37 | 38 | # Exit a parse tree produced by SQLiteParser#sql_stmt. 39 | def exitSql_stmt(self, ctx): 40 | pass 41 | 42 | 43 | # Enter a parse tree produced by SQLiteParser#alter_table_stmt. 44 | def enterAlter_table_stmt(self, ctx): 45 | pass 46 | 47 | # Exit a parse tree produced by SQLiteParser#alter_table_stmt. 48 | def exitAlter_table_stmt(self, ctx): 49 | pass 50 | 51 | 52 | # Enter a parse tree produced by SQLiteParser#analyze_stmt. 53 | def enterAnalyze_stmt(self, ctx): 54 | pass 55 | 56 | # Exit a parse tree produced by SQLiteParser#analyze_stmt. 57 | def exitAnalyze_stmt(self, ctx): 58 | pass 59 | 60 | 61 | # Enter a parse tree produced by SQLiteParser#attach_stmt. 62 | def enterAttach_stmt(self, ctx): 63 | pass 64 | 65 | # Exit a parse tree produced by SQLiteParser#attach_stmt. 66 | def exitAttach_stmt(self, ctx): 67 | pass 68 | 69 | 70 | # Enter a parse tree produced by SQLiteParser#begin_stmt. 71 | def enterBegin_stmt(self, ctx): 72 | pass 73 | 74 | # Exit a parse tree produced by SQLiteParser#begin_stmt. 75 | def exitBegin_stmt(self, ctx): 76 | pass 77 | 78 | 79 | # Enter a parse tree produced by SQLiteParser#commit_stmt. 80 | def enterCommit_stmt(self, ctx): 81 | pass 82 | 83 | # Exit a parse tree produced by SQLiteParser#commit_stmt. 84 | def exitCommit_stmt(self, ctx): 85 | pass 86 | 87 | 88 | # Enter a parse tree produced by SQLiteParser#compound_select_stmt. 89 | def enterCompound_select_stmt(self, ctx): 90 | pass 91 | 92 | # Exit a parse tree produced by SQLiteParser#compound_select_stmt. 93 | def exitCompound_select_stmt(self, ctx): 94 | pass 95 | 96 | 97 | # Enter a parse tree produced by SQLiteParser#create_index_stmt. 98 | def enterCreate_index_stmt(self, ctx): 99 | pass 100 | 101 | # Exit a parse tree produced by SQLiteParser#create_index_stmt. 102 | def exitCreate_index_stmt(self, ctx): 103 | pass 104 | 105 | 106 | # Enter a parse tree produced by SQLiteParser#create_table_stmt. 107 | def enterCreate_table_stmt(self, ctx): 108 | pass 109 | 110 | # Exit a parse tree produced by SQLiteParser#create_table_stmt. 111 | def exitCreate_table_stmt(self, ctx): 112 | pass 113 | 114 | 115 | # Enter a parse tree produced by SQLiteParser#create_trigger_stmt. 116 | def enterCreate_trigger_stmt(self, ctx): 117 | pass 118 | 119 | # Exit a parse tree produced by SQLiteParser#create_trigger_stmt. 120 | def exitCreate_trigger_stmt(self, ctx): 121 | pass 122 | 123 | 124 | # Enter a parse tree produced by SQLiteParser#create_view_stmt. 125 | def enterCreate_view_stmt(self, ctx): 126 | pass 127 | 128 | # Exit a parse tree produced by SQLiteParser#create_view_stmt. 129 | def exitCreate_view_stmt(self, ctx): 130 | pass 131 | 132 | 133 | # Enter a parse tree produced by SQLiteParser#create_virtual_table_stmt. 134 | def enterCreate_virtual_table_stmt(self, ctx): 135 | pass 136 | 137 | # Exit a parse tree produced by SQLiteParser#create_virtual_table_stmt. 138 | def exitCreate_virtual_table_stmt(self, ctx): 139 | pass 140 | 141 | 142 | # Enter a parse tree produced by SQLiteParser#delete_stmt. 143 | def enterDelete_stmt(self, ctx): 144 | pass 145 | 146 | # Exit a parse tree produced by SQLiteParser#delete_stmt. 147 | def exitDelete_stmt(self, ctx): 148 | pass 149 | 150 | 151 | # Enter a parse tree produced by SQLiteParser#delete_stmt_limited. 152 | def enterDelete_stmt_limited(self, ctx): 153 | pass 154 | 155 | # Exit a parse tree produced by SQLiteParser#delete_stmt_limited. 156 | def exitDelete_stmt_limited(self, ctx): 157 | pass 158 | 159 | 160 | # Enter a parse tree produced by SQLiteParser#detach_stmt. 161 | def enterDetach_stmt(self, ctx): 162 | pass 163 | 164 | # Exit a parse tree produced by SQLiteParser#detach_stmt. 165 | def exitDetach_stmt(self, ctx): 166 | pass 167 | 168 | 169 | # Enter a parse tree produced by SQLiteParser#drop_index_stmt. 170 | def enterDrop_index_stmt(self, ctx): 171 | pass 172 | 173 | # Exit a parse tree produced by SQLiteParser#drop_index_stmt. 174 | def exitDrop_index_stmt(self, ctx): 175 | pass 176 | 177 | 178 | # Enter a parse tree produced by SQLiteParser#drop_table_stmt. 179 | def enterDrop_table_stmt(self, ctx): 180 | pass 181 | 182 | # Exit a parse tree produced by SQLiteParser#drop_table_stmt. 183 | def exitDrop_table_stmt(self, ctx): 184 | pass 185 | 186 | 187 | # Enter a parse tree produced by SQLiteParser#drop_trigger_stmt. 188 | def enterDrop_trigger_stmt(self, ctx): 189 | pass 190 | 191 | # Exit a parse tree produced by SQLiteParser#drop_trigger_stmt. 192 | def exitDrop_trigger_stmt(self, ctx): 193 | pass 194 | 195 | 196 | # Enter a parse tree produced by SQLiteParser#drop_view_stmt. 197 | def enterDrop_view_stmt(self, ctx): 198 | pass 199 | 200 | # Exit a parse tree produced by SQLiteParser#drop_view_stmt. 201 | def exitDrop_view_stmt(self, ctx): 202 | pass 203 | 204 | 205 | # Enter a parse tree produced by SQLiteParser#factored_select_stmt. 206 | def enterFactored_select_stmt(self, ctx): 207 | pass 208 | 209 | # Exit a parse tree produced by SQLiteParser#factored_select_stmt. 210 | def exitFactored_select_stmt(self, ctx): 211 | pass 212 | 213 | 214 | # Enter a parse tree produced by SQLiteParser#insert_stmt. 215 | def enterInsert_stmt(self, ctx): 216 | pass 217 | 218 | # Exit a parse tree produced by SQLiteParser#insert_stmt. 219 | def exitInsert_stmt(self, ctx): 220 | pass 221 | 222 | 223 | # Enter a parse tree produced by SQLiteParser#pragma_stmt. 224 | def enterPragma_stmt(self, ctx): 225 | pass 226 | 227 | # Exit a parse tree produced by SQLiteParser#pragma_stmt. 228 | def exitPragma_stmt(self, ctx): 229 | pass 230 | 231 | 232 | # Enter a parse tree produced by SQLiteParser#reindex_stmt. 233 | def enterReindex_stmt(self, ctx): 234 | pass 235 | 236 | # Exit a parse tree produced by SQLiteParser#reindex_stmt. 237 | def exitReindex_stmt(self, ctx): 238 | pass 239 | 240 | 241 | # Enter a parse tree produced by SQLiteParser#release_stmt. 242 | def enterRelease_stmt(self, ctx): 243 | pass 244 | 245 | # Exit a parse tree produced by SQLiteParser#release_stmt. 246 | def exitRelease_stmt(self, ctx): 247 | pass 248 | 249 | 250 | # Enter a parse tree produced by SQLiteParser#rollback_stmt. 251 | def enterRollback_stmt(self, ctx): 252 | pass 253 | 254 | # Exit a parse tree produced by SQLiteParser#rollback_stmt. 255 | def exitRollback_stmt(self, ctx): 256 | pass 257 | 258 | 259 | # Enter a parse tree produced by SQLiteParser#savepoint_stmt. 260 | def enterSavepoint_stmt(self, ctx): 261 | pass 262 | 263 | # Exit a parse tree produced by SQLiteParser#savepoint_stmt. 264 | def exitSavepoint_stmt(self, ctx): 265 | pass 266 | 267 | 268 | # Enter a parse tree produced by SQLiteParser#simple_select_stmt. 269 | def enterSimple_select_stmt(self, ctx): 270 | pass 271 | 272 | # Exit a parse tree produced by SQLiteParser#simple_select_stmt. 273 | def exitSimple_select_stmt(self, ctx): 274 | pass 275 | 276 | 277 | # Enter a parse tree produced by SQLiteParser#select_stmt. 278 | def enterSelect_stmt(self, ctx): 279 | pass 280 | 281 | # Exit a parse tree produced by SQLiteParser#select_stmt. 282 | def exitSelect_stmt(self, ctx): 283 | pass 284 | 285 | 286 | # Enter a parse tree produced by SQLiteParser#select_or_values. 287 | def enterSelect_or_values(self, ctx): 288 | pass 289 | 290 | # Exit a parse tree produced by SQLiteParser#select_or_values. 291 | def exitSelect_or_values(self, ctx): 292 | pass 293 | 294 | 295 | # Enter a parse tree produced by SQLiteParser#update_stmt. 296 | def enterUpdate_stmt(self, ctx): 297 | pass 298 | 299 | # Exit a parse tree produced by SQLiteParser#update_stmt. 300 | def exitUpdate_stmt(self, ctx): 301 | pass 302 | 303 | 304 | # Enter a parse tree produced by SQLiteParser#update_stmt_limited. 305 | def enterUpdate_stmt_limited(self, ctx): 306 | pass 307 | 308 | # Exit a parse tree produced by SQLiteParser#update_stmt_limited. 309 | def exitUpdate_stmt_limited(self, ctx): 310 | pass 311 | 312 | 313 | # Enter a parse tree produced by SQLiteParser#vacuum_stmt. 314 | def enterVacuum_stmt(self, ctx): 315 | pass 316 | 317 | # Exit a parse tree produced by SQLiteParser#vacuum_stmt. 318 | def exitVacuum_stmt(self, ctx): 319 | pass 320 | 321 | 322 | # Enter a parse tree produced by SQLiteParser#column_def. 323 | def enterColumn_def(self, ctx): 324 | pass 325 | 326 | # Exit a parse tree produced by SQLiteParser#column_def. 327 | def exitColumn_def(self, ctx): 328 | pass 329 | 330 | 331 | # Enter a parse tree produced by SQLiteParser#type_name. 332 | def enterType_name(self, ctx): 333 | pass 334 | 335 | # Exit a parse tree produced by SQLiteParser#type_name. 336 | def exitType_name(self, ctx): 337 | pass 338 | 339 | 340 | # Enter a parse tree produced by SQLiteParser#column_constraint. 341 | def enterColumn_constraint(self, ctx): 342 | pass 343 | 344 | # Exit a parse tree produced by SQLiteParser#column_constraint. 345 | def exitColumn_constraint(self, ctx): 346 | pass 347 | 348 | 349 | # Enter a parse tree produced by SQLiteParser#conflict_clause. 350 | def enterConflict_clause(self, ctx): 351 | pass 352 | 353 | # Exit a parse tree produced by SQLiteParser#conflict_clause. 354 | def exitConflict_clause(self, ctx): 355 | pass 356 | 357 | 358 | # Enter a parse tree produced by SQLiteParser#expr. 359 | def enterExpr(self, ctx): 360 | pass 361 | 362 | # Exit a parse tree produced by SQLiteParser#expr. 363 | def exitExpr(self, ctx): 364 | pass 365 | 366 | 367 | # Enter a parse tree produced by SQLiteParser#foreign_key_clause. 368 | def enterForeign_key_clause(self, ctx): 369 | pass 370 | 371 | # Exit a parse tree produced by SQLiteParser#foreign_key_clause. 372 | def exitForeign_key_clause(self, ctx): 373 | pass 374 | 375 | 376 | # Enter a parse tree produced by SQLiteParser#raise_function. 377 | def enterRaise_function(self, ctx): 378 | pass 379 | 380 | # Exit a parse tree produced by SQLiteParser#raise_function. 381 | def exitRaise_function(self, ctx): 382 | pass 383 | 384 | 385 | # Enter a parse tree produced by SQLiteParser#indexed_column. 386 | def enterIndexed_column(self, ctx): 387 | pass 388 | 389 | # Exit a parse tree produced by SQLiteParser#indexed_column. 390 | def exitIndexed_column(self, ctx): 391 | pass 392 | 393 | 394 | # Enter a parse tree produced by SQLiteParser#table_constraint. 395 | def enterTable_constraint(self, ctx): 396 | pass 397 | 398 | # Exit a parse tree produced by SQLiteParser#table_constraint. 399 | def exitTable_constraint(self, ctx): 400 | pass 401 | 402 | 403 | # Enter a parse tree produced by SQLiteParser#with_clause. 404 | def enterWith_clause(self, ctx): 405 | pass 406 | 407 | # Exit a parse tree produced by SQLiteParser#with_clause. 408 | def exitWith_clause(self, ctx): 409 | pass 410 | 411 | 412 | # Enter a parse tree produced by SQLiteParser#qualified_table_name. 413 | def enterQualified_table_name(self, ctx): 414 | pass 415 | 416 | # Exit a parse tree produced by SQLiteParser#qualified_table_name. 417 | def exitQualified_table_name(self, ctx): 418 | pass 419 | 420 | 421 | # Enter a parse tree produced by SQLiteParser#ordering_term. 422 | def enterOrdering_term(self, ctx): 423 | pass 424 | 425 | # Exit a parse tree produced by SQLiteParser#ordering_term. 426 | def exitOrdering_term(self, ctx): 427 | pass 428 | 429 | 430 | # Enter a parse tree produced by SQLiteParser#pragma_value. 431 | def enterPragma_value(self, ctx): 432 | pass 433 | 434 | # Exit a parse tree produced by SQLiteParser#pragma_value. 435 | def exitPragma_value(self, ctx): 436 | pass 437 | 438 | 439 | # Enter a parse tree produced by SQLiteParser#common_table_expression. 440 | def enterCommon_table_expression(self, ctx): 441 | pass 442 | 443 | # Exit a parse tree produced by SQLiteParser#common_table_expression. 444 | def exitCommon_table_expression(self, ctx): 445 | pass 446 | 447 | 448 | # Enter a parse tree produced by SQLiteParser#result_column. 449 | def enterResult_column(self, ctx): 450 | pass 451 | 452 | # Exit a parse tree produced by SQLiteParser#result_column. 453 | def exitResult_column(self, ctx): 454 | pass 455 | 456 | 457 | # Enter a parse tree produced by SQLiteParser#table_or_subquery. 458 | def enterTable_or_subquery(self, ctx): 459 | pass 460 | 461 | # Exit a parse tree produced by SQLiteParser#table_or_subquery. 462 | def exitTable_or_subquery(self, ctx): 463 | pass 464 | 465 | 466 | # Enter a parse tree produced by SQLiteParser#join_clause. 467 | def enterJoin_clause(self, ctx): 468 | pass 469 | 470 | # Exit a parse tree produced by SQLiteParser#join_clause. 471 | def exitJoin_clause(self, ctx): 472 | pass 473 | 474 | 475 | # Enter a parse tree produced by SQLiteParser#join_operator. 476 | def enterJoin_operator(self, ctx): 477 | pass 478 | 479 | # Exit a parse tree produced by SQLiteParser#join_operator. 480 | def exitJoin_operator(self, ctx): 481 | pass 482 | 483 | 484 | # Enter a parse tree produced by SQLiteParser#join_constraint. 485 | def enterJoin_constraint(self, ctx): 486 | pass 487 | 488 | # Exit a parse tree produced by SQLiteParser#join_constraint. 489 | def exitJoin_constraint(self, ctx): 490 | pass 491 | 492 | 493 | # Enter a parse tree produced by SQLiteParser#select_core. 494 | def enterSelect_core(self, ctx): 495 | pass 496 | 497 | # Exit a parse tree produced by SQLiteParser#select_core. 498 | def exitSelect_core(self, ctx): 499 | pass 500 | 501 | 502 | # Enter a parse tree produced by SQLiteParser#compound_operator. 503 | def enterCompound_operator(self, ctx): 504 | pass 505 | 506 | # Exit a parse tree produced by SQLiteParser#compound_operator. 507 | def exitCompound_operator(self, ctx): 508 | pass 509 | 510 | 511 | # Enter a parse tree produced by SQLiteParser#cte_table_name. 512 | def enterCte_table_name(self, ctx): 513 | pass 514 | 515 | # Exit a parse tree produced by SQLiteParser#cte_table_name. 516 | def exitCte_table_name(self, ctx): 517 | pass 518 | 519 | 520 | # Enter a parse tree produced by SQLiteParser#signed_number. 521 | def enterSigned_number(self, ctx): 522 | pass 523 | 524 | # Exit a parse tree produced by SQLiteParser#signed_number. 525 | def exitSigned_number(self, ctx): 526 | pass 527 | 528 | 529 | # Enter a parse tree produced by SQLiteParser#literal_value. 530 | def enterLiteral_value(self, ctx): 531 | pass 532 | 533 | # Exit a parse tree produced by SQLiteParser#literal_value. 534 | def exitLiteral_value(self, ctx): 535 | pass 536 | 537 | 538 | # Enter a parse tree produced by SQLiteParser#unary_operator. 539 | def enterUnary_operator(self, ctx): 540 | pass 541 | 542 | # Exit a parse tree produced by SQLiteParser#unary_operator. 543 | def exitUnary_operator(self, ctx): 544 | pass 545 | 546 | 547 | # Enter a parse tree produced by SQLiteParser#error_message. 548 | def enterError_message(self, ctx): 549 | pass 550 | 551 | # Exit a parse tree produced by SQLiteParser#error_message. 552 | def exitError_message(self, ctx): 553 | pass 554 | 555 | 556 | # Enter a parse tree produced by SQLiteParser#module_argument. 557 | def enterModule_argument(self, ctx): 558 | pass 559 | 560 | # Exit a parse tree produced by SQLiteParser#module_argument. 561 | def exitModule_argument(self, ctx): 562 | pass 563 | 564 | 565 | # Enter a parse tree produced by SQLiteParser#column_alias. 566 | def enterColumn_alias(self, ctx): 567 | pass 568 | 569 | # Exit a parse tree produced by SQLiteParser#column_alias. 570 | def exitColumn_alias(self, ctx): 571 | pass 572 | 573 | 574 | # Enter a parse tree produced by SQLiteParser#keyword. 575 | def enterKeyword(self, ctx): 576 | pass 577 | 578 | # Exit a parse tree produced by SQLiteParser#keyword. 579 | def exitKeyword(self, ctx): 580 | pass 581 | 582 | 583 | # Enter a parse tree produced by SQLiteParser#name. 584 | def enterName(self, ctx): 585 | pass 586 | 587 | # Exit a parse tree produced by SQLiteParser#name. 588 | def exitName(self, ctx): 589 | pass 590 | 591 | 592 | # Enter a parse tree produced by SQLiteParser#function_name. 593 | def enterFunction_name(self, ctx): 594 | pass 595 | 596 | # Exit a parse tree produced by SQLiteParser#function_name. 597 | def exitFunction_name(self, ctx): 598 | pass 599 | 600 | 601 | # Enter a parse tree produced by SQLiteParser#database_name. 602 | def enterDatabase_name(self, ctx): 603 | pass 604 | 605 | # Exit a parse tree produced by SQLiteParser#database_name. 606 | def exitDatabase_name(self, ctx): 607 | pass 608 | 609 | 610 | # Enter a parse tree produced by SQLiteParser#table_name. 611 | def enterTable_name(self, ctx): 612 | pass 613 | 614 | # Exit a parse tree produced by SQLiteParser#table_name. 615 | def exitTable_name(self, ctx): 616 | pass 617 | 618 | 619 | # Enter a parse tree produced by SQLiteParser#table_or_index_name. 620 | def enterTable_or_index_name(self, ctx): 621 | pass 622 | 623 | # Exit a parse tree produced by SQLiteParser#table_or_index_name. 624 | def exitTable_or_index_name(self, ctx): 625 | pass 626 | 627 | 628 | # Enter a parse tree produced by SQLiteParser#new_table_name. 629 | def enterNew_table_name(self, ctx): 630 | pass 631 | 632 | # Exit a parse tree produced by SQLiteParser#new_table_name. 633 | def exitNew_table_name(self, ctx): 634 | pass 635 | 636 | 637 | # Enter a parse tree produced by SQLiteParser#column_name. 638 | def enterColumn_name(self, ctx): 639 | pass 640 | 641 | # Exit a parse tree produced by SQLiteParser#column_name. 642 | def exitColumn_name(self, ctx): 643 | pass 644 | 645 | 646 | # Enter a parse tree produced by SQLiteParser#collation_name. 647 | def enterCollation_name(self, ctx): 648 | pass 649 | 650 | # Exit a parse tree produced by SQLiteParser#collation_name. 651 | def exitCollation_name(self, ctx): 652 | pass 653 | 654 | 655 | # Enter a parse tree produced by SQLiteParser#foreign_table. 656 | def enterForeign_table(self, ctx): 657 | pass 658 | 659 | # Exit a parse tree produced by SQLiteParser#foreign_table. 660 | def exitForeign_table(self, ctx): 661 | pass 662 | 663 | 664 | # Enter a parse tree produced by SQLiteParser#index_name. 665 | def enterIndex_name(self, ctx): 666 | pass 667 | 668 | # Exit a parse tree produced by SQLiteParser#index_name. 669 | def exitIndex_name(self, ctx): 670 | pass 671 | 672 | 673 | # Enter a parse tree produced by SQLiteParser#trigger_name. 674 | def enterTrigger_name(self, ctx): 675 | pass 676 | 677 | # Exit a parse tree produced by SQLiteParser#trigger_name. 678 | def exitTrigger_name(self, ctx): 679 | pass 680 | 681 | 682 | # Enter a parse tree produced by SQLiteParser#view_name. 683 | def enterView_name(self, ctx): 684 | pass 685 | 686 | # Exit a parse tree produced by SQLiteParser#view_name. 687 | def exitView_name(self, ctx): 688 | pass 689 | 690 | 691 | # Enter a parse tree produced by SQLiteParser#module_name. 692 | def enterModule_name(self, ctx): 693 | pass 694 | 695 | # Exit a parse tree produced by SQLiteParser#module_name. 696 | def exitModule_name(self, ctx): 697 | pass 698 | 699 | 700 | # Enter a parse tree produced by SQLiteParser#pragma_name. 701 | def enterPragma_name(self, ctx): 702 | pass 703 | 704 | # Exit a parse tree produced by SQLiteParser#pragma_name. 705 | def exitPragma_name(self, ctx): 706 | pass 707 | 708 | 709 | # Enter a parse tree produced by SQLiteParser#savepoint_name. 710 | def enterSavepoint_name(self, ctx): 711 | pass 712 | 713 | # Exit a parse tree produced by SQLiteParser#savepoint_name. 714 | def exitSavepoint_name(self, ctx): 715 | pass 716 | 717 | 718 | # Enter a parse tree produced by SQLiteParser#table_alias. 719 | def enterTable_alias(self, ctx): 720 | pass 721 | 722 | # Exit a parse tree produced by SQLiteParser#table_alias. 723 | def exitTable_alias(self, ctx): 724 | pass 725 | 726 | 727 | # Enter a parse tree produced by SQLiteParser#transaction_name. 728 | def enterTransaction_name(self, ctx): 729 | pass 730 | 731 | # Exit a parse tree produced by SQLiteParser#transaction_name. 732 | def exitTransaction_name(self, ctx): 733 | pass 734 | 735 | 736 | # Enter a parse tree produced by SQLiteParser#any_name. 737 | def enterAny_name(self, ctx): 738 | pass 739 | 740 | # Exit a parse tree produced by SQLiteParser#any_name. 741 | def exitAny_name(self, ctx): 742 | pass 743 | 744 | 745 | -------------------------------------------------------------------------------- /sql4pandas/__init__.py: -------------------------------------------------------------------------------- 1 | from sql4pandas import PandasCursor 2 | __all__ = [PandasCursor] 3 | -------------------------------------------------------------------------------- /sql4pandas/sql4pandas.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from sqlparser import SQLParser 3 | 4 | 5 | class PandasCursor (object): 6 | """takes a dictionary of pandas dataframes as an argument""" 7 | def __init__(self, dfs): 8 | self.db = dfs 9 | self._curr_val = None 10 | 11 | def execute(self, statement, *args, **kwargs): 12 | 13 | def _execute(parsed): 14 | 15 | def id_dict(identifiers): 16 | """translate dictionary of string identifiers used into 17 | usable dictionary to pass to numexpr""" 18 | _dict = {} 19 | for idx, (col, fn) in identifiers.iteritems(): 20 | if fn is None: 21 | _dict[idx] = self._curr_val[col] 22 | else: 23 | _dict[idx] = self._curr_val[col][fn] 24 | return _dict 25 | 26 | def _single_identifier(identifier): 27 | """need to check if there is only one table with this 28 | column name, if so append that table, if not 29 | raise ambigous column name error""" 30 | matches = \ 31 | filter(lambda x: identifier == x.split('.')[1], 32 | self._curr_val.columns) 33 | if len(matches) == 1: 34 | return matches[0] 35 | else: 36 | raise ValueError('Ambigous or non-exsistant column name: %s' 37 | % identifier) 38 | 39 | def _alias(alias, col, fn): 40 | if col is None: 41 | self._curr_val[alias] = \ 42 | self._curr_val[_single_identifier(alias)] 43 | elif fn is None: 44 | self._curr_val[alias] = self._curr_val[col] 45 | else: 46 | self._curr_val[alias] = self._curr_val[col][fn] 47 | 48 | def _get_val(col, fn): 49 | if fn is not None: 50 | return self._curr_val[col][fn] 51 | else: 52 | return self._curr_val[col] 53 | 54 | def _operation(op): 55 | as_name, expr = op['as_name'], op['expr'] 56 | ev_str, identifiers = expr 57 | col = pd.eval(ev_str, local_dict=id_dict(identifiers)) 58 | self._curr_val[as_name] = col 59 | 60 | def _case(case): 61 | as_name, else_stmt, stmts = \ 62 | case['as_name'], case.get('else_stmt', None), case['stmts'] 63 | 64 | # make a copy of a column in the data frame and use it as a base 65 | col = self._curr_val.iloc[:, 0].copy() 66 | if else_stmt is not None: 67 | else_val = _get_val(*else_stmt) 68 | col.loc[:] = else_val 69 | else: 70 | # default to NULL as no else val specified 71 | col.loc[:] = None 72 | 73 | for (ev_str, identifiers), stmt in stmts: 74 | print ev_str 75 | idx = pd.eval(ev_str, local_dict=id_dict(identifiers)) 76 | val = _get_val(*stmt) 77 | col[idx] = val[idx] 78 | 79 | self._curr_val[as_name] = col 80 | 81 | def _select(identifiers): 82 | if identifiers is None or len(identifiers) == 0: 83 | return 84 | # first setup any aliases 85 | [_alias(alias, *val) for alias, val in aliases.iteritems()] 86 | 87 | ids = [] 88 | for col, fn in identifiers: 89 | if fn is None: 90 | idx = col 91 | else: 92 | idx = col+'_'+fn 93 | self._curr_val[idx] = self._curr_val[col][fn] 94 | ids.append(idx) 95 | self._curr_val = self._curr_val[ids] 96 | 97 | def _from(tbl): 98 | table, identifier = tbl 99 | self._curr_val = self.db[table].copy() 100 | # add identifier for table to column names 101 | self._curr_val.columns = \ 102 | [identifier + '.' + col for col in self._curr_val.columns] 103 | if len(joins) > 0: 104 | [_join(*j) for j in joins] 105 | # setup literal columns specified in select statement 106 | for identifier, value in literals.iteritems(): 107 | self._curr_val[identifier] = value 108 | 109 | def _join(right, how, left_on, right_on, right_identifier): 110 | right = self.db[right].copy() 111 | # need to make interchangable 112 | if left_on not in self._curr_val.columns: 113 | right_on, left_on = left_on, right_on 114 | right.columns = \ 115 | [right_identifier + '.' + col for col in right.columns] 116 | self._curr_val = \ 117 | self._curr_val.merge(right, how=how, left_on=left_on, 118 | right_on=right_on) 119 | 120 | def _where(cond): 121 | ev_str, identifiers = cond 122 | index = pd.eval(ev_str, local_dict=id_dict(identifiers)) 123 | self._curr_val = self._curr_val[index] 124 | 125 | def _apply_functions(funs, groupby=None): 126 | # dictionary that provides a mechanism to override functions, 127 | # functions are passed from SQL statment, in lowercase. set 128 | # functions name(lowercase) as key and then specify the function 129 | # to be run in on column 130 | overrides = { 131 | # 'isnull': (lambda x: x) just an example for now 132 | } 133 | funs = {k: [overrides.get(fn, fn) for fn in v] 134 | for k, v in funs.iteritems()} 135 | 136 | if groupby is None: 137 | # create a fake column which holds only one value, so 138 | # group will aggregate entire columns into one group 139 | fake_column = '####fake' 140 | self._curr_val[fake_column] = 0 141 | groupby = self._curr_val.groupby(fake_column) 142 | self._curr_val = groupby.agg(funs).reset_index() 143 | 144 | def _group(group_by): 145 | groupby = self._curr_val.groupby(group_by) 146 | if fns is not None: 147 | _apply_functions(fns, groupby) 148 | 149 | def _order(identifiers): 150 | self._curr_val.sort(identifiers, inplace=True) 151 | 152 | sections = {'SELECT': _select, 'FROM': _from, 153 | 'WHERE': _where, 'GROUP': _group, 154 | 'ORDER': _order} 155 | 156 | # dictionary to store functions and arguments to functions 157 | # needed to execute in proper SQL order of operations 158 | _exec = {} 159 | temp_tables = [] 160 | 161 | for k, v in parsed.iteritems(): 162 | if k == 'NESTED_QUERIES': 163 | for ident, query in v.iteritems(): 164 | _execute(query) 165 | self.db[ident] = self.fetchall() 166 | self.db[ident].columns = \ 167 | [col.split('.')[1] for col in self.db[ident].columns] 168 | temp_tables.append(ident) 169 | elif k in sections.keys(): 170 | _exec[k] = sections[k], v 171 | 172 | fns, joins, aliases, cases, ops = \ 173 | [parsed.get(x, [] if x == 'JOINS' else {}) 174 | for x in 'FUNCTIONS', 'JOINS', 'ALIASES', 'CASES', 'OPS'] 175 | literals = parsed.get('LITERALS', {}) 176 | 177 | # execute statement in proper SQL order. ORDER is set before SELECT 178 | # for our use case as we may need to sort by a column before it is 179 | # filtered out in SELECT statement 180 | for keyword in 'FROM', 'WHERE', 'GROUP', 'ORDER', 'SELECT': 181 | _ops = ops.get(keyword, []) 182 | if len(_ops) > 0: 183 | # setup any operations at the correct part of evaluation 184 | [_operation(op) for op in _ops] 185 | _cases = cases.get(keyword, []) 186 | if len(_cases) > 0: 187 | # setup any case statements at the correct part of evaluation 188 | [_case(case) for case in _cases] 189 | fn, args = _exec.get(keyword, (None, None)) 190 | if fn is not None: 191 | fn(args) 192 | elif keyword == 'GROUP' and len(fns) > 0: 193 | # we need to do any aggregating at this point in the query, 194 | # even if not grouping 195 | _apply_functions(fns) 196 | 197 | into = parsed.get('INTO', None) 198 | if into is not None: 199 | self.db[into] = self._curr_val 200 | self._curr_val = None 201 | 202 | # clearout any temporary tables before next statement is executed 203 | for x in temp_tables: 204 | del self.db[x] 205 | 206 | parser = SQLParser() 207 | _execute(parser.parse_statement(statement)) 208 | 209 | def fetchall(self): 210 | return self._curr_val 211 | 212 | def fetch_dicts(self): 213 | """convenience function to fetch objects as a list of dictionaries, 214 | good for JSON apis""" 215 | return self.fetchall().T.to_dict().values() 216 | -------------------------------------------------------------------------------- /sql4pandas/sqlparser.py: -------------------------------------------------------------------------------- 1 | from sqlparse import parse, tokens 2 | 3 | 4 | class SQLParser(object): 5 | """class used to parse sql statements into a data structure 6 | which can be used to execute the statement""" 7 | 8 | def parse_statement(self, statement): 9 | """converts a statement in string form to tokens and passes off to 10 | the parser""" 11 | 12 | def parse_tkns(tkns): 13 | """parse tokens into datastructure used to execute statement""" 14 | fns = {} 15 | joins = [] 16 | aliases = {} 17 | cases = {} 18 | ops = {} 19 | self.case_num = 0 20 | nested_queries = {} 21 | literals = {} 22 | 23 | # some helpers for determining a token's attributes when it isn't 24 | # completely straight forward 25 | is_identifier = lambda token: token._get_repr_name() == 'Identifier' 26 | is_case = lambda token: token._get_repr_name() == 'Case' 27 | is_function = lambda token: token._get_repr_name() == 'Function' 28 | is_comparison = lambda token: token._get_repr_name() == 'Comparison' 29 | is_operator = lambda token: token.ttype == tokens.Operator \ 30 | or token.ttype == tokens.Wildcard 31 | 32 | def strip_tkns(tkns, punctuation=None): 33 | """convenience function to remove whitespace tokens and comments 34 | from list, optionally also remove punctuation""" 35 | if punctuation is None: 36 | return [token for token in tkns if not token.is_whitespace() 37 | and token._get_repr_name() != 'Comment'] 38 | return [token for token in tkns if not token.is_whitespace() 39 | and token._get_repr_name() != 'Comment' 40 | and token.ttype != tokens.Token.Punctuation] 41 | 42 | def get_fns(tkns): 43 | """get a dictionary of all functions in statement, needed for 44 | order of operations with grouping and case statements""" 45 | for tkn in tkns: 46 | if tkn._get_repr_name() == 'Function': 47 | col, fn = sql_function(tkn) 48 | _fns = fns.get(col, []) 49 | if fn not in _fns: 50 | _fns.append(fn) 51 | fns[col] = _fns 52 | elif tkn.is_group(): 53 | get_fns(tkn.tokens) 54 | 55 | def col_identifier(token): 56 | if token.ttype in tokens.Literal: 57 | literals[token.value] = token.value 58 | return token.value, None 59 | tkns = token.tokens 60 | 61 | # strip whitespace and punctuation 62 | tkns = strip_tkns(tkns) 63 | if len(tkns) == 1: 64 | identifier = tkns[0].value 65 | if tkns[0].ttype in tokens.Literal: 66 | literals[identifier] = identifier 67 | # handle issue of ambigous column names through aliasing 68 | # for now, may be able to find a more efficient way in future 69 | aliases[identifier] = None, None 70 | return identifier, None 71 | 72 | # find the index of 'AS' in tkns 73 | as_idx = next((i for i, t in enumerate(tkns) 74 | if t.value.upper() == 'AS'), None) 75 | if as_idx is None: 76 | op_idx = next((i for i, t in enumerate(tkns) 77 | if is_operator(t)), None) 78 | if op_idx is None: 79 | return tkns[0].value + '.' + tkns[-1].value, None 80 | return operation(tkns) 81 | 82 | as_name = tkns[as_idx+1].value 83 | tkns = tkns[:as_idx] 84 | if len(tkns) == 1: 85 | # handle aliasing 86 | if tkns[0].ttype in tokens.Literal: 87 | literals[as_name] = tkns[0].value 88 | return as_name, None 89 | elif is_case(tkns[0]): 90 | return parse_case(tkns[0].tokens, as_name=as_name) 91 | elif is_identifier(tkns[0]): 92 | aliases[as_name] = col_identifier(tkns[0]), None 93 | elif is_function(tkns[0]): 94 | col, fn = sql_function(tkns[0]) 95 | aliases[as_name] = col, fn 96 | return as_name, None 97 | 98 | op_idx = next((i for i, t in enumerate(tkns) 99 | if is_operator(t)), None) 100 | if op_idx is None: 101 | # handle aliasing for special case where parser doesn't group 102 | # identifier properly 103 | aliases[as_name] = tkns[0].value + "." + tkns[-1].value, None 104 | return as_name, None 105 | return operation(tkns, as_name) 106 | 107 | def sql_function(token): 108 | tkns = token.tokens 109 | fn, parens = tkns 110 | col = parens.tokens[1] 111 | fn = fn.value.lower() 112 | col = col_identifier(col)[0] 113 | return col, fn 114 | 115 | def identifier_list(token): 116 | """used to parse sql identifiers into actual 117 | table/column groupings""" 118 | if is_identifier(token): 119 | return col_identifier(token) 120 | 121 | if is_function(token): 122 | return [sql_function(token)] 123 | 124 | if is_case(token): 125 | return parse_case(token) 126 | 127 | tkns = token.tokens 128 | if len(tkns) == 1: 129 | if is_function(tkns[0]): 130 | return sql_function(tkns[0]) 131 | return col_identifier(token) 132 | proc = [] 133 | # filter whitespace and punctuation 134 | for tkn in tkns: 135 | if is_identifier(tkn): 136 | proc.append(col_identifier(tkn)) 137 | elif is_case(tkn): 138 | proc.append(parse_case(tkn.tokens)) 139 | elif is_function(tkn): 140 | col, fn = sql_function(tkn) 141 | proc.append((col, fn)) 142 | elif not tkn.is_whitespace() \ 143 | and tkn.ttype != tokens.Punctuation: 144 | proc.append(col_identifier(tkn)) 145 | 146 | return proc 147 | 148 | def operation(tkns, as_name=None): 149 | """perform arithmetic operations""" 150 | # identifiers used in comparision, needed to work around issue 151 | # #83 of numexpr 152 | identifiers = {} 153 | 154 | if len(tkns) == 1: 155 | return col_identifier(tkns[0]) 156 | # get indicies in tkns where operators are 157 | op_indices = [i for i, t in enumerate(tkns) 158 | if is_operator(t)] 159 | # get operators 160 | operators = [t.value for t in tkns 161 | if is_operator(t)] 162 | # group other tokens around operators 163 | ids = [tkns[:op_indices[0]]] 164 | ids += [tkns[i1+1:i2] for i1, i2 165 | in zip(op_indices[:-1], op_indices[1:])] 166 | ids += [tkns[op_indices[-1]+1:]] 167 | 168 | def get_id(_id): 169 | if len(_id) > 1: 170 | return ''.join([t.value for t in _id]), None 171 | token = _id[0] 172 | if token._get_repr_name() == 'Parenthesis': 173 | # TODO: instead of just leveraging parsing, 174 | # pass parenthesis into numexpr for performance 175 | # gains 176 | return operation(token.tokens[1:-1]) 177 | if token._get_repr_name() == 'Integer': 178 | return token.value, None 179 | if is_function(token): 180 | return sql_function(token) 181 | elif token.is_group(): 182 | return col_identifier(token) 183 | 184 | ids = map(get_id, ids) 185 | cols = [(x if y is None else (x+'_'+y)).replace('.', '_') 186 | for x, y in ids] 187 | for _id, col in zip(ids, cols): 188 | try: 189 | # only add non-numbers to column identifiers dict 190 | float(col) 191 | except: 192 | identifiers[col] = _id 193 | expr = reduce(lambda x, (y, z): x+' '+y+' '+z, 194 | zip(operators, cols[1:]), cols[0]) 195 | 196 | # give auto-genereted name if no alias specified 197 | if as_name is None: 198 | as_name = ''.join(cols) 199 | op = {'as_name': as_name, 200 | 'expr': (expr, identifiers)} 201 | 202 | _ops = ops.get(curr_sect, []) 203 | _ops.append(op) 204 | ops[curr_sect] = _ops 205 | 206 | return as_name, None 207 | 208 | def comparison(comps, operators=None): 209 | # identifiers used in comparision, needed to work around issue #83 210 | identifiers = {} 211 | 212 | # need a counter for number of comparisons for variable names 213 | def comp_str(comp): 214 | comp_map = { 215 | '=': '==', 216 | '<>': '!=', 217 | } 218 | comp = strip_tkns(comp) 219 | assert len(comp) == 3 220 | col, comp, val = comp 221 | comp = comp_map.get(comp.value, comp.value) 222 | if is_function(col): 223 | col, fn = sql_function(col) 224 | col_str = (col+'_'+fn).replace('.', '_') 225 | identifiers[col_str] = col, fn 226 | elif col.is_group(): 227 | col = col_identifier(col)[0] 228 | col_str = col.replace('.', '_') 229 | identifiers[col_str] = col, None 230 | if val.is_group(): 231 | val = col_identifier(val)[0] 232 | identifiers[val.replace('.', '_')] = val, None 233 | else: 234 | val = val.value 235 | val_str = val.replace('.', '_') 236 | return """({col} {comp} {val})""".format(col=col_str, 237 | comp=comp, 238 | val=val_str) 239 | 240 | comp = comps[0] 241 | ev_str = comp_str(comp) 242 | if operators is not None: 243 | for comp, op in zip(comps[1:], operators): 244 | # build string to eventually evaluate 245 | if op == 'AND': 246 | ev_str += " & " + comp_str(comp) 247 | elif op == 'OR': 248 | ev_str += " | " + comp_str(comp) 249 | 250 | return ev_str, identifiers 251 | 252 | def parse_case(tkns, as_name=None): 253 | def get_stmt(token): 254 | if is_function(token): 255 | return sql_function(token) 256 | else: 257 | return col_identifier(token) 258 | 259 | # give auto-genereted name if no alias specified 260 | if as_name is None: 261 | self.case_num += 1 262 | as_name = 'case' + str(self.case_num) 263 | case = {'as_name': as_name, 264 | 'stmts': []} 265 | # remove whitespace from tokens 266 | tkns = strip_tkns(tkns) 267 | # need to parse backwards for proper order of operations 268 | for i, token in reversed(list(enumerate(tkns))): 269 | # stop at CASE as we are looping in reverse so will 270 | # be starting at END 271 | if token.ttype == tokens.Keyword.CASE: 272 | break 273 | elif tkns[i-1].value == 'ELSE': 274 | case['else_stmt'] = get_stmt(token) 275 | elif tkns[i-1].value == 'THEN': 276 | stmt = get_stmt(token) 277 | elif is_comparison(token): 278 | if token.is_group(): 279 | cond = comparison([token.tokens]) 280 | else: 281 | cond = comparison([[tkns[i-1], token, 282 | tkns[i+1]]]) 283 | case['stmts'].append((cond, stmt)) 284 | 285 | _cases = cases.get(curr_sect, []) 286 | _cases.append(case) 287 | cases[curr_sect] = _cases 288 | return as_name, None 289 | 290 | def parse_select(tkns): 291 | identifiers = [] 292 | tkns = strip_tkns(tkns) 293 | for i, token in enumerate(tkns): 294 | if token.ttype is tokens.Wildcard: 295 | return 296 | elif is_identifier(token): 297 | identifiers = [col_identifier(token)] 298 | elif token.is_group(): 299 | identifiers = identifier_list(token) 300 | return identifiers 301 | 302 | def parse_into(tkns): 303 | for token in tkns: 304 | if is_identifier(token): 305 | return token.value 306 | 307 | def tbl_identifier(tkns): 308 | """returns identifier as tuple of 309 | tablename, identifier""" 310 | if len(tkns) == 1: 311 | return (tkns[0].value,) * 2 312 | return tkns[0].value, tkns[-1].value 313 | 314 | def parse_from(tkns): 315 | how = None 316 | for i, token in enumerate(tkns): 317 | if token._get_repr_name() == 'Parenthesis': 318 | table, identifier = tbl_identifier(tkns[i+1].tokens) 319 | table = '###temp_' + table 320 | nested = parse_tkns(token.tokens[1:-1]) 321 | nested_queries[table] = nested 322 | # remove next token from list as it is already processed 323 | del tkns[i+1] 324 | elif token.is_group(): 325 | table, identifier = tbl_identifier(token.tokens) 326 | elif 'JOIN' in token.value: 327 | how = token.value.split()[0].lower() 328 | break 329 | if how is not None: 330 | parse_join(tkns[i+1:], how) 331 | 332 | return table, identifier 333 | 334 | def parse_join(tkns, how): 335 | for i, token in enumerate(tkns): 336 | if 'JOIN' in token.value: 337 | how_new = token.value.split()[0].lower() 338 | parse_join(tkns[i+1:], how_new) 339 | break 340 | elif token._get_repr_name() == 'Parenthesis': 341 | right, right_identifier = tbl_identifier(tkns[i+1].tokens) 342 | right = '###temp_' + right 343 | nested = parse_tkns(token.tokens[1:-1]) 344 | nested_queries[right] = nested 345 | # remove next token from list as it is already processed 346 | del tkns[i+1] 347 | elif is_comparison(token): 348 | left_on = col_identifier(token.tokens[0])[0] 349 | right_on = col_identifier(token.tokens[-1])[0] 350 | elif token.is_group(): 351 | right, right_identifier = tbl_identifier(token.tokens) 352 | joins.append((right, how, left_on, right_on, right_identifier)) 353 | 354 | def parse_where(tkns): 355 | # list of boolean indices to apply to current value 356 | comps = [token.tokens for token in tkns if is_comparison(token)] 357 | operators = [token.value for token in tkns 358 | if token.value in ('AND', 'OR')] 359 | return comparison(comps, operators) 360 | 361 | def parse_group(tkns): 362 | for tkn in tkns: 363 | if tkn.is_group(): 364 | group_by = zip(*identifier_list(tkn))[0] 365 | return group_by 366 | 367 | def parse_order(tkns): 368 | for token in tkns: 369 | if token.is_group(): 370 | identifiers = identifier_list(token) 371 | return identifiers 372 | 373 | sections = {'SELECT': parse_select, 374 | 'INTO': parse_into, 375 | 'FROM': parse_from, 376 | 'WHERE': parse_where, 377 | 'GROUP': parse_group, 378 | 'ORDER': parse_order} 379 | 380 | # remove whitespace from tokens 381 | tkns = strip_tkns(tkns) 382 | 383 | _parsed = {} 384 | for i, token in enumerate(tkns): 385 | if i == 0: 386 | start = 0 387 | curr_sect = token.value.upper() 388 | continue 389 | if token._get_repr_name().upper() == 'WHERE': 390 | _parsed[curr_sect] = sections[curr_sect](tkns[start:i]) 391 | # start next category of statement 392 | curr_sect = 'WHERE' 393 | _parsed['WHERE'] = sections['WHERE'](token.tokens) 394 | continue 395 | if token.value.upper() in sections.keys() \ 396 | and token.ttype in tokens.Keyword: 397 | if curr_sect != 'WHERE': 398 | _parsed[curr_sect] = sections[curr_sect](tkns[start:i]) 399 | # start next category of statement 400 | start = i 401 | curr_sect = token.value.upper() 402 | 403 | # add in last section 404 | if curr_sect != 'WHERE': 405 | _parsed[curr_sect] = sections[curr_sect](tkns[start:]) 406 | 407 | get_fns(tkns) 408 | _parsed['FUNCTIONS'] = fns 409 | _parsed['JOINS'] = joins 410 | _parsed['ALIASES'] = aliases 411 | _parsed['CASES'] = cases 412 | _parsed['NESTED_QUERIES'] = nested_queries 413 | _parsed['OPS'] = ops 414 | _parsed['LITERALS'] = literals 415 | return _parsed 416 | 417 | tkns = parse(statement)[0].tokens 418 | return parse_tkns(tkns) 419 | -------------------------------------------------------------------------------- /sql4pandas/tests.py: -------------------------------------------------------------------------------- 1 | from sql4pandas import PandasCursor 2 | import pandas as pd 3 | import numpy as np 4 | import unittest 5 | 6 | 7 | # # unit tests 8 | # class Tests(unittest.TestCase): 9 | 10 | # def testOne(self): 11 | # self.failUnless(IsOdd(1)) 12 | 13 | # def testTwo(self): 14 | # self.failIf(IsOdd(2)) 15 | 16 | # if __name__ == '__main__': 17 | # unittest.main() 18 | 19 | if __name__ == "__main__": 20 | 21 | tbl1 = pd.DataFrame(np.random.randn(1000, 5) * 50, 22 | columns=['a', 'b', 'c', 'd', 'e']) 23 | tbl1['f'] = 'five' 24 | tbl2 = tbl1.copy() 25 | # tbl2 *= 0.7 26 | 27 | db = {'tbl1': tbl1, 'tbl2': tbl2} 28 | crs = PandasCursor(db) 29 | 30 | 31 | crs.execute("""SELECT 5, 'testing', 5 + 5 as ten, tbl1.e as e 32 | INTO random_table 33 | from tbl1""") 34 | print crs.fetchall() 35 | crs.execute("""SELECT * FROM random_table""") 36 | print crs.fetchall() 37 | crs.execute("""SELECT 5, 'test', 5 + 5 as ten, tbl1.e as e from tbl1""") 38 | print crs.fetchall() 39 | crs.execute("""SELECT 5 as five, 'test' as test, 5 + 5 as ten, tbl1.e as e 40 | from tbl1""") 41 | print crs.fetchall() 42 | crs.execute(""" SELECT 43 | CASE 44 | WHEN tbl1.f = 'five' 45 | THEN 'test' 46 | ELSE tbl1.a 47 | END as case 48 | FROM tbl1 49 | """) 50 | print crs.fetchall() 51 | crs.execute("""SELECT SUM(tbl1.a), SUM(tbl1.b), SUM(tbl1.a) + SUM(tbl1.b) 52 | FROM tbl1""") 53 | print crs.fetchall() 54 | crs.execute("""SELECT 55 | tbl1.e, tbl1.b, tbl1.a, 56 | ((tbl1.e + tbl1.b) / tbl1.a) * 10 as eb, 57 | (tbl1.e + tbl1.b) / tbl1.a as ba 58 | FROM tbl1""") 59 | print crs.fetchall() 60 | crs.execute("""SELECT tbl1.e, tbl1.b, tbl1.e + tbl1.b as eb 61 | FROM tbl1""") 62 | print crs.fetchall() 63 | crs.execute("""SELECT SUM(tbl1.e) FROM tbl1""") 64 | # print crs.fetchall() 65 | crs.execute("""SELECT 66 | CASE 67 | WHEN tbl.a < 5 68 | THEN tbl2.e 69 | ELSE tbl.a 70 | END as case1, tbl2.b as randomness 71 | FROM (SELECT tbl1.a, tbl1.b 72 | FROM tbl1 73 | WHERE tbl1.a > 5) tbl 74 | LEFT JOIN 75 | (SELECT tbl2.a, tbl2.e, tbl2.b 76 | FROM tbl2 77 | WHERE tbl2.a < 5) tbl2 78 | ON tbl.b = tbl2.b""") 79 | print crs.fetchall() 80 | 81 | crs.execute("""SELECT tbl2.a, tbl1.b 82 | FROM tbl2 83 | LEFT JOIN tbl1 84 | ON tbl2.e = tbl1.e 85 | WHERE tbl1.a > 0 AND tbl2.b < 0 86 | """) 87 | print crs.fetchall() 88 | crs.execute("""SELECT SUM(tbl1.e) 89 | FROM tbl2 90 | LEFT JOIN tbl1 91 | ON tbl2.e = tbl1.e 92 | WHERE tbl1.a > 0 AND tbl2.b < 0 93 | GROUP BY tbl1.a, tbl2.b 94 | """) 95 | print crs.fetchall() 96 | 97 | def test(): 98 | crs.execute("""SELECT e FROM tbl1""") 99 | print crs.fetchall() 100 | crs.execute("""SELECT tbl2.e as test 101 | FROM tbl1 102 | INNER JOIN tbl2 103 | ON tbl2.a = tbl1.a 104 | WHERE tbl2.a > 7""", 'test', 7) 105 | print crs.fetchall() 106 | crs.execute("""SELECT 107 | CASE 108 | WHEN SUM(tbl1.e) > 0 109 | THEN SUM(tbl1.e) 110 | ELSE SUM(tbl2.a) 111 | END AS rand, 112 | MIN(tbl1.b) as min, 113 | CASE 114 | WHEN MIN(tbl1.c) < 0 115 | THEN MIN(tbl1.c) 116 | WHEN MAX(tbl2.b) > 0 117 | THEN MAX(tbl1.e) 118 | ELSE SUM(tbl1.b) 119 | END as crazy 120 | FROM tbl2 121 | LEFT JOIN tbl1 122 | ON tbl2.e = tbl1.e 123 | WHERE tbl1.a > 0 AND tbl2.b < 0 124 | GROUP BY tbl1.a, tbl2.b 125 | ORDER BY SUM(tbl1.d)""") 126 | print crs.fetchall() 127 | crs.execute("""SELECT 128 | CASE 129 | WHEN tbl1.e > 0 130 | THEN tbl1.e 131 | ELSE tbl2.a 132 | END, tbl1.b 133 | FROM tbl2 134 | LEFT JOIN tbl1 135 | ON tbl2.e = tbl1.e 136 | WHERE tbl1.a > 0 AND tbl2.b < 0 137 | """) 138 | return crs.fetchall() 139 | 140 | testing = False 141 | if testing: 142 | tests = 100 143 | from timeit import Timer 144 | t = Timer(test) 145 | print '***me' 146 | print t.timeit(number=tests) 147 | print 'result' 148 | print test() 149 | else: 150 | print test() 151 | --------------------------------------------------------------------------------