Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch parser-enhancements Excluding Merge-Ins
This is equivalent to a diff from 0557a179 to 09752e51
2015-11-10
| ||
12:41 | Change all parsers to use the standard "lempar.c" template in the tool/ folder and remove the customized lempar.c from src/, plus other compiler performance and space enhancements. (check-in: 0e7fb24a user: drh tags: trunk) | |
12:31 | Fix harmless compiler warnings in FTS5. (Closed-Leaf check-in: 09752e51 user: drh tags: parser-enhancements) | |
03:30 | Performance enhancement to the tokenizer. (check-in: 6ea2df86 user: drh tags: parser-enhancements) | |
2015-11-09
| ||
19:33 | Change the parser to use the standard "lempar.c" template over in the tool/ folder rather than the customized "lempar.c" found in src/. (check-in: 0a72991f user: drh tags: parser-enhancements) | |
15:06 | Avoid recursion in the yy_find_shift_action() routine of the Lemon-generated parser, so that routine can be inlined, for a size reduction and performance increase. (check-in: 0557a179 user: drh tags: trunk) | |
14:11 | Size reduction and performance improvement in the stack-popping logic of the Lemon-generated parser. (check-in: 9748c48a user: drh tags: trunk) | |
Changes to Makefile.in.
︙ | |||
641 642 643 644 645 646 647 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | - + - + | # Rule to build the amalgamation # sqlite3.lo: sqlite3.c $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c # Rules to build the LEMON compiler generator # |
︙ |
Changes to Makefile.msc.
︙ | |||
1306 1307 1308 1309 1310 1311 1312 | 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 | - - + + | # Rule to build the amalgamation # sqlite3.lo: $(SQLITE3C) $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C) # Rules to build the LEMON compiler generator # |
︙ |
Changes to ext/fts5/fts5_main.c.
︙ | |||
870 871 872 873 874 875 876 | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | - | static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){ Fts5Config *pConfig = pTab->pConfig; Fts5Sorter *pSorter; int nPhrase; int nByte; int rc = SQLITE_OK; |
︙ |
Changes to ext/fts5/fts5parse.y.
︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + + + + + + + + + + + + | #define YYNOERRORRECOVERY 1 /* ** Make yytestcase() the same as testcase() */ #define yytestcase(X) testcase(X) /* ** Indicate that sqlite3ParserFree() will never be called with a null ** pointer. */ #define YYPARSEFREENOTNULL 1 /* ** Alternative datatype for the argument to the malloc() routine passed ** into sqlite3ParserAlloc(). The default is size_t. */ #define YYMALLOCARGTYPE u64 } // end %include %left OR. %left AND. %left NOT. %left TERM. %left COLON. |
︙ | |||
164 165 166 167 168 169 170 | 176 177 178 179 180 181 182 | - - - - | /* ** Optional "*" character. */ %type star_opt {int} star_opt(A) ::= STAR. { A = 1; } star_opt(A) ::= . { A = 0; } |
Changes to main.mk.
︙ | |||
550 551 552 553 554 555 556 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | - + - + | tclsh $(TOP)/ext/fts2/mkfts2amal.tcl fts3amal.c: target_source $(TOP)/ext/fts3/mkfts3amal.tcl tclsh $(TOP)/ext/fts3/mkfts3amal.tcl # Rules to build the LEMON compiler generator # |
︙ |
Deleted src/lempar.c.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Changes to src/parse.y.
︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | + + + + + + + + + + + + | #define YYNOERRORRECOVERY 1 /* ** Make yytestcase() the same as testcase() */ #define yytestcase(X) testcase(X) /* ** Indicate that sqlite3ParserFree() will never be called with a null ** pointer. */ #define YYPARSEFREENOTNULL 1 /* ** Alternative datatype for the argument to the malloc() routine passed ** into sqlite3ParserAlloc(). The default is size_t. */ #define YYMALLOCARGTYPE u64 /* ** An instance of this structure holds information about the ** LIMIT clause of a SELECT statement. */ struct LimitVal { Expr *pLimit; /* The LIMIT expression. NULL if there is no limit */ Expr *pOffset; /* The OFFSET expression. NULL if there is none */ |
︙ | |||
635 636 637 638 639 640 641 | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | - | dbnm(A) ::= DOT nm(X). {A = X;} %type fullname {SrcList*} %destructor fullname {sqlite3SrcListDelete(pParse->db, $$);} fullname(A) ::= nm(X) dbnm(Y). {A = sqlite3SrcListAppend(pParse->db,0,&X,&Y);} %type joinop {int} |
︙ |
Changes to src/tokenize.c.
︙ | |||
365 366 367 368 369 370 371 | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | - - + + | } #endif default: { if( !IdChar(*z) ){ break; } for(i=1; IdChar(z[i]); i++){} |
︙ |
Changes to tool/lempar.c.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - - + + + + + + - - - - - - - - + + + + + + + - - - + + + + + + + + - + + + - - - - - - + + + + + + + + + - - - - - + + + + + - - - + + - - - - - + + + + + + - - - - + + + + + + + + + + - + + + + + + |
|
︙ | |||
127 128 129 130 131 132 133 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - + + + - - + + + + + + | ** yy_lookahead[] A table containing the lookahead for each entry in ** yy_action. Used to detect hash collisions. ** yy_shift_ofst[] For each state, the offset into yy_action for ** shifting terminals. ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. |
︙ | |||
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | + + + + + + + + + - + - + - - - - + + + + + + - + + + | yyTracePrompt, p->yystksz); } #endif } } #endif /* Datatype of the argument to the memory allocated passed as the ** second argument to ParseAlloc() below. This can be changed by ** putting an appropriate #define in the %include section of the input ** grammar. */ #ifndef YYMALLOCARGTYPE # define YYMALLOCARGTYPE size_t #endif /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like ** malloc. ** ** Inputs: ** A pointer to the function used to allocate memory. ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ |
︙ | |||
338 339 340 341 342 343 344 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | - + - - - + + + - - - - + + - - - - | yyTokenName[yytos->major]); } #endif yy_destructor(pParser, yytos->major, &yytos->minor); } /* |
︙ | |||
445 446 447 448 449 450 451 | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | - - - - | } }while(1); } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. |
︙ | |||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | + + | if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ %% /******** End %stack_overflow code ********************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ } /* ** Print tracing information for a SHIFT action */ #ifndef NDEBUG |
︙ | |||
518 519 520 521 522 523 524 | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | - + | } } #else # define yyTraceShift(X,Y) #endif /* |
︙ | |||
589 590 591 592 593 594 595 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | - - - - - - - - - - - - - - - - - + + | if( yyTraceFILE && yyruleno>=0 && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ yysize = yyRuleInfo[yyruleno].nrhs; fprintf(yyTraceFILE, "%sReduce [%s] -> state %d.\n", yyTracePrompt, yyRuleName[yyruleno], yymsp[-yysize].stateno); } #endif /* NDEBUG */ |
︙ | |||
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | + + + + + + | if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ %% /************ End %parse_failure code *****************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } #endif /* YYNOERRORRECOVERY */ /* ** The following code executes when a syntax error first occurs. */ static void yy_syntax_error( yyParser *yypParser, /* The parser */ int yymajor, /* The major type of the error token */ YYMINORTYPE yyminor /* The minor type of the error token */ ){ ParseARG_FETCH; #define TOKEN (yyminor.yy0) /************ Begin %syntax_error code ****************************************/ %% /************ End %syntax_error code ******************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ %% /*********** End %parse_accept code *******************************************/ ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "ParseAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is |
︙ |
Changes to tool/mkkeywordhash.c.
︙ | |||
273 274 275 276 277 278 279 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | - - + + - - - - - - - - - - - - - - - - - - - | { "WHEN", "TK_WHEN", ALWAYS }, { "WHERE", "TK_WHERE", ALWAYS }, }; /* Number of keywords */ static int nKeyword = (sizeof(aKeywordTable)/sizeof(aKeywordTable[0])); |
︙ | |||
343 344 345 346 347 348 349 | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - + | } /* ** This routine does the work. The generated code is printed on standard ** output. */ int main(int argc, char **argv){ |
︙ | |||
368 369 370 371 372 373 374 | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | - - + + | /* Fill in the lengths of strings and hashes for all entries. */ for(i=0; i<nKeyword; i++){ Keyword *p = &aKeywordTable[i]; p->len = (int)strlen(p->zName); assert( p->len<sizeof(p->zOrigName) ); memcpy(p->zOrigName, p->zName, p->len+1); totalLen += p->len; |
︙ | |||
477 478 479 480 481 482 483 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | - + | aKeywordTable[i].iNext = aHash[h]; aHash[h] = i+1; } /* Begin generating code */ printf("%s", zHdr); printf("/* Hash score: %d */\n", bestCount); |
︙ | |||
581 582 583 584 585 586 587 | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | - - + + - - - - - + + + + - + + + - + - + + + - + | printf("\n"); j = 0; } } printf("%s };\n", j==0 ? "" : "\n"); printf(" int h, i;\n"); |