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 _mimechar ([[:alnum:]-])
46 _mimetype ({_mimechar}+"/"{_mimechar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
47 _capschar ("\\".)|([^[:space:]\;!\,\(\)\]\[])
48 _capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
49 _caps {_mimetype}(","[^!]|{_capsstring})*
50 _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"!")|("!")
59 PRINT ("ASSIGNMENT: %s\n", yytext);
60 lvalp->s = gst_parse_strdup (yytext);
67 PRINT ("PADREF: %s\n", yytext);
68 lvalp->s = gst_parse_strdup (yytext);
74 PRINT ("REF: %s\n", yytext);
75 lvalp->s = gst_parse_strdup (yytext);
82 while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++;
84 PRINT ("BINREF: %s\n", yytext);
85 lvalp->s = gst_parse_strdup (yytext);
91 PRINT ("IDENTIFIER: %s\n", yytext);
92 lvalp->s = gst_parse_strdup (yytext);
99 PRINT ("LINK: %s\n", yytext);
102 while (g_ascii_isspace (*c)) c++;
103 c = lvalp->s = gst_parse_strdup (c);
105 g_assert (*--c == '!');
106 while (g_ascii_isspace (*--c));
115 PRINT ("URL: %s\n", yytext);
116 if (gst_uri_is_valid (yytext)) {
117 lvalp->s = g_strdup (yytext);
119 lvalp->s = gst_uri_construct ("file", yytext);
121 gst_parse_unescape (lvalp->s);
126 {_operator} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; }
128 [[:space:]]+ { PRINT ("SPACE: [%s]\n", yytext); }
131 printf ("???: %s\n", yytext);