Menu

#13 underestimation of n in YYFILL(n)

closed-fixed
None
5
2005-11-02
2005-09-21
Anonymous
No

The scanner below fails to match "0.eL" if YYFILL(n) reads
exactly n characters (not more). Same (or similar) problem
with test/cnokw.re (if modified so that YYFILL(n) reads
exactly n characters), with input "0.e+1L".

I believe it is due to an underestimation of 'n' at
state yy00. Probably caused by a change that made
maxDist() to store its result with 't->depth = maxDist(t)'
and avoiding recalculation. It seems to conflict with
void calcDepth(State *head) marking non-key states
(with s->link = NULL) and calling maxDist in the same loop.
Moving the marking of non-key states to
another loop before doing the calculations appear to help:

E.g.:
// mark non-key states by s->link= NULL ;
for (dfa_state_t* s = head; s; s = s->next ){
if ( (s!=head)&&
!SCC::state_is_in_non_trivial_SCC(s) ){
s->link= NULL ;
}
}

// calculate max number of transitions before
guarantied to reach
// a key state.
for (dfa_state_t* s = head; s; s = s->dfa_state_next() ){
SCC::maxDist(s);
}

Affected versions:

0.9.1-6 from ubuntu hoary: no
0.9.9 yes
0.9.10 yes

----------------------------------------------
int scan(Scanner *s){
uchar *cursor = s->cur;
std:
s->tok = cursor;

/*!re2c
any = [\000-\377];

*/

/*!re2c

("0"* "." "e"? "L"?) |
("0"+ "." "e"? "L"?)
{ RET(FCON); }

"\n"
{
if(cursor == s->eof) RET(EOI);
s->pos = cursor; s->line++;
goto std;
}

any
{
RET(UNEXPECTED);
}
*/

}
-------------------------------------------------------

Discussion

  • Nobody/Anonymous

    example scanners

     
  • Marcus Börger

    Marcus Börger - 2005-09-27

    Logged In: YES
    user_id=271023

    It seems you analyzed this in more detail, could you perhaps
    create a patch also?

     
  • Marcus Börger

    Marcus Börger - 2005-10-26
    • assigned_to: nobody --> helly
     
  • Marcus Börger

    Marcus Börger - 2005-11-02
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB