New design on LEL that's way more sane and allows for more flexible columns and rows.

This commit is contained in:
Zed A. Shaw 2025-02-16 11:50:14 -05:00
parent f884b83809
commit 79c84ce885
8 changed files with 83 additions and 78 deletions

View file

@ -7,7 +7,7 @@
namespace lel {
#line 44 "lel_parser.rl"
#line 40 "lel_parser.rl"
@ -84,7 +84,7 @@ static const int Parser_error = 0;
static const int Parser_en_main = 1;
#line 47 "lel_parser.rl"
#line 43 "lel_parser.rl"
bool Parser::parse(std::string input) {
reset();
@ -101,7 +101,7 @@ bool Parser::parse(std::string input) {
cs = Parser_start;
}
#line 58 "lel_parser.rl"
#line 54 "lel_parser.rl"
#line 94 "lel_parser.cpp"
{
@ -183,11 +183,11 @@ _match:
break;
case 1:
#line 13 "lel_parser.rl"
{ }
{}
break;
case 2:
#line 14 "lel_parser.rl"
{ cur.row = rows; }
{ grid.push_back(Row()); }
break;
case 3:
#line 15 "lel_parser.rl"
@ -199,45 +199,41 @@ _match:
break;
case 5:
#line 17 "lel_parser.rl"
{
rows++;
columns = std::max(columns, cur.col);
cur.col = 0;
}
{ cur.col = 0; cur.row++; }
break;
case 6:
#line 22 "lel_parser.rl"
#line 18 "lel_parser.rl"
{ cur.right = (*p) == '>'; }
break;
case 7:
#line 23 "lel_parser.rl"
#line 19 "lel_parser.rl"
{cur.max_w = std::stoi(tk); }
break;
case 8:
#line 24 "lel_parser.rl"
#line 20 "lel_parser.rl"
{ cur.max_h = std::stoi(tk); }
break;
case 9:
#line 25 "lel_parser.rl"
#line 21 "lel_parser.rl"
{ cur.expand = true; }
break;
case 10:
#line 26 "lel_parser.rl"
#line 22 "lel_parser.rl"
{ cur.center = true; }
break;
case 11:
#line 27 "lel_parser.rl"
#line 23 "lel_parser.rl"
{ cur.percent = true; }
break;
case 12:
#line 37 "lel_parser.rl"
#line 33 "lel_parser.rl"
{ start = p; }
break;
case 13:
#line 40 "lel_parser.rl"
#line 36 "lel_parser.rl"
{start = p;}
break;
#line 213 "lel_parser.cpp"
#line 209 "lel_parser.cpp"
}
}
@ -250,7 +246,7 @@ _again:
_out: {}
}
#line 59 "lel_parser.rl"
#line 55 "lel_parser.rl"
bool good = pe - p == 0;
if(good) {