2012-03-15 12:09:17 -07:00
|
|
|
%option prefix="perf_pmu_"
|
2023-04-05 23:52:23 -07:00
|
|
|
%option reentrant
|
|
|
|
%option bison-bridge
|
2012-03-15 12:09:17 -07:00
|
|
|
|
|
|
|
%{
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include "pmu.h"
|
|
|
|
#include "pmu-bison.h"
|
|
|
|
|
2023-04-05 23:52:23 -07:00
|
|
|
char *perf_pmu_get_text(yyscan_t yyscanner);
|
|
|
|
YYSTYPE *perf_pmu_get_lval(yyscan_t yyscanner);
|
|
|
|
|
|
|
|
static int value(yyscan_t scanner, int base)
|
2012-03-15 12:09:17 -07:00
|
|
|
{
|
2023-04-05 23:52:23 -07:00
|
|
|
YYSTYPE *yylval = perf_pmu_get_lval(scanner);
|
|
|
|
char *text = perf_pmu_get_text(scanner);
|
2012-03-15 12:09:17 -07:00
|
|
|
long num;
|
|
|
|
|
|
|
|
errno = 0;
|
2023-04-05 23:52:23 -07:00
|
|
|
num = strtoul(text, NULL, base);
|
2012-03-15 12:09:17 -07:00
|
|
|
if (errno)
|
|
|
|
return PP_ERROR;
|
|
|
|
|
2023-04-05 23:52:23 -07:00
|
|
|
yylval->num = num;
|
2012-03-15 12:09:17 -07:00
|
|
|
return PP_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
num_dec [0-9]+
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
2023-04-05 23:52:23 -07:00
|
|
|
{num_dec} { return value(yyscanner, 10); }
|
2012-03-15 12:09:17 -07:00
|
|
|
config { return PP_CONFIG; }
|
|
|
|
- { return '-'; }
|
|
|
|
: { return ':'; }
|
|
|
|
, { return ','; }
|
|
|
|
. { ; }
|
|
|
|
\n { ; }
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
2023-04-05 23:52:23 -07:00
|
|
|
int perf_pmu_wrap(void *scanner __maybe_unused)
|
2012-03-15 12:09:17 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|