diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-12-11 14:08:28 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-12-11 14:08:28 +0100 |
commit | 5e371eedeb5b18ad01e208c6b22d3d93fc8257f2 (patch) | |
tree | feb7f044ab1a63376528c47e9ce130dd059c4b07 | |
parent | 7ad0432d82c1ff0d762e138c720e6191f5ba0f68 (diff) |
Change language parser to glr type, remove type prefix.
-rw-r--r-- | lexer/theme-lexer.l | 1 | ||||
-rw-r--r-- | lexer/theme-parser.y | 24 | ||||
-rw-r--r-- | source/view.c | 14 |
3 files changed, 17 insertions, 22 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 8a747545..28e38f26 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -12,7 +12,6 @@ int yylex(void); %% -"@" { return CLASS;} "\{" { return BOPEN;} "\}" { return BCLOSE;} ":" { return PSEP; } diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 952303e4..b48198a8 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -1,3 +1,6 @@ +%glr-parser +%skeleton "glr.c" + %locations %debug %error-verbose @@ -35,14 +38,12 @@ Widget *rofi_theme = NULL; %token <bval> T_BOOLEAN %token <colorval> T_COLOR -%token CLASS "class"; %token BOPEN "bracket open"; %token BCLOSE "bracket close"; %token PSEP "property separator"; %token PCLOSE "property close"; %token NSEP "Name separator"; -%type <sval> class %type <sval> entry %type <sval> pvalue %type <theme> entries @@ -75,17 +76,14 @@ entries: ; entry: - class - name_path - properties + name_path BOPEN optional_properties BCLOSE { - Widget *widget = rofi_theme_find_or_create_class ( rofi_theme , $1 ); - g_free($1); - for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) { + Widget *widget = rofi_theme;//rofi_theme_find_or_create_class ( rofi_theme , $1 ); + for ( GList *iter = g_list_first ( $1 ); iter ; iter = g_list_next ( iter ) ) { widget = rofi_theme_find_or_create_class ( widget, iter->data ); } - g_list_foreach ( $2, (GFunc)g_free , NULL ); - g_list_free ( $2 ); + g_list_foreach ( $1, (GFunc)g_free , NULL ); + g_list_free ( $1 ); if ( widget->properties != NULL ) { fprintf(stderr, "Properties already set on this widget.\n"); exit ( EXIT_FAILURE ); @@ -101,10 +99,12 @@ optional_properties : %empty { $$ = NULL; } | property_list { $$ = $1; } ; +/* properties: BOPEN property_list BCLOSE { $$ = $2;} | BOPEN BCLOSE { $$ = NULL; } | %empty { $$ = NULL; } ; +*/ property_list: property { @@ -147,10 +147,6 @@ property pvalue: N_STRING { $$ = $1; } -class: - CLASS N_STRING { $$ = $2; } -; - name_path: %empty { $$ = NULL; } diff --git a/source/view.c b/source/view.c index ed2c29ae..21ddefec 100644 --- a/source/view.c +++ b/source/view.c @@ -1431,7 +1431,7 @@ RofiViewState *rofi_view_create ( Mode *sw, // Get active monitor size. TICK_N ( "Get active monitor" ); - state->main_box = box_create ( "box.mainbox", BOX_VERTICAL, + state->main_box = box_create ( "mainbox.box", BOX_VERTICAL, state->border, state->border, state->width - 2 * state->border, state->height - 2 * state->border ); @@ -1439,13 +1439,13 @@ RofiViewState *rofi_view_create ( Mode *sw, unsigned int line_height = textbox_get_estimated_char_height (); rofi_view_calculate_window_and_element_width ( state ); - state->input_bar = box_create ( "box.inputbar", BOX_HORIZONTAL, 0, 0, state->width - state->border, line_height ); - state->input_bar_separator = separator_create ( "separator.inputbar", S_HORIZONTAL, 2 ); + state->input_bar = box_create ( "inputbar.box", BOX_HORIZONTAL, 0, 0, state->width - state->border, line_height ); + state->input_bar_separator = separator_create ( "inputbar.separator", S_HORIZONTAL, 2 ); // Only enable widget when sidebar is enabled. if ( config.sidebar_mode ) { - state->sidebar_bar = box_create ( "box.sidebar", BOX_HORIZONTAL, 0, 0, state->width - 2 * state->border, line_height ); - separator *sep = separator_create ( "separator.sidebar", S_HORIZONTAL, 2 ); + state->sidebar_bar = box_create ( "sidebar.box", BOX_HORIZONTAL, 0, 0, state->width - 2 * state->border, line_height ); + separator *sep = separator_create ( "sidebar.separator", S_HORIZONTAL, 2 ); box_add ( state->main_box, WIDGET ( state->sidebar_bar ), FALSE, TRUE ); box_add ( state->main_box, WIDGET ( sep ), FALSE, TRUE ); state->num_modi = rofi_get_num_enabled_modi (); @@ -1482,7 +1482,7 @@ RofiViewState *rofi_view_create ( Mode *sw, if ( message ) { textbox *message_tb = textbox_create ( TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, 0, 0, state->width - ( 2 * ( state->border ) ), -1, NORMAL, message ); - separator *sep = separator_create ( "separator.message", S_HORIZONTAL, 2 ); + separator *sep = separator_create ( "message.separator", S_HORIZONTAL, 2 ); box_add ( state->main_box, WIDGET ( sep ), FALSE, end); box_add ( state->main_box, WIDGET ( message_tb ), FALSE, end); } @@ -1550,7 +1550,7 @@ int rofi_view_error_dialog ( const char *msg, int markup ) state->finalize = process_result; rofi_view_calculate_window_and_element_width ( state ); - state->main_box = box_create ( "box.mainbox", BOX_VERTICAL, + state->main_box = box_create ( "mainbox.box", BOX_VERTICAL, state->border, state->border, state->width - 2 * state->border, state->height - 2 * state->border ); state->text = textbox_create ( ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ), |