mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2024-12-28 09:29:57 +00:00
process "\n" when finishing up lexer.
This commit is contained in:
parent
0c96252d65
commit
09ed3428bc
@ -60,8 +60,8 @@ void init(Environment &env) {
|
|||||||
int read_file(phase1 &p, const std::string &file) {
|
int read_file(phase1 &p, const std::string &file) {
|
||||||
const mapped_file mf(file, mapped_file::readonly);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ int main(int argc, char **argv) {
|
|||||||
if (cflag) {
|
if (cflag) {
|
||||||
std::string s(cflag);
|
std::string s(cflag);
|
||||||
s.push_back('\n');
|
s.push_back('\n');
|
||||||
p1.process(s.data(), s.data() + s.length(), true);
|
p1.process(s, true);
|
||||||
p2.finish();
|
p2.finish();
|
||||||
exit(e.status());
|
exit(e.status());
|
||||||
}
|
}
|
||||||
|
4
phase1.h
4
phase1.h
@ -18,9 +18,9 @@ public:
|
|||||||
process((const unsigned char *)begin, (const unsigned char *)end, final);
|
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();
|
void reset();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user