From 62ec640fb695e794be45d529a7f77d9e70c894d9 Mon Sep 17 00:00:00 2001
From: helly
Date: Fri, 24 Feb 2006 21:16:17 +0000
Subject: [PATCH] - Applied #1438160 expose YYCTXMARKER.
---
CHANGELOG | 1 +
code.cc | 10 +--
globals.h | 1 -
htdocs/manual.html | 6 +-
main.cc | 1 -
re2c.1.in | 9 +++
test/ctx.b.c | 33 ++++----
test/ctx.b.re | 2 +
test/ctx.c | 33 ++++----
test/ctx.re | 2 +
test/ctx.s.c | 33 ++++----
test/ctx.s.re | 2 +
test/modula.c | 197 ++++++++++++++++++++++-----------------------
test/modula.re | 3 +-
14 files changed, 173 insertions(+), 160 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index a39d6066..e992c40e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
Version 0.10.1 (????-??-??)
---------------------------
+- Applied #1438160 expose YYCTXMARKER.
Version 0.10.0 (2006-02-18)
---------------------------
diff --git a/code.cc b/code.cc
index 5d251f3a..e40525dd 100644
--- a/code.cc
+++ b/code.cc
@@ -466,7 +466,7 @@ void Rule::emit(std::ostream &o, uint ind, bool &) const
if (back != 0u)
{
- o << indent(ind) << "YYCURSOR = yyctxmarker;\n";
+ o << indent(ind) << "YYCURSOR = YYCTXMARKER;\n";
}
RuleLine rl(*rule);
@@ -857,8 +857,7 @@ void State::emit(std::ostream &o, uint ind, bool &readCh) const
}
if (isPreCtxt)
{
- o << indent(ind) << "yyctxmarker = YYCURSOR + 1;\n";
- bUsedCtxMarker = true;
+ o << indent(ind) << "YYCTXMARKER = YYCURSOR + 1;\n";
}
action->emit(o, ind, readCh);
}
@@ -1365,11 +1364,6 @@ void DFA::emit(std::ostream &o, uint ind)
o << indent(ind++) << "{\n\n";
}
- if (bUsedCtxMarker)
- {
- o << indent(ind) << "YYCTYPE *yyctxmarker = YYCURSOR;\n";
- }
-
if (hasFillLabels == true)
{
vUsedLabels.insert(start_label);
diff --git a/globals.h b/globals.h
index d9e2b511..d77b7bab 100644
--- a/globals.h
+++ b/globals.h
@@ -22,7 +22,6 @@ extern bool sFlag;
extern bool wFlag;
extern bool bUsedYYAccept;
-extern bool bUsedCtxMarker;
extern bool bUseStartLabel;
extern std::string startLabelName;
extern uint maxFill;
diff --git a/htdocs/manual.html b/htdocs/manual.html
index c5ae90bd..3d31db38 100755
--- a/htdocs/manual.html
+++ b/htdocs/manual.html
@@ -149,10 +149,13 @@ YYCURSOR to YYLIMIT to determine when the buffer needs (re)filling.
<
YYMARKER
l-expression of type *YYCTYPE. The generated code saves backtracking
information in YYMARKER.
+YYCTXMARKER
+l-expression of type *YYCTYPE. The generated code saves context backtracking
+information in YYCTXMARKER.
YYFILL(n)
The generated code "calls" YYFILL when the buffer needs (re)filling: at
least n additional characters should be provided. YYFILL should adjust
-YYCURSOR, YYLIMIT and YYMARKER as needed. Note that for typical programming
+YYCURSOR, YYLIMIT, YYMARKER and YYCTXMARKER as needed. Note that for typical programming
languages n will be the length of the longest keyword plus one.
YYGETSTATE()
The user only needs to define this macro if the -f flag was
@@ -636,7 +639,6 @@ accordingly.
specification for each start condition (as illustrated in the above example).
BUGS
-Only fixed length trailing context can be handled.
Difference only works for character sets.
The re2c internal algorithms need documentation.
diff --git a/main.cc b/main.cc
index 2ea0ca88..98e8a481 100644
--- a/main.cc
+++ b/main.cc
@@ -29,7 +29,6 @@ bool sFlag = false;
bool wFlag = false;
bool bUsedYYAccept = false;
-bool bUsedCtxMarker= false;
bool bUseStartLabel= false;
std::string startLabelName;
uint maxFill = 1;
diff --git a/re2c.1.in b/re2c.1.in
index 2a39acdc..a2c9e39a 100644
--- a/re2c.1.in
+++ b/re2c.1.in
@@ -7,6 +7,9 @@
.ds rx regular expression
.ds lx \fIl\fP-expression
\"$Log$
+\"Revision 1.40 2006/02/24 21:16:17 helly
+\"- Applied #1438160 expose YYCTXMARKER.
+\"
\"Revision 1.39 2006/01/21 15:51:02 helly
\"- Generic fix for oline generation (by providing specialized ostream whose
\" stream_buffer count '\n's)
@@ -300,6 +303,12 @@ to determine when the buffer needs (re)filling.
\*(lx of type \fC*YYCTYPE\fP.
The generated code saves backtracking information in \fCYYMARKER\fP.
.TP
+\fCYYCTXMARKER\fP
+\*(lx of type \fC*YYCTYPE\fP.
+The generated code saves trailing context backtracking information in \fCYYCTXMARKER\fP.
+The user only needs to define this macro if a scanner specification uses trailing
+context in one or more of its regular expressions.
+.TP
\fCYYFILL(\fP\fIn\fP\fC)\fP
The generated code "calls" \fCYYFILL\fP when the buffer needs
(re)filling: at least \fIn\fP additional characters should
diff --git a/test/ctx.b.c b/test/ctx.b.c
index 1606dc4d..d996591a 100755
--- a/test/ctx.b.c
+++ b/test/ctx.b.c
@@ -13,6 +13,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -20,6 +21,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
@@ -79,10 +81,9 @@ std:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 83 ""
+#line 85 ""
{
YYCTYPE yych;
- YYCTYPE *yyctxmarker = YYCURSOR;
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
@@ -104,36 +105,36 @@ std:
if(yych >= 'c') goto yy9;
}
}
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
++YYCURSOR;
if((yych = *YYCURSOR) <= '/') goto yy3;
if(yych == '1') goto yy15;
if(yych <= '9') goto yy12;
yy3:
-#line 58 "ctx.b.re"
+#line 60 "ctx.b.re"
{
return UNEXPECTED;
}
-#line 118 ""
+#line 119 ""
yy4:
++YYCURSOR;
yych = *YYCURSOR;
goto yy11;
yy5:
-#line 48 "ctx.b.re"
+#line 50 "ctx.b.re"
{ return NUMBER; }
-#line 126 ""
+#line 127 ""
yy6:
++YYCURSOR;
yy7:
-#line 51 "ctx.b.re"
+#line 53 "ctx.b.re"
{
if(s.cur == s.lim)
return EOI;
cursor = s.cur;
goto std;
}
-#line 137 ""
+#line 138 ""
yy8:
yych = *++YYCURSOR;
goto yy7;
@@ -156,22 +157,22 @@ yy12:
if(yych <= '/') goto yy14;
if(yych <= '9') goto yy12;
yy14:
- YYCURSOR = yyctxmarker;
-#line 47 "ctx.b.re"
+ YYCURSOR = YYCTXMARKER;
+#line 49 "ctx.b.re"
{ return KEYWORD; }
-#line 163 ""
+#line 164 ""
yy15:
++YYCURSOR;
if((yych = *YYCURSOR) <= '/') goto yy16;
if(yych <= '9') goto yy12;
yy16:
- YYCURSOR = yyctxmarker;
-#line 46 "ctx.b.re"
+ YYCURSOR = YYCTXMARKER;
+#line 48 "ctx.b.re"
{ return KEYWORD; }
-#line 172 ""
+#line 173 ""
}
}
-#line 61 "ctx.b.re"
+#line 63 "ctx.b.re"
}
diff --git a/test/ctx.b.re b/test/ctx.b.re
index 6187526b..802df5a3 100755
--- a/test/ctx.b.re
+++ b/test/ctx.b.re
@@ -11,6 +11,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -18,6 +19,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
diff --git a/test/ctx.c b/test/ctx.c
index 0ea67f15..1bb3902c 100755
--- a/test/ctx.c
+++ b/test/ctx.c
@@ -13,6 +13,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -20,6 +21,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
@@ -44,10 +46,9 @@ std:
s.tok = cursor;
-#line 48 ""
+#line 50 ""
{
YYCTYPE yych;
- YYCTYPE *yyctxmarker = YYCURSOR;
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
@@ -70,7 +71,7 @@ std:
default: goto yy9;
}
yy2:
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
++YYCURSOR;
switch((yych = *YYCURSOR)) {
case '0':
@@ -86,30 +87,30 @@ yy2:
default: goto yy3;
}
yy3:
-#line 58 "ctx.re"
+#line 60 "ctx.re"
{
return UNEXPECTED;
}
-#line 94 ""
+#line 95 ""
yy4:
++YYCURSOR;
yych = *YYCURSOR;
goto yy11;
yy5:
-#line 48 "ctx.re"
+#line 50 "ctx.re"
{ return NUMBER; }
-#line 102 ""
+#line 103 ""
yy6:
++YYCURSOR;
yy7:
-#line 51 "ctx.re"
+#line 53 "ctx.re"
{
if(s.cur == s.lim)
return EOI;
cursor = s.cur;
goto std;
}
-#line 113 ""
+#line 114 ""
yy8:
yych = *++YYCURSOR;
goto yy7;
@@ -152,10 +153,10 @@ yy12:
default: goto yy14;
}
yy14:
- YYCURSOR = yyctxmarker;
-#line 47 "ctx.re"
+ YYCURSOR = YYCTXMARKER;
+#line 49 "ctx.re"
{ return KEYWORD; }
-#line 159 ""
+#line 160 ""
yy15:
++YYCURSOR;
switch((yych = *YYCURSOR)) {
@@ -172,12 +173,12 @@ yy15:
default: goto yy16;
}
yy16:
- YYCURSOR = yyctxmarker;
-#line 46 "ctx.re"
+ YYCURSOR = YYCTXMARKER;
+#line 48 "ctx.re"
{ return KEYWORD; }
-#line 179 ""
+#line 180 ""
}
-#line 61 "ctx.re"
+#line 63 "ctx.re"
}
diff --git a/test/ctx.re b/test/ctx.re
index 6187526b..802df5a3 100755
--- a/test/ctx.re
+++ b/test/ctx.re
@@ -11,6 +11,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -18,6 +19,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
diff --git a/test/ctx.s.c b/test/ctx.s.c
index 58b07c8b..e26ef14a 100755
--- a/test/ctx.s.c
+++ b/test/ctx.s.c
@@ -13,6 +13,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -20,6 +21,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
@@ -44,10 +46,9 @@ std:
s.tok = cursor;
-#line 48 ""
+#line 50 ""
{
YYCTYPE yych;
- YYCTYPE *yyctxmarker = YYCURSOR;
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
@@ -69,36 +70,36 @@ std:
if(yych >= 'c') goto yy9;
}
}
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
++YYCURSOR;
if((yych = *YYCURSOR) <= '/') goto yy3;
if(yych == '1') goto yy15;
if(yych <= '9') goto yy12;
yy3:
-#line 58 "ctx.s.re"
+#line 60 "ctx.s.re"
{
return UNEXPECTED;
}
-#line 83 ""
+#line 84 ""
yy4:
++YYCURSOR;
yych = *YYCURSOR;
goto yy11;
yy5:
-#line 48 "ctx.s.re"
+#line 50 "ctx.s.re"
{ return NUMBER; }
-#line 91 ""
+#line 92 ""
yy6:
++YYCURSOR;
yy7:
-#line 51 "ctx.s.re"
+#line 53 "ctx.s.re"
{
if(s.cur == s.lim)
return EOI;
cursor = s.cur;
goto std;
}
-#line 102 ""
+#line 103 ""
yy8:
yych = *++YYCURSOR;
goto yy7;
@@ -120,21 +121,21 @@ yy12:
if(yych <= '/') goto yy14;
if(yych <= '9') goto yy12;
yy14:
- YYCURSOR = yyctxmarker;
-#line 47 "ctx.s.re"
+ YYCURSOR = YYCTXMARKER;
+#line 49 "ctx.s.re"
{ return KEYWORD; }
-#line 127 ""
+#line 128 ""
yy15:
++YYCURSOR;
if((yych = *YYCURSOR) <= '/') goto yy16;
if(yych <= '9') goto yy12;
yy16:
- YYCURSOR = yyctxmarker;
-#line 46 "ctx.s.re"
+ YYCURSOR = YYCTXMARKER;
+#line 48 "ctx.s.re"
{ return KEYWORD; }
-#line 136 ""
+#line 137 ""
}
-#line 61 "ctx.s.re"
+#line 63 "ctx.s.re"
}
diff --git a/test/ctx.s.re b/test/ctx.s.re
index 6187526b..802df5a3 100755
--- a/test/ctx.s.re
+++ b/test/ctx.s.re
@@ -11,6 +11,7 @@ struct Scanner
char *cur;
char *lim;
char *ptr;
+ char *ctx;
char *tok;
};
@@ -18,6 +19,7 @@ struct Scanner
#define YYCURSOR s.cur
#define YYLIMIT s.lim
#define YYMARKER s.ptr
+#define YYCTXMARKER s.ctx
#define YYFILL(n)
enum What
diff --git a/test/modula.c b/test/modula.c
index f1f7888a..35c7d21e 100644
--- a/test/modula.c
+++ b/test/modula.c
@@ -13,13 +13,14 @@ typedef unsigned char uchar;
#define YYCURSOR cursor
#define YYLIMIT s->lim
#define YYMARKER s->ptr
+#define YYCTXMARKER s->ctx
#define YYFILL {cursor = fill(s, cursor);}
#define RETURN(i) {s->cur = cursor; return i;}
typedef struct Scanner {
int fd;
- uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof;
+ uchar *bot, *tok, *ptr, *ctx, *cur, *pos, *lim, *top, *eof;
uint line;
} Scanner;
@@ -59,15 +60,14 @@ int scan(Scanner *s){
uint depth;
std:
s->tok = cursor;
-#line 64 "modula.re"
+#line 65 "modula.re"
-#line 67 ""
+#line 68 ""
{
YYCTYPE yych;
unsigned int yyaccept = 0;
- YYCTYPE *yyctxmarker = YYCURSOR;
if((YYLIMIT - YYCURSOR) < 15) YYFILL(15);
yych = *YYCURSOR;
@@ -170,20 +170,20 @@ yy2:
default: goto yy3;
}
yy3:
-#line 79 "modula.re"
+#line 80 "modula.re"
{RETURN(9);}
#line 176 ""
yy4:
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy292;
yy5:
-#line 69 "modula.re"
+#line 70 "modula.re"
{RETURN(1);}
#line 185 ""
yy6:
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy278;
@@ -195,7 +195,7 @@ yy7:
default: goto yy274;
}
yy8:
-#line 158 "modula.re"
+#line 159 "modula.re"
{
printf("unexpected character: %c\n", *s->tok);
goto std;
@@ -210,37 +210,37 @@ yy9:
}
yy10:
++YYCURSOR;
-#line 77 "modula.re"
+#line 78 "modula.re"
{RETURN(7);}
#line 216 ""
yy12:
++YYCURSOR;
-#line 78 "modula.re"
+#line 79 "modula.re"
{RETURN(8);}
#line 221 ""
yy14:
++YYCURSOR;
-#line 80 "modula.re"
+#line 81 "modula.re"
{RETURN(10);}
#line 226 ""
yy16:
++YYCURSOR;
-#line 81 "modula.re"
+#line 82 "modula.re"
{RETURN(11);}
#line 231 ""
yy18:
++YYCURSOR;
-#line 82 "modula.re"
+#line 83 "modula.re"
{RETURN(12);}
#line 236 ""
yy20:
++YYCURSOR;
-#line 83 "modula.re"
+#line 84 "modula.re"
{RETURN(13);}
#line 241 ""
yy22:
++YYCURSOR;
-#line 84 "modula.re"
+#line 85 "modula.re"
{RETURN(14);}
#line 246 ""
yy24:
@@ -250,12 +250,12 @@ yy24:
default: goto yy25;
}
yy25:
-#line 85 "modula.re"
+#line 86 "modula.re"
{RETURN(15);}
#line 256 ""
yy26:
++YYCURSOR;
-#line 87 "modula.re"
+#line 88 "modula.re"
{RETURN(17);}
#line 261 ""
yy28:
@@ -265,12 +265,12 @@ yy28:
default: goto yy29;
}
yy29:
-#line 88 "modula.re"
+#line 89 "modula.re"
{RETURN(18);}
#line 271 ""
yy30:
++YYCURSOR;
-#line 90 "modula.re"
+#line 91 "modula.re"
{RETURN(20);}
#line 276 ""
yy32:
@@ -281,12 +281,12 @@ yy32:
default: goto yy33;
}
yy33:
-#line 91 "modula.re"
+#line 92 "modula.re"
{RETURN(21);}
#line 287 ""
yy34:
++YYCURSOR;
-#line 94 "modula.re"
+#line 95 "modula.re"
{RETURN(24);}
#line 292 ""
yy36:
@@ -296,42 +296,42 @@ yy36:
default: goto yy37;
}
yy37:
-#line 95 "modula.re"
+#line 96 "modula.re"
{RETURN(25);}
#line 302 ""
yy38:
++YYCURSOR;
-#line 97 "modula.re"
+#line 98 "modula.re"
{RETURN(27);}
#line 307 ""
yy40:
++YYCURSOR;
-#line 98 "modula.re"
+#line 99 "modula.re"
{RETURN(28);}
#line 312 ""
yy42:
++YYCURSOR;
-#line 99 "modula.re"
+#line 100 "modula.re"
{RETURN(29);}
#line 317 ""
yy44:
++YYCURSOR;
-#line 100 "modula.re"
+#line 101 "modula.re"
{RETURN(30);}
#line 322 ""
yy46:
++YYCURSOR;
-#line 101 "modula.re"
+#line 102 "modula.re"
{RETURN(31);}
#line 327 ""
yy48:
++YYCURSOR;
-#line 102 "modula.re"
+#line 103 "modula.re"
{RETURN(32);}
#line 332 ""
yy50:
++YYCURSOR;
-#line 103 "modula.re"
+#line 104 "modula.re"
{RETURN(33);}
#line 337 ""
yy52:
@@ -342,7 +342,7 @@ yy52:
default: goto yy81;
}
yy53:
-#line 146 "modula.re"
+#line 147 "modula.re"
{RETURN(74);}
#line 348 ""
yy54:
@@ -475,12 +475,12 @@ yy73:
yych = *YYCURSOR;
goto yy79;
yy74:
-#line 148 "modula.re"
+#line 149 "modula.re"
{ goto std; }
#line 481 ""
yy75:
++YYCURSOR;
-#line 151 "modula.re"
+#line 152 "modula.re"
{
if(cursor == s->eof) RETURN(0);
s->pos = cursor; s->line++;
@@ -656,7 +656,7 @@ yy85:
default: goto yy86;
}
yy86:
-#line 144 "modula.re"
+#line 145 "modula.re"
{RETURN(73);}
#line 662 ""
yy87:
@@ -739,7 +739,7 @@ yy89:
default: goto yy90;
}
yy90:
-#line 143 "modula.re"
+#line 144 "modula.re"
{RETURN(72);}
#line 745 ""
yy91:
@@ -816,7 +816,7 @@ yy92:
default: goto yy93;
}
yy93:
-#line 142 "modula.re"
+#line 143 "modula.re"
{RETURN(71);}
#line 822 ""
yy94:
@@ -905,7 +905,7 @@ yy97:
default: goto yy98;
}
yy98:
-#line 141 "modula.re"
+#line 142 "modula.re"
{RETURN(70);}
#line 911 ""
yy99:
@@ -982,7 +982,7 @@ yy100:
default: goto yy101;
}
yy101:
-#line 139 "modula.re"
+#line 140 "modula.re"
{RETURN(68);}
#line 988 ""
yy102:
@@ -1065,7 +1065,7 @@ yy104:
default: goto yy105;
}
yy105:
-#line 140 "modula.re"
+#line 141 "modula.re"
{RETURN(69);}
#line 1071 ""
yy106:
@@ -1142,7 +1142,7 @@ yy107:
default: goto yy108;
}
yy108:
-#line 138 "modula.re"
+#line 139 "modula.re"
{RETURN(67);}
#line 1148 ""
yy109:
@@ -1219,7 +1219,7 @@ yy110:
default: goto yy111;
}
yy111:
-#line 137 "modula.re"
+#line 138 "modula.re"
{RETURN(66);}
#line 1225 ""
yy112:
@@ -1328,7 +1328,7 @@ yy118:
default: goto yy119;
}
yy119:
-#line 136 "modula.re"
+#line 137 "modula.re"
{RETURN(65);}
#line 1334 ""
yy120:
@@ -1411,7 +1411,7 @@ yy122:
default: goto yy123;
}
yy123:
-#line 135 "modula.re"
+#line 136 "modula.re"
{RETURN(64);}
#line 1417 ""
yy124:
@@ -1494,7 +1494,7 @@ yy126:
default: goto yy127;
}
yy127:
-#line 134 "modula.re"
+#line 135 "modula.re"
{RETURN(63);}
#line 1500 ""
yy128:
@@ -1607,7 +1607,7 @@ yy135:
default: goto yy136;
}
yy136:
-#line 133 "modula.re"
+#line 134 "modula.re"
{RETURN(62);}
#line 1613 ""
yy137:
@@ -1726,7 +1726,7 @@ yy145:
default: goto yy146;
}
yy146:
-#line 132 "modula.re"
+#line 133 "modula.re"
{RETURN(61);}
#line 1732 ""
yy147:
@@ -1821,7 +1821,7 @@ yy151:
default: goto yy152;
}
yy152:
-#line 131 "modula.re"
+#line 132 "modula.re"
{RETURN(60);}
#line 1827 ""
yy153:
@@ -1892,7 +1892,7 @@ yy153:
default: goto yy154;
}
yy154:
-#line 129 "modula.re"
+#line 130 "modula.re"
{RETURN(58);}
#line 1898 ""
yy155:
@@ -1963,7 +1963,7 @@ yy155:
default: goto yy156;
}
yy156:
-#line 130 "modula.re"
+#line 131 "modula.re"
{RETURN(59);}
#line 1969 ""
yy157:
@@ -2040,7 +2040,7 @@ yy158:
default: goto yy159;
}
yy159:
-#line 128 "modula.re"
+#line 129 "modula.re"
{RETURN(57);}
#line 2046 ""
yy160:
@@ -2117,7 +2117,7 @@ yy161:
default: goto yy162;
}
yy162:
-#line 126 "modula.re"
+#line 127 "modula.re"
{RETURN(55);}
#line 2123 ""
yy163:
@@ -2200,7 +2200,7 @@ yy165:
default: goto yy166;
}
yy166:
-#line 127 "modula.re"
+#line 128 "modula.re"
{RETURN(56);}
#line 2206 ""
yy167:
@@ -2283,7 +2283,7 @@ yy169:
default: goto yy170;
}
yy170:
-#line 125 "modula.re"
+#line 126 "modula.re"
{RETURN(54);}
#line 2289 ""
yy171:
@@ -2354,7 +2354,7 @@ yy171:
default: goto yy172;
}
yy172:
-#line 121 "modula.re"
+#line 122 "modula.re"
{RETURN(50);}
#line 2360 ""
yy173:
@@ -2431,7 +2431,7 @@ yy174:
default: goto yy175;
}
yy175:
-#line 124 "modula.re"
+#line 125 "modula.re"
{RETURN(53);}
#line 2437 ""
yy176:
@@ -2527,7 +2527,7 @@ yy180:
default: goto yy181;
}
yy181:
-#line 123 "modula.re"
+#line 124 "modula.re"
{RETURN(52);}
#line 2533 ""
yy182:
@@ -2652,7 +2652,7 @@ yy191:
default: goto yy192;
}
yy192:
-#line 122 "modula.re"
+#line 123 "modula.re"
{RETURN(51);}
#line 2658 ""
yy193:
@@ -2741,7 +2741,7 @@ yy196:
default: goto yy197;
}
yy197:
-#line 120 "modula.re"
+#line 121 "modula.re"
{RETURN(49);}
#line 2747 ""
yy198:
@@ -2812,7 +2812,7 @@ yy198:
default: goto yy199;
}
yy199:
-#line 119 "modula.re"
+#line 120 "modula.re"
{RETURN(48);}
#line 2818 ""
yy200:
@@ -2926,7 +2926,7 @@ yy207:
default: goto yy208;
}
yy208:
-#line 118 "modula.re"
+#line 119 "modula.re"
{RETURN(47);}
#line 2932 ""
yy209:
@@ -2997,7 +2997,7 @@ yy209:
default: goto yy210;
}
yy210:
-#line 117 "modula.re"
+#line 118 "modula.re"
{RETURN(46);}
#line 3003 ""
yy211:
@@ -3068,7 +3068,7 @@ yy211:
default: goto yy212;
}
yy212:
-#line 116 "modula.re"
+#line 117 "modula.re"
{RETURN(45);}
#line 3074 ""
yy213:
@@ -3146,7 +3146,7 @@ yy214:
default: goto yy215;
}
yy215:
-#line 114 "modula.re"
+#line 115 "modula.re"
{RETURN(43);}
#line 3152 ""
yy216:
@@ -3223,7 +3223,7 @@ yy217:
default: goto yy218;
}
yy218:
-#line 115 "modula.re"
+#line 116 "modula.re"
{RETURN(44);}
#line 3229 ""
yy219:
@@ -3306,7 +3306,7 @@ yy221:
default: goto yy222;
}
yy222:
-#line 113 "modula.re"
+#line 114 "modula.re"
{RETURN(42);}
#line 3312 ""
yy223:
@@ -3377,7 +3377,7 @@ yy223:
default: goto yy224;
}
yy224:
-#line 112 "modula.re"
+#line 113 "modula.re"
{RETURN(41);}
#line 3383 ""
yy225:
@@ -3490,7 +3490,7 @@ yy232:
default: goto yy233;
}
yy233:
-#line 111 "modula.re"
+#line 112 "modula.re"
{RETURN(40);}
#line 3496 ""
yy234:
@@ -3585,7 +3585,7 @@ yy238:
default: goto yy239;
}
yy239:
-#line 110 "modula.re"
+#line 111 "modula.re"
{RETURN(39);}
#line 3591 ""
yy240:
@@ -3662,7 +3662,7 @@ yy241:
default: goto yy242;
}
yy242:
-#line 109 "modula.re"
+#line 110 "modula.re"
{RETURN(38);}
#line 3668 ""
yy243:
@@ -3739,7 +3739,7 @@ yy244:
default: goto yy245;
}
yy245:
-#line 108 "modula.re"
+#line 109 "modula.re"
{RETURN(37);}
#line 3745 ""
yy246:
@@ -3822,7 +3822,7 @@ yy248:
default: goto yy249;
}
yy249:
-#line 107 "modula.re"
+#line 108 "modula.re"
{RETURN(36);}
#line 3828 ""
yy250:
@@ -3917,7 +3917,7 @@ yy254:
default: goto yy255;
}
yy255:
-#line 106 "modula.re"
+#line 107 "modula.re"
{RETURN(35);}
#line 3923 ""
yy256:
@@ -3988,32 +3988,32 @@ yy256:
default: goto yy257;
}
yy257:
-#line 105 "modula.re"
+#line 106 "modula.re"
{RETURN(34);}
#line 3994 ""
yy258:
++YYCURSOR;
-#line 96 "modula.re"
+#line 97 "modula.re"
{RETURN(26);}
#line 3999 ""
yy260:
++YYCURSOR;
-#line 93 "modula.re"
+#line 94 "modula.re"
{RETURN(23);}
#line 4004 ""
yy262:
++YYCURSOR;
-#line 92 "modula.re"
+#line 93 "modula.re"
{RETURN(22);}
#line 4009 ""
yy264:
++YYCURSOR;
-#line 89 "modula.re"
+#line 90 "modula.re"
{RETURN(19);}
#line 4014 ""
yy266:
++YYCURSOR;
-#line 86 "modula.re"
+#line 87 "modula.re"
{RETURN(16);}
#line 4019 ""
yy268:
@@ -4037,7 +4037,7 @@ yy270:
}
yy271:
++YYCURSOR;
-#line 75 "modula.re"
+#line 76 "modula.re"
{RETURN(6);}
#line 4043 ""
yy273:
@@ -4058,11 +4058,11 @@ yy275:
default: goto yy286;
}
yy276:
-#line 74 "modula.re"
+#line 75 "modula.re"
{RETURN(5);}
#line 4064 ""
yy277:
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
yyaccept = 0;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
@@ -4115,13 +4115,13 @@ yy279:
}
yy281:
++YYCURSOR;
-#line 73 "modula.re"
+#line 74 "modula.re"
{RETURN(4);}
#line 4121 ""
yy283:
++YYCURSOR;
- YYCURSOR = yyctxmarker;
-#line 70 "modula.re"
+ YYCURSOR = YYCTXMARKER;
+#line 71 "modula.re"
{RETURN(1);}
#line 4127 ""
yy285:
@@ -4194,7 +4194,7 @@ yy289:
default: goto yy276;
}
yy291:
- yyctxmarker = YYCURSOR + 1;
+ YYCTXMARKER = YYCURSOR + 1;
yyaccept = 0;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
@@ -4245,7 +4245,7 @@ yy293:
default: goto yy294;
}
yy294:
-#line 71 "modula.re"
+#line 72 "modula.re"
{RETURN(2);}
#line 4251 ""
yy295:
@@ -4272,23 +4272,22 @@ yy295:
default: goto yy296;
}
yy296:
-#line 72 "modula.re"
+#line 73 "modula.re"
{RETURN(3);}
#line 4278 ""
yy297:
++YYCURSOR;
-#line 67 "modula.re"
+#line 68 "modula.re"
{ depth = 1; goto comment; }
#line 4283 ""
}
-#line 162 "modula.re"
+#line 163 "modula.re"
comment:
#line 4289 ""
{
YYCTYPE yych;
- YYCTYPE *yyctxmarker = YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
@@ -4304,9 +4303,9 @@ yy301:
default: goto yy302;
}
yy302:
-#line 179 "modula.re"
+#line 180 "modula.re"
{ goto comment; }
-#line 4310 ""
+#line 4309 ""
yy303:
yych = *++YYCURSOR;
switch(yych){
@@ -4315,33 +4314,33 @@ yy303:
}
yy304:
++YYCURSOR;
-#line 174 "modula.re"
+#line 175 "modula.re"
{
if(cursor == s->eof) RETURN(0);
s->tok = s->pos = cursor; s->line++;
goto comment;
}
-#line 4325 ""
+#line 4324 ""
yy306:
yych = *++YYCURSOR;
goto yy302;
yy307:
++YYCURSOR;
-#line 172 "modula.re"
+#line 173 "modula.re"
{ ++depth; goto comment; }
-#line 4333 ""
+#line 4332 ""
yy309:
++YYCURSOR;
-#line 166 "modula.re"
+#line 167 "modula.re"
{
if(--depth == 0)
goto std;
else
goto comment;
}
-#line 4343 ""
+#line 4342 ""
}
-#line 180 "modula.re"
+#line 181 "modula.re"
}
diff --git a/test/modula.re b/test/modula.re
index 0468ba4e..186b0cc1 100644
--- a/test/modula.re
+++ b/test/modula.re
@@ -11,13 +11,14 @@ typedef unsigned char uchar;
#define YYCURSOR cursor
#define YYLIMIT s->lim
#define YYMARKER s->ptr
+#define YYCTXMARKER s->ctx
#define YYFILL {cursor = fill(s, cursor);}
#define RETURN(i) {s->cur = cursor; return i;}
typedef struct Scanner {
int fd;
- uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof;
+ uchar *bot, *tok, *ptr, *ctx, *cur, *pos, *lim, *top, *eof;
uint line;
} Scanner;
--
2.40.0