add location to InvalidSingleQuotedCharacter
This commit is contained in:
@@ -452,7 +452,7 @@ pub enum ParserError {
|
|||||||
IO(IOError),
|
IO(IOError),
|
||||||
IncompleteReduction(Location),
|
IncompleteReduction(Location),
|
||||||
InfiniteFloat(Location),
|
InfiniteFloat(Location),
|
||||||
InvalidSingleQuotedCharacter(char),
|
InvalidSingleQuotedCharacter(char, Location),
|
||||||
LexicalError(lexical::Error),
|
LexicalError(lexical::Error),
|
||||||
MissingQuote(Location),
|
MissingQuote(Location),
|
||||||
NonPrologChar(Location),
|
NonPrologChar(Location),
|
||||||
@@ -466,6 +466,7 @@ impl ParserError {
|
|||||||
pub fn location(&self) -> Option<Location> {
|
pub fn location(&self) -> Option<Location> {
|
||||||
match self {
|
match self {
|
||||||
ParserError::BackQuotedString(location)
|
ParserError::BackQuotedString(location)
|
||||||
|
| ParserError::InvalidSingleQuotedCharacter(_, location)
|
||||||
| ParserError::IncompleteReduction(location)
|
| ParserError::IncompleteReduction(location)
|
||||||
| ParserError::InfiniteFloat(location)
|
| ParserError::InfiniteFloat(location)
|
||||||
| ParserError::MissingQuote(location)
|
| ParserError::MissingQuote(location)
|
||||||
@@ -473,9 +474,7 @@ impl ParserError {
|
|||||||
| ParserError::ParseBigInt(location)
|
| ParserError::ParseBigInt(location)
|
||||||
| ParserError::UnexpectedChar(_, location) => Some(location.clone()),
|
| ParserError::UnexpectedChar(_, location) => Some(location.clone()),
|
||||||
ParserError::Utf8Error(location) => location.as_ref().cloned(),
|
ParserError::Utf8Error(location) => location.as_ref().cloned(),
|
||||||
ParserError::IO(_)
|
ParserError::IO(_) | ParserError::LexicalError(_) => None,
|
||||||
| ParserError::LexicalError(_)
|
|
||||||
| ParserError::InvalidSingleQuotedCharacter(_) => None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -632,7 +632,10 @@ impl<'a, R: CharRead> Lexer<'a, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(ParserError::InvalidSingleQuotedCharacter(c));
|
return Err(ParserError::InvalidSingleQuotedCharacter(
|
||||||
|
c,
|
||||||
|
self.location.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match self.get_back_quoted_string() {
|
match self.get_back_quoted_string() {
|
||||||
|
|||||||
Reference in New Issue
Block a user