summaryrefslogtreecommitdiffstats
path: root/lexer
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-09 00:09:02 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-09 00:09:02 +0100
commit713d41f619a1a8b311c3028a97e909e79cf88353 (patch)
tree8f30db8856307c2ebbc156573fc1dfc54969ba21 /lexer
parentbaab2047adf24642cbc727b50a77dc544e934a76 (diff)
Allow matching highlighting to be set. Fixes #522
Diffstat (limited to 'lexer')
-rw-r--r--lexer/theme-lexer.l25
-rw-r--r--lexer/theme-parser.y19
2 files changed, 42 insertions, 2 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index 5a7540c1..843eeccb 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -69,6 +69,11 @@ SOUTH "south"
EAST "east"
WEST "west"
+NONE "none"
+BOLD "bold"
+UNDERLINE "underline"
+ITALIC "italic"
+
LS_DASH "dash"
LS_SOLID "solid"
@@ -302,10 +307,26 @@ if ( queue == NULL ){
yylval->ival = WL_NORTH;
return T_POSITION;
}
-<PROPERTIES>NORTH {
+<PROPERTIES>{NORTH} {
yylval->ival = WL_NORTH;
return T_POSITION;
}
+<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;
+}
<INITIAL><<EOF>> {
g_queue_free ( queue );
// Reset pointer to NULL
@@ -325,7 +346,7 @@ if ( queue == NULL ){
const char *error_msg = "Expected 'root' element or a 'named' element.\n"\
"Place all global properties in a root element:\n"\
" * {\n"\
- " }\n";
+ " }\n";
YY_FATAL_ERROR( error_msg );
}
<*>. {
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 59317b52..055add3b 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -38,6 +38,7 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token <sval> T_STRING
%token <sval> N_STRING
%token <ival> T_POSITION;
+%token <ival> T_HIGHLIGHT_STYLE
%token <sval> NAME_ELEMENT "Element name"
%token <bval> T_BOOLEAN
%token <colorval> T_COLOR
@@ -54,6 +55,7 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token WHITESPACE "White space";
%token PDEFAULTS "Default settings";
+%type <ival> highlight_styles
%type <sval> entry
%type <sval> pvalue
%type <theme> entries
@@ -171,8 +173,25 @@ property
$$->name = $1;
$$->value.i = $3;
}
+| pvalue PSEP highlight_styles T_COLOR PCLOSE {
+ $$ = rofi_theme_property_create ( P_HIGHLIGHT );
+ $$->name = $1;
+ $$->value.highlight.style = $3|HL_COLOR;
+ $$->value.highlight.color = $4;
+}
+| pvalue PSEP highlight_styles PCLOSE {
+ $$ = rofi_theme_property_create ( P_HIGHLIGHT );
+ $$->name = $1;
+ $$->value.highlight.style = $3;
+}
;
+highlight_styles:
+ T_HIGHLIGHT_STYLE { $$ = $1; }
+| highlight_styles T_HIGHLIGHT_STYLE {
+ $$ = $1 | $2;
+}
+;
pvalue: N_STRING { $$ = $1; }
name_path: