aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/storycode.y
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-03-30 17:32:24 +0100
committerThomas White <taw@bitwiz.me.uk>2019-03-30 17:32:24 +0100
commit5a1e588c3fbdce549e0b3c487e2671c679890675 (patch)
treece7f29799aa02cec088d2ec676069ae4ac9cac8d /libstorycode/storycode.y
parent96c903e0756e8a85649c1f7d8d6aa1b146b8c038 (diff)
Get rid of Presentation structure
It doesn't have any reason to exist. A Narrative defines the top-level object already. This is, after all, a narrative-based presentation system. This removes a lot of faff surrounding retrieving the Narrative from the Presentation. It also removes a gigantic place for bugs to hide in keeping the Presentation's view of the slides in sync with the Narrative's opinion. What was that quote? "Code is terrible, and we want as little of it as possible in our program."
Diffstat (limited to 'libstorycode/storycode.y')
-rw-r--r--libstorycode/storycode.y18
1 files changed, 6 insertions, 12 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y
index f549525..d2508e2 100644
--- a/libstorycode/storycode.y
+++ b/libstorycode/storycode.y
@@ -26,7 +26,6 @@
%code requires {
- #include "presentation.h"
#include "narrative.h"
#include "slide.h"
#include "stylesheet.h"
@@ -35,7 +34,6 @@
}
%union {
- Presentation *p;
Stylesheet *ss;
Narrative *n;
Slide *s;
@@ -77,7 +75,6 @@
%token SQOPEN SQCLOSE
%token UNIT VALUE SIZE HEXCOL
-%type <p> presentation
%type <n> narrative
%type <s> slide
%type <ss> stylesheet
@@ -102,11 +99,10 @@
%parse-param { struct scpctx *ctx };
%initial-action
{
- ctx->p = presentation_new();
+ ctx->n = narrative_new();
/* These are the objects currently being created. They will be
- * added to the presentation when they're complete */
- ctx->n = narrative_new();
+ * added to the narrative when they're complete */
ctx->ss = stylesheet_new();
ctx->s = slide_new();
@@ -179,9 +175,8 @@ void set_style(struct scpctx *ctx, enum style_element element)
/* The only thing a "presentation" really needs is narrative */
presentation:
- stylesheet narrative { presentation_add_stylesheet(ctx->p, ctx->ss);
- presentation_add_narrative(ctx->p, ctx->n); }
-| narrative { presentation_add_narrative(ctx->p, ctx->n); }
+ stylesheet narrative
+| narrative
;
@@ -211,8 +206,7 @@ narrative_bulletpoint:
/* -------- Slide -------- */
slide:
- SLIDE '{' slide_parts '}' { presentation_add_slide(ctx->p, ctx->s);
- narrative_add_slide(ctx->n, ctx->s);
+ SLIDE '{' slide_parts '}' { narrative_add_slide(ctx->n, ctx->s);
/* New work in progress object */
ctx->s = slide_new(); }
;
@@ -326,7 +320,7 @@ stylesheet:
STYLES '{'
style_narrative
style_slide
- '}' { }
+ '}' { narrative_add_stylesheet(ctx->n, ctx->ss); }
;
style_narrative: