diff options
author | David Robillard <d@drobilla.net> | 2010-12-09 01:57:52 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-09 01:57:52 +0000 |
commit | 39af9fe79809a67c837485d8edcae6b9246c5fa6 (patch) | |
tree | 159b854110774669e410116f89de10f85d3e2b2d /src/parse.cpp | |
parent | e759ca41e4ba831279b1495c6713d79ad10ab6f9 (diff) | |
download | resp-39af9fe79809a67c837485d8edcae6b9246c5fa6.tar.gz resp-39af9fe79809a67c837485d8edcae6b9246c5fa6.tar.bz2 resp-39af9fe79809a67c837485d8edcae6b9246c5fa6.zip |
Const-correct parser.
git-svn-id: http://svn.drobilla.net/resp/resp@323 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/parse.cpp')
-rw-r--r-- | src/parse.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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<ATuple, AST> list; + List<ATuple, const AST> 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<float>(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; |