2002-03-31 21:09:17 +00:00
|
|
|
%{
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
#include "../gst_private.h"
|
|
|
|
|
2002-04-01 06:30:39 +00:00
|
|
|
#include "types.h"
|
2003-04-08 21:59:44 +00:00
|
|
|
#include "../gstinfo.h"
|
2003-11-24 03:21:54 +00:00
|
|
|
#include "../gsturi.h"
|
2003-04-08 21:59:44 +00:00
|
|
|
#include "grammar.tab.h"
|
2002-03-31 21:09:17 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
2004-02-07 01:23:13 +00:00
|
|
|
#define PRINT(...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " __VA_ARGS__)
|
2002-11-29 17:05:13 +00:00
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
2004-02-07 01:23:13 +00:00
|
|
|
#define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " args)
|
2002-04-01 04:36:56 +00:00
|
|
|
#else
|
2004-05-07 02:36:28 +00:00
|
|
|
static inline void
|
|
|
|
PRINT (const char *format, ...)
|
|
|
|
{
|
|
|
|
va_list varargs;
|
|
|
|
|
|
|
|
va_start (varargs, format);
|
|
|
|
GST_CAT_LEVEL_LOG_valist (GST_CAT_PIPELINE, GST_LEVEL_DEBUG, NULL,
|
|
|
|
format, varargs);
|
|
|
|
va_end (varargs);
|
|
|
|
}
|
2003-05-13 05:47:04 +00:00
|
|
|
#endif
|
2002-04-07 23:32:16 +00:00
|
|
|
|
|
|
|
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
|
2002-03-31 21:09:17 +00:00
|
|
|
%}
|
|
|
|
|
2004-10-19 09:38:20 +00:00
|
|
|
_operator [(){}.!,;=]
|
|
|
|
_identifier [[:alpha:]][[:alnum:]\-_%:]*
|
2003-04-08 21:59:44 +00:00
|
|
|
|
|
|
|
_char ("\\".)|([^[:space:]])
|
2003-05-17 20:45:06 +00:00
|
|
|
_string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2002-12-06 20:06:06 +00:00
|
|
|
_comma [[:space:]]*","[[:space:]]*
|
|
|
|
_assign [[:space:]]*"="[[:space:]]*
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2003-11-24 03:21:54 +00:00
|
|
|
_protocol [[:alpha:]][[:alnum:]+-\.]*
|
|
|
|
_url {_protocol}"://"{_string}|["."{_identifier}]?"/"{_string}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
/* we must do this here, because nearly everything matches a {_string} */
|
|
|
|
_assignment {_identifier}{_assign}{_string}
|
|
|
|
|
|
|
|
/* get pad/element references and stuff with dots right */
|
|
|
|
_padref "."{_identifier}
|
|
|
|
_ref {_identifier}"."{_identifier}?
|
|
|
|
_binref {_identifier}[[:space:]]*"."[[:space:]]*"("
|
2002-03-31 21:09:17 +00:00
|
|
|
|
2003-05-17 20:45:06 +00:00
|
|
|
/* links */
|
2003-12-14 04:28:11 +00:00
|
|
|
_mimechar ([[:alnum:]-])
|
|
|
|
_mimetype ({_mimechar}+"/"{_mimechar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
2003-12-22 06:57:29 +00:00
|
|
|
_capschar ("\\".)|([^\;!])
|
2003-05-17 20:45:06 +00:00
|
|
|
_capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
2003-05-18 02:30:00 +00:00
|
|
|
_caps {_mimetype}(","[^!]|{_capsstring})*
|
2004-05-04 17:00:11 +00:00
|
|
|
_link ("!"[[:space:]]*{_caps}([[:space:]]*(";"[[:space:]]*{_caps})*[[:space:]]*)*"!")|("!")
|
2003-05-17 20:45:06 +00:00
|
|
|
|
2002-03-31 21:09:17 +00:00
|
|
|
%x value
|
|
|
|
%option noyywrap
|
2003-04-13 19:40:31 +00:00
|
|
|
%option nounput
|
2002-03-31 21:09:17 +00:00
|
|
|
%%
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
{_assignment} {
|
|
|
|
/* "=" */
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("ASSIGNMENT: %s", yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
lvalp->s = gst_parse_strdup (yytext);
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return ASSIGNMENT;
|
2002-04-07 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
{_padref} {
|
|
|
|
yytext++;
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("PADREF: %s", yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
lvalp->s = gst_parse_strdup (yytext);
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return PADREF;
|
2002-04-07 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
{_ref} {
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("REF: %s", yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
lvalp->s = gst_parse_strdup (yytext);
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return REF;
|
2002-04-07 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
{_binref} {
|
|
|
|
gchar *pos = yytext;
|
|
|
|
while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++;
|
|
|
|
*pos = '\0';
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("BINREF: %s", yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
lvalp->s = gst_parse_strdup (yytext);
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return BINREF;
|
2002-12-06 20:06:06 +00:00
|
|
|
}
|
|
|
|
|
2002-03-31 21:09:17 +00:00
|
|
|
{_identifier} {
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("IDENTIFIER: %s", yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
lvalp->s = gst_parse_strdup (yytext);
|
|
|
|
BEGIN (INITIAL);
|
2002-04-01 04:36:56 +00:00
|
|
|
return IDENTIFIER;
|
2002-03-31 21:09:17 +00:00
|
|
|
}
|
|
|
|
|
2003-05-17 20:45:06 +00:00
|
|
|
{_link} {
|
|
|
|
gchar *c = yytext;
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("LINK: %s", yytext);
|
2003-05-17 20:45:06 +00:00
|
|
|
c++;
|
|
|
|
if (*c) {
|
|
|
|
while (g_ascii_isspace (*c)) c++;
|
|
|
|
c = lvalp->s = gst_parse_strdup (c);
|
|
|
|
while (*c) c++;
|
2004-08-03 10:24:39 +00:00
|
|
|
if (*--c != '!')
|
|
|
|
g_assert_not_reached ();
|
2003-05-17 20:45:06 +00:00
|
|
|
while (g_ascii_isspace (*--c));
|
|
|
|
*++c = '\0';
|
|
|
|
} else {
|
|
|
|
lvalp->s = NULL;
|
|
|
|
}
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return LINK;
|
|
|
|
}
|
2003-11-24 03:21:54 +00:00
|
|
|
{_url} {
|
2004-02-20 13:18:32 +00:00
|
|
|
PRINT ("URL: %s", yytext);
|
2003-11-24 03:21:54 +00:00
|
|
|
if (gst_uri_is_valid (yytext)) {
|
|
|
|
lvalp->s = g_strdup (yytext);
|
|
|
|
} else {
|
|
|
|
lvalp->s = gst_uri_construct ("file", yytext);
|
|
|
|
}
|
|
|
|
gst_parse_unescape (lvalp->s);
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return PARSE_URL;
|
|
|
|
}
|
2003-05-17 20:45:06 +00:00
|
|
|
|
2004-02-20 13:18:32 +00:00
|
|
|
{_operator} { PRINT ("OPERATOR: [%s]", yytext); return *yytext; }
|
2002-03-31 21:09:17 +00:00
|
|
|
|
2004-02-20 13:18:32 +00:00
|
|
|
[[:space:]]+ { PRINT ("SPACE: [%s]", yytext); }
|
2002-03-31 21:09:17 +00:00
|
|
|
|
|
|
|
. {
|
2003-04-08 21:59:44 +00:00
|
|
|
printf ("???: %s\n", yytext);
|
2002-04-01 04:36:56 +00:00
|
|
|
return *yytext;
|
2002-03-31 21:09:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
%%
|