summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e4d9875)
raw | patch | inline | side by side (parent: e4d9875)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 31 Mar 2014 21:35:23 +0000 (23:35 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 31 Mar 2014 21:35:23 +0000 (23:35 +0200) |
No escape sequences whatsoever are supported so far but except for that any
single-quoted strings which do not contain single quotes, can be used.
FETCH now supports host names specified as strings as well.
single-quoted strings which do not contain single quotes, can be used.
FETCH now supports host names specified as strings as well.
src/frontend/grammar.y | patch | blob | history | |
src/frontend/scanner.l | patch | blob | history |
diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y
index 4f7a8913630c547b19c5edc86b4d320804ecd2ec..c3ee0af37886d3391d37f0d8fd425a586d0257c1 100644 (file)
--- a/src/frontend/grammar.y
+++ b/src/frontend/grammar.y
%token SCANNER_ERROR
-%token <str> IDENTIFIER
+%token <str> IDENTIFIER STRING
%token <node> FETCH LIST
%type <list> statements
free($2);
$2 = NULL;
}
+ |
+ FETCH STRING
+ {
+ $$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
+ conn_fetch_t, conn_fetch_destroy));
+ CONN_FETCH($$)->name = strdup($2);
+ $$->cmd = CONNECTION_FETCH;
+ free($2);
+ $2 = NULL;
+ }
;
list_statement:
diff --git a/src/frontend/scanner.l b/src/frontend/scanner.l
index c279a4876d11a66672fb54e209c81213608ed55b..c0d167c00c0df1da371d8762098acd57c7ce5abc 100644 (file)
--- a/src/frontend/scanner.l
+++ b/src/frontend/scanner.l
csc_end \*\/
identifier ([A-Za-z_][A-Za-z_0-9$]*)
+/* TODO: fully support SQL strings */
+string ('[^']*')
%%
yylval->str = strdup(yytext);
return IDENTIFIER;
}
+{string} {
+ yytext[yyleng - 1] = '\0';
+ yylval->str = strdup(yytext + 1);
+ return STRING;
+ }
. { /* do nothing for now */ }