LEL is working at a basic grid level, able to render boxes where I want.

This commit is contained in:
Zed A. Shaw 2025-02-15 01:31:57 -05:00
parent 846b7aaf16
commit 872cedc8e1
8 changed files with 127 additions and 99 deletions

View file

@ -1,5 +1,6 @@
#include "lel.hpp"
#include <fmt/core.h>
#include <iostream>
%%{
machine LELParser;
@ -27,7 +28,7 @@
setw = ("(" number %setwidth ("," number %setheight)? ")") ;
modifiers = (expand | valign | halign | setw);
id = modifiers* ((alpha | '_')+ :>> (alnum | '_')*) >{start = fpc;} %id;
row = space* ltab space* id space* (col space* id)* space* rtab space*;
row = space* ltab space* id space* (col space* id space*)* space* rtab space*;
main := row+;
}%%
@ -47,7 +48,11 @@ bool LELParser::parse(std::string input) {
%% write exec;
bool good = pe - p == 0;
finalize();
if(good) {
finalize();
} else {
fmt::println("error at");
std::cout << p;
}
return good;
}