Skip to content

Commit

Permalink
Delete not reachable error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed Dec 8, 2023
1 parent a7807cf commit 6498bd3
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 29 deletions.
6 changes: 0 additions & 6 deletions packages/hurl_core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"),
}
}

Expand Down Expand Up @@ -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:?}"),
}
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/hurl_core/src/parser/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pub enum ParseError {
Status,
TemplateVariable,
Unicode,
Url,
UrlIllegalCharacter(char),
UrlInvalidStart,
Version,
Expand Down
5 changes: 0 additions & 5 deletions packages/hurl_core/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
}
Expand All @@ -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)?;
Expand Down
18 changes: 1 addition & 17 deletions packages/hurl_core/src/parser/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -91,22 +83,14 @@ pub fn url(reader: &mut Reader) -> ParseResult<Template> {
}
}
}

if !buffer.is_empty() {
elements.push(TemplateElement::String {
value: buffer.clone(),
encoded: buffer,
});
}

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() {
Expand Down

0 comments on commit 6498bd3

Please sign in to comment.