bump simplecpp
This commit is contained in:
parent
be6e0cbf85
commit
51858ecc96
|
@ -19,21 +19,16 @@
|
||||||
#include "simplecpp.h"
|
#include "simplecpp.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <limits>
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <set>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <vector>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib> // strtoll, etc
|
#include <exception>
|
||||||
#include <sstream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <sstream>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <string>
|
#include <stdexcept>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
|
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
@ -533,6 +528,18 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
|
||||||
if (currentToken.size() < 2U)
|
if (currentToken.size() < 2U)
|
||||||
// TODO report
|
// TODO report
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
std::string s = currentToken;
|
||||||
|
std::string::size_type pos;
|
||||||
|
while ((pos = s.find_first_of("\r\n")) != std::string::npos) {
|
||||||
|
s.erase(pos,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
push_back(new Token(s, location)); // push string without newlines
|
||||||
|
|
||||||
|
location.adjust(currentToken);
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -900,12 +907,25 @@ std::string simplecpp::TokenList::readUntil(std::istream &istr, const Location &
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret += start;
|
ret += start;
|
||||||
|
|
||||||
|
bool backslash = false;
|
||||||
char ch = 0;
|
char ch = 0;
|
||||||
while (ch != end && ch != '\r' && ch != '\n' && istr.good()) {
|
while (ch != end && ch != '\r' && ch != '\n' && istr.good()) {
|
||||||
ch = (unsigned char)istr.get();
|
ch = (unsigned char)istr.get();
|
||||||
|
if (backslash && ch == '\n') {
|
||||||
|
ch = 0;
|
||||||
|
backslash = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
backslash = false;
|
||||||
ret += ch;
|
ret += ch;
|
||||||
if (ch == '\\')
|
if (ch == '\\') {
|
||||||
ret += (unsigned char)istr.get();
|
const char next = (unsigned char)istr.get();
|
||||||
|
if (next == '\r' || next == '\n') {
|
||||||
|
ret.erase(ret.size()-1U);
|
||||||
|
backslash = (next == '\r');
|
||||||
|
}
|
||||||
|
ret += next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!istr.good() || ch != end) {
|
if (!istr.good() || ch != end) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define simplecppH
|
#define simplecppH
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstddef>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -27,7 +28,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# ifdef SIMPLECPP_EXPORT
|
# ifdef SIMPLECPP_EXPORT
|
||||||
# define SIMPLECPP_LIB __declspec(dllexport)
|
# define SIMPLECPP_LIB __declspec(dllexport)
|
||||||
|
|
Loading…
Reference in New Issue