[gtk+/wip/otte/shader: 44/151] gskslexpression: Parse (sub)expressions in parenthesis



commit ff5dfc89ac784ec96aa15798fd41f83cbb448a8c
Author: Benjamin Otte <otte redhat com>
Date:   Fri Sep 29 01:18:49 2017 +0200

    gskslexpression: Parse (sub)expressions in parenthesis
    
    Well, that was easy.

 gsk/gskslexpression.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskslexpression.c b/gsk/gskslexpression.c
index 9ea7cdb..ad1d7b4 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -1282,6 +1282,23 @@ gsk_sl_expression_parse_primary (GskSlScope        *scope,
       gsk_sl_preprocessor_consume (stream, (GskSlExpression *) constant);
       return (GskSlExpression *) constant;
 
+    case GSK_SL_TOKEN_LEFT_PAREN:
+      {
+        GskSlExpression *expr;
+
+        gsk_sl_preprocessor_consume (stream, NULL);
+        expr = gsk_sl_expression_parse (scope, stream);
+
+        token = gsk_sl_preprocessor_get (stream);
+        if (!gsk_sl_token_is (token, GSK_SL_TOKEN_RIGHT_PAREN))
+          {
+            gsk_sl_preprocessor_error (stream, SYNTAX, "Expected closing \")\".");
+            gsk_sl_preprocessor_sync (stream, GSK_SL_TOKEN_RIGHT_PAREN);
+          }
+        gsk_sl_preprocessor_consume (stream, NULL);
+
+        return expr;
+      }
     case GSK_SL_TOKEN_VOID:
     case GSK_SL_TOKEN_FLOAT:
     case GSK_SL_TOKEN_DOUBLE:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]