/* Copyright (C) 2008, 2009 Jiri Olsa This file is part of the latrace. The latrace is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The latrace is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the latrace (file COPYING). If not, see . */ %{ #include #include "config.h" #include "args-bison.h" struct lt_args_include* lt_args_buf_get(void); %} alphnum [-0-9a-zA-Z_] name ({alphnum})+ filename ([-0-9a-zA-Z\./_])+ %x comment include %% "/*" BEGIN(comment); [^*\n]* /* eat anything that's not a '*' */ "*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ \n { lt_args_buf_get()->lineno++; } "*"+"/" BEGIN(INITIAL); "#include" { BEGIN(include); return INCLUDE; } {filename} { yylval.s = strdup(yytext); return FILENAME; } "\"" { return '"'; } \n { BEGIN(INITIAL); } . { ; } "extern" { ; } "const" { ; } <> { return END; } "struct" { return STRUCT; } "enum" { return ENUM; } "typedef" { return TYPEDEF; } {name} { yylval.s = strdup(yytext); return NAME; } "\*"+ { return POINTER; } ")" { return ')'; } "(" { return '('; } "}" { return '}'; } "{" { return '{'; } ";" { return ';'; } "," { return ','; } "=" { return '='; } \ { ; } \n { lt_args_buf_get()->lineno++; } . { ; } %% #ifndef yywrap int yywrap() { return 1; /* XXX not to get the compiler 'not used' warning */ yyunput(0, NULL); input(); } #endif void yyerror(const char *m) { printf("latrace config file [%s] line %d: %s\n", lt_args_buf_get()->file, lt_args_buf_get()->lineno, m); }