Changeset: af28066b2069 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af28066b2069
Modified Files:
monetdb5/extras/jaql/parser/jaql.l
Branch: Jul2012
Log Message:
jaqllex: fix up rules so we match all input
The rules for <OBJ> and <ARR> were missing matches for the newline,
thanks Sjoerd for the suggestion. However, before that, I did some
tweaking here and there in order to try and resolve the problem.
diffs (59 lines):
diff --git a/monetdb5/extras/jaql/parser/jaql.l
b/monetdb5/extras/jaql/parser/jaql.l
--- a/monetdb5/extras/jaql/parser/jaql.l
+++ b/monetdb5/extras/jaql/parser/jaql.l
@@ -156,8 +156,17 @@ null return NIL;
yymore();
}
%}
- "[" yymore(); yyextra->esc_depth++;
+ "[" {yymore(); yyextra->esc_depth++;}
. yymore();
+ \n yymore();
+ <<EOF>> %{
+ jaqlerror(yyextra, "unexpected end of input");
+ yyextra->pos = yyextra->start = strlen(yyextra->buf);
+ yyextra->scanbuf = yyextra->tokstart = NULL;
+ YY_FLUSH_BUFFER;
+ BEGIN(INITIAL);
+ return EOF;
+ %}
}
"]" return ']';
"[" return '[';
@@ -171,8 +180,17 @@ null return NIL;
yymore();
}
%}
- "{" yymore(); yyextra->esc_depth++;
+ "{" {yymore(); yyextra->esc_depth++;}
. yymore();
+ \n yymore();
+ <<EOF>> %{
+ jaqlerror(yyextra, "unexpected end of input");
+ yyextra->pos = yyextra->start = strlen(yyextra->buf);
+ yyextra->scanbuf = yyextra->tokstart = NULL;
+ YY_FLUSH_BUFFER;
+ BEGIN(INITIAL);
+ return EOF;
+ %}
}
"}" return '}';
"{" return '{';
@@ -188,14 +206,14 @@ null return NIL;
("#"|"//").*\n /* ignore comments */;
[a-zA-Z_][a-zA-Z0-9_]* {yylval->j_ident = GDKstrdup(yytext); return IDENT;}
<<EOF>> return EOF;
-. {
+. %{
char buf[32];
snprintf(buf, sizeof(buf), "unexpected character: %c", yytext[0]);
jaqlerror(yyextra, buf);
yyextra->pos = yyextra->start = strlen(yyextra->buf);
yyextra->scanbuf = yyextra->tokstart = NULL;
YY_FLUSH_BUFFER;
- BEGIN(0);
+ BEGIN(INITIAL);
return EOF;
-}
+%}
%%
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list