-Version 0.13.2 (2008-??-??)
+Version 0.13.2 (2008-02-14)
---------------------------
+- Added flag --case-inverted.
- Added flag --case-insensitive.
- Added support for '<!...>' to enable rule setup.
- Added support for '=>' style rules.
-/* Generated by re2c 0.13.2.dev on Wed Feb 13 14:12:34 2008 */
+/* Generated by re2c 0.13.2.dev on Thu Feb 14 20:22:44 2008 */
/* $Id$ */
#include <stdlib.h>
#include <string.h>
++YYCURSOR;
{
cur = cursor;
- yylval.regexp = strToCaseInsensitiveRE(token());
+ if (bCaseInverted)
+ {
+ yylval.regexp = strToRE(token());
+ }
+ else
+ {
+ yylval.regexp = strToCaseInsensitiveRE(token());
+ }
return STRING;
}
yy140:
++YYCURSOR;
{
cur = cursor;
- if (bCaseInsensitive)
+ if (bCaseInsensitive || bCaseInverted)
{
yylval.regexp = strToCaseInsensitiveRE(token());
}
extern bool bWroteGetState;
extern bool bWroteCondCheck;
extern bool bCaseInsensitive;
+extern bool bCaseInverted;
extern uint asc2ebc[256];
extern uint ebc2asc[256];
</ul>
<hr />
<h1>Changelog</h1>
-<h2>2008-??-??: 0.13.2</h2>
+<h2>2008-02-14: 0.13.2</h2>
+<li>Added flag --case-inverted.</li>
<li>Added flag --case-insensitive.</li>
<li>Added support for '<!...>' to enable rule setup.</li>
<li>Added support for '=>' style rules.</li>
<dt><b>--case-insensitive</b></dt>
<dd>All strings are case insensitive, so all "-expressions are treated
in the same way '-expressions are.<br /><br /></dd>
+<dt><b>--case-inverted</b></dt>
+<dd>Invert the meaning of single and double quoted strings.
+With this switch single quotes are case sensitive and
+double quotes are case insensitive.<br /><br /></dd>
</dl>
<br />
<br />
<dt>YYMAXFILL</dt>
<dd>This will be automatically defined by /*!max:re2c */ blocks as explained
above.<br /><br /></dd>
-<dt>YYSETCONDITION</dt>(<i>c</i>)
+<dt>YYSETCONDITION(<i>c</i>)</dt>
<dd>This define is used to set the condition in transition rules. This is only
being used when <b>-c</b> is active and transition rules are being used.</dd>
<dt>YYSETSTATE(<i>s</i>)</dt>
block of all rules of a certain set of conditions or to all code blocks to all
rules. This can be helpful when some operation is common among rules. For
instance this can be used to store the length of the scanned string. These
-special prefix rules start with an exclamation mark followed by either a list
+special setup rules start with an exclamation mark followed by either a list
of conditions <b><! condition, ... ></b> or a star <b><!*></b>.
When <b>re2c</b> generates the code for a rule whose state does not have a
-prefix rule and a star'd prefix rule is present, than that code will be used
-as prefix code.
+setup rule and a star'd setup rule is present, than that code will be used
+as setup code.
</p>
<a name="lbAI" id="lbAI"> </a>
<h2>SCANNER SPECIFICATIONS</h2>
bool bWroteGetState = false;
bool bWroteCondCheck = false;
bool bCaseInsensitive = false;
+bool bCaseInverted = false;
uint nRealChars = 256;
mbo_opt_struct('1', 0, "single-pass"),
mbo_opt_struct(10, 0, "no-generation-date"),
mbo_opt_struct(11, 0, "case-insensitive"),
+ mbo_opt_struct(12, 0, "case-inverted"),
mbo_opt_struct('-', 0, NULL) /* end of args */
};
"\n"
"--case-insensitive All strings are case insensitive, so all \"-expressions\n"
" are treated in the same way '-expressions are.\n"
+ "\n"
+ "--case-inverted Invert the meaning of single and double quoted strings.\n"
+ " With this switch single quotes are case sensitive and\n"
+ " double quotes are case insensitive.\n"
;
}
case 11:
bCaseInsensitive = true;
break;
+
+ case 12:
+ bCaseInverted = true;
+ break;
}
}
\fb--case-insensitive\fP
All strings are case insensitive, so all "-expressions are treated
in the same way '-expressions are.
+.TP
+\fB--case-inverted\fP
+Invert the meaning of single and double quoted strings.
+With this switch single quotes are case sensitive and
+double quotes are case insensitive.
+
.SH "INTERFACE CODE"
Unlike other scanner generators, \*(re does not generate complete scanners:
the user must supply some interface code.
block of all rules of a certain set of conditions or to all code blocks to all
rules. This can be helpful when some operation is common among rules. For
instance this can be used to store the length of the scanned string. These
-special prefix rules start with an exclamation mark followed by either a list
+special setup rules start with an exclamation mark followed by either a list
of conditions \fB<! condition, ... >\fP or a star \fB<!*>\fP.
When \*(re generates the code for a rule whose state does not have a
-prefix rule and a star'd prefix rule is present, than that code will be used
-as prefix code.
+setup rule and a star'd setup rule is present, than that code will be used
+as setup code.
.SH "SCANNER SPECIFICATIONS"
Each scanner specification consists of a set of \fIrules\fP, \fInamed
fi;
for x in $tests; do
tstcnt=$(($tstcnt+1))
- switches=`basename $x|sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g'`
- genname=`echo $switches|sed -e 's,^.[^o]*$,,g' -e 's,^--.*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),@builddir@/test/\1,g'`
- headers=`echo $switches|sed -e 's,^.[^t]*$,,g' -e 's,^--.*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),@builddir@/test/\1,g'`
+ switches=`basename $x|sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g' -e 's/\([^ ]\)--/\1 --/g'`
+ genname=`echo $switches|sed -e 's,--.*$,,g' -e 's,^.[^o]*$,,g' -e 's,^[^ot]*t.*o.*$,,g' -e 's,^-[^o]*o\(.*\),@builddir@/test/\1,g'`
+ headers=`echo $switches|sed -e 's,--.*$,,g' -e 's,^.[^t]*$,,g' -e 's,^[^ot]*o.*t.*$,,g' -e 's,^-[^t]*t\(.*\),@builddir@/test/\1,g'`
switches=`echo $switches|sed -e 's,^-\([^ot-]*[ot]\)\(.*\)$,-\1@builddir@/test/\2,g'`
# don't use the -o flag, since it makes it harder to diff.
echo $x: $switches
dstring {
cur = cursor;
- if (bCaseInsensitive)
+ if (bCaseInsensitive || bCaseInverted)
{
yylval.regexp = strToCaseInsensitiveRE(token());
}
sstring {
cur = cursor;
- yylval.regexp = strToCaseInsensitiveRE(token());
+ if (bCaseInverted)
+ {
+ yylval.regexp = strToRE(token());
+ }
+ else
+ {
+ yylval.regexp = strToCaseInsensitiveRE(token());
+ }
return STRING;
}
/* Generated by re2c */
-#line 1 "long-flag.-case-insensitive.re"
-#line 5 "<stdout>"
{
YYCTYPE yych;
yy2:
yy3:
++YYCURSOR;
-#line 2 "long-flag.-case-insensitive.re"
{return 'a';}
-#line 23 "<stdout>"
yy5:
++YYCURSOR;
-#line 3 "long-flag.-case-insensitive.re"
{return 'b';}
-#line 28 "<stdout>"
}
-#line 4 "long-flag.-case-insensitive.re"
}
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+
+ if (YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'A':
+ case 'a': goto yy3;
+ case 'b': goto yy5;
+ default: goto yy2;
+ }
+yy2:
+yy3:
+ ++YYCURSOR;
+ {return 'a';}
+yy5:
+ ++YYCURSOR;
+ {return 'b';}
+}
+
+}
--- /dev/null
+/*!re2c
+ "a" {return 'a';}
+ 'b' {return 'b';}
+*/
+}
--- /dev/null
+/* Generated by re2c */
+
+{
+ YYCTYPE yych;
+
+ if (YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'B':
+ case 'b': goto yy5;
+ case 'a': goto yy3;
+ default: goto yy2;
+ }
+yy2:
+yy3:
+ ++YYCURSOR;
+ {return 'a';}
+yy5:
+ ++YYCURSOR;
+ {return 'b';}
+}
+
+}
--- /dev/null
+/*!re2c
+ "a" {return 'a';}
+ 'b' {return 'b';}
+*/
+}