You can now prefix a size with % and it will do percentage for the size, even over 100.

This commit is contained in:
Zed A. Shaw 2025-02-15 12:52:26 -05:00
parent d558da1620
commit c03a384372
6 changed files with 60 additions and 46 deletions

View file

@ -24,6 +24,7 @@ namespace lel {
action setheight { cur.max_h = std::stoi(tk); }
action expand { cur.expand = true; }
action center { cur.center = true; }
action percent { cur.percent = true; }
col = "|" $col;
ltab = "[" $ltab;
@ -31,10 +32,11 @@ namespace lel {
valign = ("^" | ".") $valign;
expand = "*" $expand;
center = "=" $center;
percent = "%" $percent;
halign = ("<" | ">") $align;
number = digit+ >{ start = fpc; } %token;
setw = ("(" number %setwidth ("," number %setheight)? ")") ;
modifiers = (center | expand | valign | halign | setw);
modifiers = (percent | center | expand | valign | halign | setw);
id = modifiers* ((alpha | '_')+ :>> (alnum | '_')*) >{start = fpc;} %id;
row = space* ltab space* id space* (col space* id space*)* space* rtab space*;