/ Check-in [42af190f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the LEMON parser generator, provide reduce actions with access to the lookahead token.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 42af190f4f86ad60de02800054010fafd484ac86ca41e2a13799b2e583eea98c
User & Date: drh 2017-12-15 12:22:21
Context
2017-12-15
20:21
Enhance the "swarmvtab" extension. See header comments in ext/misc/unionvtab.c for details. check-in: 01c17365 user: dan tags: trunk
12:22
In the LEMON parser generator, provide reduce actions with access to the lookahead token. check-in: 42af190f user: drh tags: trunk
2017-12-13
23:47
In valueFromExpr() only generate a OOM fault if there have been no prior faults. check-in: 3765aaf7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/lempar.c.

   647    647   };
   648    648   
   649    649   static void yy_accept(yyParser*);  /* Forward Declaration */
   650    650   
   651    651   /*
   652    652   ** Perform a reduce action and the shift that must immediately
   653    653   ** follow the reduce.
          654  +**
          655  +** The yyLookahead and yyLookaheadToken parameters provide reduce actions
          656  +** access to the lookahead token (if any).  The yyLookahead will be YYNOCODE
          657  +** if the lookahead token has already been consumed.  As this procedure is
          658  +** only called from one place, optimizing compilers will in-line it, which
          659  +** means that the extra parameters have no performance impact.
   654    660   */
   655    661   static void yy_reduce(
   656    662     yyParser *yypParser,         /* The parser */
   657         -  unsigned int yyruleno        /* Number of the rule by which to reduce */
          663  +  unsigned int yyruleno,       /* Number of the rule by which to reduce */
          664  +  int yyLookahead,             /* Lookahead token, or YYNOCODE if none */
          665  +  ParseTOKENTYPE yyLookaheadToken  /* Value of the lookahead token */
   658    666   ){
   659    667     int yygoto;                     /* The next state */
   660    668     int yyact;                      /* The next action */
   661    669     yyStackEntry *yymsp;            /* The top of the parser's stack */
   662    670     int yysize;                     /* Amount to pop the stack */
   663    671     ParseARG_FETCH;
   664    672     yymsp = yypParser->yytos;
................................................................................
   849    857       if( yyact <= YY_MAX_SHIFTREDUCE ){
   850    858         yy_shift(yypParser,yyact,yymajor,yyminor);
   851    859   #ifndef YYNOERRORRECOVERY
   852    860         yypParser->yyerrcnt--;
   853    861   #endif
   854    862         yymajor = YYNOCODE;
   855    863       }else if( yyact <= YY_MAX_REDUCE ){
   856         -      yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
          864  +      yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
   857    865       }else{
   858    866         assert( yyact == YY_ERROR_ACTION );
   859    867         yyminorunion.yy0 = yyminor;
   860    868   #ifdef YYERRORSYMBOL
   861    869         int yymx;
   862    870   #endif
   863    871   #ifndef NDEBUG