projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make CTF metadata parser reentrant
[babeltrace.git]
/
formats
/
ctf
/
metadata
/
ctf-lexer.l
diff --git
a/formats/ctf/metadata/ctf-lexer.l
b/formats/ctf/metadata/ctf-lexer.l
index d2151a72e1e9fb2218c027ab99f4c914d2d6ff0e..21e5efa415bac5151c45f1cb46cf7b95dcd18527 100644
(file)
--- a/
formats/ctf/metadata/ctf-lexer.l
+++ b/
formats/ctf/metadata/ctf-lexer.l
@@
-1,13
+1,20
@@
%{
#include <stdio.h>
%{
#include <stdio.h>
+#include "ctf-scanner.h"
#include "ctf-parser.h"
#include "ctf-ast.h"
#include "ctf-parser.h"
#include "ctf-ast.h"
-extern YYSTYPE yylval;
-extern void setstring(const char *src);
+extern void setstring(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src);
+
+#define printf_dbg(fmt, args...) fprintf(stderr, "%s: " fmt, __func__, args)
+#define printf_dbg_noarg(fmt) fprintf(stderr, "%s: " fmt, __func__)
+
%}
%x comment_ml comment_sl string_lit char_const
%}
%x comment_ml comment_sl string_lit char_const
+%option reentrant yylineno noyywrap bison-bridge
+%option extra-type="struct ctf_scanner *"
+ /* bison-locations */
INTEGER_SUFFIX [ \n\t]*(U|UL|ULL|LU|LLU|Ul|Ull|lU|llU|u|uL|uLL|Lu|LLu|ul|ull|lu|llu)
DIGIT [0-9]
NONDIGIT [a-zA-Z_]
INTEGER_SUFFIX [ \n\t]*(U|UL|ULL|LU|LLU|Ul|Ull|lU|llU|u|uL|uLL|Lu|LLu|ul|ull|lu|llu)
DIGIT [0-9]
NONDIGIT [a-zA-Z_]
@@
-92,7
+99,7
@@
_Imaginary return _IMAGINARY;
[1-9]{DIGIT}*{INTEGER_SUFFIX}? return DECIMAL_CONSTANT;
0{OCTALDIGIT}*{INTEGER_SUFFIX}? return OCTAL_CONSTANT;
0[xX]{HEXDIGIT}+{INTEGER_SUFFIX}? return HEXADECIMAL_CONSTANT;
[1-9]{DIGIT}*{INTEGER_SUFFIX}? return DECIMAL_CONSTANT;
0{OCTALDIGIT}*{INTEGER_SUFFIX}? return OCTAL_CONSTANT;
0[xX]{HEXDIGIT}+{INTEGER_SUFFIX}? return HEXADECIMAL_CONSTANT;
-{IDENTIFIER} printf_dbg("<IDENTIFIER %s>\n", yytext); setstring(yy
text); if (is_type(
yytext)) return ID_TYPE; else return IDENTIFIER;
+{IDENTIFIER} printf_dbg("<IDENTIFIER %s>\n", yytext); setstring(yy
extra, yylval, yytext); if (is_type(yyextra,
yytext)) return ID_TYPE; else return IDENTIFIER;
[ \t\n]+ ; /* ignore */
. return ERROR;
%%
[ \t\n]+ ; /* ignore */
. return ERROR;
%%
This page took
0.023518 seconds
and
4
git commands to generate.