aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/storycode.y
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-02-25 21:03:27 +0100
committerThomas White <taw@bitwiz.me.uk>2019-02-25 21:03:27 +0100
commita779b9a9095cfceaa4a0a8da5b4faaaa98287078 (patch)
tree5cc65c14e82c22e78836f91c4cd34179c04892f1 /libstorycode/storycode.y
parent0a146090aa9dc02f5568e9c314e11ab69b40d225 (diff)
Parse gradients
Diffstat (limited to 'libstorycode/storycode.y')
-rw-r--r--libstorycode/storycode.y27
1 files changed, 24 insertions, 3 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y
index 724a779..38a0750 100644
--- a/libstorycode/storycode.y
+++ b/libstorycode/storycode.y
@@ -47,6 +47,7 @@
double val;
double rgba[4];
enum alignment align;
+ enum gradient grad;
}
%{
@@ -70,6 +71,7 @@
%token IMAGEFRAME
%token BP
%token FONT GEOMETRY PAD ALIGN FGCOL BGCOL PARASPACE
+%token VERT HORIZ
%token LEFT CENTER RIGHT
%token STRING
%token SQOPEN SQCLOSE
@@ -95,6 +97,7 @@
%type <str> slidetitle
%type <character> UNIT
%type <val> VALUE
+%type <grad> gradtype
%parse-param { struct scpctx *ctx };
%initial-action
@@ -302,6 +305,11 @@ length:
if ( $UNIT == 'f' ) $$.unit = LENGTH_FRAC; }
;
+gradtype:
+ VERT { $$ = GRAD_VERT; }
+| HORIZ { $$ = GRAD_HORIZ; }
+;
+
/* ------ Stylesheet ------ */
@@ -332,10 +340,14 @@ style_slide:
style_slide_def:
%empty
+ /* Doesn't need set_style() */
+| style_slide_def style_slidesize { }
+ /* Call set_style() immediately */
+| style_slide_def background { set_style(ctx, STYEL_SLIDE); }
+ /* The ones below will call set_style() themselves */
| style_slide_def style_slide_prestitle { }
| style_slide_def style_slide_text { }
| style_slide_def style_slide_title { }
-| style_slide_def style_slidesize { }
;
style_slidesize:
@@ -349,6 +361,16 @@ style_slidesize:
}
;
+background:
+ BGCOL colour { for ( int i=0; i<4; i++ ) ctx->bgcol[i] = $2[i];
+ ctx->bggrad = GRAD_NONE;
+ ctx->mask |= STYMASK_BGCOL; }
+| BGCOL gradtype colour colour { for ( int i=0; i<4; i++ ) ctx->bgcol[i] = $3[i];
+ for ( int i=0; i<4; i++ ) ctx->bgcol2[i] = $4[i];
+ ctx->bggrad = $2;
+ ctx->mask |= STYMASK_BGCOL; }
+;
+
style_slide_prestitle:
PRESTITLE '{' styledefs '}' { set_style(ctx, STYEL_SLIDE_PRESTITLE); }
;
@@ -377,8 +399,7 @@ styledef:
ctx->mask |= STYMASK_PARASPACE; }
| FGCOL colour { for ( int i=0; i<4; i++ ) ctx->fgcol[i] = $2[i];
ctx->mask |= STYMASK_FGCOL; }
-| BGCOL colour { for ( int i=0; i<4; i++ ) ctx->bgcol[i] = $2[i];
- ctx->mask |= STYMASK_BGCOL; }
+| background { /* Handled in rule 'background' */ }
| ALIGN alignment { ctx->alignment = $2;
ctx->mask |= STYMASK_ALIGNMENT; }
;