[gtk+/wip/otte/tokenizer: 19/78] css: Convert enums to token parsing



commit e9bc9082a435de59c73ea264f3472862fb8e98a7
Author: Benjamin Otte <otte redhat com>
Date:   Thu Mar 17 02:20:58 2016 +0100

    css: Convert enums to token parsing

 gtk/gtkcssenumvalue.c         |  254 +++++++++++++++++++++++++++++++++++++++--
 gtk/gtkcssenumvalueprivate.h  |   15 +++
 gtk/gtkcssstylepropertyimpl.c |  110 ++++++++++++++++--
 3 files changed, 358 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index f8828ec..3707b08 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -102,6 +102,23 @@ _gtk_css_border_style_value_new (GtkBorderStyle border_style)
 }
 
 GtkCssValue *
+gtk_css_border_style_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (border_style_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, border_style_values[i].name))
+        return _gtk_css_value_ref (&border_style_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_border_style_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -244,6 +261,23 @@ _gtk_css_font_size_value_new (GtkCssFontSize font_size)
 }
 
 GtkCssValue *
+gtk_css_font_size_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (font_size_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, font_size_values[i].name))
+        return _gtk_css_value_ref (&font_size_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_font_size_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -292,6 +326,23 @@ _gtk_css_font_style_value_new (PangoStyle font_style)
 }
 
 GtkCssValue *
+gtk_css_font_style_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (font_style_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, font_style_values[i].name))
+        return _gtk_css_value_ref (&font_style_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_font_style_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -339,6 +390,23 @@ _gtk_css_font_variant_value_new (PangoVariant font_variant)
 }
 
 GtkCssValue *
+gtk_css_font_variant_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (font_variant_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, font_variant_values[i].name))
+        return _gtk_css_value_ref (&font_variant_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_font_variant_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -468,6 +536,23 @@ _gtk_css_font_weight_value_new (PangoWeight font_weight)
 }
 
 GtkCssValue *
+gtk_css_font_weight_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (font_weight_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, font_weight_values[i].name))
+        return _gtk_css_value_ref (&font_weight_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_font_weight_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -530,6 +615,23 @@ _gtk_css_font_stretch_value_new (PangoStretch font_stretch)
 }
 
 GtkCssValue *
+gtk_css_font_stretch_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (font_stretch_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, font_stretch_values[i].name))
+        return _gtk_css_value_ref (&font_stretch_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_font_stretch_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -578,6 +680,23 @@ _gtk_css_text_decoration_line_value_new (GtkTextDecorationLine line)
 }
 
 GtkCssValue *
+gtk_css_text_decoration_line_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (text_decoration_line_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, text_decoration_line_values[i].name))
+        return _gtk_css_value_ref (&text_decoration_line_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_text_decoration_line_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -626,6 +745,23 @@ _gtk_css_text_decoration_style_value_new (GtkTextDecorationStyle style)
 }
 
 GtkCssValue *
+gtk_css_text_decoration_style_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (text_decoration_style_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, text_decoration_style_values[i].name))
+        return _gtk_css_value_ref (&text_decoration_style_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_text_decoration_style_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -680,6 +816,23 @@ _gtk_css_area_value_new (GtkCssArea area)
 }
 
 GtkCssValue *
+gtk_css_area_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (area_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, area_values[i].name))
+        return _gtk_css_value_ref (&area_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_area_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -735,6 +888,23 @@ _gtk_css_direction_value_new (GtkCssDirection direction)
 }
 
 GtkCssValue *
+gtk_css_direction_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (direction_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, direction_values[i].name))
+        return _gtk_css_value_ref (&direction_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_direction_value_try_parse (GtkCssParser *parser)
 {
   int i;
@@ -791,6 +961,23 @@ _gtk_css_play_state_value_new (GtkCssPlayState play_state)
 }
 
 GtkCssValue *
+gtk_css_play_state_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (play_state_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, play_state_values[i].name))
+        return _gtk_css_value_ref (&play_state_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_play_state_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -846,6 +1033,23 @@ _gtk_css_fill_mode_value_new (GtkCssFillMode fill_mode)
 }
 
 GtkCssValue *
