Overview
SHA1 Hash: | 16abe219572ba217643f2e01bdb862714c548fea |
---|---|
Date: | 2010-11-24 12:50:04 |
User: | kinaba |
Comment: | added documentation comment to polemy.ast so that it also works for @macro users of Polemy. |
Timelines: | family | ancestors | descendants | both | trunk |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [f65680e1d2]
- sym-trunk inherited from [f65680e1d2]
Changes
Modified main.d from [f44d615cc4428107] to [97a442948c980634].
10 import std.algorithm; 10 import std.algorithm; 11 import std.array; 11 import std.array; 12 12 13 /// Advance args[] to point the argument list fed to the script. 13 /// Advance args[] to point the argument list fed to the script. 14 /// Returns the name of the source file to run, or returns "" if 14 /// Returns the name of the source file to run, or returns "" if 15 /// no filename was given. Also, returns to libs[] the list of 15 /// no filename was given. Also, returns to libs[] the list of 16 /// library source to load. 16 /// library source to load. > 17 /// TODO: use std.getopt 17 18 18 string parseArgv(ref string[] args, out string[] libs) 19 string parseArgv(ref string[] args, out string[] libs) 19 { 20 { 20 args.popFront(); 21 args.popFront(); 21 22 22 while( !args.empty && args.front=="-l" ) { 23 while( !args.empty && args.front=="-l" ) { 23 args.popFront(); 24 args.popFront();
Modified polemy/ast.d from [2e3f1e0044f7841f] to [55043f61f436485a].
8 import polemy._common; 8 import polemy._common; 9 import polemy.failure; 9 import polemy.failure; 10 import polemy.layer; 10 import polemy.layer; 11 11 12 /// 12 /// 13 abstract class AST 13 abstract class AST 14 { 14 { 15 LexPosition pos; | 15 LexPosition pos; /// 16 16 17 mixin SimpleConstructor; 17 mixin SimpleConstructor; 18 } 18 } 19 19 20 /// | 20 /// AST node for integer literal 21 class Int : AST 21 class Int : AST 22 { 22 { 23 BigInt data; | 23 BigInt data; /// 24 24 25 mixin SimpleClass; 25 mixin SimpleClass; 26 this(LexPosition pos, int n) {super(pos); data = n;} 26 this(LexPosition pos, int n) {super(pos); data = n;} 27 this(LexPosition pos, long n) {super(pos); data = n;} 27 this(LexPosition pos, long n) {super(pos); data = n;} 28 this(LexPosition pos, BigInt n) {super(pos); data = n;} 28 this(LexPosition pos, BigInt n) {super(pos); data = n;} 29 this(LexPosition pos, string n) {super(pos); data = BigInt(n);} 29 this(LexPosition pos, string n) {super(pos); data = BigInt(n);} 30 } 30 } 31 31 32 /// | 32 /// AST node for string literal 33 class Str : AST 33 class Str : AST 34 { 34 { 35 string data; | 35 string data; /// > 36 > 37 mixin SimpleClass; > 38 } > 39 > 40 /// AST node for variable reference > 41 class Var : AST > 42 { > 43 string name; /// 36 44 37 mixin SimpleClass; 45 mixin SimpleClass; 38 } 46 } 39 47 40 /// | 48 /// AST node for @layered(expression) 41 class Var : AST | 49 class Lay : AST 42 { 50 { 43 string name; | 51 Layer layer; /// > 52 AST expr; /// 44 53 45 mixin SimpleClass; 54 mixin SimpleClass; 46 } 55 } 47 56 48 /// | 57 /// AST node for variable declaration 49 class Lay : AST | 58 class Let : AST 50 { 59 { > 60 string name; /// 51 Layer layer; | 61 Layer layer; /// > 62 AST init; /// 52 AST expr; | 63 AST expr; /// 53 64 54 mixin SimpleClass; 65 mixin SimpleClass; 55 } 66 } 56 67 57 /// | 68 /// AST node for function application 58 class Let : AST < 59 { < 60 string name; < 61 Layer layer; < 62 AST init; < 63 AST expr; < 64 < 65 mixin SimpleClass; < 66 } < 67 < 68 /// < 69 class App : AST 69 class App : AST 70 { 70 { 71 AST fun; | 71 AST fun; /// 72 AST[] args; | 72 AST[] args; /// 73 73 74 mixin SimpleClass; 74 mixin SimpleClass; 75 this(LexPosition pos, AST fun, AST[] args...) { super(pos); this.fun=fun 75 this(LexPosition pos, AST fun, AST[] args...) { super(pos); this.fun=fun 76 } 76 } 77 77 78 /// 78 /// 79 class Parameter 79 class Parameter 80 { 80 { 81 string name; | 81 string name; /// 82 Layer[] layers; | 82 Layer[] layers; /// 83 83 84 mixin SimpleClass; 84 mixin SimpleClass; 85 } 85 } 86 86 87 /// | 87 /// AST node for function literal 88 class Fun : AST 88 class Fun : AST 89 { 89 { 90 Parameter[] params; | 90 Parameter[] params; /// 91 AST funbody; | 91 AST funbody; /// 92 92 93 mixin SimpleClass; 93 mixin SimpleClass; 94 } 94 } 95 95 96 /// List of AST Types 96 /// List of AST Types 97 97 98 alias TypeTuple!(Int,Str,Var,Lay,Let,App,Fun) ListOfASTTypes; 98 alias TypeTuple!(Int,Str,Var,Lay,Let,App,Fun) ListOfASTTypes;