Parse ident
This commit is contained in:
parent
e9d2602cd6
commit
932af88c84
1 changed files with 8 additions and 5 deletions
|
|
@ -1,19 +1,22 @@
|
|||
use chumsky::prelude::*;
|
||||
use chumsky::text::whitespace;
|
||||
|
||||
use crate::ast::Space;
|
||||
use crate::ast::{Ident, Space};
|
||||
use crate::span::Span;
|
||||
|
||||
type Error = Simple<char, Span>;
|
||||
|
||||
fn space() -> impl Parser<char, Space, Error = Error> {
|
||||
// TODO Parse comments
|
||||
whitespace().map_with_span(|(), span| Space {
|
||||
text::whitespace().map_with_span(|(), span| Space {
|
||||
comment: vec![],
|
||||
span,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn parser() -> impl Parser<char, Space, Error = Error> {
|
||||
space().then_ignore(end())
|
||||
fn ident() -> impl Parser<char, Ident, Error = Error> {
|
||||
text::ident().map_with_span(|name, span| Ident { name, span })
|
||||
}
|
||||
|
||||
pub fn parser() -> impl Parser<char, Ident, Error = Error> {
|
||||
ident().padded().then_ignore(end())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue