feat: parse affiliated keywords in block
This commit is contained in:
parent
868cd9ab10
commit
6930640866
2 changed files with 6 additions and 2 deletions
|
|
@ -199,13 +199,13 @@ pub trait Traverser {
|
|||
SUBSCRIPT => walk!(Subscript),
|
||||
KEYWORD => walk!(Keyword),
|
||||
PROPERTY_DRAWER => walk!(PropertyDrawer),
|
||||
NODE_PROPERTY => {}
|
||||
BLOCK_CONTENT | LIST_ITEM_CONTENT => {
|
||||
for child in node.children_with_tokens() {
|
||||
self.element(child, ctx);
|
||||
take_control!();
|
||||
}
|
||||
}
|
||||
NODE_PROPERTY | AFFILIATED_KEYWORD => {}
|
||||
|
||||
kind => debug_assert!(
|
||||
!kind.is_element() && !kind.is_object(),
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ use super::{
|
|||
},
|
||||
element::element_nodes,
|
||||
input::Input,
|
||||
keyword::affiliated_keyword_nodes,
|
||||
SyntaxKind::*,
|
||||
};
|
||||
|
||||
fn block_node_base(input: Input) -> IResult<Input, GreenElement, ()> {
|
||||
let (input, affiliated_keywords) = affiliated_keyword_nodes(input)?;
|
||||
let (input, (block_begin, name)) = block_begin_node(input)?;
|
||||
let (input, pre_blank) = blank_lines(input)?;
|
||||
|
||||
|
|
@ -36,7 +38,9 @@ fn block_node_base(input: Input) -> IResult<Input, GreenElement, ()> {
|
|||
if let Ok((input, block_end)) = block_end_node(input, name) {
|
||||
let (input, post_blank) = blank_lines(input)?;
|
||||
|
||||
let mut children = vec![block_begin];
|
||||
let mut children = vec![];
|
||||
children.extend(affiliated_keywords);
|
||||
children.push(block_begin);
|
||||
children.extend(pre_blank);
|
||||
if kind.is_greater_element() {
|
||||
children.push(node(BLOCK_CONTENT, element_nodes(contents)?));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue