From 39af9fe79809a67c837485d8edcae6b9246c5fa6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 9 Dec 2010 01:57:52 +0000 Subject: Const-correct parser. git-svn-id: http://svn.drobilla.net/resp/resp@323 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/parse.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/parse.cpp') diff --git a/src/parse.cpp b/src/parse.cpp index 420a8ea..43fb681 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -49,7 +49,7 @@ eat_char(Cursor& cur, istream& in, const char character) THROW_IF(c != character, cur, (format("expected `%1%'") % character).str()); } -static AST* +static const AST* read_string(Cursor& cur, istream& in) { Cursor loc = cur; @@ -83,10 +83,10 @@ read_line_comment(Cursor& cur, istream& in) while (read_char(cur, in) != '\n') {} } -static AST* +static const AST* read_list(PEnv& penv, Cursor& cur, istream& in) { - List list; + List list; eat_char(cur, in, '('); while (true) { @@ -101,7 +101,7 @@ read_list(PEnv& penv, Cursor& cur, istream& in) assert(false); } -static AST* +static const AST* read_special(Cursor& cur, istream& in) { eat_char(cur, in, '#'); @@ -120,7 +120,7 @@ read_special(Cursor& cur, istream& in) assert(false); } -static AST* +static const AST* read_number(Cursor& cur, istream& in) { Cursor loc = cur; @@ -139,7 +139,7 @@ read_number(Cursor& cur, istream& in) return new ALiteral(T_FLOAT, strtod(str.c_str(), NULL), loc); } -static AST* +static const AST* read_symbol(PEnv& penv, Cursor& cur, istream& in) { string str; @@ -155,7 +155,7 @@ read_symbol(PEnv& penv, Cursor& cur, istream& in) } /// Read an expression from @a in -AST* +const AST* read_expression(PEnv& penv, Cursor& cur, istream& in) { while (!cin.eof()) { @@ -175,7 +175,7 @@ read_expression(PEnv& penv, Cursor& cur, istream& in) throw Error(cur, "unexpected `)'"); case '#': { - AST* ret = read_special(cur, in); + const AST* ret = read_special(cur, in); if (ret) return ret; break; -- cgit v1.2.1