-/* Generated by re2c 0.16 on Thu Dec 22 09:52:03 2016 */
+/* Generated by re2c 0.16 on Thu Dec 22 11:52:24 2016 */
#line 1 "../src/parse/lex.re"
#include "src/util/c99_stdint.h"
#include <stddef.h>
int Scanner::scan()
{
- uint32_t depth;
-
+ uint32_t depth, code_line;
scan:
tchar = cur - pos;
- tline = cline;
tok = cur;
switch (lexer_state)
{
start:
-#line 893 "src/parse/lex.cc"
+#line 891 "src/parse/lex.cc"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
fatalf("unexpected character: '%c'", *tok);
goto scan;
}
-#line 1003 "src/parse/lex.cc"
+#line 1001 "src/parse/lex.cc"
yy161:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
{
goto scan;
}
-#line 1015 "src/parse/lex.cc"
+#line 1013 "src/parse/lex.cc"
yy164:
yyaccept = 0;
yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
cline++;
goto scan;
}
-#line 1033 "src/parse/lex.cc"
+#line 1031 "src/parse/lex.cc"
yy166:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '\n') goto yy164;
{
return *tok;
}
-#line 1045 "src/parse/lex.cc"
+#line 1043 "src/parse/lex.cc"
yy169:
++YYCURSOR;
#line 262 "../src/parse/lex.re"
{ yylval.regexp = lex_str('"', opts->bCaseInsensitive || opts->bCaseInverted); return TOKEN_REGEXP; }
-#line 1050 "src/parse/lex.cc"
+#line 1048 "src/parse/lex.cc"
yy171:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '}') goto yy195;
++YYCURSOR;
#line 261 "../src/parse/lex.re"
{ yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return TOKEN_REGEXP; }
-#line 1059 "src/parse/lex.cc"
+#line 1057 "src/parse/lex.cc"
yy174:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '/') goto yy195;
yylval.op = *tok;
return TOKEN_STAR;
}
-#line 1068 "src/parse/lex.cc"
+#line 1066 "src/parse/lex.cc"
yy176:
++YYCURSOR;
#line 283 "../src/parse/lex.re"
yylval.op = *tok;
return TOKEN_CLOSE;
}
-#line 1076 "src/parse/lex.cc"
+#line 1074 "src/parse/lex.cc"
yy178:
++YYCURSOR;
#line 367 "../src/parse/lex.re"
yylval.regexp = mkDot();
return TOKEN_REGEXP;
}
-#line 1084 "src/parse/lex.cc"
+#line 1082 "src/parse/lex.cc"
yy180:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '*') goto yy197;
if (yych == '^') goto yy212;
#line 263 "../src/parse/lex.re"
{ yylval.regexp = lex_cls(false); return TOKEN_REGEXP; }
-#line 1146 "src/parse/lex.cc"
+#line 1144 "src/parse/lex.cc"
yy187:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == 'e') goto yy214;
}
}
yy189:
-#line 232 "../src/parse/lex.re"
+#line 230 "../src/parse/lex.re"
{
depth = 1;
+ code_line = cline;
goto code;
}
-#line 1174 "src/parse/lex.cc"
+#line 1173 "src/parse/lex.cc"
yy190:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
tok = cur;
return 0;
}
-#line 1215 "src/parse/lex.cc"
+#line 1214 "src/parse/lex.cc"
yy197:
++YYCURSOR;
#line 250 "../src/parse/lex.re"
depth = 1;
goto comment;
}
-#line 1223 "src/parse/lex.cc"
+#line 1222 "src/parse/lex.cc"
yy199:
++YYCURSOR;
#line 247 "../src/parse/lex.re"
{
goto nextLine;
}
-#line 1230 "src/parse/lex.cc"
+#line 1229 "src/parse/lex.cc"
yy201:
++YYCURSOR;
YYCURSOR -= 1;
return TOKEN_REGEXP;
}
}
-#line 1250 "src/parse/lex.cc"
+#line 1249 "src/parse/lex.cc"
yy203:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yylval.str = new std::string (tok, tok_len ());
return TOKEN_ID;
}
-#line 1275 "src/parse/lex.cc"
+#line 1274 "src/parse/lex.cc"
yy207:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '>') goto yy224;
-#line 241 "../src/parse/lex.re"
+#line 240 "../src/parse/lex.re"
{
tok += 2; /* skip ":=" */
depth = 0;
+ code_line = cline;
goto code;
}
#line 1285 "src/parse/lex.cc"
yy224:
++YYCURSOR;
YYCURSOR -= 2;
-#line 237 "../src/parse/lex.re"
+#line 236 "../src/parse/lex.re"
{
return *tok;
}
{
--cur;
}
- yylval.code = new Code (tok, tok_len (), get_fname (), tline);
+ yylval.code = new Code (tok, tok_len (), get_fname (), code_line);
return TOKEN_CODE;
}
else if (cur == eof)
}
else if (--depth == 0)
{
- yylval.code = new Code (tok, tok_len (), get_fname (), tline);
+ yylval.code = new Code (tok, tok_len (), get_fname (), code_line);
return TOKEN_CODE;
}
goto code;
{
u = lex_cls_chr();
if (l > u) {
- warn.swapped_range(get_line(), l, u);
+ warn.swapped_range(cline, l, u);
std::swap(l, u);
}
goto add;
++YYCURSOR;
#line 615 "../src/parse/lex.re"
{
- warn.useless_escape(tline, tok - pos, tok[1]);
+ warn.useless_escape(cline, tok - pos, tok[1]);
return static_cast<uint8_t>(tok[1]);
}
#line 2381 "src/parse/lex.cc"
#line 646 "../src/parse/lex.re"
{
if (tok[1] != quote) {
- warn.useless_escape(tline, tok - pos, tok[1]);
+ warn.useless_escape(cline, tok - pos, tok[1]);
}
return static_cast<uint8_t>(tok[1]);
}
int Scanner::scan()
{
- uint32_t depth;
-
+ uint32_t depth, code_line;
scan:
tchar = cur - pos;
- tline = cline;
tok = cur;
switch (lexer_state)
{
/*!re2c
"{" {
depth = 1;
+ code_line = cline;
goto code;
}
":=" {
tok += 2; /* skip ":=" */
depth = 0;
+ code_line = cline;
goto code;
}
}
else if (--depth == 0)
{
- yylval.code = new Code (tok, tok_len (), get_fname (), tline);
+ yylval.code = new Code (tok, tok_len (), get_fname (), code_line);
return TOKEN_CODE;
}
goto code;
{
--cur;
}
- yylval.code = new Code (tok, tok_len (), get_fname (), tline);
+ yylval.code = new Code (tok, tok_len (), get_fname (), code_line);
return TOKEN_CODE;
}
else if (cur == eof)
"-" / [^\]] {
u = lex_cls_chr();
if (l > u) {
- warn.swapped_range(get_line(), l, u);
+ warn.swapped_range(cline, l, u);
std::swap(l, u);
}
goto add;
esc "-" { return static_cast<uint8_t>('-'); }
esc "]" { return static_cast<uint8_t>(']'); }
esc . {
- warn.useless_escape(tline, tok - pos, tok[1]);
+ warn.useless_escape(cline, tok - pos, tok[1]);
return static_cast<uint8_t>(tok[1]);
}
*/
esc "\\" { return static_cast<uint8_t>('\\'); }
esc . {
if (tok[1] != quote) {
- warn.useless_escape(tline, tok - pos, tok[1]);
+ warn.useless_escape(cline, tok - pos, tok[1]);
}
return static_cast<uint8_t>(tok[1]);
}