Merge pull request #51 from erihsu/master

Fix issues #49 and #50
This commit is contained in:
dalance 2022-04-30 10:05:25 +09:00 committed by GitHub
commit 2a011c01db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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))
}),

View File

@ -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>),