From: helly Date: Fri, 8 Apr 2005 16:06:13 +0000 (+0000) Subject: - Fix [ 1022799 ] re2c scanner has buffering bug X-Git-Tag: 0.13.6~671 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98c8697f8b66c5f9e2ab8ff2aedd8934bbed57be;p=re2c - Fix [ 1022799 ] re2c scanner has buffering bug --- diff --git a/code.cc b/code.cc index 8375b991..fbf1229f 100644 --- a/code.cc +++ b/code.cc @@ -994,12 +994,12 @@ void DFA::emit(std::ostream &o) findSCCs(); head->link = head; - head->depth = maxDist(head); uint nRules = 0; for (s = head; s; s = s->next) { + s->depth = maxDist(s); if (s->rule && s->rule->accept >= nRules) { nRules = s->rule->accept + 1; diff --git a/test/c.c b/test/c.c index 8866e54c..e240f3d1 100644 --- a/test/c.c +++ b/test/c.c @@ -131,7 +131,7 @@ std: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = *YYCURSOR; @@ -826,7 +826,7 @@ yy131: yych = *++YYCURSOR; } yy132: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy133; yy133: switch(yych){ @@ -1014,7 +1014,7 @@ yy151: yyaccept = 3; } yy152: yyaccept = 0; YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy153; yy153: switch(yych){ @@ -1090,7 +1090,7 @@ yy159: switch(yych){ } yy160: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy161; yy161: switch(yych){ @@ -4032,7 +4032,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy343; -yy344: ++YYCURSOR; + ++YYCURSOR; yy343: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; diff --git a/test/cmmap.c b/test/cmmap.c index 00c9d764..9c9edea5 100644 --- a/test/cmmap.c +++ b/test/cmmap.c @@ -114,7 +114,7 @@ std: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = *YYCURSOR; @@ -809,7 +809,7 @@ yy131: yych = *++YYCURSOR; } yy132: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy133; yy133: switch(yych){ @@ -997,7 +997,7 @@ yy151: yyaccept = 3; } yy152: yyaccept = 0; YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy153; yy153: switch(yych){ @@ -1073,7 +1073,7 @@ yy159: switch(yych){ } yy160: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy161; yy161: switch(yych){ @@ -4015,7 +4015,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy343; -yy344: ++YYCURSOR; + ++YYCURSOR; yy343: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; diff --git a/test/cnokw.c b/test/cnokw.c index fcdd7285..cf5e2215 100644 --- a/test/cnokw.c +++ b/test/cnokw.c @@ -131,7 +131,7 @@ std: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = *YYCURSOR; @@ -745,7 +745,7 @@ yy116: yych = *++YYCURSOR; } yy117: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy118; yy118: switch(yych){ @@ -933,7 +933,7 @@ yy136: yyaccept = 3; } yy137: yyaccept = 0; YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy138; yy138: switch(yych){ @@ -1009,7 +1009,7 @@ yy144: switch(yych){ } yy145: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy146; yy146: switch(yych){ @@ -1300,7 +1300,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy170; -yy171: ++YYCURSOR; + ++YYCURSOR; yy170: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; diff --git a/test/cunroll.c b/test/cunroll.c index 4ae3cd05..80d36013 100644 --- a/test/cunroll.c +++ b/test/cunroll.c @@ -131,7 +131,7 @@ std: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = *YYCURSOR; @@ -806,7 +806,7 @@ yy116: yych = *++YYCURSOR; } yy117: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy118; yy118: switch(yych){ @@ -994,7 +994,7 @@ yy136: yyaccept = 3; } yy137: yyaccept = 0; YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy138; yy138: switch(yych){ @@ -1070,7 +1070,7 @@ yy144: switch(yych){ } yy145: yyaccept = 3; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy146; yy146: switch(yych){ @@ -1841,7 +1841,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy185; -yy186: ++YYCURSOR; + ++YYCURSOR; yy185: if((YYLIMIT - YYCURSOR) < 8) YYFILL(8); yych = *YYCURSOR; diff --git a/test/input1.c b/test/input1.c index d5156992..1bca641f 100644 --- a/test/input1.c +++ b/test/input1.c @@ -6,7 +6,7 @@ YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -27,7 +27,7 @@ yy3: yy4: yych = *++YYCURSOR; goto yy3; yy5: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy6; yy6: switch(yych){ diff --git a/test/input2.c b/test/input2.c index 70763826..6517d063 100644 --- a/test/input2.c +++ b/test/input2.c @@ -6,7 +6,7 @@ YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -15,7 +15,7 @@ yy0: default: goto yy2; } yy2:yy3: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy4; yy4: switch(yych){ diff --git a/test/input3.c b/test/input3.c index f3a80ae1..6e6b31bd 100644 --- a/test/input3.c +++ b/test/input3.c @@ -6,7 +6,7 @@ YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -15,7 +15,7 @@ yy0: default: goto yy2; } yy2:yy3: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy4; yy4: switch(yych){ diff --git a/test/modula.c b/test/modula.c index 485dcbec..015ba33d 100644 --- a/test/modula.c +++ b/test/modula.c @@ -68,7 +68,7 @@ std: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 15) YYFILL(15); yych = *YYCURSOR; @@ -3825,7 +3825,7 @@ yy276: #line 3769 "" yy277: yyaccept = 0; YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; goto yy278; yy278: switch(yych){ @@ -3886,7 +3886,7 @@ yy284: YYCURSOR -= 2; #line 3831 "" yy285: yyaccept = 2; YYMARKER = ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; goto yy286; yy286: switch(yych){ @@ -4040,7 +4040,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy299; -yy300: ++YYCURSOR; + ++YYCURSOR; yy299: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; diff --git a/test/repeater.c b/test/repeater.c index 95503f16..3996dcf7 100644 --- a/test/repeater.c +++ b/test/repeater.c @@ -20,7 +20,7 @@ char *q; YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; diff --git a/test/sample.c b/test/sample.c index 4d943e1c..a2bc6974 100644 --- a/test/sample.c +++ b/test/sample.c @@ -6,7 +6,7 @@ YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; diff --git a/test/scanner.c b/test/scanner.c index 438dc298..68535291 100644 --- a/test/scanner.c +++ b/test/scanner.c @@ -80,7 +80,7 @@ echo: YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; @@ -167,7 +167,7 @@ scan: YYCTYPE yych; unsigned int yyaccept; goto yy15; -yy16: ++YYCURSOR; + ++YYCURSOR; yy15: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -515,7 +515,7 @@ yy62: goto comment; } #line 439 "" yy63: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy64; yy64: switch(yych){ @@ -591,7 +591,7 @@ code: YYCTYPE yych; unsigned int yyaccept; goto yy74; -yy75: ++YYCURSOR; + ++YYCURSOR; yy74: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -697,7 +697,7 @@ comment: YYCTYPE yych; unsigned int yyaccept; goto yy93; -yy94: ++YYCURSOR; + ++YYCURSOR; yy93: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; diff --git a/test/simple.c b/test/simple.c index 5f254c6b..6c0a372a 100644 --- a/test/simple.c +++ b/test/simple.c @@ -14,7 +14,7 @@ char *q; YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR;