From e8f4d6904b535c7f45997e060ed3b70ed21d323a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 11 Oct 2015 09:05:12 -0400 Subject: [PATCH] Lexer: Removed one indirect lookup from ::dequote --- src/Lexer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 59630987b..ddcb884ff 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -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) { int quote = input[0]; if (quotes.find (quote) != std::string::npos) { size_t len = input.length (); - if (input[0] == input[len - 1]) + if (quote == input[len - 1]) input = input.substr (1, len - 2); } }