parser support differentiate newline and space
This commit is contained in:
parent
9015bb0a95
commit
82ecd16f20
@ -314,9 +314,12 @@ pub(crate) fn white_space(s: Span) -> IResult<Span, WhiteSpace> {
|
|||||||
})(s)
|
})(s)
|
||||||
} else {
|
} else {
|
||||||
alt((
|
alt((
|
||||||
map(multispace1, |x: Span| {
|
map(space1, |x: Span| {
|
||||||
WhiteSpace::Space(Box::new(into_locate(x)))
|
WhiteSpace::Space(Box::new(into_locate(x)))
|
||||||
}),
|
}),
|
||||||
|
map(multispace1, |x: Span| {
|
||||||
|
WhiteSpace::Newline(Box::new(into_locate(x)))
|
||||||
|
}),
|
||||||
map(preceded(peek(char('/')), comment), |x| {
|
map(preceded(peek(char('/')), comment), |x| {
|
||||||
WhiteSpace::Comment(Box::new(x))
|
WhiteSpace::Comment(Box::new(x))
|
||||||
}),
|
}),
|
||||||
|
@ -14,6 +14,7 @@ pub struct Keyword {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Node)]
|
#[derive(Clone, Debug, PartialEq, Node)]
|
||||||
pub enum WhiteSpace {
|
pub enum WhiteSpace {
|
||||||
|
Newline(Box<Locate>),
|
||||||
Space(Box<Locate>),
|
Space(Box<Locate>),
|
||||||
Comment(Box<Comment>),
|
Comment(Box<Comment>),
|
||||||
CompilerDirective(Box<CompilerDirective>),
|
CompilerDirective(Box<CompilerDirective>),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user