dirty fix windows \r\n change line

This commit is contained in:
Dun Liang 2021-04-09 14:40:23 +08:00
parent e37dd420d9
commit dff7835847
1 changed files with 3 additions and 0 deletions

View File

@ -261,6 +261,9 @@ void expand_macro(const string& macro, const vector<string>& args, string& new_s
string precompile(unordered_map<string,string> defs, string src, unordered_map<string, string>& macros) { string precompile(unordered_map<string,string> defs, string src, unordered_map<string, string>& macros) {
string new_src; string new_src;
new_src.reserve(src.size()); new_src.reserve(src.size());
// dirty fix windows \r\n change line
for (auto& c : src)
if (c == '\r') c = '\n';
for (size_t i=0; i<src.size(); i++) { for (size_t i=0; i<src.size(); i++) {
try{ try{
if (src[i] == '/' && (i+1<src.size() && src[i+1] == '/')) { if (src[i] == '/' && (i+1<src.size() && src[i+1] == '/')) {