Extend that optimization to more object parsers.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/// Parse an element that has affiliated keywords.
|
||||
macro_rules! ak_element {
|
||||
($parser:ident, $affiliated_keywords:expr, $post_affiliated_keywords_input: expr, $context: expr, $input: expr, $wrapper: expr) => {
|
||||
($parser:expr, $affiliated_keywords:expr, $post_affiliated_keywords_input: expr, $context: expr, $input: expr, $wrapper: expr) => {
|
||||
if let Ok((remaining, ele)) = $parser(
|
||||
$affiliated_keywords,
|
||||
$post_affiliated_keywords_input,
|
||||
@@ -10,7 +10,7 @@ macro_rules! ak_element {
|
||||
return Ok((remaining, $wrapper(ele)));
|
||||
}
|
||||
};
|
||||
($parser:ident, $affiliated_keywords:expr, $post_affiliated_keywords_input: expr, $context: expr, $input: expr) => {
|
||||
($parser:expr, $affiliated_keywords:expr, $post_affiliated_keywords_input: expr, $context: expr, $input: expr) => {
|
||||
if let Ok((remaining, ele)) = $parser(
|
||||
$affiliated_keywords,
|
||||
$post_affiliated_keywords_input,
|
||||
@@ -25,12 +25,12 @@ macro_rules! ak_element {
|
||||
pub(crate) use ak_element;
|
||||
|
||||
macro_rules! element {
|
||||
($parser:ident, $context: expr, $input: expr, $wrapper: expr) => {
|
||||
($parser:expr, $context: expr, $input: expr, $wrapper: expr) => {
|
||||
if let Ok((remaining, ele)) = $parser($context, $input) {
|
||||
return Ok((remaining, $wrapper(ele)));
|
||||
}
|
||||
};
|
||||
($parser:ident, $context: expr, $input: expr) => {
|
||||
($parser:expr, $context: expr, $input: expr) => {
|
||||
if let Ok((remaining, ele)) = $parser($context, $input) {
|
||||
return Ok((remaining, ele));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user