mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-22 10:15:39 +02:00
Implement '&&' and '||' operators on map
'-' is a valid character for tags.
Commit 03e1c7d
(module/network: Add link stats, 2022-04-30) introduced
two new tags for the network module: `ul-speed` and `dl-speed`. These
use the `-` character, that was previously never used in any tag.
We had two options: either change those tags to use `_` instead, or just
accept `-`s as a valid character. Going forward, I can see many people
deciding to name their tags with `-` instead of `_`, so I believe it is
better to just accept it once and for all.
Note that `-` cannot be used as the first character of a tag (e.g.
`-tag1`) since the `-` has a special meaning in `.yml` files. I don't
believe this will happen often, however, and should be easy to both
detect and correct if it does.
This commit is contained in:
parent
463b39b56d
commit
4a41d4296a
10 changed files with 330 additions and 226 deletions
25
particles/map.l
Normal file
25
particles/map.l
Normal file
|
@ -0,0 +1,25 @@
|
|||
%{
|
||||
#include <string.h>
|
||||
#include "map.h"
|
||||
#include "map.tab.h"
|
||||
%}
|
||||
|
||||
%option warn nodefault nounput noinput noyywrap
|
||||
|
||||
%%
|
||||
[[:alnum:]_-]+ yylval.str = strdup(yytext); return WORD;
|
||||
\".*\" yylval.str = strndup(yytext + 1, strlen(yytext) - 2); return STRING;
|
||||
== yylval.op = MAP_OP_EQ; return CMP_OP;
|
||||
!= yylval.op = MAP_OP_NE; return CMP_OP;
|
||||
\<= yylval.op = MAP_OP_LE; return CMP_OP;
|
||||
\< yylval.op = MAP_OP_LT; return CMP_OP;
|
||||
>= yylval.op = MAP_OP_GE; return CMP_OP;
|
||||
> yylval.op = MAP_OP_GT; return CMP_OP;
|
||||
&& yylval.op = MAP_OP_AND; return BOOL_OP;
|
||||
\|\| yylval.op = MAP_OP_OR; return BOOL_OP;
|
||||
~ return NOT;
|
||||
\( return L_PAR;
|
||||
\) return R_PAR;
|
||||
[ \t\n] ;
|
||||
. yylval.str = strdup(yytext); return STRING;
|
||||
%%
|
Loading…
Add table
Add a link
Reference in a new issue