mirror of
https://github.com/davatorium/rofi.git
synced 2025-07-31 21:59:25 -04:00
Change language parser to glr type, remove type prefix.
This commit is contained in:
parent
7ad0432d82
commit
5e371eedeb
3 changed files with 17 additions and 22 deletions
|
@ -12,7 +12,6 @@ int yylex(void);
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
"@" { return CLASS;}
|
|
||||||
"\{" { return BOPEN;}
|
"\{" { return BOPEN;}
|
||||||
"\}" { return BCLOSE;}
|
"\}" { return BCLOSE;}
|
||||||
":" { return PSEP; }
|
":" { return PSEP; }
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
%glr-parser
|
||||||
|
%skeleton "glr.c"
|
||||||
|
|
||||||
%locations
|
%locations
|
||||||
%debug
|
%debug
|
||||||
%error-verbose
|
%error-verbose
|
||||||
|
@ -35,14 +38,12 @@ Widget *rofi_theme = NULL;
|
||||||
%token <bval> T_BOOLEAN
|
%token <bval> T_BOOLEAN
|
||||||
%token <colorval> T_COLOR
|
%token <colorval> T_COLOR
|
||||||
|
|
||||||
%token CLASS "class";
|
|
||||||
%token BOPEN "bracket open";
|
%token BOPEN "bracket open";
|
||||||
%token BCLOSE "bracket close";
|
%token BCLOSE "bracket close";
|
||||||
%token PSEP "property separator";
|
%token PSEP "property separator";
|
||||||
%token PCLOSE "property close";
|
%token PCLOSE "property close";
|
||||||
%token NSEP "Name separator";
|
%token NSEP "Name separator";
|
||||||
|
|
||||||
%type <sval> class
|
|
||||||
%type <sval> entry
|
%type <sval> entry
|
||||||
%type <sval> pvalue
|
%type <sval> pvalue
|
||||||
%type <theme> entries
|
%type <theme> entries
|
||||||
|
@ -75,17 +76,14 @@ entries:
|
||||||
;
|
;
|
||||||
|
|
||||||
entry:
|
entry:
|
||||||
class
|
name_path BOPEN optional_properties BCLOSE
|
||||||
name_path
|
|
||||||
properties
|
|
||||||
{
|
{
|
||||||
Widget *widget = rofi_theme_find_or_create_class ( rofi_theme , $1 );
|
Widget *widget = rofi_theme;//rofi_theme_find_or_create_class ( rofi_theme , $1 );
|
||||||
g_free($1);
|
for ( GList *iter = g_list_first ( $1 ); iter ; iter = g_list_next ( iter ) ) {
|
||||||
for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) {
|
|
||||||
widget = rofi_theme_find_or_create_class ( widget, iter->data );
|
widget = rofi_theme_find_or_create_class ( widget, iter->data );
|
||||||
}
|
}
|
||||||
g_list_foreach ( $2, (GFunc)g_free , NULL );
|
g_list_foreach ( $1, (GFunc)g_free , NULL );
|
||||||
g_list_free ( $2 );
|
g_list_free ( $1 );
|
||||||
if ( widget->properties != NULL ) {
|
if ( widget->properties != NULL ) {
|
||||||
fprintf(stderr, "Properties already set on this widget.\n");
|
fprintf(stderr, "Properties already set on this widget.\n");
|
||||||
exit ( EXIT_FAILURE );
|
exit ( EXIT_FAILURE );
|
||||||
|
@ -101,10 +99,12 @@ optional_properties
|
||||||
: %empty { $$ = NULL; }
|
: %empty { $$ = NULL; }
|
||||||
| property_list { $$ = $1; }
|
| property_list { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
/*
|
||||||
properties: BOPEN property_list BCLOSE { $$ = $2;}
|
properties: BOPEN property_list BCLOSE { $$ = $2;}
|
||||||
| BOPEN BCLOSE { $$ = NULL; }
|
| BOPEN BCLOSE { $$ = NULL; }
|
||||||
| %empty { $$ = NULL; }
|
| %empty { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
property_list:
|
property_list:
|
||||||
property {
|
property {
|
||||||
|
@ -147,10 +147,6 @@ property
|
||||||
|
|
||||||
pvalue: N_STRING { $$ = $1; }
|
pvalue: N_STRING { $$ = $1; }
|
||||||
|
|
||||||
class:
|
|
||||||
CLASS N_STRING { $$ = $2; }
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
name_path:
|
name_path:
|
||||||
%empty { $$ = NULL; }
|
%empty { $$ = NULL; }
|
||||||
|
|
|
@ -1431,7 +1431,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
|
||||||
// Get active monitor size.
|
// Get active monitor size.
|
||||||
TICK_N ( "Get active monitor" );
|
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->border, state->border,
|
||||||
state->width - 2 * state->border, state->height - 2 * 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 ();
|
unsigned int line_height = textbox_get_estimated_char_height ();
|
||||||
rofi_view_calculate_window_and_element_width ( state );
|
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 = box_create ( "inputbar.box", BOX_HORIZONTAL, 0, 0, state->width - state->border, line_height );
|
||||||
state->input_bar_separator = separator_create ( "separator.inputbar", S_HORIZONTAL, 2 );
|
state->input_bar_separator = separator_create ( "inputbar.separator", S_HORIZONTAL, 2 );
|
||||||
|
|
||||||
// Only enable widget when sidebar is enabled.
|
// Only enable widget when sidebar is enabled.
|
||||||
if ( config.sidebar_mode ) {
|
if ( config.sidebar_mode ) {
|
||||||
state->sidebar_bar = box_create ( "box.sidebar", BOX_HORIZONTAL, 0, 0, state->width - 2 * state->border, line_height );
|
state->sidebar_bar = box_create ( "sidebar.box", BOX_HORIZONTAL, 0, 0, state->width - 2 * state->border, line_height );
|
||||||
separator *sep = separator_create ( "separator.sidebar", S_HORIZONTAL, 2 );
|
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 ( state->sidebar_bar ), FALSE, TRUE );
|
||||||
box_add ( state->main_box, WIDGET ( sep ), FALSE, TRUE );
|
box_add ( state->main_box, WIDGET ( sep ), FALSE, TRUE );
|
||||||
state->num_modi = rofi_get_num_enabled_modi ();
|
state->num_modi = rofi_get_num_enabled_modi ();
|
||||||
|
@ -1482,7 +1482,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
|
||||||
if ( message ) {
|
if ( message ) {
|
||||||
textbox *message_tb = textbox_create ( TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, 0, 0,
|
textbox *message_tb = textbox_create ( TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, 0, 0,
|
||||||
state->width - ( 2 * ( state->border ) ), -1, NORMAL, message );
|
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 ( sep ), FALSE, end);
|
||||||
box_add ( state->main_box, WIDGET ( message_tb ), 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;
|
state->finalize = process_result;
|
||||||
|
|
||||||
rofi_view_calculate_window_and_element_width ( state );
|
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->border, state->border,
|
||||||
state->width - 2 * state->border, state->height - 2 * state->border );
|
state->width - 2 * state->border, state->height - 2 * state->border );
|
||||||
state->text = textbox_create ( ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ),
|
state->text = textbox_create ( ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue