refactor(parser): make REDUCE macro non-variadic
This commit is contained in:
parent
895c7680e7
commit
818cd8c291
2 changed files with 10 additions and 14 deletions
|
|
@ -1299,16 +1299,9 @@ impl Generator {
|
|||
} => {
|
||||
add!(
|
||||
self,
|
||||
"REDUCE(.symbol = {}, .child_count = {child_count}",
|
||||
"REDUCE({}, {child_count}, {dynamic_precedence}, {production_id})",
|
||||
self.symbol_ids[&symbol]
|
||||
);
|
||||
if dynamic_precedence != 0 {
|
||||
add!(self, ", .dynamic_precedence = {dynamic_precedence}");
|
||||
}
|
||||
if production_id != 0 {
|
||||
add!(self, ", .production_id = {production_id}");
|
||||
}
|
||||
add!(self, ")");
|
||||
}
|
||||
}
|
||||
add!(self, ",");
|
||||
|
|
|
|||
|
|
@ -203,12 +203,15 @@ struct TSLanguage {
|
|||
} \
|
||||
}}
|
||||
|
||||
#define REDUCE(...) \
|
||||
{{ \
|
||||
.reduce = { \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
#define REDUCE(symbol_name, children, precedence, prod_id) \
|
||||
{{ \
|
||||
.reduce = { \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
.symbol = symbol_name, \
|
||||
.child_count = children, \
|
||||
.dynamic_precedence = precedence, \
|
||||
.production_id = prod_id \
|
||||
}, \
|
||||
}}
|
||||
|
||||
#define RECOVER() \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue