Initial cut of the lel parser mostly working but none of the basic alignment properties work.

This commit is contained in:
Zed A. Shaw 2025-02-14 15:40:15 -05:00
parent e7e0df6b70
commit 846b7aaf16
7 changed files with 492 additions and 354 deletions

42
lel.hpp Normal file
View file

@ -0,0 +1,42 @@
#pragma once
#include <string>
#include <unordered_map>
struct Cell {
int x = 0;
int y = 0;
int w = 0;
int h = 0;
int col = 0;
int row = 0;
bool left = true;
bool top = true;
bool expand = false;
Cell(int col, int row) : col(col), row(row) {}
};
struct LELParser {
int grid_x = 0;
int grid_y = 0;
int grid_w = 0;
int grid_h = 0;
int row_count = 0;
int max_columns = 0;
Cell cur;
std::unordered_map<std::string, Cell> cells;
LELParser(int x, int y, int width, int height);
void col();
void ltab();
void align(char dir);
void valign(char dir);
void id(std::string name);
void row();
void setwidth(int width);
void setheight(int height);
void expand();
void reset();
bool parse(std::string input);
void finalize();
};