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)
|
||||
} else {
|
||||
alt((
|
||||
map(multispace1, |x: Span| {
|
||||
map(space1, |x: Span| {
|
||||
WhiteSpace::Space(Box::new(into_locate(x)))
|
||||
}),
|
||||
map(multispace1, |x: Span| {
|
||||
WhiteSpace::Newline(Box::new(into_locate(x)))
|
||||
}),
|
||||
map(preceded(peek(char('/')), comment), |x| {
|
||||
WhiteSpace::Comment(Box::new(x))
|
||||
}),
|
||||
|
@ -14,6 +14,7 @@ pub struct Keyword {
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Node)]
|
||||
pub enum WhiteSpace {
|
||||
Newline(Box<Locate>),
|
||||
Space(Box<Locate>),
|
||||
Comment(Box<Comment>),
|
||||
CompilerDirective(Box<CompilerDirective>),
|
||||
|
Loading…
x
Reference in New Issue
Block a user