//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringExtras.h"
+#include <cstring>
using namespace llvm;
/// getToken - This function extracts one token from source, ignoring any
/// The Source source string is updated in place to remove the returned string
/// and any delimiter prefix from it.
std::string llvm::getToken(std::string &Source, const char *Delimiters) {
- unsigned NumDelimiters = std::strlen(Delimiters);
+ size_t NumDelimiters = std::strlen(Delimiters);
// Figure out where the token starts.
std::string::size_type Start =
case 'r': Str[i] = '\r'; break;
case 't': Str[i] = '\t'; break;
case 'v': Str[i] = '\v'; break;
+ case '"': Str[i] = '\"'; break;
case '\'': Str[i] = '\''; break;
case '\\': Str[i] = '\\'; break;
}
} else if (Str[i] == '\t') {
Str[i++] = '\\';
Str.insert(Str.begin()+i, 't');
+ } else if (Str[i] == '"') {
+ Str.insert(Str.begin()+i++, '\\');
} else if (Str[i] == '\n') {
Str[i++] = '\\';
Str.insert(Str.begin()+i, 'n');