summaryrefslogtreecommitdiff
path: root/src/intersim/config.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/intersim/config.y')
-rw-r--r--src/intersim/config.y33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/intersim/config.y b/src/intersim/config.y
new file mode 100644
index 0000000..d2388c9
--- /dev/null
+++ b/src/intersim/config.y
@@ -0,0 +1,33 @@
+%{
+
+#include "booksim.hpp"
+#include <string>
+#include "config_utils.hpp"
+
+int configlex(void);
+void configerror(string msg);
+
+%}
+
+%union {
+ char *name;
+ unsigned int num;
+ double fnum;
+}
+
+%token <name> STR
+%token <num> NUM
+%token <fnum> FNUM
+
+%%
+
+commands : commands command
+ | command
+;
+
+command : STR '=' STR ';' { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); free( $3 ); }
+ | STR '=' NUM ';' { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); }
+ | STR '=' FNUM ';' { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); }
+;
+
+%%