Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
redundant use of YYMARKER #61
Consider the following re2c source (1.re):
Build and grep YYMARKER and condition borders:
Condition c2 needs YYMARKER (it backups and restores YYCURSOR). Condition c1 doesn't need YYMARKER (it never restores YYCURSOR, but backups it).
With HEAD the bug emerges even without '-c':
Build and grep:
Note: It may be not so obvious that YYMARKER is redundant. One may think that re2c should have generated code that restores YYCURSOR (that the real error is not redundant backup, but the lack of restore). That's not true: in this case, though rules overlap, longer rule always succeeds (so there's no need to backup shorter rule match). When I say "longer rule always succeeds" I'm pretty aware that input string may end unexpectedly. In this case either YYFILL will supply enough characters for the longer rule to succeed or YYFILL will not return and the shorter rule match will be discarded anyway.
Original comment by: skvadrik