Mercurial > projects > dil
changeset 835:451ede0105e0
Applied minor fixes and tidied some code up a bit.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 12 Aug 2008 02:59:11 +0200 |
parents | 8bcf482b2062 |
children | e7cb5e38d567 |
files | src/TypeRules.d src/TypeRulesGenerator.d src/cmd/DDoc.d src/cmd/Highlight.d src/dil/ast/Expressions.d src/dil/ast/Parameters.d src/dil/ast/Types.d src/dil/lexer/Lexer.d src/dil/semantic/Interpreter.d src/dil/semantic/Pass1.d |
diffstat | 10 files changed, 47 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/src/TypeRules.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/TypeRules.d Tue Aug 12 02:59:11 2008 +0200 @@ -1,14 +1,20 @@ +#! /usr/bin/rdmd /++ Author: Aziz Köksal License: GPL3 +/ module TypeRules; +import TypeRulesData; +import cmd.Highlight : xml_escape; -import cmd.Generate : xml_escape; -import TypeRulesData; import common; +void main(char[][] args) +{ + genHTMLTypeRulesTables(); +} + static const string[] basicTypes = [ "char"[], "wchar", "dchar", "bool", "byte", "ubyte", "short", "ushort", @@ -76,7 +82,8 @@ ` </style>`\n `</head>`\n `<body>`\n - `<p>These tables show what the type results of certain expressions are.</p>`\n + `<p>The following tables show the type results of different expressions. Compiler used: ` ~ + compilerNameVersion ~ `.` ); Stdout.format("<table>\n<tr><th colspan=\"{}\">Unary Expressions</th></tr>\n", unaryExpressions.length);
--- a/src/TypeRulesGenerator.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/TypeRulesGenerator.d Tue Aug 12 02:59:11 2008 +0200 @@ -12,8 +12,9 @@ void main(char[][] args) { - char[] text = "// Generated by TypeRulesGenerator.d\n" - "module TypeRules.d;\n\n"; + char[] text = "/// Generated by TypeRulesGenerator.d\n" + "module TypeRulesData;\n\n"; + text ~= Format(`const char[] compilerNameVersion = "{} {}.{,:d3}";`\n, __VENDOR__, __VERSION__/1000, __VERSION__%1000); text ~= "char[][][] unaryExpsResults = [\n"; foreach (results; unaryExpsResults) {
--- a/src/cmd/DDoc.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/cmd/DDoc.d Tue Aug 12 02:59:11 2008 +0200 @@ -4,24 +4,24 @@ +/ module cmd.DDoc; -import cmd.DDocXML; -import cmd.Highlight; -import dil.doc.Parser; -import dil.doc.Macro; -import dil.doc.Doc; -import dil.ast.Node; -import dil.ast.Declarations, +import cmd.DDocXML, + cmd.Highlight; +import dil.doc.Parser, + dil.doc.Macro, + dil.doc.Doc; +import dil.ast.Node, + dil.ast.Declarations, dil.ast.Statements, dil.ast.Expression, dil.ast.Parameters, - dil.ast.Types; -import dil.ast.DefaultVisitor; -import dil.lexer.Token; -import dil.lexer.Funcs; -import dil.semantic.Module; -import dil.semantic.Pass1; -import dil.semantic.Symbol; -import dil.semantic.Symbols; + dil.ast.Types, + dil.ast.DefaultVisitor; +import dil.lexer.Token, + dil.lexer.Funcs; +import dil.semantic.Module, + dil.semantic.Pass1, + dil.semantic.Symbol, + dil.semantic.Symbols; import dil.Compilation; import dil.Information; import dil.Converter; @@ -203,7 +203,7 @@ { // Save the previous comment of the parent scope. saved_prevCmnt = this.outer.prevCmnt; saved_cmntIsDitto = this.outer.cmntIsDitto; - saved_prevDeclOffset = this.outer.prevDeclOffset; + saved_prevDeclOffset = this.outer.prevDeclOffset; // Entering a new scope. Clear variables. this.outer.prevCmnt = null; this.outer.cmntIsDitto = false;
--- a/src/cmd/Highlight.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/cmd/Highlight.d Tue Aug 12 02:59:11 2008 +0200 @@ -4,8 +4,8 @@ +/ module cmd.Highlight; -import dil.ast.DefaultVisitor; -import dil.ast.Node, +import dil.ast.DefaultVisitor, + dil.ast.Node, dil.ast.Declaration, dil.ast.Statement, dil.ast.Expression, @@ -410,9 +410,10 @@ print("$(D_CODE\n"); if (lx.errors.length) { // Output error messages. - print(tags["CompBegin"]); + // FIXME: CompBegin and CompEnd break the table layout. +// print(tags["CompBegin"]); printErrors(lx, tags, print); - print(tags["CompEnd"]); +// print(tags["CompEnd"]); } // Traverse linked list and print tokens. for (auto token = lx.firstToken(); token; token = token.next) {
--- a/src/dil/ast/Expressions.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/dil/ast/Expressions.d Tue Aug 12 02:59:11 2008 +0200 @@ -663,7 +663,7 @@ class BoolExpression : Expression { IntExpression value; /// IntExpression of type bool. - + this() { mixin(set_kind);
--- a/src/dil/ast/Parameters.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/dil/ast/Parameters.d Tue Aug 12 02:59:11 2008 +0200 @@ -53,7 +53,7 @@ { return !!(stc & StorageClass.Variadic); } - + /// Returns true if this parameter is lazy. bool isLazy() { @@ -78,7 +78,7 @@ return items[$-1].isVariadic(); return false; } - + bool hasLazy() { foreach(param; items)
--- a/src/dil/ast/Types.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/dil/ast/Types.d Tue Aug 12 02:59:11 2008 +0200 @@ -77,6 +77,7 @@ class TypeofType : TypeNode { Expression e; + /// "typeof" "(" Expression ")" this(Expression e) { this(); @@ -84,12 +85,13 @@ this.e = e; } - // For D2.0: "typeof" "(" "return" ")" + /// For D2.0: "typeof" "(" "return" ")" this() { mixin(set_kind); } + /// Returns true if this is a "typeof(return)". bool isTypeofReturn() { return e is null;
--- a/src/dil/lexer/Lexer.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/dil/lexer/Lexer.d Tue Aug 12 02:59:11 2008 +0200 @@ -2053,7 +2053,7 @@ ulong_ += *p - '0'; } else if (*p == '_') - continue; + continue; else break; }
--- a/src/dil/semantic/Interpreter.d Mon Aug 11 19:14:28 2008 +0200 +++ b/src/dil/semantic/Interpreter.d Tue Aug 12 02:59:11 2008 +0200 @@ -43,7 +43,7 @@ { return (new Interpreter(/+scop,+/ infoMan)).eval(e); } - + /// Executes the function at compile-time with the given arguments. /// Returns: NAR or a value. static Expression interpret(FunctionDeclaration fd, Expression[] args, InfoManager infoMan/+, Scope scop+/) @@ -63,7 +63,7 @@ { return e; } - + /// Start evaluation of a function. Expression eval(FunctionDeclaration fd, Expression[] args) { @@ -85,7 +85,7 @@ assert(false); return NAR; } - + alias Expression E; override @@ -260,7 +260,7 @@ switch(e.kind) { alias NodeKind NK; - + case NK.IntExpression: auto num = (cast(IntExpression)e).number; return num ? value == true : value == false;