As recommended here: How to benchmark Boost Spirit Parser? I want to make my grammar stateless, static and const. Therefore I have to store the current column, row and result somewhere and I thought locals would be the right place. Unfortunately, I cannot access locals of the parent rule in a sub rule to modify them:
qi::rule<Iterator, qi::locals<Slk::Table::size_type, Slk::Table::size_type, Slk::Table> > cells;
cells =
eps[ref(_b) = 1][ref(_a) = 1]
now I want to change the locals in a sub rule:
f_record =
lit('F')
>> +(
skipped_field
| y_field[ref(_a) = _1]
| x_field[ref(_b) = _1]
)
;
but how can I access the locals from the parent rule? Do I have to store them in the attribute?! What's the best way to make the grammar stateless? Where do I store variables of the current state which might be modified by ANY sub rule anywhere in the grammar at any time?