mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer: Removed one indirect lookup from ::dequote
This commit is contained in:
parent
cfebb21260
commit
e8f4d6904b
1 changed files with 3 additions and 1 deletions
|
@ -313,13 +313,15 @@ bool Lexer::isPunctuation (int c)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Assumes that quotes is a string containing a non-trivial set of quote
|
||||||
|
// characters.
|
||||||
void Lexer::dequote (std::string& input, const std::string& quotes)
|
void Lexer::dequote (std::string& input, const std::string& quotes)
|
||||||
{
|
{
|
||||||
int quote = input[0];
|
int quote = input[0];
|
||||||
if (quotes.find (quote) != std::string::npos)
|
if (quotes.find (quote) != std::string::npos)
|
||||||
{
|
{
|
||||||
size_t len = input.length ();
|
size_t len = input.length ();
|
||||||
if (input[0] == input[len - 1])
|
if (quote == input[len - 1])
|
||||||
input = input.substr (1, len - 2);
|
input = input.substr (1, len - 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue