Made the grammer fit the README description more and it seems to work the same. Tests in other projects confirmed, but may need to watch it.

main
Zed A. Shaw 4 days ago
parent 88bc6f9123
commit 9e6038dd7d
  1. 8
      lel_parser.cpp
  2. 5
      lel_parser.rl

@ -7,7 +7,7 @@
namespace lel { namespace lel {
#line 40 "lel_parser.rl" #line 41 "lel_parser.rl"
@ -84,7 +84,7 @@ static const int Parser_error = 0;
static const int Parser_en_main = 1; static const int Parser_en_main = 1;
#line 43 "lel_parser.rl" #line 44 "lel_parser.rl"
bool Parser::parse(std::string input) { bool Parser::parse(std::string input) {
reset(); reset();
@ -101,7 +101,7 @@ bool Parser::parse(std::string input) {
cs = Parser_start; cs = Parser_start;
} }
#line 54 "lel_parser.rl" #line 55 "lel_parser.rl"
#line 94 "lel_parser.cpp" #line 94 "lel_parser.cpp"
{ {
@ -246,7 +246,7 @@ _again:
_out: {} _out: {}
} }
#line 55 "lel_parser.rl" #line 56 "lel_parser.rl"
bool good = pe - p == 0; bool good = pe - p == 0;
if(good) { if(good) {

@ -33,8 +33,9 @@ namespace lel {
number = digit+ >{ start = fpc; } %token; number = digit+ >{ start = fpc; } %token;
setw = ("(" number %setwidth ("," number %setheight)? ")") ; setw = ("(" number %setwidth ("," number %setheight)? ")") ;
modifiers = (percent | center | expand | valign | halign | setw); modifiers = (percent | center | expand | valign | halign | setw);
id = modifiers* ((alpha | '_')+ :>> (alnum | '_')*) >{start = fpc;} %id; id = ((alpha | '_')+ :>> (alnum | '_')*) >{start = fpc;} %id;
row = space* ltab space* id space* (col space* id space*)* space* rtab space*; cell = modifiers* id;
row = space* ltab space* cell space* (col space* cell space*)* space* rtab space*;
main := row+; main := row+;
}%% }%%

Loading…
Cancel
Save