parse-events.l (6870112c46c867f50cd27570860a05bd82614b5c) parse-events.l (387ad33fe710758a8e1b860819a7452bceb4329a)
1
2%option reentrant
3%option bison-bridge
4%option prefix="parse_events_"
5%option stack
6%option bison-locations
7%option yylineno
8%option reject

--- 115 unchanged lines hidden (view full) ---

124 \
125 if (__alloc) \
126 __yylval->str = strdup(text); \
127 \
128 yycolumn -= strlen(text); \
129 yyless(0); \
130} while (0)
131
1
2%option reentrant
3%option bison-bridge
4%option prefix="parse_events_"
5%option stack
6%option bison-locations
7%option yylineno
8%option reject

--- 115 unchanged lines hidden (view full) ---

124 \
125 if (__alloc) \
126 __yylval->str = strdup(text); \
127 \
128 yycolumn -= strlen(text); \
129 yyless(0); \
130} while (0)
131
132static int pmu_str_check(yyscan_t scanner)
132static int pmu_str_check(yyscan_t scanner, struct parse_events_state *parse_state)
133{
134 YYSTYPE *yylval = parse_events_get_lval(scanner);
135 char *text = parse_events_get_text(scanner);
136
137 yylval->str = strdup(text);
133{
134 YYSTYPE *yylval = parse_events_get_lval(scanner);
135 char *text = parse_events_get_text(scanner);
136
137 yylval->str = strdup(text);
138
139 if (parse_state->fake_pmu)
140 return PE_PMU_EVENT_FAKE;
141
138 switch (perf_pmu__parse_check(text)) {
139 case PMU_EVENT_SYMBOL_PREFIX:
140 return PE_PMU_EVENT_PRE;
141 case PMU_EVENT_SYMBOL_SUFFIX:
142 return PE_PMU_EVENT_SUF;
143 case PMU_EVENT_SYMBOL:
144 return PE_KERNEL_PMU_EVENT;
145 default:

--- 225 unchanged lines hidden (view full) ---

371mem: { BEGIN(mem); return PE_PREFIX_MEM; }
372r{num_raw_hex} { return raw(yyscanner); }
373{num_dec} { return value(yyscanner, 10); }
374{num_hex} { return value(yyscanner, 16); }
375
376{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
377{bpf_object} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); }
378{bpf_source} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); }
142 switch (perf_pmu__parse_check(text)) {
143 case PMU_EVENT_SYMBOL_PREFIX:
144 return PE_PMU_EVENT_PRE;
145 case PMU_EVENT_SYMBOL_SUFFIX:
146 return PE_PMU_EVENT_SUF;
147 case PMU_EVENT_SYMBOL:
148 return PE_KERNEL_PMU_EVENT;
149 default:

--- 225 unchanged lines hidden (view full) ---

375mem: { BEGIN(mem); return PE_PREFIX_MEM; }
376r{num_raw_hex} { return raw(yyscanner); }
377{num_dec} { return value(yyscanner, 10); }
378{num_hex} { return value(yyscanner, 16); }
379
380{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
381{bpf_object} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_OBJECT); }
382{bpf_source} { if (!isbpf(yyscanner)) { USER_REJECT }; return str(yyscanner, PE_BPF_SOURCE); }
379{name} { return pmu_str_check(yyscanner); }
383{name} { return pmu_str_check(yyscanner, _parse_state); }
380{name_tag} { return str(yyscanner, PE_NAME); }
381"/" { BEGIN(config); return '/'; }
382- { return '-'; }
383, { BEGIN(event); return ','; }
384: { return ':'; }
385"{" { BEGIN(event); return '{'; }
386"}" { return '}'; }
387= { return '='; }
388\n { }
389. { }
390
391%%
392
393int parse_events_wrap(void *scanner __maybe_unused)
394{
395 return 1;
396}
384{name_tag} { return str(yyscanner, PE_NAME); }
385"/" { BEGIN(config); return '/'; }
386- { return '-'; }
387, { BEGIN(event); return ','; }
388: { return ':'; }
389"{" { BEGIN(event); return '{'; }
390"}" { return '}'; }
391= { return '='; }
392\n { }
393. { }
394
395%%
396
397int parse_events_wrap(void *scanner __maybe_unused)
398{
399 return 1;
400}