X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fepist.y;h=243e416877c5ca8f268efd198c68b2bb00c9d02d;hb=97019b8b77f7e6450d87b057bcb6eae43e9f3e2b;hp=c1bf196dcdb748de4156a65d96fc70fd297f515f;hpb=97e86c912ee33e9e75e68f9c193d78879f91d542;p=chaz%2Fopenbox diff --git a/util/epist/epist.y b/util/epist/epist.y index c1bf196d..243e4168 100644 --- a/util/epist/epist.y +++ b/util/epist/epist.y @@ -1,11 +1,18 @@ %{ +#ifdef HAVE_CONFIG_H +# include "../../config.h" +#endif // HAVE_CONFIG_H + #include #include #include "parser.hh" #define YYPARSE_PARAM parser_obj #define YYSTYPE char* - + +extern int yylineno; +extern char *yytext; + extern "C" { int yylex(); int yywrap() { @@ -13,19 +20,21 @@ extern "C" { } } -void yyerror(const char *c) { - printf("ERROR: %s\n", c); +void yyerror(const char *c) +{ + printf("ERROR: %s, on line %d, near %s\n", c, yylineno, yytext); } - %} -%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING +%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING OPTIONS TRUE FALSE +%expect 1 %% commands: | commands command + | commands options_block ; command: @@ -48,6 +57,10 @@ chain_command: } ; +options_block: + options_keyword OBRACE options EBRACE + ; + binding: binding_w_modifier bind_key ; @@ -77,6 +90,21 @@ parameter: | NUMBER { ((parser*)parser_obj)->setArgumentNum($1); } | DASH NUMBER { ((parser*)parser_obj)->setArgumentNegNum($2); } | QUOTES { ((parser*)parser_obj)->setArgumentStr($1); } + | TRUE { ((parser*)parser_obj)->setArgumentTrue($1); } + | FALSE { ((parser*)parser_obj)->setArgumentFalse($1); } + ; + +options_keyword: + OPTIONS + ; + +options: + | options option + ; + +option: + WORD parameter SEMICOLON + { ((parser*)parser_obj)->setOption($1); } ; %%