Compiler/lexical analyzer: Difference between revisions

m
m (ol example fixed)
m (→‎{{header|C++}}: fix warning)
Line 1,648:
 
using namespace std;
 
 
// =====================================================================================================================
Line 1,669 ⟶ 1,668:
return contents;
}
 
 
void string_to_file (const string& path, string contents)
Line 1,678 ⟶ 1,676:
file.write(contents.data(), contents.size());
}
 
 
template <class F>
Line 1,693 ⟶ 1,690:
else string_to_file(destination, output);
}
 
 
// Add escaped newlines and backslashes back in for printing
string sanitize (string s)
{
for (intauto i = 00u; i < s.size(); ++i)
{
if (s[i] == '\n') s.replace(i++, 1, "\\n");
Line 1,706 ⟶ 1,702:
return s;
}
 
 
class Scanner
Anonymous user