diff --git a/src/parser.rs b/src/parser.rs index 8b8625f..f1e5b26 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -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; fn space() -> impl Parser { // TODO Parse comments - whitespace().map_with_span(|(), span| Space { + text::whitespace().map_with_span(|(), span| Space { comment: vec![], span, }) } -pub fn parser() -> impl Parser { - space().then_ignore(end()) +fn ident() -> impl Parser { + text::ident().map_with_span(|name, span| Ident { name, span }) +} + +pub fn parser() -> impl Parser { + ident().padded().then_ignore(end()) }