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