2002-03-31 21:09:17 +00:00
|
|
|
%{
|
|
|
|
#include <math.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.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 HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
# ifdef GST_DEBUG_ENABLED
|
|
|
|
# define PRINT(...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "__VA_ARGS__)
|
|
|
|
# endif
|
2002-11-29 17:05:13 +00:00
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
2003-04-08 21:59:44 +00:00
|
|
|
# ifdef GST_DEBUG_ENABLED
|
|
|
|
# define PRINT(...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "##args)
|
|
|
|
# endif
|
2002-04-01 04:36:56 +00:00
|
|
|
#else
|
2003-04-08 21:59:44 +00:00
|
|
|
# ifdef GST_DEBUG_ENABLED
|
|
|
|
# define PRINT(a...) GST_DEBUG (GST_CAT_PIPELINE, "flex: "##a)
|
|
|
|
# endif
|
|
|
|
#endif // G_HAVE_ISO_VARARGS
|
2002-04-07 23:32:16 +00:00
|
|
|
|
|
|
|
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)
|
|
|
|
#define YY_NO_UNPUT
|
2002-03-31 21:09:17 +00:00
|
|
|
%}
|
|
|
|
|
2003-04-08 21:59:44 +00:00
|
|
|
_operators [(){}.:!,=]
|
|
|
|
_identifier [[:alpha:]][[:alnum:]\-_%]*
|
|
|
|
|
|
|
|
_char ("\\".)|([^[:space:]])
|
2002-12-06 20:06: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
|
|
|
|
|
|
|
%x value
|
|
|
|
%option noyywrap
|
|
|
|
%%
|
|
|
|
|
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-04-08 21:59:44 +00:00
|
|
|
{_operators} { 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
|
|
|
}
|
|
|
|
|
|
|
|
%%
|