diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-12 11:30:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-12 11:30:04 +0200 |
commit | 257ad3c2c5e633d2fd3f2228021ac3ae8d6d07cb (patch) | |
tree | ecfa5df6e8abca5bd483d5498bf84412ae58930e /build/lexer.cxx | |
parent | 0dcf07989b4b942f6ff872023b2886b7f698d711 (diff) |
Initial buildfile parser implementation
g++-4.9 -std=c++14 -g -I../../.. -o driver driver.cxx ../../../build/lexer.cxx ../../../build/parser.cxx && ./driver
Diffstat (limited to 'build/lexer.cxx')
-rw-r--r-- | build/lexer.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/build/lexer.cxx b/build/lexer.cxx index 8566788..9e3521a 100644 --- a/build/lexer.cxx +++ b/build/lexer.cxx @@ -56,10 +56,7 @@ namespace build if (!is_eos (c)) return c; - if (!name_.empty ()) - cerr << name_ << ':' << c.line () << ':' << c.column () << ": error: " << - "unterminated escape sequence" << endl; - + error (c) << "unterminated escape sequence" << endl; throw lexer_error (); } @@ -219,4 +216,11 @@ namespace build buf_ = c; unget_ = true; } + + ostream& lexer:: + error (const xchar& c) + { + return diag_ << name_ << ':' << c.line () << ':' << + c.column () << ": error: "; + } } |