add extra error for empty pipeline
authorBenjamin Otte <otte@gnome.org>
Sun, 27 Apr 2003 23:56:31 +0000 (23:56 +0000)
committerBenjamin Otte <otte@gnome.org>
Sun, 27 Apr 2003 23:56:31 +0000 (23:56 +0000)
Original commit message from CVS:
add extra error for empty pipeline

gst/gstparse.h
gst/parse/grammar.y

index 70356ac..70e2460 100644 (file)
@@ -40,6 +40,7 @@ typedef enum
   GST_PARSE_ERROR_LINK,
   GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
   GST_PARSE_ERROR_EMPTY_BIN,
+  GST_PARSE_ERROR_EMPTY
 } GstParseError;
 
 
index 47c2cea..a15bb59 100644 (file)
@@ -521,7 +521,6 @@ static int yyerror (const char *s);
 %type <e> element
 %type <p> padlist pads assignments
 
-
 %left '{' '}' '(' ')'
 %left ','
 %right '.'
@@ -580,7 +579,6 @@ reference:  REF                           { MAKE_REF ($$, $1, NULL); }
 linkpart:      reference                     { $$ = $1; }
        |       pads                          { MAKE_REF ($$, NULL, $1); }
        |       /* NOP */                     { MAKE_REF ($$, NULL, NULL); }
-       |       linkpart error                { $$ = $1; }
        ;
        
 link:          linkpart '!' linkpart         { $$ = $1;
@@ -594,7 +592,7 @@ linklist:   link                          { $$ = g_slist_prepend (NULL, $1); }
        |       link linklist                 { $$ = g_slist_prepend ($2, $1); }
        |       linklist error                { $$ = $1; }
        ;       
-       
+
 chain:         element                       { $$ = gst_parse_chain_new ();
                                                $$->first = $$->last = $1;
                                                $$->front = $$->back = NULL;
@@ -688,7 +686,10 @@ chain:     element                       { $$ = gst_parse_chain_new ();
        |       chain error                   { $$ = $1; }
        ;
        
-graph:         chain                         { $$ = (graph_t *) graph;
+graph:         /* NOP */                     { ERROR (GST_PARSE_ERROR_EMPTY, "Empty pipeline not allowed");
+                                               $$ = (graph_t *) graph;
+                                             }
+       |       chain                         { $$ = (graph_t *) graph;
                                                if ($1->front) {
                                                  if (!$1->front->src_name) {
                                                    ERROR (GST_PARSE_ERROR_LINK, "link without source element");