aboutsummaryrefslogtreecommitdiff
path: root/properties.y
diff options
context:
space:
mode:
Diffstat (limited to 'properties.y')
-rw-r--r--properties.y30
1 files changed, 28 insertions, 2 deletions
diff --git a/properties.y b/properties.y
index 69d683d..a765c8a 100644
--- a/properties.y
+++ b/properties.y
@@ -2,19 +2,45 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
%}
%token KEY DIV VALUE
+%union
+{
+ char *value;
+}
+
%%
-value: VALUE
- | VALUE value
+value: VALUE {
+ $$.value = calloc(2, sizeof(char));
+ strcat($$.value, $1.value);
+ }
+ | value VALUE {
+ char *s = strdup($$.value);
+ $$.value = calloc(strlen(s) + strlen($2.value) + 1, sizeof(char));
+ strcat($$.value, s);
+ strcat($$.value, $2.value);
+ }
;
%%
+extern FILE *yyin;
+
+int
+main(void)
+{
+ do {
+ yyparse();
+ } while(!feof(yyin));
+
+ return EXIT_SUCCESS;
+}
+
void
yyerror(char *s)
{