2002-03-31 21:09:17 +00:00
|
|
|
%{
|
2010-01-20 01:09:55 +00:00
|
|
|
#include "../gst_private.h"
|
|
|
|
|
2002-03-31 21:09:17 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2005-07-19 10:40:49 +00:00
|
|
|
#include <glib/gprintf.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
|
|
|
|
2013-12-27 11:55:02 +00:00
|
|
|
#ifdef malloc
|
|
|
|
#undef malloc
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef free
|
|
|
|
#undef free
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef realloc
|
|
|
|
#undef realloc
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define malloc g_malloc
|
|
|
|
#define free g_free
|
|
|
|
#define realloc g_realloc
|
|
|
|
|
2005-07-19 10:40:49 +00:00
|
|
|
/* Override the default ECHO so as to avoid fortify warnings. Ignore the
|
|
|
|
embedded-NUL case for now. We know yytext is NUL-terminated. */
|
|
|
|
#define ECHO g_fprintf(yyout, "%s", yytext)
|
|
|
|
|
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
|
|
|
|
2002-03-31 21:09:17 +00:00
|
|
|
%}
|
|
|
|
|
2004-10-19 09:38:20 +00:00
|
|
|
_operator [(){}.!,;=]
|
2011-04-13 16:20:13 +00:00
|
|
|
_identifier [[:alnum:]_][[:alnum:]\-_%:]*
|
2003-04-08 21:59:44 +00:00
|
|
|
|
|
|
|
_char ("\\".)|([^[:space:]])
|
2006-03-03 15:32:30 +00:00
|
|
|
_string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\'")*"'")
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2002-12-06 20:06:06 +00:00
|
|
|
_assign [[:space:]]*"="[[:space:]]*
|
2003-04-08 21:59:44 +00:00
|
|
|
|
2003-11-24 03:21:54 +00:00
|
|
|
_protocol [[:alpha:]][[:alnum:]+-\.]*
|
2005-01-18 15:39:14 +00:00
|
|
|
_url ({_protocol}"://"{_string}|["."{_identifier}]?"/"{_string})|({_protocol}"://")
|
2003-11-24 03:21:54 +00:00
|
|
|
|
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 */
|
2006-03-03 15:32:30 +00:00
|
|
|
_mimechar [[:alnum:]-]
|
|
|
|
_mimetype {_mimechar}+"/"{_mimechar}+
|
2003-12-22 06:57:29 +00:00
|
|
|
_capschar ("\\".)|([^\;!])
|
2006-03-03 15:32:30 +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
|
gst/parse/: Make the parser reentrant and recursively callable. This requires flex >= 2.5.31, for older versions preg...
Original commit message from CVS:
Patch by: Marc-Andre Lureau <marcandre dot lureau at gmail dot com>
* gst/parse/Makefile.am:
* gst/parse/grammar.y:
* gst/parse/parse.l:
Make the parser reentrant and recursively callable. This requires flex
>= 2.5.31, for older versions pregenerated sources are used as we
can't bump the build dependency. Finally fixes #349180.
* gst/gstparse.c: (gst_parse_launch):
Drop the HAVE_MT_SAVE_FLEX #ifdefs as we always use a new enough flex
now anyway.
* docs/gst/Makefile.am:
* docs/gst/Makefile.am:
* gst/parse/grammar.tab.pre.c: (__gst_parse_strdup),
(__gst_parse_strfree), (__gst_parse_link_new),
(__gst_parse_link_free), (__gst_parse_chain_new),
(__gst_parse_chain_free), (SET_ERROR), (YYPRINTF),
(gst_parse_element_set), (gst_parse_free_link),
(gst_parse_found_pad), (gst_parse_perform_delayed_link),
(gst_parse_perform_link), (yytnamerr), (yysyntax_error), (yyerror),
(_gst_parse_launch):
* gst/parse/grammar.tab.pre.h:
* gst/parse/lex._gst_parse_yy.pre.c: (PRINT), (yy_get_next_buffer),
(yy_get_previous_state), (yy_try_NUL_trans), (input),
(_gst_parse_yyrestart), (_gst_parse_yy_switch_to_buffer),
(_gst_parse_yy_load_buffer_state), (_gst_parse_yy_create_buffer),
(_gst_parse_yy_delete_buffer), (_gst_parse_yy_init_buffer),
(_gst_parse_yy_flush_buffer), (_gst_parse_yypush_buffer_state),
(_gst_parse_yypop_buffer_state),
(_gst_parse_yyensure_buffer_stack), (_gst_parse_yy_scan_buffer),
(_gst_parse_yy_scan_string), (_gst_parse_yy_scan_bytes),
(yy_fatal_error), (_gst_parse_yyget_extra),
(_gst_parse_yyget_lineno), (_gst_parse_yyget_column),
(_gst_parse_yyget_in), (_gst_parse_yyget_out),
(_gst_parse_yyget_leng), (_gst_parse_yyget_text),
(_gst_parse_yyset_extra), (_gst_parse_yyset_lineno),
(_gst_parse_yyset_column), (_gst_parse_yyset_in),
(_gst_parse_yyset_out), (_gst_parse_yyget_debug),
(_gst_parse_yyset_debug), (_gst_parse_yyget_lval),
(_gst_parse_yyset_lval), (_gst_parse_yylex_init),
(yy_init_globals), (_gst_parse_yylex_destroy), (yy_flex_strncpy),
(yy_flex_strlen), (_gst_parse_yyalloc), (_gst_parse_yyrealloc),
(_gst_parse_yyfree):
If the installed flex version is too old use pre-generated parser
sources. These pre-generated parser sources are always updated when
the actual flex/bison sources change but require everybody who wants
to change something in the parser to have flex >= 2.5.31 installed.
2007-04-18 12:34:51 +00:00
|
|
|
%option reentrant
|
|
|
|
%option bison-bridge
|
2008-01-04 18:44:03 +00:00
|
|
|
%option never-interactive
|
|
|
|
%option noinput
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = gst_parse_strdup (yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = gst_parse_strdup (yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = gst_parse_strdup (yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = gst_parse_strdup (yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = gst_parse_strdup (yytext);
|
2003-04-08 21:59:44 +00:00
|
|
|
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++;
|
2014-01-10 20:10:17 +00:00
|
|
|
c = yylval->ss = gst_parse_strdup (c);
|
2003-05-17 20:45:06 +00:00
|
|
|
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 {
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = NULL;
|
2003-05-17 20:45:06 +00:00
|
|
|
}
|
|
|
|
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);
|
2014-01-10 20:10:17 +00:00
|
|
|
yylval->ss = g_strdup (yytext);
|
|
|
|
gst_parse_unescape (yylval->ss);
|
2003-11-24 03:21:54 +00:00
|
|
|
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
|
|
|
|
|
|
|
. {
|
2006-07-27 13:26:27 +00:00
|
|
|
PRINT ("Invalid Lexer element: %s\n", yytext);
|
2002-04-01 04:36:56 +00:00
|
|
|
return *yytext;
|
2002-03-31 21:09:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
%%
|