+gtk_css_fill_mode_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (fill_mode_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, fill_mode_values[i].name))
+        return _gtk_css_value_ref (&fill_mode_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_fill_mode_value_try_parse (GtkCssParser *parser)
 {
   guint i;
@@ -879,37 +1083,54 @@ static const GtkCssValueClass GTK_CSS_VALUE_ICON_EFFECT = {
   gtk_css_value_enum_print
 };
 
-static GtkCssValue image_effect_values[] = {
+static GtkCssValue icon_effect_values[] = {
   { &GTK_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_NONE, "none" },
   { &GTK_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_HIGHLIGHT, "highlight" },
   { &GTK_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_DIM, "dim" }
 };
 
 GtkCssValue *
-_gtk_css_icon_effect_value_new (GtkCssIconEffect image_effect)
+_gtk_css_icon_effect_value_new (GtkCssIconEffect icon_effect)
 {
   guint i;
 
-  for (i = 0; i < G_N_ELEMENTS (image_effect_values); i++)
+  for (i = 0; i < G_N_ELEMENTS (icon_effect_values); i++)
     {
-      if (image_effect_values[i].value == image_effect)
-        return _gtk_css_value_ref (&image_effect_values[i]);
+      if (icon_effect_values[i].value == icon_effect)
+        return _gtk_css_value_ref (&icon_effect_values[i]);
     }
 
   g_return_val_if_reached (NULL);
 }
 
 GtkCssValue *
+gtk_css_icon_effect_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (icon_effect_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, icon_effect_values[i].name))
+        return _gtk_css_value_ref (&icon_effect_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_icon_effect_value_try_parse (GtkCssParser *parser)
 {
   guint i;
 
   g_return_val_if_fail (parser != NULL, NULL);
 
-  for (i = 0; i < G_N_ELEMENTS (image_effect_values); i++)
+  for (i = 0; i < G_N_ELEMENTS (icon_effect_values); i++)
     {
-      if (_gtk_css_parser_try (parser, image_effect_values[i].name, TRUE))
-        return _gtk_css_value_ref (&image_effect_values[i]);
+      if (_gtk_css_parser_try (parser, icon_effect_values[i].name, TRUE))
+        return _gtk_css_value_ref (&icon_effect_values[i]);
     }
 
   return NULL;
@@ -987,6 +1208,23 @@ _gtk_css_icon_style_value_new (GtkCssIconStyle icon_style)
 }
 
 GtkCssValue *
+gtk_css_icon_style_value_from_token (const GtkCssToken *token)
+{
+  guint i;
+
+  if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
+    return NULL;
+
+  for (i = 0; i < G_N_ELEMENTS (icon_style_values); i++)
+    {
+      if (gtk_css_token_is_ident (token, icon_style_values[i].name))
+        return _gtk_css_value_ref (&icon_style_values[i]);
+    }
+
+  return NULL;
+}
+
+GtkCssValue *
 _gtk_css_icon_style_value_try_parse (GtkCssParser *parser)
 {
   guint i;
diff --git a/gtk/gtkcssenumvalueprivate.h b/gtk/gtkcssenumvalueprivate.h
index 884a243..166ec1d 100644
--- a/gtk/gtkcssenumvalueprivate.h
+++ b/gtk/gtkcssenumvalueprivate.h
@@ -22,67 +22,82 @@
 
 #include "gtkenums.h"
 #include "gtkcssparserprivate.h"
+#include "gtkcsstokensourceprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkcssvalueprivate.h"
 
 G_BEGIN_DECLS
 
 GtkCssValue *   _gtk_css_border_style_value_new       (GtkBorderStyle     border_style);
+GtkCssValue *   gtk_css_border_style_value_from_token (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_border_style_value_try_parse (GtkCssParser      *parser);
 GtkBorderStyle  _gtk_css_border_style_value_get       (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_font_size_value_new          (GtkCssFontSize     size);
+GtkCssValue *   gtk_css_font_size_value_from_token    (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_font_size_value_try_parse    (GtkCssParser      *parser);
 GtkCssFontSize  _gtk_css_font_size_value_get          (const GtkCssValue *value);
 double          _gtk_css_font_size_get_default        (GtkStyleProviderPrivate *provider);
 
 GtkCssValue *   _gtk_css_font_style_value_new         (PangoStyle         style);
+GtkCssValue *   gtk_css_font_style_value_from_token   (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_font_style_value_try_parse   (GtkCssParser      *parser);
 PangoStyle      _gtk_css_font_style_value_get         (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_font_variant_value_new       (PangoVariant       variant);
+GtkCssValue *   gtk_css_font_variant_value_from_token (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_font_variant_value_try_parse (GtkCssParser      *parser);
 PangoVariant    _gtk_css_font_variant_value_get       (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_font_weight_value_new        (PangoWeight        weight);
+GtkCssValue *   gtk_css_font_weight_value_from_token  (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_font_weight_value_try_parse  (GtkCssParser      *parser);
 PangoWeight     _gtk_css_font_weight_value_get        (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_font_stretch_value_new       (PangoStretch       stretch);
+GtkCssValue *   gtk_css_font_stretch_value_from_token (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_font_stretch_value_try_parse (GtkCssParser      *parser);
 PangoStretch    _gtk_css_font_stretch_value_get       (const GtkCssValue *value);
 
 GtkCssValue *         _gtk_css_text_decoration_line_value_new       (GtkTextDecorationLine  line);
+GtkCssValue *         gtk_css_text_decoration_line_value_from_token (const GtkCssToken     *token);
 GtkCssValue *         _gtk_css_text_decoration_line_value_try_parse (GtkCssParser          *parser);
 GtkTextDecorationLine _gtk_css_text_decoration_line_value_get       (const GtkCssValue     *value);
 
 GtkCssValue *          _gtk_css_text_decoration_style_value_new       (GtkTextDecorationStyle  style);
+GtkCssValue *          gtk_css_text_decoration_style_value_from_token (const GtkCssToken     *token);
 GtkCssValue *          _gtk_css_text_decoration_style_value_try_parse (GtkCssParser           *parser);
 GtkTextDecorationStyle _gtk_css_text_decoration_style_value_get       (const GtkCssValue      *value);
 
 GtkCssValue *   _gtk_css_area_value_new               (GtkCssArea         area);
+GtkCssValue *   gtk_css_area_value_from_token         (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_area_value_try_parse         (GtkCssParser      *parser);
 GtkCssArea      _gtk_css_area_value_get               (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_direction_value_new          (GtkCssDirection    direction);
+GtkCssValue *   gtk_css_direction_value_from_token    (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_direction_value_try_parse    (GtkCssParser      *parser);
 GtkCssDirection _gtk_css_direction_value_get          (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_play_state_value_new         (GtkCssPlayState    play_state);
+GtkCssValue *   gtk_css_play_state_value_from_token   (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_play_state_value_try_parse   (GtkCssParser      *parser);
 GtkCssPlayState _gtk_css_play_state_value_get         (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_fill_mode_value_new          (GtkCssFillMode     fill_mode);
+GtkCssValue *   gtk_css_fill_mode_value_from_token    (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_fill_mode_value_try_parse    (GtkCssParser      *parser);
 GtkCssFillMode  _gtk_css_fill_mode_value_get          (const GtkCssValue *value);
 
 GtkCssValue *   _gtk_css_icon_effect_value_new        (GtkCssIconEffect   image_effect);
+GtkCssValue *   gtk_css_icon_effect_value_from_token  (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_icon_effect_value_try_parse  (GtkCssParser      *parser);
 GtkCssIconEffect _gtk_css_icon_effect_value_get       (const GtkCssValue *value);
 void            gtk_css_icon_effect_apply             (GtkCssIconEffect   icon_effect,
                                                        cairo_surface_t   *surface);
 
 GtkCssValue *   _gtk_css_icon_style_value_new         (GtkCssIconStyle    icon_style);
+GtkCssValue *   gtk_css_icon_style_value_from_token   (const GtkCssToken *token);
 GtkCssValue *   _gtk_css_icon_style_value_try_parse   (GtkCssParser      *parser);
 GtkCssIconStyle _gtk_css_icon_style_value_get         (const GtkCssValue *value);
 
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 27918ea..c1c8c7b 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -141,6 +141,27 @@ gtk_css_style_property_register (const char *                      name,
 
 /*** IMPLEMENTATIONS ***/
 
+static GtkCssValue *
+token_parse_enum (GtkCssTokenSource   *source,
+                  GtkCssValue *      (* func) (const GtkCssToken *))
+{
+  const GtkCssToken *token;
+  GtkCssValue *value;
+
+  token = gtk_css_token_source_get_token (source);
+  value = func (token);
+  if (value == NULL)
+    {
+      gtk_css_token_source_error (source, "Unknown value for property");
+      gtk_css_token_source_consume_all (source);
+      return NULL;
+    }
+
+  gtk_css_token_source_consume_token (source);
+
+  return value;
+}
+
 static void
 query_length_as_int (GtkCssStyleProperty *property,
                      const GtkCssValue   *css_value,
@@ -317,6 +338,13 @@ parse_pango_style (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+token_parse_pango_style (GtkCssTokenSource   *source,
+                         GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_font_style_value_from_token);
+}
+
 static void
 query_pango_style (GtkCssStyleProperty *property,
                     const GtkCssValue   *css_value,
@@ -345,6 +373,13 @@ parse_pango_weight (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+token_parse_pango_weight (GtkCssTokenSource   *source,
+                          GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_font_weight_value_from_token);
+}
+
 static void
 query_pango_weight (GtkCssStyleProperty *property,
                     const GtkCssValue   *css_value,
@@ -373,6 +408,13 @@ parse_pango_variant (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+token_parse_pango_variant (GtkCssTokenSource   *source,
+                           GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_font_variant_value_from_token);
+}
+
 static void
 query_pango_variant (GtkCssStyleProperty *property,
                      const GtkCssValue   *css_value,
@@ -401,6 +443,13 @@ parse_pango_stretch (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+token_parse_pango_stretch (GtkCssTokenSource   *source,
+                           GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_font_stretch_value_from_token);
+}
+
 static void
 query_pango_stretch (GtkCssStyleProperty *property,
                      const GtkCssValue   *css_value,
@@ -429,6 +478,13 @@ parse_border_style (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+token_parse_border_style (GtkCssTokenSource   *source,
+                          GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_border_style_value_from_token);
+}
+
 static void
 query_border_style (GtkCssStyleProperty *property,
                     const GtkCssValue   *css_value,
@@ -554,6 +610,13 @@ image_effect_parse (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+image_effect_token_parse (GtkCssTokenSource   *source,
+                          GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_icon_effect_value_from_token);
+}
+
+static GtkCssValue *
 icon_palette_parse (GtkCssStyleProperty *property,
                    GtkCssParser        *parser)
 {
@@ -573,6 +636,13 @@ icon_style_parse (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+icon_style_token_parse (GtkCssTokenSource   *source,
+                        GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_icon_style_value_from_token);
+}
+
+static GtkCssValue *
 bindings_value_parse_one (GtkCssParser *parser)
 {
   char *name;
@@ -692,6 +762,13 @@ parse_text_decoration_line (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+token_parse_text_decoration_line (GtkCssTokenSource   *source,
+                                  GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_text_decoration_line_value_from_token);
+}
+
+static GtkCssValue *
 parse_text_decoration_style (GtkCssStyleProperty *property,
                              GtkCssParser        *parser)
 {
@@ -704,6 +781,13 @@ parse_text_decoration_style (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+token_parse_text_decoration_style (GtkCssTokenSource   *source,
+                                   GtkCssStyleProperty *property)
+{
+  return token_parse_enum (source, gtk_css_text_decoration_style_value_from_token);
+}
+
+static GtkCssValue *
 box_shadow_value_parse (GtkCssStyleProperty *property,
                         GtkCssParser        *parser)
 {
@@ -1205,7 +1289,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_STYLE_PROPERTY_INHERIT,
                                           GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           parse_pango_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_pango_style,
                                           query_pango_style,
                                           assign_pango_style,
                                           _gtk_css_font_style_value_new (PANGO_STYLE_NORMAL));
@@ -1215,7 +1299,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_STYLE_PROPERTY_INHERIT,
                                           GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           parse_pango_variant,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_pango_variant,
                                           query_pango_variant,
                                           assign_pango_variant,
                                           _gtk_css_font_variant_value_new (PANGO_VARIANT_NORMAL));
@@ -1225,7 +1309,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
                                           GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           parse_pango_weight,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_pango_weight,
                                           query_pango_weight,
                                           assign_pango_weight,
                                           _gtk_css_font_weight_value_new (PANGO_WEIGHT_NORMAL));
@@ -1235,7 +1319,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_STYLE_PROPERTY_INHERIT,
                                           GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           parse_pango_stretch,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_pango_stretch,
                                           query_pango_stretch,
                                           assign_pango_stretch,
                                           _gtk_css_font_stretch_value_new (PANGO_STRETCH_NORMAL));
@@ -1257,7 +1341,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           parse_text_decoration_line,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_text_decoration_line,
                                           NULL,
                                           NULL,
                                           _gtk_css_text_decoration_line_value_new 
(GTK_CSS_TEXT_DECORATION_LINE_NONE));
@@ -1277,7 +1361,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           parse_text_decoration_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_text_decoration_style,
                                           NULL,
                                           NULL,
                                           _gtk_css_text_decoration_style_value_new 
(GTK_CSS_TEXT_DECORATION_STYLE_SOLID));
@@ -1393,7 +1477,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_BORDER,
                                           parse_border_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_border_style,
                                           query_border_style,
                                           assign_border_style,
                                           _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE));
@@ -1413,7 +1497,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_BORDER,
                                           parse_border_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_border_style,
                                           query_border_style,
                                           assign_border_style,
                                           _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE));
@@ -1433,7 +1517,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_BORDER,
                                           parse_border_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_border_style,
                                           query_border_style,
                                           assign_border_style,
                                           _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE));
@@ -1453,7 +1537,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_BORDER,
                                           parse_border_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_border_style,
                                           query_border_style,
                                           assign_border_style,
                                           _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE));
@@ -1519,7 +1603,7 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           GTK_CSS_AFFECTS_OUTLINE | GTK_CSS_AFFECTS_CLIP,
                                           parse_border_style,
-                                          gtk_css_style_property_token_parse_default,
+                                          token_parse_border_style,
                                           query_border_style,
                                           assign_border_style,
                                           _gtk_css_border_style_value_new (GTK_BORDER_STYLE_NONE));
@@ -1784,7 +1868,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_STYLE_PROPERTY_INHERIT,
                                           GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
                                           icon_style_parse,
-                                          gtk_css_style_property_token_parse_default,
+                                          icon_style_token_parse,
                                           NULL,
                                           NULL,
                                           _gtk_css_icon_style_value_new (GTK_CSS_ICON_STYLE_REQUESTED));
@@ -1960,7 +2044,7 @@ _gtk_css_style_property_init_properties (void)
                                          GTK_STYLE_PROPERTY_INHERIT,
                                           GTK_CSS_AFFECTS_ICON,
                                          image_effect_parse,
-                                          gtk_css_style_property_token_parse_default,
+                                         image_effect_token_parse,
                                          NULL,
                                          NULL,
                                          _gtk_css_icon_effect_value_new (GTK_CSS_ICON_EFFECT_NONE));


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