parse: minor code simplification

This commit is contained in:
Matthias Schiffer 2015-04-18 16:55:06 +02:00
parent 6597de68e4
commit 4ed7d5a1b2
2 changed files with 2 additions and 4 deletions

View file

@ -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()});

View file

@ -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()});