diff options
author | drh <drh@noemail.net> | 2017-12-15 12:22:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-12-15 12:22:21 +0000 |
commit | 087316ceecb47f18f0f0eb750e7fc3273f50dcca (patch) | |
tree | 433601bbc78b12861a32898b27ea5cf1e8ffaa2f /tool/lempar.c | |
parent | 84a6c85c644981854e61ce9d9ebda5a9762ee27a (diff) | |
download | sqlite-087316ceecb47f18f0f0eb750e7fc3273f50dcca.tar.gz sqlite-087316ceecb47f18f0f0eb750e7fc3273f50dcca.zip |
In the LEMON parser generator, provide reduce actions with access to the
lookahead token.
FossilOrigin-Name: 42af190f4f86ad60de02800054010fafd484ac86ca41e2a13799b2e583eea98c
Diffstat (limited to 'tool/lempar.c')
-rw-r--r-- | tool/lempar.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tool/lempar.c b/tool/lempar.c index 37a589219..da81ddd4b 100644 --- a/tool/lempar.c +++ b/tool/lempar.c @@ -651,10 +651,18 @@ static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. */ static void yy_reduce( yyParser *yypParser, /* The parser */ - unsigned int yyruleno /* Number of the rule by which to reduce */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ ){ int yygoto; /* The next state */ int yyact; /* The next action */ @@ -853,7 +861,7 @@ void Parse( #endif yymajor = YYNOCODE; }else if( yyact <= YY_MAX_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE); + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); }else{ assert( yyact == YY_ERROR_ACTION ); yyminorunion.yy0 = yyminor; |