aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp.hpp')
-rw-r--r--src/resp.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/resp.hpp b/src/resp.hpp
index 5da4214..6a40729 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -432,7 +432,7 @@ list_contains(const ATuple* head, const AST* child) {
/// Type Expression, e.g. "Int", "(Fn (Int Int) Float)"
struct AType : public ATuple {
enum Kind { VAR, NAME, PRIM, EXPR, DOTS };
- AType(ASymbol* s, Kind k) : ATuple(s, NULL, s->loc), kind(k), id(0) { tag(T_TYPE); }
+ AType(const ASymbol* s, Kind k) : ATuple(s, NULL, s->loc), kind(k), id(0) { tag(T_TYPE); }
AType(Cursor c, unsigned i) : ATuple(c), kind(VAR), id(i) { tag(T_TYPE); }
AType(Cursor c, Kind k=EXPR) : ATuple(c), kind(k), id(0) { tag(T_TYPE); }
AType(Cursor c, AST* ast, va_list args) : ATuple(c, ast, args), kind(EXPR), id(0) { tag(T_TYPE); }
@@ -567,8 +567,8 @@ AST::operator==(const AST& rhs) const
/// Parse Time Environment (really just a symbol table)
struct PEnv : private map<const string, ASymbol*> {
PEnv() : symID(0) {}
- typedef AST* (*PF)(PEnv&, const AST*, void*); ///< Parse Function
- typedef AST* (*MF)(PEnv&, const AST*); ///< Macro Function
+ typedef const AST* (*PF)(PEnv&, const AST*, void*); ///< Parse Function
+ typedef const AST* (*MF)(PEnv&, const AST*); ///< Macro Function
struct Handler { Handler(PF f, void* a=0) : func(f), arg(a) {} PF func; void* arg; };
map<const string, Handler> aHandlers; ///< Atom parse functions
map<const string, Handler> lHandlers; ///< List parse functions
@@ -600,7 +600,7 @@ struct PEnv : private map<const string, ASymbol*> {
return sym;
}
}
- AST* parse(const AST* exp);
+ const AST* parse(const AST* exp);
typedef std::set<std::string> Primitives;
Primitives primitives;
@@ -636,7 +636,7 @@ struct Subst : public list<Constraint> {
if (in->kind == AType::EXPR) {
TList out;
for (ATuple::const_iterator i = in->begin(); i != in->end(); ++i)
- out.push_back(const_cast<AType*>(apply((*i)->as_type())));
+ out.push_back(apply((*i)->as_type()));
out.head->loc = in->loc;
return out.head;
} else {
@@ -644,7 +644,7 @@ struct Subst : public list<Constraint> {
if (i != end()) {
const AType* out = i->second->as_type();
if (out->kind == AType::EXPR && !out->concrete())
- out = const_cast<AType*>(apply(out->as_type()));
+ out = apply(out->as_type());
return out;
} else {
return new AType(*in);
@@ -879,7 +879,7 @@ private:
* EVAL/REPL/MAIN *
***************************************************************************/
-typedef list<AST*> Code;
+typedef list<const AST*> Code;
void pprint(std::ostream& out, const AST* ast, CEnv* cenv, bool types);
void initLang(PEnv& penv, TEnv& tenv);