2002-03-31 21:09:17 +00:00
|
|
|
%{
|
|
|
|
#include <math.h>
|
|
|
|
#include <ctype.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"
|
|
|
|
#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
|
2003-06-29 14:05:49 +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)
|
2003-06-29 14:05:49 +00:00
|
|
|
#define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: "##args)
|
2002-04-01 04:36:56 +00:00
|
|
|
#else
|
2003-05-13 05:47:04 +00:00
|
|
|
#define PRINT(args...)
|
|
|
|
#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
|
|
|
%}
|
|
|
|
|
2003-05-17 20:45:06 +00:00
|
|
|
_operator [(){}.:!,;=]
|
2003-04-08 21:59:44 +00:00
|
|
|
_identifier [[:alpha:]][[:alnum:]\-_%]*
|
|
|
|
|
|
|
|
_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
|
|
|
|
|
|
|
/* 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-05-18 02:30:00 +00:00
|
|
|
_capschar ("\\".)|([^[:space:]\;!\.\,\(\)\]\[])
|
2003-05-17 20:45:06 +00:00
|
|
|
_capsstring {_capschar}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
|
|
|
_mimetype ({_capschar}+"/"{_capschar}+)|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\"")*"'")
|
2003-05-18 02:30:00 +00:00
|
|
|
_caps {_mimetype}(","[^!]|{_capsstring})*
|
|
|
|
_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} {
|
|
|
|
/* "=" */
|
|
|
|
PRINT ("ASSIGNMENT: %s\n", yytext);
|
|
|
|
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++;
|
|
|
|
PRINT ("PADREF: %s\n", yytext);
|
|
|
|
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} {
|
|
|
|
PRINT ("REF: %s\n", yytext);
|
|
|
|
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';
|
|
|
|
PRINT ("BINREF: %s\n", yytext);
|
|
|
|
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} {
|
2003-04-08 21:59:44 +00:00
|
|
|
PRINT ("IDENTIFIER: %s\n", yytext);
|
|
|
|
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;
|
|
|
|
PRINT ("LINK: %s\n", yytext);
|
|
|
|
c++;
|
|
|
|
if (*c) {
|
|
|
|
while (g_ascii_isspace (*c)) c++;
|
|
|
|
c = lvalp->s = gst_parse_strdup (c);
|
|
|
|
while (*c) c++;
|
|
|
|
g_assert (*--c == '!');
|
|
|
|
while (g_ascii_isspace (*--c));
|
|
|
|
*++c = '\0';
|
|
|
|
} else {
|
|
|
|
lvalp->s = NULL;
|
|
|
|
}
|
|
|
|
BEGIN (INITIAL);
|
|
|
|
return LINK;
|
|
|
|
}
|
|
|
|
|
|
|
|
{_operator} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; }
|
2002-03-31 21:09:17 +00:00
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
[[:space:]]+ { PRINT ("SPACE: [%s]\n", 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
|
|
|
}
|
|
|
|
|
|
|
|
%%
|