From c6cc71d98d84bb61affc5dbca2ce733a0707af59 Mon Sep 17 00:00:00 2001 From: helly Date: Sun, 16 Apr 2006 13:54:50 +0000 Subject: [PATCH] - Drop non working links wrong YYFILL - Unify all YYFILL usages to YYFILL(n) --- htdocs/manual.html | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/htdocs/manual.html b/htdocs/manual.html index 63cf977f..9744b972 100755 --- a/htdocs/manual.html +++ b/htdocs/manual.html @@ -84,7 +84,7 @@ yy7: if(yych <= '/') goto yy3;

After the /*!re2c */ blocks you can place a /*!max:re2c */ block that will output a define (YYMAXFILL) that holds the maximum number of characters required to parse -the input. That is the maximum value YYFILL() will receive.

+the input. That is the maximum value YYFILL(n) will receive.

You can also use /*!ignore:re2c */ blocks that allows to document the scanner code and will not be part of the output.

@@ -153,8 +153,8 @@ backtracking information in YYCTXMARKER. The user only needs to define this macro if a scanner specification uses trailing context in one or more of its regular expressions.

YYFILL(n)
-
The generated code "calls" YYFILL when the buffer needs (re)filling: at -least n additional characters should be provided. YYFILL should adjust +
The generated code "calls" YYFILL(n) when the buffer needs (re)filling: at +least n additional characters should be provided. YYFILL(n) should adjust YYCURSOR, YYLIMIT, YYMARKER and YYCTXMARKER as needed. Note that for typical programming languages n will be the length of the longest keyword plus one. The user can place a comment of the form /*!max:re2c */ after the @@ -167,13 +167,13 @@ beginning of the scanner in order to obtain the saved state. YYGETSTATE must return a signed integer. The value must be either -1, indicating that the scanner is entered for the first time, or a value previously saved by YYSETSTATE. In the second case, the scanner will resume operations right after -where the last YYFILL was called.

+where the last YYFILL(n) was called.

YYSETSTATE(n)
The user only needs to define this macro if the -f flag was specified. In that case, the generated code "calls" YYSETSTATE just before -calling YYFILL. The parameter to YYSETSTATE is a signed integer that uniquely -identifies the specific instance of YYFILL that is about to be called. Should -the user wish to save the state of the scanner and have YYFILL return to the +calling YYFILL(n). The parameter to YYSETSTATE is a signed integer that uniquely +identifies the specific instance of YYFILL(n) that is about to be called. Should +the user wish to save the state of the scanner and have YYFILL(n) return to the caller, all he has to do is store that unique identifer in a variable. Later, when the scannered is called again, it will call YYGETSTATE() and resume execution right where it left off.

@@ -218,22 +218,18 @@ and restore these. In the example examples/push.re these are declared as fields of the (C++) class of which the scanner is a method, so they do not need to be saved/restored explicitly. For C they could e.g. be made macros that select fields from a structure passed in as parameter. Alternatively, they -could be declared as local variables, saved with YYFILL(n) when it decides +could be declared as local variables, saved with YYFILL(n) when it decides to return and restored at entry to the function. Also, it could be more -efficient to save the state from YYFILL(n) because -YYSETSTATE(state) is called unconditionally. YYFILL(n) however does not +efficient to save the state from YYFILL(n) because +YYSETSTATE(state) is called unconditionally. YYFILL(n) however does not get state as parameter, so we would have to store state in a local variable by YYSETSTATE(state).

-

3. Modify YYFILL(n) to return (from +

3. Modify YYFILL(n) to return (from the function calling it) if more input is needed.

4. Modify caller to recognise "more input is needed" and respond appropriately.

5.The generated code will contain a switch block that is used to restores -the last state by jumping behind the corrspoding YYFILL() call. This code is +the last state by jumping behind the corrspoding YYFILL(n) call. This code is automatically generated in the epilog of the first "/*!re2c */" block. It is possible to trigger generation of the YYGETSTATE() block earlier by placing a "/*!getstate:re2c */" comment. This is especially useful when @@ -344,7 +340,7 @@ not want any indendation at all you can simply set this to "".

If set to zero then a decimal table is being used else a hexadecimal table will be generated.
re2c:yyfill:enable = 1 ;
-
Set this to zero to suppress generation of YYFILL(). When using this be sure +
Set this to zero to suppress generation of YYFILL(n). When using this be sure to verify that the generated scanner does not read behind input. Allowing this behavior might introduce sever security issues to you programs.
re2c:startlabel = 0 ;
@@ -383,7 +379,7 @@ example above.

string, a rule matching a null character will suffice. If the source is from a file then you could pad the input with a newline (or some other character that cannot appear within another token); upon recognizing such a character check -to see if it is the sentinel and act accordingly. And you can also use YYFILL +to see if it is the sentinel and act accordingly. And you can also use YYFILL(n) to end the scanner in case not enough characters are available which is nothing else then e detection of end of data/file.

re2c does not provide start conditions: use a separate scanner -- 2.50.1