From 5a1e588c3fbdce549e0b3c487e2671c679890675 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 30 Mar 2019 17:32:24 +0100 Subject: 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." --- libstorycode/storycode.y | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'libstorycode/storycode.y') 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

presentation %type narrative %type slide %type 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: -- cgit v1.2.3