@@ -162,6 +162,26 @@ select start.pid, (end.TIMESTAMP_USECS - start.TIMESTAMP_USECS) as lat from sche
WHERE start.prio < 100 || end.prev_prio < 100
--
+
+KEYWORDS AS EVENT FIELDS
+------------------------
+
+In some cases, an event may have a keyword. For example, regcache_drop_region has "from"
+as a field and the following will not work
+
+[source,c]
+--
+ select from from regcache_drop_region
+--
+
+In such cases, add a backslash to the conflicting field, and this will tell the parser
+that the "from" is a field and not a keyword:
+
+[source,c]
+--
+ select \from from regcache_drop_region
+--
+
HISTOGRAMS
----------
@@ -25,7 +25,7 @@ extern int my_yyinput(void *extra, char *buf, int max);
%option reentrant
%option bison-bridge
-field [a-z_][a-z0-9_\.]*
+field \\?[a-z_][a-z0-9_\.]*
qstring \"[^\"]*\"
hexnum 0x[0-9a-f]+
number [0-9a-f]+
@@ -46,8 +46,10 @@ where { HANDLE_COLUMN; return WHERE; }
}
{field} {
+ const char *str = yyg->yytext_r;
HANDLE_COLUMN;
- yylval->string = store_str(TRACE_SB, yyg->yytext_r);
+ if (str[0] == '\\') { str++; };
+ yylval->string = store_str(TRACE_SB, str);
return FIELD;
}