diff options
author | Nadrieril | 2019-08-13 19:31:23 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-13 19:31:23 +0200 |
commit | 5895c3aa6552f75d7e5202be561f9734fe8945e7 (patch) | |
tree | 80c4258ce94e82af29bf6a09f483c38601a16b34 /dhall_syntax/src/parser.rs | |
parent | cbd62bb57bcc94e0133c57437488a5af22a0b1c2 (diff) |
No need to track the absence of `Span`s at the type level
Diffstat (limited to '')
-rw-r--r-- | dhall_syntax/src/parser.rs | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index 9ae6dc8..1ab6e6d 100644 --- a/dhall_syntax/src/parser.rs +++ b/dhall_syntax/src/parser.rs @@ -15,46 +15,15 @@ use crate::*; // their own crate because they are quite general and useful. For now they // are here and hopefully you can figure out how they work. -type ParsedExpr = Expr<Span, Import>; -type ParsedSubExpr = SubExpr<Span, Import>; -type ParsedText = InterpolatedText<SubExpr<Span, Import>>; -type ParsedTextContents = InterpolatedTextContents<SubExpr<Span, Import>>; +pub(crate) type ParsedExpr = Expr<Import>; +pub(crate) type ParsedSubExpr = SubExpr<Import>; +type ParsedText = InterpolatedText<SubExpr<Import>>; +type ParsedTextContents = InterpolatedTextContents<SubExpr<Import>>; pub type ParseError = pest::error::Error<Rule>; pub type ParseResult<T> = Result<T, ParseError>; -fn unspanned(x: ParsedExpr) -> ParsedSubExpr { - SubExpr::from_expr_no_note(x) -} - -#[derive(Debug, Clone)] -pub struct Span { - input: Rc<str>, - /// # Safety - /// - /// Must be a valid character boundary index into `input`. - start: usize, - /// # Safety - /// - /// Must be a valid character boundary index into `input`. - end: usize, -} - -impl Span { - fn make(input: Rc<str>, sp: pest::Span) -> Self { - Span { - input, - start: sp.start(), - end: sp.end(), - } - } -} - -fn spanned(span: Span, x: ParsedExpr) -> ParsedSubExpr { - SubExpr::new(x, span) -} - #[derive(Debug)] enum Either<A, B> { Left(A), |