Use a lel:: namespace.

This commit is contained in:
Zed A. Shaw 2025-02-15 11:55:04 -05:00
parent cebf61a794
commit 1620a5420f
6 changed files with 155 additions and 148 deletions

View file

@ -4,25 +4,27 @@
#include <fmt/core.h>
#include <iostream>
namespace lel {
#line 34 "lel_parser.rl"
#line 36 "lel_parser.rl"
#line 8 "lel_parser.cpp"
static const char _LELParser_actions[] = {
#line 10 "lel_parser.cpp"
static const char _Parser_actions[] = {
0, 1, 1, 1, 2, 1, 3, 1,
4, 1, 5, 1, 6, 1, 9, 1,
10, 1, 11, 2, 0, 7, 2, 0,
8, 2, 4, 1, 2, 4, 5
};
static const char _LELParser_key_offsets[] = {
static const char _Parser_key_offsets[] = {
0, 0, 4, 18, 20, 24, 35, 47,
52, 54, 57
};
static const char _LELParser_trans_keys[] = {
static const char _Parser_trans_keys[] = {
32, 91, 9, 13, 32, 40, 42, 46,
60, 62, 94, 95, 9, 13, 65, 90,
97, 122, 48, 57, 41, 44, 48, 57,
@ -33,22 +35,22 @@ static const char _LELParser_trans_keys[] = {
57, 32, 91, 9, 13, 0
};
static const char _LELParser_single_lengths[] = {
static const char _Parser_single_lengths[] = {
0, 2, 8, 0, 2, 7, 4, 3,
0, 1, 2
};
static const char _LELParser_range_lengths[] = {
static const char _Parser_range_lengths[] = {
0, 1, 3, 1, 1, 2, 4, 1,
1, 1, 1
};
static const char _LELParser_index_offsets[] = {
static const char _Parser_index_offsets[] = {
0, 0, 4, 16, 18, 22, 32, 41,
46, 48, 51
};
static const char _LELParser_indicies[] = {
static const char _Parser_indicies[] = {
0, 2, 0, 1, 3, 4, 5, 6,
7, 7, 6, 8, 3, 8, 8, 1,
9, 1, 10, 11, 12, 1, 4, 5,
@ -58,28 +60,28 @@ static const char _LELParser_indicies[] = {
21, 22, 1, 23, 2, 23, 1, 0
};
static const char _LELParser_trans_targs[] = {
static const char _Parser_trans_targs[] = {
1, 0, 2, 2, 3, 5, 5, 5,
6, 4, 5, 8, 4, 7, 6, 10,
2, 7, 10, 2, 9, 5, 9, 10
};
static const char _LELParser_trans_actions[] = {
static const char _Parser_trans_actions[] = {
0, 0, 3, 0, 0, 13, 5, 11,
17, 15, 19, 19, 0, 7, 0, 28,
25, 0, 9, 1, 15, 22, 0, 0
};
static const int LELParser_start = 1;
static const int LELParser_first_final = 10;
static const int LELParser_error = 0;
static const int Parser_start = 1;
static const int Parser_first_final = 10;
static const int Parser_error = 0;
static const int LELParser_en_main = 1;
static const int Parser_en_main = 1;
#line 37 "lel_parser.rl"
#line 39 "lel_parser.rl"
bool LELParser::parse(std::string input) {
bool Parser::parse(std::string input) {
reset();
int cs = 0;
const char *start = nullptr;
@ -89,14 +91,14 @@ bool LELParser::parse(std::string input) {
std::string tk;
#line 84 "lel_parser.cpp"
#line 86 "lel_parser.cpp"
{
cs = LELParser_start;
cs = Parser_start;
}
#line 48 "lel_parser.rl"
#line 50 "lel_parser.rl"
#line 87 "lel_parser.cpp"
#line 89 "lel_parser.cpp"
{
int _klen;
unsigned int _trans;
@ -109,10 +111,10 @@ bool LELParser::parse(std::string input) {
if ( cs == 0 )
goto _out;
_resume:
_keys = _LELParser_trans_keys + _LELParser_key_offsets[cs];
_trans = _LELParser_index_offsets[cs];
_keys = _Parser_trans_keys + _Parser_key_offsets[cs];
_trans = _Parser_index_offsets[cs];
_klen = _LELParser_single_lengths[cs];
_klen = _Parser_single_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@ -135,7 +137,7 @@ _resume:
_trans += _klen;
}
_klen = _LELParser_range_lengths[cs];
_klen = _Parser_range_lengths[cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@ -158,67 +160,67 @@ _resume:
}
_match:
_trans = _LELParser_indicies[_trans];
cs = _LELParser_trans_targs[_trans];
_trans = _Parser_indicies[_trans];
cs = _Parser_trans_targs[_trans];
if ( _LELParser_trans_actions[_trans] == 0 )
if ( _Parser_trans_actions[_trans] == 0 )
goto _again;
_acts = _LELParser_actions + _LELParser_trans_actions[_trans];
_acts = _Parser_actions + _Parser_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
#line 9 "lel_parser.rl"
#line 11 "lel_parser.rl"
{tk = input.substr(start - begin, p - start); }
break;
case 1:
#line 11 "lel_parser.rl"
#line 13 "lel_parser.rl"
{ col(); }
break;
case 2:
#line 12 "lel_parser.rl"
#line 14 "lel_parser.rl"
{ ltab(); }
break;
case 3:
#line 13 "lel_parser.rl"
#line 15 "lel_parser.rl"
{ valign((*p)); }
break;
case 4:
#line 14 "lel_parser.rl"
#line 16 "lel_parser.rl"
{ id(input.substr(start - begin, p - start)); }
break;
case 5:
#line 15 "lel_parser.rl"
#line 17 "lel_parser.rl"
{ row(); }
break;
case 6:
#line 16 "lel_parser.rl"
#line 18 "lel_parser.rl"
{ align((*p)); }
break;
case 7:
#line 17 "lel_parser.rl"
#line 19 "lel_parser.rl"
{ setwidth(std::stoi(tk)); }
break;
case 8:
#line 18 "lel_parser.rl"
#line 20 "lel_parser.rl"
{ setheight(std::stoi(tk)); }
break;
case 9:
#line 19 "lel_parser.rl"
#line 21 "lel_parser.rl"
{ expand(); }
break;
case 10:
#line 27 "lel_parser.rl"
#line 29 "lel_parser.rl"
{ start = p; }
break;
case 11:
#line 30 "lel_parser.rl"
#line 32 "lel_parser.rl"
{start = p;}
break;
#line 196 "lel_parser.cpp"
#line 198 "lel_parser.cpp"
}
}
@ -231,7 +233,7 @@ _again:
_out: {}
}
#line 49 "lel_parser.rl"
#line 51 "lel_parser.rl"
bool good = pe - p == 0;
if(good) {
@ -242,3 +244,5 @@ _again:
}
return good;
}
}