diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-04-18 18:54:40 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-04-18 18:54:40 +0200 |
commit | 3cab65c9f0e2a513a2cd3601c41085ca69cf9193 (patch) | |
tree | df81a46c3142a8bc2b5b33cc485993cbdc8fa268 /src | |
parent | a6cf9b0956f68a1e68fbbd1a2716fae3398c2582 (diff) | |
download | solar-3cab65c9f0e2a513a2cd3601c41085ca69cf9193.tar solar-3cab65c9f0e2a513a2cd3601c41085ca69cf9193.zip |
parse: improve code formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/parse.cpp | 2 | ||||
-rw-r--r-- | src/parse.y | 27 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/parse.cpp b/src/parse.cpp index c99ceca..0d8d417 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -86,7 +86,7 @@ static inline void parse_reduce_11(std::string *lhs, unsigned char c1, unsigned grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()}); } -static inline rhs_t * parse_reduce_12(__attribute__((unused)) grammar_t *grammar) {return new rhs_t();} +static inline rhs_t * parse_reduce_12(__attribute__((unused)) grammar_t *grammar) {return new rhs_t;} static inline rhs_t * parse_reduce_13(rhs_t *rhs, symbol_t *sym, var_t *var, __attribute__((unused)) grammar_t *grammar) { rhs->first.push_back(*sym); diff --git a/src/parse.y b/src/parse.y index 9959b0b..33bcb55 100644 --- a/src/parse.y +++ b/src/parse.y @@ -104,7 +104,7 @@ directive |= SYMBOL(lhs) "|=" '(' CHAR(c1) "..." CHAR(c2) ')' ';' { } -rhs |= [new rhs_t()] +rhs |= [new rhs_t] rhs |= rhs(=rhs) symbol(sym) variable(var) { rhs->first.push_back(*sym); @@ -123,16 +123,17 @@ rhs |= rhs(=rhs) STRING(str) { } -variable |= [new var_t] -variable |= '(' consume(consume) csymbol(var) ')' [new var_t(*var, consume)] +variable |= [new var_t] +variable |= '(' consume(consume) csymbol(var) ')' + [new var_t(*var, consume)] -consume |= [false] -consume |= '=' [true] +consume |= [false] +consume |= '=' [true] -action |= ';' [new std::string] -action |= BLOCK(=v) [v] -action |= SQBLOCK(v) [new std::string("return " + *v + ";")] +action |= ';' [new std::string] +action |= BLOCK(=v) [v] +action |= SQBLOCK(v) [new std::string("return " + *v + ";")] namespace |= csymbol(v) [new std::vector<std::string> {*v}] @@ -142,11 +143,11 @@ namespace |= namespace(=ns) "::" csymbol(v) { } -symbol |= SYMBOL(v) [new symbol_t(symbol_t::make_nonterm(*v))] -symbol |= term(=v) [v] +symbol |= SYMBOL(v) [new symbol_t(symbol_t::make_nonterm(*v))] +symbol |= term(=v) [v] -term |= SYMBOL_UC(v) [new symbol_t(symbol_t::make_term(*v))] -term |= CHAR(v) [new symbol_t(symbol_t::make_char(v))] +term |= SYMBOL_UC(v) [new symbol_t(symbol_t::make_term(*v))] +term |= CHAR(v) [new symbol_t(symbol_t::make_char(v))] csymbol |= SYMBOL_UC(=v) [v] -csymbol |= SYMBOL(=v) [v] +csymbol |= SYMBOL(=v) [v] |