summaryrefslogtreecommitdiffstats
path: root/lexer
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-12-31 21:37:19 +0100
committerDave Davenport <qball@gmpclient.org>2016-12-31 21:37:19 +0100
commit5f424fa598662e35f647b99c9e7755ffecb451ad (patch)
treee409dea011c254c761983645282aab076d3bcb48 /lexer
parent2bfbb464e60736664de427c974a294ca42dd82ad (diff)
Padding should be specified in px now and 4 borders can be specified on
one pixel line.
Diffstat (limited to 'lexer')
-rw-r--r--lexer/theme-lexer.l12
-rw-r--r--lexer/theme-parser.y12
2 files changed, 22 insertions, 2 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index 01732733..0cf11f66 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -23,7 +23,9 @@ WHITESPACE [[:space:]]
WORD [[:alnum:]-]+
STRING [[:print:]]+
HEX [[:xdigit:]]
-NUMBER [[:digit:]-]
+NUMBER [[:digit:]]
+PX (px)
+NEWLINES (\r|\n)+
%x PROPERTIES
%x NAMESTR
@@ -102,6 +104,11 @@ if ( queue == NULL ){
<PROPERTIES>{NUMBER}+ { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES>{NUMBER}+\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES>\"{STRING}\" { yytext[yyleng-1] = '\0'; yylval->sval = g_strdup(&yytext[1]); return T_STRING;}
+
+<PROPERTIES>{NUMBER}+{PX} {
+ yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10);
+ return T_PIXEL;
+}
<PROPERTIES>#{HEX}{8} {
union { unsigned int val; struct { unsigned char b,g,r,a;};} val;
val.val = (unsigned int)strtoull ( &yytext[1], NULL, 16);
@@ -146,7 +153,8 @@ if ( queue == NULL ){
return T_COLOR;
}
-<*>(\r\n|\n) {
+<*>(\r\n) {
+ printf("newlines\n");
yylloc->last_column = 1;
yylloc->last_line ++;
};
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 3c64ee2d..1384f7fe 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -11,6 +11,7 @@
%{
#include <stdio.h>
#include <stdlib.h>
+#include <glib.h>
#include "theme.h"
@@ -39,6 +40,7 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token <sval> NAME_ELEMENT
%token <bval> T_BOOLEAN
%token <colorval> T_COLOR
+%token <ival> T_PIXEL
%token <sval> CLASS_NAME
%token <sval> FIRST_NAME
@@ -165,6 +167,16 @@ property
$$->name = $1;
$$->value.b = $3;
}
+| pvalue PSEP T_PIXEL PCLOSE {
+ $$ = rofi_theme_property_create ( P_PADDING );
+ $$->name = $1;
+ $$->value.padding = (Padding){ $3, $3, $3, $3, FALSE };
+}
+| pvalue PSEP T_PIXEL T_PIXEL T_PIXEL T_PIXEL PCLOSE {
+ $$ = rofi_theme_property_create ( P_PADDING );
+ $$->name = $1;
+ $$->value.padding = (Padding){ $3, $4, $5, $6, FALSE };
+}
;
pvalue: N_STRING { $$ = $1; }