aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/parse.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/parse.cpp b/src/parse.cpp
index 63765c4..420a8ea 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -28,12 +28,11 @@ using namespace std;
static inline int
read_char(Cursor& cur, istream& in)
{
- int ch = in.get();
- switch (ch) {
+ switch (in.peek()) {
case '\n': ++cur.line; cur.col = 0; break;
default: ++cur.col;
}
- return ch;
+ return in.get();
}
static inline void
@@ -47,8 +46,7 @@ static inline void
eat_char(Cursor& cur, istream& in, const char character)
{
const char c = read_char(cur, in);
- assert(c == character);
- return;
+ THROW_IF(c != character, cur, (format("expected `%1%'") % character).str());
}
static AST*
@@ -79,12 +77,10 @@ read_string(Cursor& cur, istream& in)
return new AString(loc, str);
}
-static AST*
+static void
read_line_comment(Cursor& cur, istream& in)
{
- char c;
- while ((c = read_char(cur, in)) != '\n') {}
- return NULL;
+ while (read_char(cur, in) != '\n') {}
}
static AST*
@@ -146,7 +142,6 @@ read_number(Cursor& cur, istream& in)
static AST*
read_symbol(PEnv& penv, Cursor& cur, istream& in)
{
- Cursor loc = cur;
string str;
char c;
while ((c = in.peek()) != EOF) {