1 %option prefix="perf_pmu_" 1 %option prefix="perf_pmu_" 2 %option reentrant 2 %option reentrant 3 %option bison-bridge 3 %option bison-bridge 4 4 5 %{ 5 %{ 6 #include <stdlib.h> 6 #include <stdlib.h> 7 #include <linux/bitops.h> 7 #include <linux/bitops.h> 8 #include "pmu.h" 8 #include "pmu.h" 9 #include "pmu-bison.h" 9 #include "pmu-bison.h" 10 10 11 char *perf_pmu_get_text(yyscan_t yyscanner); 11 char *perf_pmu_get_text(yyscan_t yyscanner); 12 YYSTYPE *perf_pmu_get_lval(yyscan_t yyscanner) 12 YYSTYPE *perf_pmu_get_lval(yyscan_t yyscanner); 13 13 14 static int value(yyscan_t scanner, int base) 14 static int value(yyscan_t scanner, int base) 15 { 15 { 16 YYSTYPE *yylval = perf_pmu_get_lval(sc 16 YYSTYPE *yylval = perf_pmu_get_lval(scanner); 17 char *text = perf_pmu_get_text(scanner 17 char *text = perf_pmu_get_text(scanner); 18 long num; 18 long num; 19 19 20 errno = 0; 20 errno = 0; 21 num = strtoul(text, NULL, base); 21 num = strtoul(text, NULL, base); 22 if (errno) 22 if (errno) 23 return PP_ERROR; 23 return PP_ERROR; 24 24 25 yylval->num = num; 25 yylval->num = num; 26 return PP_VALUE; 26 return PP_VALUE; 27 } 27 } 28 28 29 %} 29 %} 30 30 31 num_dec [0-9]+ 31 num_dec [0-9]+ 32 32 33 %% 33 %% 34 34 35 {num_dec} { return value(yyscanner, 10); 35 {num_dec} { return value(yyscanner, 10); } 36 config { return PP_CONFIG; } 36 config { return PP_CONFIG; } 37 - { return '-'; } 37 - { return '-'; } 38 : { return ':'; } 38 : { return ':'; } 39 , { return ','; } 39 , { return ','; } 40 . { ; } 40 . { ; } 41 \n { ; } 41 \n { ; } 42 42 43 %% 43 %% 44 44 45 int perf_pmu_wrap(void *scanner __maybe_unused 45 int perf_pmu_wrap(void *scanner __maybe_unused) 46 { 46 { 47 return 1; 47 return 1; 48 } 48 }
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.