1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GTK_CSS_PARSER_PRIVATE_H__
21 #define __GTK_CSS_PARSER_PRIVATE_H__
23 #include <gtk/gtksymboliccolor.h>
27 typedef struct _GtkCssParser GtkCssParser;
29 typedef void (* GtkCssParserErrorFunc) (GtkCssParser *parser,
33 GtkCssParser * _gtk_css_parser_new (const char *data,
34 GtkCssParserErrorFunc error_func,
36 void _gtk_css_parser_free (GtkCssParser *parser);
38 void _gtk_css_parser_take_error (GtkCssParser *parser,
40 void _gtk_css_parser_error (GtkCssParser *parser,
42 ...) G_GNUC_PRINTF (2, 3);
44 guint _gtk_css_parser_get_line (GtkCssParser *parser);
45 guint _gtk_css_parser_get_position (GtkCssParser *parser);
47 gboolean _gtk_css_parser_is_eof (GtkCssParser *parser);
48 gboolean _gtk_css_parser_begins_with (GtkCssParser *parser,
50 gboolean _gtk_css_parser_is_string (GtkCssParser *parser);
53 * _try_foo() functions do not modify the data pointer if they fail, nor do they
54 * signal an error. _read_foo() will modify the data pointer and position it at
55 * the first token that is broken and emit an error about the failure.
56 * So only call _read_foo() when you know that you are reading a foo. _try_foo()
57 * however is fine to call if you don't know yet if the token is a foo or a bar,
58 * you can _try_bar() if try_foo() failed.
60 gboolean _gtk_css_parser_try (GtkCssParser *parser,
62 gboolean skip_whitespace);
63 char * _gtk_css_parser_try_ident (GtkCssParser *parser,
64 gboolean skip_whitespace);
65 char * _gtk_css_parser_try_name (GtkCssParser *parser,
66 gboolean skip_whitespace);
67 gboolean _gtk_css_parser_try_int (GtkCssParser *parser,
69 gboolean _gtk_css_parser_try_uint (GtkCssParser *parser,
71 gboolean _gtk_css_parser_try_double (GtkCssParser *parser,
74 void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
75 char * _gtk_css_parser_read_string (GtkCssParser *parser);
76 char * _gtk_css_parser_read_uri (GtkCssParser *parser);
77 char * _gtk_css_parser_read_value (GtkCssParser *parser);
78 GtkSymbolicColor *_gtk_css_parser_read_symbolic_color
79 (GtkCssParser *parser);
81 void _gtk_css_parser_resync (GtkCssParser *parser,
82 gboolean sync_at_semicolon,
87 #endif /* __GTK_CSS_PARSER_PRIVATE_H__ */