parse: minor code simplification
This commit is contained in:
parent
6597de68e4
commit
4ed7d5a1b2
2 changed files with 2 additions and 4 deletions
|
@ -77,8 +77,7 @@ static inline void parse_reduce_10(std::string *lhs, rhs_t *rhs, std::string *ac
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void parse_reduce_11(std::string *lhs, unsigned char c1, unsigned char c2, __attribute__((unused)) grammar_t *grammar) {
|
static inline void parse_reduce_11(std::string *lhs, unsigned char c1, unsigned char c2, __attribute__((unused)) grammar_t *grammar) {
|
||||||
vars_t vars;
|
vars_t vars(1);
|
||||||
vars.emplace_back();
|
|
||||||
|
|
||||||
for (unsigned int c = c1; c <= c2; c++)
|
for (unsigned int c = c1; c <= c2; c++)
|
||||||
grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()});
|
grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()});
|
||||||
|
|
|
@ -91,8 +91,7 @@ directive |= SYMBOL(lhs) "|=" rhs(rhs) action(action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
directive |= SYMBOL(lhs) "|=" '(' CHAR(c1) "..." CHAR(c2) ')' ';' {
|
directive |= SYMBOL(lhs) "|=" '(' CHAR(c1) "..." CHAR(c2) ')' ';' {
|
||||||
vars_t vars;
|
vars_t vars(1);
|
||||||
vars.emplace_back();
|
|
||||||
|
|
||||||
for (unsigned int c = c1; c <= c2; c++)
|
for (unsigned int c = c1; c <= c2; c++)
|
||||||
grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()});
|
grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()});
|
||||||
|
|
Reference in a new issue