5 #include <glib/gprintf.h>
7 #include "../gst_private.h"
10 #include "../gstinfo.h"
11 #include "../gsturi.h"
12 #include "grammar.tab.h"
14 /* Override the default ECHO so as to avoid fortify warnings. Ignore the
15 embedded-NUL case for now. We know yytext is NUL-terminated. */
16 #define ECHO g_fprintf(yyout, "%s", yytext)
18 #ifdef G_HAVE_ISO_VARARGS
19 #define PRINT(...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " __VA_ARGS__)
20 #elif defined(G_HAVE_GNUC_VARARGS)
21 #define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " args)
24 PRINT (const char *format, ...)
28 va_start (varargs, format);
29 GST_CAT_LEVEL_LOG_valist (GST_CAT_PIPELINE, GST_LEVEL_DEBUG, NULL,
35 #define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
39 _identifier [[:alpha:]][[:alnum:]\-_%:]*
41 _char ("\\".)|([^[:space:]])
42 _string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
44 _comma [[:space:]]*","[[:space:]]*
45 _assign [[:space:]]*"="[[:space:]]*
47 _protocol [[:alpha:]][[:alnum:]+-\.]*
48 _url ({_protocol}"://"{_string}|["."{_identifier}]?"/"{_string})|({_protocol}"://")
50 /* we must do this here, because nearly everything matches a {_string} */
51 _assignment {_identifier}{_assign}{_string}
53 /* get pad/element references and stuff with dots right */
54 _padref "."{_identifier}
55 _ref {_identifier}"."{_identifier}?
56 _binref {_identifier}[[:space:]]*"."[[:space:]]*"("
59 _mimechar ([[:alnum:]-])
60 _mimetype ({_mimechar}+"/"{_mimechar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
61 _capschar ("\\".)|([^\;!])
62 _capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
63 _caps {_mimetype}(","[^!]|{_capsstring})*
64 _link ("!"[[:space:]]*{_caps}([[:space:]]*(";"[[:space:]]*{_caps})*[[:space:]]*)*"!")|("!")
73 PRINT ("ASSIGNMENT: %s", yytext);
74 lvalp->s = gst_parse_strdup (yytext);
81 PRINT ("PADREF: %s", yytext);
82 lvalp->s = gst_parse_strdup (yytext);
88 PRINT ("REF: %s", yytext);
89 lvalp->s = gst_parse_strdup (yytext);
96 while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++;
98 PRINT ("BINREF: %s", yytext);
99 lvalp->s = gst_parse_strdup (yytext);
105 PRINT ("IDENTIFIER: %s", yytext);
106 lvalp->s = gst_parse_strdup (yytext);
113 PRINT ("LINK: %s", yytext);
116 while (g_ascii_isspace (*c)) c++;
117 c = lvalp->s = gst_parse_strdup (c);
120 g_assert_not_reached ();
121 while (g_ascii_isspace (*--c));
130 PRINT ("URL: %s", yytext);
131 if (gst_uri_is_valid (yytext)) {
132 lvalp->s = g_strdup (yytext);
134 lvalp->s = gst_uri_construct ("file", yytext);
136 gst_parse_unescape (lvalp->s);
141 {_operator} { PRINT ("OPERATOR: [%s]", yytext); return *yytext; }
143 [[:space:]]+ { PRINT ("SPACE: [%s]", yytext); }
146 printf ("???: %s\n", yytext);