parser: Ensure that all nonterminals have tokens after parsing

This commit is contained in:
Vadim Petrochenkov
2021-05-06 16:21:40 +03:00
parent 9a576175cc
commit cbdfa1edca
8 changed files with 612 additions and 31 deletions

View File

@@ -342,16 +342,10 @@ impl<'a> Parser<'a> {
// If we support tokens at all
if let Some(target_tokens) = ret.tokens_mut() {
if let Some(target_tokens) = target_tokens {
assert!(
!self.capture_cfg,
"Encountered existing tokens with capture_cfg set: {:?}",
target_tokens
);
} else {
if target_tokens.is_none() {
// Store se our newly captured tokens into the AST node
*target_tokens = Some(tokens.clone());
};
}
}
let final_attrs = ret.attrs();