Mercurial > projects > dang
comparison sema/AstAction.d @ 94:48bb2287c035 new_gen
Added Modules. Right now it's very simple - will grow with time and need.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 06 May 2008 16:24:14 +0200 |
parents | eb5b2c719a39 |
children | 857f0d530789 |
comparison
equal
deleted
inserted
replaced
93:621cedba53ea | 94:48bb2287c035 |
---|---|
5 import lexer.Token; | 5 import lexer.Token; |
6 | 6 |
7 import misc.Error, | 7 import misc.Error, |
8 basic.SourceManager; | 8 basic.SourceManager; |
9 | 9 |
10 import ast.Exp, | 10 import ast.Module, |
11 ast.Exp, | |
11 ast.Stmt, | 12 ast.Stmt, |
12 ast.Decl; | 13 ast.Decl; |
13 | 14 |
14 public | 15 public |
15 import parser.Action; | 16 import parser.Action; |
39 private Identifier identifierFromTok(Token t) | 40 private Identifier identifierFromTok(Token t) |
40 { | 41 { |
41 return new Identifier(t.location, sm.getText(t.asRange)); | 42 return new Identifier(t.location, sm.getText(t.asRange)); |
42 } | 43 } |
43 | 44 |
45 override ModuleT actOnModule(char[] name) | |
46 { | |
47 return new Module(name); | |
48 } | |
49 | |
50 override void actOnModuleDecl(ModuleT m, DeclT d) | |
51 { | |
52 (cast(Module)m).addDecl(cast(Decl)d); | |
53 } | |
44 | 54 |
45 // -- Declarations -- | 55 // -- Declarations -- |
46 override DeclT actOnDeclarator(ref Id type, ref Id id, ExprT init) | 56 override DeclT actOnDeclarator(ref Id type, ref Id id, ExprT init) |
47 { | 57 { |
48 Exp exp = cast(Exp)init; | 58 Exp exp = cast(Exp)init; |