5 #include "../gstparse.h"
9 #define YYERROR_VERBOSE 1
10 #define YYPARSE_PARAM pgraph
12 static int yylex (void *lvalp);
13 static int yyerror (const char *s);
26 %token <c> CONNECTION BCONNECTION
32 %type <p> property_value value
33 %type <c> connection rconnection
48 value: VALUE { $$ = g_new0 (property_t, 1); $$->value = $1; }
51 property_value: id '=' value { $$ = $3; $$->name = $1; }
54 element: id { static int i = 0; $$ = g_new0 (element_t, 1);
55 $$->type = $1; $$->index = ++i; }
58 graph: /* empty */ { $$ = g_new0 (graph_t, 1); *((graph_t**) pgraph) = $$; }
59 | graph element { GList *l;
60 $$ = $1; l = $$->connections_pending;
61 $$->elements = g_list_append ($$->elements, $2);
64 $$->first = $$->current;
66 ((connection_t*) l->data)->sink_index = $$->current->index;
69 if ($$->connections_pending) {
70 g_list_free ($$->connections_pending);
71 $$->connections_pending = NULL;
74 | graph bin { GList *l; $$ = $1; l = $$->connections_pending;
75 *((graph_t**) pgraph) = $$;
76 $$->bins = g_list_append ($$->bins, $2);
78 $$->current = $2->first;
80 $$->first = $$->current;
82 ((connection_t*) l->data)->sink_index = $$->current->index;
85 if ($$->connections_pending) {
86 g_list_free ($$->connections_pending);
87 $$->connections_pending = NULL;
89 $$->current = $2->current;
91 | graph connection { $$ = $1;
92 $$->connections = g_list_append ($$->connections, $2);
93 $2->src_index = $$->current->index;
95 $$->connections_pending = g_list_append ($$->connections_pending, $2);
97 | graph property_value { $$ = $1;
98 $$->current->property_values = g_list_append ($$->current->property_values,
103 bin: '{' graph '}' { $$ = $2; $$->current_bin_type = "thread"; }
104 | id '.' '(' graph ')' { $$ = $4; $$->current_bin_type = $1; }
107 connection: CONNECTION
111 rconnection: '!' { $$ = g_new0 (connection_t, 1); }
112 | BCONNECTION { $$ = $1; }
113 | id ',' rconnection ',' id
115 $$->src_pads = g_list_prepend ($$->src_pads, $1);
116 $$->sink_pads = g_list_append ($$->sink_pads, $5);
123 int _gst_parse_yylex (YYSTYPE *lvalp);
125 static int yylex (void *lvalp) {
126 return _gst_parse_yylex ((YYSTYPE*) lvalp);
130 yyerror (const char *s)
132 printf ("error: %s\n", s);
136 int yy_scan_string (char*);
138 graph_t * _gst_parse_launch (const gchar *str, GError **error)
143 g_return_val_if_fail (str != NULL, NULL);
145 dstr = g_strdup (str);
146 yy_scan_string (dstr);
152 if (yyparse (&g) != 0) {
155 GST_PARSE_ERROR_SYNTAX,
161 g_assert (g != NULL);