aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/lexer3
-rw-r--r--build/lexer.cxx6
2 files changed, 7 insertions, 2 deletions
diff --git a/build/lexer b/build/lexer
index 987efab..34b6fcc 100644
--- a/build/lexer
+++ b/build/lexer
@@ -21,6 +21,9 @@ namespace build
class lexer
{
public:
+ // If name is empty, then no diagnostics is issued, just lexer_error
+ // is thrown (use for testing).
+ //
lexer (std::istream& is, const std::string& name)
: is_ (is), name_ (name) {}
diff --git a/build/lexer.cxx b/build/lexer.cxx
index 101227e..8566788 100644
--- a/build/lexer.cxx
+++ b/build/lexer.cxx
@@ -56,8 +56,10 @@ namespace build
if (!is_eos (c))
return c;
- cerr << name_ << ':' << c.line () << ':' << c.column () << ": error: " <<
- "unterminated escape sequence" << endl;
+ if (!name_.empty ())
+ cerr << name_ << ':' << c.line () << ':' << c.column () << ": error: " <<
+ "unterminated escape sequence" << endl;
+
throw lexer_error ();
}