1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Change language parser to glr type, remove type prefix.

This commit is contained in:
Dave Davenport 2016-12-11 14:08:28 +01:00
parent 7ad0432d82
commit 5e371eedeb
3 changed files with 17 additions and 22 deletions

View file

@ -12,7 +12,6 @@ int yylex(void);
%%
"@" { return CLASS;}
"\{" { return BOPEN;}
"\}" { return BCLOSE;}
":" { return PSEP; }

View file

@ -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; }

View file

@ -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 ),