aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/storycode.y
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-02-16 20:43:59 +0100
committerThomas White <taw@physics.org>2019-02-16 20:43:59 +0100
commit6a31d8c2ba70c1a5342bc827091a2076e65fb2e0 (patch)
treea5054f25d397091023943bb3eeb1883fa6ff5d65 /libstorycode/storycode.y
parentcd63ea1509bc349ce3b0042da134da7c193213d5 (diff)
Start of work on parser
Diffstat (limited to 'libstorycode/storycode.y')
-rw-r--r--libstorycode/storycode.y28
1 files changed, 23 insertions, 5 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y
index 33336a7..095ed96 100644
--- a/libstorycode/storycode.y
+++ b/libstorycode/storycode.y
@@ -27,9 +27,18 @@
void scerror(const char *s);
%}
-%define api.value.type {char *}
%define api.token.prefix {SC_}
%define api.prefix {sc}
+
+%union {
+ Presentation *p;
+ Stylesheet *ss;
+ Narrative *n;
+ Slide *s;
+ SlideItem *si;
+ char *str;
+}
+
%token STYLES SLIDE
%token NARRATIVE
%token PRESTITLE
@@ -49,6 +58,15 @@
%token PLUS TIMES
%token UNIT VALUE
+%type <p> presentation
+%type <n> narrative
+%type <s> slide
+%type <ss> stylesheet
+%type <str> prestitle
+%type <str> STRING
+%type <str> bulletpoint
+%type <si> textframe
+
%%
presentation:
@@ -62,10 +80,10 @@ narrative:
;
narrative_el:
- prestitle { printf("prestitle: '%s'\n", $1); }
-| bulletpoint { printf("* '%s'\n", $1); }
-| slide
-| STRING { printf("Text line '%s'\n", $1); }
+ prestitle { narrative_add_prestitle(n, $1); }
+| bulletpoint { narrative_add_bp(n, $1); }
+| slide { narrative_add_slide(n, $1); }
+| STRING { narrative_add_text(n, $1); }
;
/* Can be in narrative or slide */