Skip to main content

sevenmark_parser/parser/token/
token_angle_bracket.rs

1use crate::ast::{Element, Span, TextElement};
2use crate::parser::ParserInput;
3use winnow::Result;
4use winnow::prelude::*;
5use winnow::stream::Location as StreamLocation;
6use winnow::token::literal;
7
8/// `<` 토큰 파서: 멘션 파서가 실패한 경우 `<`를 Text로 변환
9pub fn token_angle_bracket_parser(parser_input: &mut ParserInput) -> Result<Element> {
10    let start = parser_input.current_token_start();
11    literal("<").parse_next(parser_input)?;
12    let end = parser_input.previous_token_end();
13
14    Ok(Element::Text(TextElement {
15        span: Span { start, end },
16        value: "<".to_string(),
17    }))
18}