Delete not reachable error.

This commit is contained in:
jcamiel 2023-12-06 17:39:46 +01:00
parent a7807cfe21
commit 6498bd3449
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
4 changed files with 1 additions and 29 deletions

View File

@ -66,9 +66,6 @@ impl Error for parser::Error {
ParseError::Version => "Parsing version".to_string(),
ParseError::XPathExpr => "Parsing XPath expression".to_string(),
ParseError::Xml => "Parsing XML".to_string(),
// TODO: implement all variants
// _ => ,
ParseError::Url => format!("{self:?}"),
}
}
@ -173,9 +170,6 @@ impl Error for parser::Error {
}
ParseError::XPathExpr => "expecting a XPath expression".to_string(),
ParseError::Xml => "invalid XML".to_string(),
// TODO: implement all variants
// _ => format!("{self:?}"),
ParseError::Url => format!("{self:?}"),
}
}
}

View File

@ -52,7 +52,6 @@ pub enum ParseError {
Status,
TemplateVariable,
Unicode,
Url,
UrlIllegalCharacter(char),
UrlInvalidStart,
Version,

View File

@ -22,14 +22,11 @@ use crate::parser::reader::Reader;
use crate::parser::ParseResult;
pub fn parse(reader: &mut Reader) -> ParseResult<Expr> {
// let start = p.state.clone();
try_literal("{{", reader)?;
let space0 = zero_or_more_spaces(reader)?;
let variable = variable_name(reader)?;
let space1 = zero_or_more_spaces(reader)?;
//literal("}}", p)?;
if try_literal("}}}", reader).is_err() {
literal("}}", reader)?
}
@ -42,8 +39,6 @@ pub fn parse(reader: &mut Reader) -> ParseResult<Expr> {
}
pub fn parse2(reader: &mut Reader) -> ParseResult<Expr> {
// let start = p.state.clone();
let space0 = zero_or_more_spaces(reader)?;
let variable = variable_name(reader)?;
let space1 = zero_or_more_spaces(reader)?;

View File

@ -28,14 +28,6 @@ pub fn url(reader: &mut Reader) -> ParseResult<Template> {
let mut elements = vec![];
let mut buffer = String::new();
if reader.is_eof() {
return Err(Error {
pos: start.pos,
recoverable: false,
inner: ParseError::Url,
});
}
if !url_prefix_valid(reader) {
return Err(Error {
pos: reader.state.pos,
@ -91,6 +83,7 @@ pub fn url(reader: &mut Reader) -> ParseResult<Template> {
}
}
}
if !buffer.is_empty() {
elements.push(TemplateElement::String {
value: buffer.clone(),
@ -98,15 +91,6 @@ pub fn url(reader: &mut Reader) -> ParseResult<Template> {
});
}
if elements.is_empty() {
reader.state = start;
return Err(Error {
pos: start.pos,
recoverable: false,
inner: ParseError::Url,
});
}
// URLs should be followed by a line terminator
let save = reader.state;
if line_terminator(reader).is_err() {