Support Requests item #2404247, was opened at 2008-12-07 19:58
Message generated for change (Comment added) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=616201&aid=2404247&group_id=96864

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Using re2c without a EOF sentinel token

Initial Comment:
Is there a way to use re2c to scan a buffer without the use of a sentinel token 
to act as EOF?  I want to scan a region between two pointers e.g. I want to run 
re2c like:

scan(char *start, char *end) {
/*!re2c
...
*/
}

and only scan data between start and end with no sentinel token like "\0"




----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2008-12-07 20:59

Message:
Looking at the generated code from re2c's examples directory, re2c calls
YYFILL(n) with an n value of at least the size of the longest possible
match.  e.g.

/*!re2c
    "a" { return 0; }
    "b"{6} { return 1; }
*/

will generate:

if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6);

If we use this value to check for end of buffer, re2c will quit before
matching "a" if it is in the last 5 characters of the buffer.  If we do not
check this value, the generated code will exceed the buffer limits if it
matches 'b' in the last 5 characters, as there's no check against YYLIMIT
until another 6 bs are consumed.

It seems to me that re2c cannot generate a correct solution without an EOF
sentinel?

----------------------------------------------------------------------

Comment By: Marcus Börger (helly)
Date: 2008-12-07 20:04

Message:
re2c does not have any notion whatsoever of an end token, unless you define
one. Also re2c uses a fill function (or macro) to read the minimum amount
of characters to continue parsing. Obviously if that exaggerates the end
pointer, you have to exit. For that re2c proves enough flexibility.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=616201&aid=2404247&group_id=96864

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Re2c-general mailing list
Re2c-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/re2c-general

Reply via email to