parser: Allow element names to begin with digits
authorDavid Schleef <ds@schleef.org>
Wed, 13 Apr 2011 16:20:13 +0000 (09:20 -0700)
committerDavid Schleef <ds@schleef.org>
Wed, 13 Apr 2011 19:24:12 +0000 (12:24 -0700)
gst/parse/parse.l
tests/check/pipelines/parse-launch.c

index b9162c2..bcd6527 100644 (file)
@@ -35,7 +35,7 @@ PRINT (const char *format, ...)
 %}
 
 _operator [(){}.!,;=]
-_identifier [[:alpha:]][[:alnum:]\-_%:]*
+_identifier [[:alnum:]_][[:alnum:]\-_%:]*
 
 _char ("\\".)|([^[:space:]])
 _string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\'")*"'")
index 0f02b67..3c7fdf9 100644 (file)
@@ -99,6 +99,8 @@ static const gchar *test_lines[] = {
   "fakesrc !   video/raw,  format=(fourcc)YUY2; video/raw, format=(fourcc)YV12 ! fakesink silent=true",
   "fakesrc ! audio/x-raw-int, width=[16,  32], depth={16, 24, 32}, signed=TRUE ! fakesink silent=true",
   "fakesrc ! identity silent=true ! identity silent=true ! identity silent=true ! fakesink silent=true",
+  "fakesrc name=100 fakesink name=101 silent=true 100. ! 101.",
+  "fakesrc ! 1dentity ! fakesink silent=true",
   NULL
 };
 
@@ -106,6 +108,18 @@ GST_START_TEST (test_launch_lines)
 {
   GstElement *pipeline;
   const gchar **s;
+  GType type;
+  GstElementFactory *efac;
+
+  efac = gst_element_factory_find ("identity");
+  fail_unless (efac != NULL);
+  efac =
+      GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (efac)));
+  fail_unless (efac != NULL);
+  type = gst_element_factory_get_element_type (efac);
+  fail_unless (type != 0);
+  g_object_unref (efac);
+  fail_unless (gst_element_register (NULL, "1dentity", GST_RANK_NONE, type));
 
   for (s = test_lines; *s != NULL; s++) {
     pipeline = setup_pipeline (*s);