Rename library to nomo
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
d691fb9198
commit
d2e0405033
28 changed files with 92 additions and 92 deletions
|
|
@ -33,10 +33,10 @@ use winnow::token::take_until;
|
|||
use winnow::token::take_while;
|
||||
|
||||
use crate::SourceSpan;
|
||||
use crate::input::TempleInput;
|
||||
use crate::input::NomoInput;
|
||||
use crate::resume_after_cut;
|
||||
|
||||
type Input<'input> = Recoverable<LocatingSlice<TempleInput>, ParseError>;
|
||||
type Input<'input> = Recoverable<LocatingSlice<NomoInput>, ParseError>;
|
||||
type PResult<'input, T> = Result<T, ParseError>;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
@ -52,7 +52,7 @@ impl std::fmt::Display for ParseFailure {
|
|||
}
|
||||
|
||||
impl ParseFailure {
|
||||
fn from_errors(errors: Vec<ParseError>, input: TempleInput) -> ParseFailure {
|
||||
fn from_errors(errors: Vec<ParseError>, input: NomoInput) -> ParseFailure {
|
||||
ParseFailure {
|
||||
input: Arc::from(input.to_string()),
|
||||
errors,
|
||||
|
|
@ -248,13 +248,13 @@ impl<const LEN: usize> winnow::stream::ContainsToken<&'_ TemplateToken> for [Tok
|
|||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct TemplateToken {
|
||||
kind: TokenKind,
|
||||
source: TempleInput,
|
||||
source: NomoInput,
|
||||
}
|
||||
|
||||
macro_rules! impl_token_kind_builders {
|
||||
($($name:ident => $kind:expr),+ $(,)?) => {
|
||||
$(
|
||||
fn $name(source: TempleInput) -> Self {
|
||||
fn $name(source: NomoInput) -> Self {
|
||||
TemplateToken {
|
||||
kind: $kind,
|
||||
source,
|
||||
|
|
@ -277,7 +277,7 @@ impl TemplateToken {
|
|||
end => TokenKind::End,
|
||||
}
|
||||
|
||||
pub fn literal(literal: TokenLiteral, source: TempleInput) -> Self {
|
||||
pub fn literal(literal: TokenLiteral, source: NomoInput) -> Self {
|
||||
TemplateToken {
|
||||
kind: TokenKind::Literal(literal),
|
||||
source,
|
||||
|
|
@ -288,12 +288,12 @@ impl TemplateToken {
|
|||
self.kind
|
||||
}
|
||||
|
||||
pub fn source(&self) -> TempleInput {
|
||||
pub fn source(&self) -> NomoInput {
|
||||
self.source.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse(input: TempleInput) -> Result<ParsedTemplate, ParseFailure> {
|
||||
pub fn parse(input: NomoInput) -> Result<ParsedTemplate, ParseFailure> {
|
||||
let (_remaining, val, errors) =
|
||||
parse_tokens.recoverable_parse(LocatingSlice::new(input.clone()));
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ fn parse_interpolate<'input>(input: &mut Input<'input>) -> PResult<'input, Vec<T
|
|||
.resume_after(recover)
|
||||
.with_taken()
|
||||
.map(|(val, taken)| {
|
||||
val.unwrap_or_else(|| (vec![TemplateToken::invalid(taken)], TempleInput::from("")))
|
||||
val.unwrap_or_else(|| (vec![TemplateToken::invalid(taken)], NomoInput::from("")))
|
||||
})
|
||||
.parse_next(input)?;
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ fn parse_ident<'input>(input: &mut Input<'input>) -> PResult<'input, TemplateTok
|
|||
.parse_next(input)
|
||||
}
|
||||
|
||||
fn ident<'input>(input: &mut Input<'input>) -> PResult<'input, TempleInput> {
|
||||
fn ident<'input>(input: &mut Input<'input>) -> PResult<'input, NomoInput> {
|
||||
peek(not(parse_literal))
|
||||
.context(ParseError::ctx().msg("Expected an ident, but found a literal instead"))
|
||||
.parse_next(input)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue