From: helly After the /*!re2c */ blocks you can place a /*!max:re2c */ block that will
-output a define that holds the maximum number of characters required to parse
+output a define (YYMAXFILL) that holds the maximum number of characters required to parse
the input. That is the maximum value YYFILL() will receive. re2c provides the following options:
OPTIONS
-
+
@@ -200,14 +203,48 @@ scanner, it resumes operations exactly where it left off.
At this point, the -f option only works with "mono-block" re2c scanners: if the scanner is described with more than one /*!re2c ... */ block, re2c -f fails with an error.
+Changes needed compared to the "pull" model.
+1. User has to supply macros YYSETSTATE() YYGETSTATE(state)
+2. The -f option inhibits declaration of yych and +yyaccept. So the user has to declare these. Also the user has to save +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 +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 +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 +the function calling it) if more input is needed.
+4. Modify caller to recognise "more input is needed" and respond +appropriately.
Please see examples/push.re for push-model scanner.
Each scanner specification consists of a set of rules and name -definitions. Rules consist of a regular expression along with a block of C/C++ -code that is to be executed when the associated regular expression is matched. -Name definitions are of the form ``name = regular -expression;''.
+Each scanner specification consists of a set of rules, name +definitions and configurations.
+Rules consist of a regular expression along with a block of C/C++ +code that is to be executed when the associated regular expression is +matched.
+Name definitions are of the form:
+Configurations look like name definitions whose names start with +"re2c:":
+Character classes and string literals may contain octoal or hexadecimal
-character definitions and the following set of escape sequences (\n,
- \t, \v, \b, \r, \f, \a, \\). An octal character is defined by a backslash
-followed by its three octal digits and a hexadecimal character is defined by
-backslash, a lower cased 'x' and its two hexadecimal digits.
re2c further more supports the c/c++ unicode notation. That is a backslash +followed by either a lowercased u and its four hexadecimal digits or an +uppercased U and its eight hexadecimal digits. However using the U +notation it is not possible to support characters greater \U0000FFFF due +to an internal limitation of re2c.
+Since characters greater \X00FF are not allowed in non unicode mode, +the only portable "any" rules are (.|"\n") and [^].
The regular expressions listed above are grouped according to precedence, from highest precedence at the top to lowest at the bottom. Those grouped together have equal precedence.
+It is possible to configure code generation inside re2c blocks. The +following lists the available configurations:
+#include <stdlib.h> @@ -593,7 +664,7 @@ specification for each start condition (as illustrated in the above example).
VERSION INFORMATION
-This manpage describes re2c, version 0.9.10.
+This manpage describes re2c, version 0.10.0.
Index
@@ -617,6 +688,6 @@ specification for each start condition (as illustrated in the above example).
This document was created by man2html, using the manual pages.
+Time: 23:55:44 GMT, Februar 18, 2006
-Time: 11:33:44 GMT, September 04, 2005