process "\n" when finishing up lexer.

This commit is contained in:
Kelvin Sherlock 2016-02-03 15:08:10 -05:00
parent 0c96252d65
commit 09ed3428bc
2 changed files with 5 additions and 5 deletions

View File

@ -60,8 +60,8 @@ void init(Environment &env) {
int read_file(phase1 &p, const std::string &file) {
const mapped_file mf(file, mapped_file::readonly);
p.process(mf.begin(), mf.end(), true);
p.process(mf.begin(), mf.end(), false);
p.finish();
return 0;
}
@ -227,7 +227,7 @@ int main(int argc, char **argv) {
if (cflag) {
std::string s(cflag);
s.push_back('\n');
p1.process(s.data(), s.data() + s.length(), true);
p1.process(s, true);
p2.finish();
exit(e.status());
}

View File

@ -18,9 +18,9 @@ public:
process((const unsigned char *)begin, (const unsigned char *)end, final);
}
void process(const std::string &s) { process(s.data(), s.data() + s.size()); }
void process(const std::string &s, bool final = false) { process(s.data(), s.data() + s.size(), final); }
void finish() { const char *tmp = ""; process(tmp, tmp, true); }
void finish() { const char *tmp = "\n"; process(tmp, tmp+1, true); }
void reset();