74 lines
1.8 KiB
Diff
74 lines
1.8 KiB
Diff
|
--- tc/emp_ematch.l
|
||
|
+++ tc/emp_ematch.l
|
||
|
@@ -63,7 +63,7 @@
|
||
|
|
||
|
%}
|
||
|
|
||
|
-%x str
|
||
|
+%x STR
|
||
|
|
||
|
%option 8bit stack warn noyywrap prefix="ematch_"
|
||
|
%%
|
||
|
@@ -78,17 +78,17 @@
|
||
|
}
|
||
|
strbuf_index = 0;
|
||
|
|
||
|
- BEGIN(str);
|
||
|
+ BEGIN(STR);
|
||
|
}
|
||
|
|
||
|
-<str>\" {
|
||
|
+<STR>\" {
|
||
|
BEGIN(INITIAL);
|
||
|
yylval.b = bstr_new(strbuf, strbuf_index);
|
||
|
yylval.b->quoted = 1;
|
||
|
return ATTRIBUTE;
|
||
|
}
|
||
|
|
||
|
-<str>\\[0-7]{1,3} { /* octal escape sequence */
|
||
|
+<STR>\\[0-7]{1,3} { /* octal escape sequence */
|
||
|
int res;
|
||
|
|
||
|
sscanf(yytext + 1, "%o", &res);
|
||
|
@@ -100,12 +100,12 @@
|
||
|
strbuf_append_char((unsigned char) res);
|
||
|
}
|
||
|
|
||
|
-<str>\\[0-9]+ { /* catch wrong octal escape seq. */
|
||
|
+<STR>\\[0-9]+ { /* catch wrong octal escape seq. */
|
||
|
fprintf(stderr, "error: invalid octale escape sequence\n");
|
||
|
return ERROR;
|
||
|
}
|
||
|
|
||
|
-<str>\\x[0-9a-fA-F]{1,2} {
|
||
|
+<STR>\\x[0-9a-fA-F]{1,2} {
|
||
|
int res;
|
||
|
|
||
|
sscanf(yytext + 2, "%x", &res);
|
||
|
@@ -118,16 +118,16 @@
|
||
|
strbuf_append_char((unsigned char) res);
|
||
|
}
|
||
|
|
||
|
-<str>\\n strbuf_append_char('\n');
|
||
|
-<str>\\r strbuf_append_char('\r');
|
||
|
-<str>\\t strbuf_append_char('\t');
|
||
|
-<str>\\v strbuf_append_char('\v');
|
||
|
-<str>\\b strbuf_append_char('\b');
|
||
|
-<str>\\f strbuf_append_char('\f');
|
||
|
-<str>\\a strbuf_append_char('\a');
|
||
|
+<STR>\\n strbuf_append_char('\n');
|
||
|
+<STR>\\r strbuf_append_char('\r');
|
||
|
+<STR>\\t strbuf_append_char('\t');
|
||
|
+<STR>\\v strbuf_append_char('\v');
|
||
|
+<STR>\\b strbuf_append_char('\b');
|
||
|
+<STR>\\f strbuf_append_char('\f');
|
||
|
+<STR>\\a strbuf_append_char('\a');
|
||
|
|
||
|
-<str>\\(.|\n) strbuf_append_char(yytext[1]);
|
||
|
-<str>[^\\\n\"]+ strbuf_append_charp(yytext);
|
||
|
+<STR>\\(.|\n) strbuf_append_char(yytext[1]);
|
||
|
+<STR>[^\\\n\"]+ strbuf_append_charp(yytext);
|
||
|
|
||
|
[aA][nN][dD] return AND;
|
||
|
[oO][rR] return OR;
|