summaryrefslogtreecommitdiff
path: root/util/epist/epist.y
diff options
context:
space:
mode:
authorScott Moynes <smoynes@nexus.carleton.ca>2002-08-06 22:37:06 +0000
committerScott Moynes <smoynes@nexus.carleton.ca>2002-08-06 22:37:06 +0000
commit6d40002093a5d8e665d4f310ea028d22e93e88cb (patch)
tree6a537e4ee4625df1b57a651357e913b8ff71a996 /util/epist/epist.y
parent00391787e32111fa5c9de606b5edf595846e7513 (diff)
Big fat merge for epist.
This adds a config parser, chaining, and a tonne of other stuff. Still need to fix up build system for the lex and yacc stuff.
Diffstat (limited to 'util/epist/epist.y')
-rw-r--r--util/epist/epist.y83
1 files changed, 83 insertions, 0 deletions
diff --git a/util/epist/epist.y b/util/epist/epist.y
new file mode 100644
index 00000000..60fe9aaa
--- /dev/null
+++ b/util/epist/epist.y
@@ -0,0 +1,83 @@
+%{
+#include <stdio.h>
+#include <string.h>
+#include "parser.hh"
+
+#define YYPARSE_PARAM parser_obj
+#define YYSTYPE char*
+
+extern "C" {
+ int yylex();
+ int yywrap() {
+ return 1;
+ }
+}
+
+void yyerror(const char *c) {
+ printf("ERROR: %s\n", c);
+}
+
+
+%}
+
+%token OBRACE EBRACE SEMICOLON DASH ACTION BINDING NUMBER QUOTES WORD
+
+%%
+
+commands:
+ | commands command
+ ;
+
+command:
+ action_command | chain_command
+ ;
+
+action_command:
+ binding ACTION parameter SEMICOLON
+ {
+ ((parser*)parser_obj)->setAction($2);
+ ((parser*)parser_obj)->endAction();
+ }
+
+ ;
+
+chain_command:
+ binding obrace commands ebrace
+ {
+ ((parser*)parser_obj)->endChain();
+ }
+ ;
+
+binding:
+ binding_w_modifier bind_key
+ ;
+
+obrace:
+ OBRACE { ((parser*)parser_obj)->startChain(); }
+ ;
+
+ebrace:
+ EBRACE { /* ((parser*)parser_obj)->endChain(); */ }
+ ;
+
+binding_w_modifier:
+ | BINDING DASH binding_w_modifier { ((parser*)parser_obj)->addModifier($1); }
+ ;
+
+bind_key:
+ OBRACE { ((parser*)parser_obj)->setKey($1); }
+ | EBRACE { ((parser*)parser_obj)->setKey($1); }
+ | DASH { ((parser*)parser_obj)->setKey($1); }
+ | SEMICOLON { ((parser*)parser_obj)->setKey($1); }
+ | NUMBER { ((parser*)parser_obj)->setKey($1); }
+ | WORD { ((parser*)parser_obj)->setKey($1); }
+ ;
+
+parameter:
+ | NUMBER { ((parser*)parser_obj)->setArgument($1); }
+ | DASH NUMBER { ((parser*)parser_obj)->setArgument($1); }
+ | QUOTES { ((parser*)parser_obj)->setArgument($1); }
+ ;
+
+%%
+