summaryrefslogtreecommitdiffstats
path: root/lexer
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-06 23:25:55 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-06 23:25:55 +0100
commitb26d241f04059c858462367318f1a6427053a8b4 (patch)
treea0655aeea78760ee64b674ccb9fc864089031fc6 /lexer
parent361d5c62d75b27be63395a2ef6667c80b5d132c7 (diff)
Make parser accept old + more CSS style elements
Diffstat (limited to 'lexer')
-rw-r--r--lexer/theme-lexer.l7
-rw-r--r--lexer/theme-parser.y18
2 files changed, 7 insertions, 18 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index e5995e25..9af32541 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -90,24 +90,25 @@ if ( queue == NULL ){
}
/* Go into parsing an entry */
-<INITIAL>"\{" {
+<NAMESTR>"\{" {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(ENTRY);
return BOPEN;
}
/* Pop out of parsing an entry. */
<ENTRY>"\}" {
+ g_queue_pop_head ( queue );
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
return BCLOSE;
}
<INITIAL>"#" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(NAMESTR);return NAME_PREFIX;}
-<INITIAL,NAMESTR>"." { return NSEP; }
+<NAMESTR>\.|{WHITESPACE} { return NSEP; }
<INITIAL,ENTRY>{WORD} { yylval->sval = g_strdup(yytext); return N_STRING;}
<NAMESTR>{WORD} { yylval->sval = g_strdup(yytext); return NAME_ELEMENT;}
/* After Namestr/Classstr we want to go to state str, then to { */
-<NAMESTR>{WHITESPACE} { BEGIN(GPOINTER_TO_INT (g_queue_pop_head ( queue )));}
+ /*<NAMESTR>{WHITESPACE} { BEGIN(GPOINTER_TO_INT (g_queue_pop_head ( queue )));}*/
<INITIAL,ENTRY>{WHITESPACE}+ ; // ignore all whitespace
<PROPERTIES>{WHITESPACE}+ ; // ignore all whitespace
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 81add24e..01c66ee0 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -90,7 +90,7 @@ entries:
;
entry:
-NAME_PREFIX name_path state_path BOPEN optional_properties BCLOSE
+NAME_PREFIX name_path BOPEN optional_properties BCLOSE
{
ThemeWidget *widget = rofi_theme;
for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) {
@@ -99,13 +99,7 @@ NAME_PREFIX name_path state_path BOPEN optional_properties BCLOSE
g_list_foreach ( $2, (GFunc)g_free , NULL );
g_list_free ( $2 );
widget->set = TRUE;
- for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) {
- widget = rofi_theme_find_or_create_name ( widget, iter->data );
- }
- g_list_foreach ( $3, (GFunc)g_free , NULL );
- g_list_free ( $3 );
- widget->set = TRUE;
- rofi_theme_widget_add_properties ( widget, $5);
+ rofi_theme_widget_add_properties ( widget, $4);
};
/**
@@ -190,14 +184,8 @@ pvalue: N_STRING { $$ = $1; }
name_path:
NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );}
| name_path NSEP NAME_ELEMENT { $$ = g_list_append ( $1, $3);}
+| name_path NSEP { $$ = $1; }
;
-state_path:
- %empty { $$ = NULL; }
-| N_STRING { $$ = g_list_append ( NULL, $1 );}
-| state_path NSEP N_STRING { $$ = g_list_append ( $1, $3);}
-;
-
-
%%