feat: support affiliated keyword

This commit is contained in:
PoiScript 2023-11-15 00:03:16 +08:00
parent a269f2f258
commit 1362624083
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
34 changed files with 946 additions and 399 deletions

View file

@ -7,15 +7,15 @@ use nom::{
use super::{
combinator::{
debug_assert_lossless, l_bracket_token, l_curly_token, node, r_bracket_token,
r_curly_token, GreenElement,
l_bracket_token, l_curly_token, node, r_bracket_token, r_curly_token, GreenElement,
},
input::Input,
SyntaxKind,
};
#[tracing::instrument(level = "debug", skip(input), fields(input = input.s))]
pub fn inline_src_node(input: Input) -> IResult<Input, GreenElement, ()> {
debug_assert_lossless(map(
let mut parser = map(
tuple((
tag("src_"),
take_while1(|c: char| !c.is_ascii_whitespace() && c != '[' && c != '{'),
@ -40,7 +40,8 @@ pub fn inline_src_node(input: Input) -> IResult<Input, GreenElement, ()> {
children.push(r_curly);
node(SyntaxKind::INLINE_SRC, children)
},
))(input)
);
crate::lossless_parser!(parser, input)
}
#[test]