view sema/LiteralInterpreter.d @ 192:fda35d57847e

Fixed String parsing, so that they get created with the right type in AST. Also added so that you can parse options to the test program, that will mirror them to Dang. Eg. ./tests/run --semantic-only will pass --semantic-only to Dang on each run.
author Anders Johnsen <skabet@gmail.com>
date Fri, 25 Jul 2008 15:00:54 +0200
parents 6cb2f4201e2a
children
line wrap: on
line source

module sema.LiteralInterpreter;

import sema.Visitor;

import basic.LiteralParsing,
       basic.Message;

class LiteralInterpreter : Visitor!(void)
{
    this(MessageHandler messages)
    {
        this.messages = messages;
    }

    void visit(Module[] modules)
    {
        super.visit(modules);
        messages.checkErrors();
    }
    
    void visitStringExp(StringExp exp)
    {
        auto str = parseString(exp.str, exp.loc, messages);
        exp.data = str;
    }

    void visitIntegerLit(IntegerLit exp)
    {
        exp.number = parseNumber(exp.name, exp.loc, messages);
    }

    MessageHandler messages;
}