2 #include "../gst_private.h"
7 #include <glib/gprintf.h>
10 #include "../gstinfo.h"
11 #include "../gsturi.h"
12 #include "grammar.tab.h"
26 #define malloc g_malloc
28 #define realloc g_realloc
30 /* Override the default ECHO so as to avoid fortify warnings. Ignore the
31 embedded-NUL case for now. We know yytext is NUL-terminated. */
32 #define ECHO g_fprintf(yyout, "%s", yytext)
34 #ifdef G_HAVE_ISO_VARARGS
35 #define PRINT(...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " __VA_ARGS__)
36 #elif defined(G_HAVE_GNUC_VARARGS)
37 #define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " args)
40 PRINT (const char *format, ...)
44 va_start (varargs, format);
45 GST_CAT_LEVEL_LOG_valist (GST_CAT_PIPELINE, GST_LEVEL_DEBUG, NULL,
53 _operator [(){}.!:,;=]
54 _identifier [[:alnum:]_][[:alnum:]\-_%:]*
56 _char ("\\".)|([^[:space:]])
57 _string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\'")*"'")
59 _assign [[:space:]]*"="[[:space:]]*
61 _protocol [[:alpha:]][[:alnum:]+-\.]*
62 _url ({_protocol}"://"{_string}|["."{_identifier}]?"/"{_string})|({_protocol}"://")
64 /* we must do this here, because nearly everything matches a {_string} */
65 _assignment {_identifier}{_assign}{_string}
67 /* get pad/element references and stuff with dots right */
68 _padref "."{_identifier}
69 _ref {_identifier}"."{_identifier}?
70 _binref {_identifier}[[:space:]]*"."[[:space:]]*"("
73 _mimechar [[:alnum:]-]
74 _mimetype {_mimechar}+"/"{_mimechar}+
75 _capschar ("\\".)|([^\;!])
76 _capsstring {_capschar}+
77 _caps {_mimetype}(","[^!]|{_capsstring})*
78 _link ([!:][[:space:]]*{_caps}([[:space:]]*(";"[[:space:]]*{_caps})*[[:space:]]*)*[!:])|([!:])
85 %option never-interactive
91 PRINT ("ASSIGNMENT: %s", yytext);
92 yylval->ss = gst_parse_strdup (yytext);
99 PRINT ("PADREF: %s", yytext);
100 yylval->ss = gst_parse_strdup (yytext);
106 PRINT ("REF: %s", yytext);
107 yylval->ss = gst_parse_strdup (yytext);
114 while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++;
116 PRINT ("BINREF: %s", yytext);
117 yylval->ss = gst_parse_strdup (yytext);
123 PRINT ("IDENTIFIER: %s", yytext);
124 yylval->ss = gst_parse_strdup (yytext);
134 PRINT ("LINK: %s", yytext);
135 /* First char is a link operator */
136 link_all = (*c == ':');
139 while (g_ascii_isspace (*c)) c++;
140 c = yylval->ss = gst_parse_strdup (c);
142 /* Last non-space char is a link operator */
144 if (op != '!' && op != ':')
145 g_assert_not_reached ();
149 /* Walk backward past whitespaces - what remains
150 * is a filter caps string, or empty */
151 while (g_ascii_isspace (*--c));
157 return link_all ? LINK_ALL : LINK;
160 PRINT ("URL: %s", yytext);
161 yylval->ss = g_strdup (yytext);
162 gst_parse_unescape (yylval->ss);
167 {_operator} { PRINT ("OPERATOR: [%s]", yytext); return *yytext; }
169 [[:space:]]+ { PRINT ("SPACE: [%s]", yytext); }
172 PRINT ("Invalid Lexer element: %s\n", yytext);