6 #include "../gst_private.h"
9 #include "../gstinfo.h"
10 #include "../gsturi.h"
11 #include "grammar.tab.h"
13 #ifdef G_HAVE_ISO_VARARGS
14 #define PRINT(...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: "__VA_ARGS__)
15 #elif defined(G_HAVE_GNUC_VARARGS)
16 #define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: "##args)
18 #define PRINT(args...)
21 #define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
24 _operator [(){}.:!,;=]
25 _identifier [[:alpha:]][[:alnum:]\-_%]*
27 _char ("\\".)|([^[:space:]])
28 _string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
30 _comma [[:space:]]*","[[:space:]]*
31 _assign [[:space:]]*"="[[:space:]]*
33 _protocol [[:alpha:]][[:alnum:]+-\.]*
34 _url {_protocol}"://"{_string}|["."{_identifier}]?"/"{_string}
36 /* we must do this here, because nearly everything matches a {_string} */
37 _assignment {_identifier}{_assign}{_string}
39 /* get pad/element references and stuff with dots right */
40 _padref "."{_identifier}
41 _ref {_identifier}"."{_identifier}?
42 _binref {_identifier}[[:space:]]*"."[[:space:]]*"("
45 _capschar ("\\".)|([^[:space:]\;!\.\,\(\)\]\[])
46 _capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
47 _mimetype ({_capschar}+"/"{_capschar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
48 _caps {_mimetype}(","[^!]|{_capsstring})*
49 _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"!")|("!")
58 PRINT ("ASSIGNMENT: %s\n", yytext);
59 lvalp->s = gst_parse_strdup (yytext);
66 PRINT ("PADREF: %s\n", yytext);
67 lvalp->s = gst_parse_strdup (yytext);
73 PRINT ("REF: %s\n", yytext);
74 lvalp->s = gst_parse_strdup (yytext);
81 while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++;
83 PRINT ("BINREF: %s\n", yytext);
84 lvalp->s = gst_parse_strdup (yytext);
90 PRINT ("IDENTIFIER: %s\n", yytext);
91 lvalp->s = gst_parse_strdup (yytext);
98 PRINT ("LINK: %s\n", yytext);
101 while (g_ascii_isspace (*c)) c++;
102 c = lvalp->s = gst_parse_strdup (c);
104 g_assert (*--c == '!');
105 while (g_ascii_isspace (*--c));
114 PRINT ("URL: %s\n", yytext);
115 if (gst_uri_is_valid (yytext)) {
116 lvalp->s = g_strdup (yytext);
118 lvalp->s = gst_uri_construct ("file", yytext);
120 gst_parse_unescape (lvalp->s);
125 {_operator} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; }
127 [[:space:]]+ { PRINT ("SPACE: [%s]\n", yytext); }
130 printf ("???: %s\n", yytext);