ges-launch: Update lexer / parser to handle set-*

+ cleanup of the lexer
This commit is contained in:
Mathieu Duponchelle 2015-02-19 13:15:25 +01:00 committed by Thibault Saunier
parent ecf167e95e
commit c6dedf2f36
3 changed files with 32 additions and 1 deletions

View file

@ -107,6 +107,26 @@ ges_structure_parser_parse_symbol (GESStructureParser * self,
self->add_comma = TRUE;
}
void
ges_structure_parser_parse_setter (GESStructureParser * self,
const gchar * setter)
{
gchar *parsed_setter;
while (*setter == '-' || *setter == ' ')
setter++;
while (*setter != '-')
setter++;
setter++;
parsed_setter = g_strdup_printf ("set-property, property=%s, value=", setter);
self->add_comma = FALSE;
ges_structure_parser_parse_string (self, parsed_setter, TRUE);
g_free (parsed_setter);
}
GESStructureParser *
ges_structure_parser_new (void)
{

View file

@ -52,6 +52,7 @@ void ges_structure_parser_parse_string (GESStructureParser *self, const gchar *s
void ges_structure_parser_parse_default (GESStructureParser *self, const gchar *text);
void ges_structure_parser_parse_whitespace (GESStructureParser *self);
void ges_structure_parser_parse_symbol (GESStructureParser *self, const gchar *symbol);
void ges_structure_parser_parse_setter (GESStructureParser *self, const gchar *setter);
void ges_structure_parser_end_of_file (GESStructureParser *self);
GESStructureParser *ges_structure_parser_new(void);

View file

@ -10,16 +10,26 @@
%option never-interactive
%option noinput
CLIP [ ]+--clip[ ]+|[ ]+-c[ ]+
TRANSITION [ ]+--transition[ ]+|[ ]+-t[ ]+
EFFECT [ ]+--effect[ ]+|[ ]+-e[ ]+
SETTER [ ]+--set-.[ ]+
%%
\"(\\.|[^"])*\" {
ges_structure_parser_parse_string (yyextra, yytext, FALSE);
}
[ ]+--clip[ ]+|[ ]+-c[ ]+|[ ]+--transition[ ]+|[ ]+-t[ ]+|[ ]+--effect[ ]+|[ ]+-e[ ]+|[ ]+--set-property[ ]+|[ ]+-s[ ]+ {
{CLIP}|{TRANSITION}|{EFFECT} {
ges_structure_parser_parse_symbol (yyextra, yytext);
}
{SETTER} {
ges_structure_parser_parse_setter (yyextra, yytext);
}
[ \t\n]+ {
ges_structure_parser_parse_whitespace (yyextra);
}