mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-10 14:24:40 +03:00
Delete not reachable error.
This commit is contained in:
parent
a7807cfe21
commit
6498bd3449
@ -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:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ pub enum ParseError {
|
||||
Status,
|
||||
TemplateVariable,
|
||||
Unicode,
|
||||
Url,
|
||||
UrlIllegalCharacter(char),
|
||||
UrlInvalidStart,
|
||||
Version,
|
||||
|
@ -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)?;
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user