1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-10 15:44:41 -05:00

Update highlight style parsing

This commit is contained in:
Dave Davenport 2017-05-09 14:12:03 +02:00
parent cf8796ccd3
commit 00e297c5ca
2 changed files with 29 additions and 30 deletions

View file

@ -544,22 +544,10 @@ if ( queue == NULL ){
<PROPERTIES>{WEST} { return T_POS_WEST; }
<PROPERTIES>{SOUTH} { return T_POS_SOUTH; }
<PROPERTIES>{NORTH} { return T_POS_NORTH; }
<PROPERTIES>{NONE} {
yylval->ival = HL_NONE;
return T_HIGHLIGHT_STYLE;
}
<PROPERTIES>{BOLD} {
yylval->ival = HL_BOLD;
return T_HIGHLIGHT_STYLE;
}
<PROPERTIES>{ITALIC} {
yylval->ival = HL_ITALIC;
return T_HIGHLIGHT_STYLE;
}
<PROPERTIES>{UNDERLINE} {
yylval->ival = HL_UNDERLINE;
return T_HIGHLIGHT_STYLE;
}
<PROPERTIES>{NONE} { return T_NONE; }
<PROPERTIES>{BOLD} { return T_BOLD; }
<PROPERTIES>{ITALIC} { return T_ITALIC; }
<PROPERTIES>{UNDERLINE} { return T_UNDERLINE; }
<INITIAL><<EOF>> {
ParseObject *po = g_queue_pop_head ( file_queue );
if ( po ) {

View file

@ -101,7 +101,6 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token <fval> T_DOUBLE
%token <sval> T_STRING
%token <sval> N_STRING "property name"
%token <ival> T_HIGHLIGHT_STYLE
%token <sval> NAME_ELEMENT "Element name"
%token <bval> T_BOOLEAN
%token <colorval> T_COLOR
@ -114,6 +113,11 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token T_POS_NORTH "North"
%token T_POS_SOUTH "South"
%token T_NONE "None"
%token T_BOLD "Bold"
%token T_ITALIC "Italic"
%token T_UNDERLINE "Underline"
%token BOPEN "bracket open ('{')"
%token BCLOSE "bracket close ('}')"
@ -126,6 +130,7 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token CONFIGURATION "Configuration block"
%type <ival> highlight_styles
%type <ival> highlight_style
%type <wloc> t_position
%type <wloc> t_position_ew
%type <wloc> t_position_sn
@ -292,12 +297,18 @@ t_position_sn
/**
* Highlight style, allow mulitple styles to be combined.
* Empty not allowed
*/
highlight_styles:
T_HIGHLIGHT_STYLE { $$ = $1; }
| highlight_styles T_HIGHLIGHT_STYLE {
$$ = $1 | $2;
}
highlight_styles
: highlight_style { $$ = $1;}
| highlight_styles highlight_style { $$ = $1|$2;}
;
/** Single style. */
highlight_style
: T_NONE { $$ = HL_NONE; }
| T_BOLD { $$ = HL_BOLD; }
| T_UNDERLINE { $$ = HL_UNDERLINE; }
| T_ITALIC { $$ = HL_ITALIC; }
;
pvalue: N_STRING { $$ = $1; }