From ac3e97014885af00b5a2eb01df232221482db023 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 20 Mar 2010 15:55:52 -0400 Subject: Support max() and min(). --- dimension/common.rules | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'dimension/common.rules') diff --git a/dimension/common.rules b/dimension/common.rules index e5b9e67..c8e0767 100644 --- a/dimension/common.rules +++ b/dimension/common.rules @@ -453,6 +453,12 @@ ARITH_EXPR: FLOAT_LITERAL | "log" "(" ARITH_EXPR ")" { $$ = dmnsn_new_astnode1(DMNSN_AST_LOG, @$, $3); } + | "max" "(" MAX_LIST ")" { + $$ = $3; + } + | "min" "(" MIN_LIST ")" { + $$ = $3; + } | "mod" "(" ARITH_EXPR "," ARITH_EXPR ")" { $$ = dmnsn_new_astnode2(DMNSN_AST_MOD, @$, $3, $5); } @@ -501,6 +507,22 @@ ARITH_EXPR: FLOAT_LITERAL | "t" { $$ = dmnsn_new_ast_ivector(0, 0, 0, 1, 0); } ; +MAX_LIST: ARITH_EXPR "," ARITH_EXPR { + $$ = dmnsn_new_astnode2(DMNSN_AST_MAX, @$, $1, $3); + } + | MAX_LIST "," ARITH_EXPR { + $$ = dmnsn_new_astnode2(DMNSN_AST_MAX, @$, $1, $3); + } +; + +MIN_LIST: ARITH_EXPR "," ARITH_EXPR { + $$ = dmnsn_new_astnode2(DMNSN_AST_MIN, @$, $1, $3); + } + | MIN_LIST "," ARITH_EXPR { + $$ = dmnsn_new_astnode2(DMNSN_AST_MIN, @$, $1, $3); + } +; + /* Colors */ COLOR: COLOR_BODY { -- cgit v1.2.3