<p>re2c - convert regular expressions to C/C++</p>
<a name="lbAC" id="lbAC"> </a>
<h2>SYNOPSIS</h2>
-<p><b>re2c</b> [<b>-bdefghisvVw1</b>] [<b>-o output</b>] file</p>
+<p><b>re2c</b> [<b>-bdefghisuvVw1</b>] [<b>-o output</b>] file</p>
<a name="lbAD" id="lbAD"> </a>
<h2>DESCRIPTION</h2>
<p><b>re2c</b> is a preprocessor that generates C-based recognizers from
token-specific code.</p>
<p>For example, given the following code</p>
<pre>
-#define NULL ((char*) 0)
char *scan(char *p)
{
-#define YYCTYPE char
-#define YYCURSOR p
-#define YYLIMIT p
-#define YYFILL(n)
/*!re2c
- [0-9]+ {return YYCURSOR;}
- [\000-\377] {return NULL;}
+ re2c:define:YYCTYPE = "unsigned char";
+ re2c:define:YYCURSOR = p;
+ re2c:yyfill:enable = 0;
+ re2c:yych:conversion = 1;
+ re2c:indent:top = 1;
+ [0-9]+ {return p;}
+ [\000-\377] {return (char*)0;}
*/
}
</pre>
<br />
<br />
-<p><b>re2c</b> will generate</p>
+<p><b>re2c -is</b> will generate</p>
<pre>
/* Generated by re2c on Sat Apr 16 11:40:58 1994 */
-#line 1 "simple.re"
-#define NULL ((char*) 0)
char *scan(char *p)
{
-#define YYCTYPE char
-#define YYCURSOR p
-#define YYLIMIT p
-#define YYFILL(n)
-{
- YYCTYPE yych;
+ {
+ unsigned char yych;
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
+ yych = (unsigned char)*p;
if(yych <= '/') goto yy4;
if(yych >= ':') goto yy4;
-yy2: yych = *++YYCURSOR;
+ ++p;
+ yych = (unsigned char)*p;
goto yy7;
yy3:
-#line 9
- {return YYCURSOR;}
-yy4: yych = *++YYCURSOR;
-yy5:
-#line 10
- {return NULL;}
-yy6: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy7: if(yych <= '/') goto yy3;
+ {return p;}
+yy4:
+ ++p;
+ yych = (unsigned char)*p;
+ {return char*)0;}
+yy6:
+ ++p;
+ yych = (unsigned char)*p;
+yy7:
+ if(yych <= '/') goto yy3;
if(yych <= '9') goto yy6;
goto yy3;
-}
-#line 11
+ }
}
</pre>
re2c \- convert regular expressions to C/C++
.SH SYNOPSIS
-\*(re [\fB-bdefghisvVw1\fP] [\fB-o output\fP] file\fP
+\*(re [\fB-bdefghisuvVw1\fP] [\fB-o output\fP] file\fP
.SH DESCRIPTION
\*(re is a preprocessor that generates C-based recognizers from regular
.in +3
.nf
-#define NULL ((char*) 0)
char *scan(char *p)
{
-#define YYCTYPE char
-#define YYCURSOR p
-#define YYLIMIT p
-#define YYFILL(n)
/*!re2c
- [0-9]+ {return YYCURSOR;}
- [\\000-\\377] {return NULL;}
+ re2c:define:YYCTYPE = "unsigned char";
+ re2c:define:YYCURSOR = p;
+ re2c:yyfill:enable = 0;
+ re2c:yych:conversion = 1;
+ re2c:indent:top = 1;
+ [0-9]+ {return p;}
+ [\000-\377] {return (char*)0;}
*/
}
.fi
.in -3
-\*(re will generate
+\*(re -is will generate
.in +3
.nf
/* Generated by re2c on Sat Apr 16 11:40:58 1994 */
-#line 1 "simple.re"
-#define NULL ((char*) 0)
char *scan(char *p)
{
-#define YYCTYPE char
-#define YYCURSOR p
-#define YYLIMIT p
-#define YYFILL(n)
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '/') goto yy4;
- if(yych >= ':') goto yy4;
-yy2: yych = *++YYCURSOR;
+ {
+ unsigned char yych;
+
+ yych = (unsigned char)*p;
+ if(yych <= '/') goto yy4;
+ if(yych >= ':') goto yy4;
+ ++p;
+ yych = (unsigned char)*p;
goto yy7;
yy3:
-#line 9
- {return YYCURSOR;}
-yy4: yych = *++YYCURSOR;
-yy5:
-#line 10
- {return NULL;}
-yy6: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy7: if(yych <= '/') goto yy3;
- if(yych <= '9') goto yy6;
+ {return p;}
+yy4:
+ ++p;
+ yych = (unsigned char)*p;
+ {return char*)0;}
+yy6:
+ ++p;
+ yych = (unsigned char)*p;
+yy7:
+ if(yych <= '/') goto yy3;
+ if(yych <= '9') goto yy6;
goto yy3;
-}
-#line 11
+ }
}
.fi