diff options
author | drh <drh@noemail.net> | 2018-04-21 13:51:42 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-21 13:51:42 +0000 |
commit | fb32c44e41f9fba15f84dfca6e165a32fbb0e679 (patch) | |
tree | aca83b1b1effb5cc44ebcc0b7bbb4fb9126fe180 /src | |
parent | f3d7bbb767c2d225b816557ba0a86442650d1ae0 (diff) | |
download | sqlite-fb32c44e41f9fba15f84dfca6e165a32fbb0e679.tar.gz sqlite-fb32c44e41f9fba15f84dfca6e165a32fbb0e679.zip |
Add the %extra_context directive to lemon, as an alternative to %extra_argument.
Use this to improve the performance of the parser.
FossilOrigin-Name: be47a6f5262a43f477700579512fe7112a0872faedcbbe5c3383d13a08af6440
Diffstat (limited to 'src')
-rw-r--r-- | src/parse.y | 5 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/tokenize.c | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/parse.y b/src/parse.y index 7af0af55e..aca3bfb1c 100644 --- a/src/parse.y +++ b/src/parse.y @@ -24,8 +24,9 @@ %token_type {Token} %default_type {Token} -// The generated parser function takes a 4th argument as follows: -%extra_argument {Parse *pParse} +// An extra argument to the constructor for the parser, which is available +// to all actions. +%extra_context {Parse *pParse} // This code runs whenever there is a syntax error // diff --git a/src/sqliteInt.h b/src/sqliteInt.h index ccbf8467f..4a99a69ce 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4213,10 +4213,10 @@ char sqlite3IndexColumnAffinity(sqlite3*, Index*, int); ** The interface to the LEMON-generated parser */ #ifndef SQLITE_AMALGAMATION - void *sqlite3ParserAlloc(void*(*)(u64)); + void *sqlite3ParserAlloc(void*(*)(u64), Parse*); void sqlite3ParserFree(void*, void(*)(void*)); #endif -void sqlite3Parser(void*, int, Token, Parse*); +void sqlite3Parser(void*, int, Token); #ifdef YYTRACKMAXSTACKDEPTH int sqlite3ParserStackPeak(void*); #endif diff --git a/src/tokenize.c b/src/tokenize.c index e6da3fb54..b591d2223 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -496,9 +496,9 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ /* sqlite3ParserTrace(stdout, "parser: "); */ #ifdef sqlite3Parser_ENGINEALWAYSONSTACK pEngine = &sEngine; - sqlite3ParserInit(pEngine); + sqlite3ParserInit(pEngine, pParse); #else - pEngine = sqlite3ParserAlloc(sqlite3Malloc); + pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse); if( pEngine==0 ){ sqlite3OomFault(db); return SQLITE_NOMEM_BKPT; @@ -542,7 +542,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ }else{ pParse->sLastToken.z = zSql; pParse->sLastToken.n = n; - sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse); + sqlite3Parser(pEngine, tokenType, pParse->sLastToken); lastTokenParsed = tokenType; zSql += n; if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break; |