PS: There is another reason, aside from aesthetics and simpler grammar to filter white spaces inside the tokenizer: you avoid all the parser conflicts you could get with "empty | or space" rules.
2007/10/24, Gaspard Bucher <[EMAIL PROTECTED]>: > > Gaspard Bucher <[EMAIL PROTECTED]> wrote: > > > I do not understand why lemon waits for one more token when it has > > > enough information to reduce. > > > > > > I want to recognize : > > > foo = Bar() > > > when the token CLOSE_PAR is received, not when an extra token is parsed.. > > > > > > How can I avoid lemon waiting for the extra token before reducing ? > > > > > > > I don't think you can. Why do you want to? Why not just go > > ahead and send it the next token? > Most people find a way around this problem using white-space. This > could be a solution but then my grammar will be filled with > "white-space | nothing" rules and I thought Lemon could reduce when > there is no other way out of the current stack as it is more elegant. > I went into the sources and saw this comment: > > I think I might find something to do here: > in yy_find_shift_action : > when we find the action: > > // return yy_action[i]; > result = yy_action[i]; > printf("==> next : %i\n", result); > printf("==> next_next: %i\n", yy_shift_ofst[result % (YYNSTATE+YYNRULE)]); > // if the shift results in a default action do this action now. > if (result < (YYNSTATE+YYNRULE) && yy_shift_ofst[result] == > YY_SHIFT_USE_DFLT) { > // do the change ourself > > YYMINORTYPE yyminorunion; > yy_shift(pParser,result,iLookAhead,&yyminorunion); > pParser->yyerrcnt--; > return yy_default[result]; > } else > return result; > > This works except when the reduction reaches state '1'. Somehow, it > should jump directly to state '0', clearing the current lookahead. > > > -- > > D. Richard Hipp <[EMAIL PROTECTED]> > > > > > > ----------------------------------------------------------------------------- > > To unsubscribe, send email to [EMAIL PROTECTED] > > ----------------------------------------------------------------------------- > > > > > > !DSPAM:471f82d0320381804284693! > > > > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------