changeset 777:9f61e8af55d5

Added module dil.Compilation. Added predefined ID 'startaddress'. Added keyword 'nothrow'.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Wed, 20 Feb 2008 01:24:19 +0100
parents 580d4ca9f1ff
children 78be32e3e157
files trunk/README trunk/src/cmd/DDoc.d trunk/src/dil/Compilation.d trunk/src/dil/ast/Declarations.d trunk/src/dil/lexer/Identifier.d trunk/src/dil/lexer/IdentsGenerator.d trunk/src/dil/lexer/Keywords.d trunk/src/dil/lexer/TokensEnum.d trunk/src/dil/semantic/Module.d trunk/src/dil/semantic/Pass1.d trunk/src/macros_dil.ddoc
diffstat 11 files changed, 73 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/README	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/README	Wed Feb 20 01:24:19 2008 +0100
@@ -11,7 +11,7 @@
 How To Compile dil
 ==================
 In order to compile dil you need to have:
- *) DMD 1.024 (http://www.digitalmars.com/d/1.0/changelog.html)
+ *) DMD 1.027 (http://www.digitalmars.com/d/1.0/changelog.html)
  *) Tango 0.99.4 (http://dsource.org/projects/tango/)
  *) DSSS 0.71 (http://dsource.org/projects/dsss/)
 
--- a/trunk/src/cmd/DDoc.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/cmd/DDoc.d	Wed Feb 20 01:24:19 2008 +0100
@@ -90,10 +90,10 @@
   mtable.insert("MODPATH", mod.getFQNPath() ~ mod.fileExtension());
 
   mtable.insert("TITLE", mod.getFQN());
-  mtable.insert("DOCFILENAME", mod.getFQN());
+  mtable.insert("DOCFILENAME", mod.getFQN() ~ ".html");
   auto timeStr = Time.toString();
   mtable.insert("DATETIME", timeStr);
-  mtable.insert("YEAR", timeStr[20..24]);
+  mtable.insert("YEAR", Time.year(timeStr));
 
   auto doc = new DDocEmitter(mtable, incUndoc, mod, tokenHL);
   doc.emit();
@@ -429,7 +429,7 @@
     auto basesBegin = bases[0].begin.prevNWS;
     if (basesBegin.kind == TOK.Colon)
       basesBegin = bases[0].begin;
-    text ~= " : " ~ escape(textSpan(basesBegin, bases[$-1].end));
+    write(" : ", escape(textSpan(basesBegin, bases[$-1].end)));
   }
 
   void write(char[][] strings...)
@@ -441,9 +441,7 @@
   void SYMBOL(char[] name, Declaration d)
   {
     auto loc = d.begin.getRealLocation();
-    auto str = Format("$(SYMBOL {}, {}, {}.{}, {})",
-                      name, modul.getFQN(), modul.getFQNPath(),
-                      modul.fileExtension(), loc.lineNum);
+    auto str = Format("$(SYMBOL {}, {})", name, loc.lineNum);
     write(str);
     // write("$(DDOC_PSYMBOL ", name, ")");
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/dil/Compilation.d	Wed Feb 20 01:24:19 2008 +0100
@@ -0,0 +1,19 @@
+/++
+  Author: Aziz Köksal
+  License: GPL3
++/
+module dil.Compilation;
+
+import common;
+
+/// A group of settings relevant to the compilation process.
+class CompilationContext
+{
+  string[] importPaths;
+  uint debugLevel;
+  uint versionLevel;
+  bool[string] debugIds;
+  bool[string] versionIds;
+  bool releaseBuild;
+  uint structAlign;
+}
--- a/trunk/src/dil/ast/Declarations.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/ast/Declarations.d	Wed Feb 20 01:24:19 2008 +0100
@@ -465,6 +465,19 @@
     this.decls = decls;
     this.elseDecls = elseDecls;
   }
+
+  bool isSpecification()
+  {
+    return decls is null;
+  }
+
+  bool isCondition()
+  {
+    return decls !is null;
+  }
+
+  /// The branch to be compiled in.
+  Declaration compiledDecls;
 }
 
 class DebugDeclaration : ConditionalCompilationDeclaration
--- a/trunk/src/dil/lexer/Identifier.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/lexer/Identifier.d	Wed Feb 20 01:24:19 2008 +0100
@@ -13,7 +13,7 @@
 ///<pre>
 ///  Identifier := IdStart IdChar*
 ///  IdStart := "_" | Letter
-///  IdChar := Letter | "0"-"9"
+///  IdChar := IdStart | "0"-"9"
 ///  Letter := UniAlpha
 ///</pre>
 ///  Unicode alphas are defined in Unicode 5.0.0.
--- a/trunk/src/dil/lexer/IdentsGenerator.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/lexer/IdentsGenerator.d	Wed Feb 20 01:24:19 2008 +0100
@@ -24,7 +24,7 @@
   // scope:
   {"exit"}, {"success"}, {"failure"},
   // pragma:
-  {"msg"}, {"lib"},
+  {"msg"}, {"lib"}, {"startaddress"},
   // Linkage:
   {"C"}, {"D"}, {"Windows"}, {"Pascal"}, {"System"},
   // Con-/Destructor:
--- a/trunk/src/dil/lexer/Keywords.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/lexer/Keywords.d	Wed Feb 20 01:24:19 2008 +0100
@@ -68,6 +68,7 @@
   {"mixin", TOK.Mixin},
   {"module", TOK.Module},
   {"new", TOK.New},
+  {"nothrow", TOK.Nothrow}, // D2.0
   {"null", TOK.Null},
   {"out", TOK.Out},
   {"override", TOK.Override},
--- a/trunk/src/dil/lexer/TokensEnum.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/lexer/TokensEnum.d	Wed Feb 20 01:24:19 2008 +0100
@@ -93,7 +93,7 @@
   Finally, For, Foreach, Foreach_reverse, Function, Goto,
   If, Import, In, Inout,
   Interface, Invariant, Is, Lazy, Macro/+D2.0+/,
-  Mixin, Module, New, Null, Out, Override, Package,
+  Mixin, Module, New, Nothrow/+D2.0+/, Null, Out, Override, Package,
   Pragma, Private, Protected, Public, Pure/+D2.0+/, Ref, Return,
   Scope, Static, Struct, Super, Switch, Synchronized,
   Template, This, Throw, Traits/+D2.0+/, True, Try, Typedef, Typeid,
@@ -197,7 +197,7 @@
   "finally","for","foreach","foreach_reverse","function","goto",
   "if","import","in","inout",
   "interface","invariant","is","lazy","macro",
-  "mixin","module","new","null","out","override","package",
+  "mixin","module","new","nothrow","null","out","override","package",
   "pragma","private","protected","public","pure","ref","return",
   "scope","static","struct","super","switch","synchronized",
   "template","this","throw","__traits","true","try","typedef","typeid",
--- a/trunk/src/dil/semantic/Module.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/semantic/Module.d	Wed Feb 20 01:24:19 2008 +0100
@@ -19,7 +19,7 @@
 
 alias FileConst.PathSeparatorChar dirSep;
 
-/// Represents a D module and source file.
+/// Represents a semantic D module and a source file.
 class Module : ScopeSymbol
 {
   SourceText sourceText; /// The source file of this module.
--- a/trunk/src/dil/semantic/Pass1.d	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/dil/semantic/Pass1.d	Wed Feb 20 01:24:19 2008 +0100
@@ -348,10 +348,19 @@
     return d;
   }
 
-  D visit(DebugDeclaration)
-  { return null; }
-  D visit(VersionDeclaration)
-  { return null; }
+  D visit(DebugDeclaration d)
+  {
+    if (d.isSpecification)
+    {
+
+    }
+    return null;
+  }
+
+  D visit(VersionDeclaration d)
+  {
+    return null;
+  }
 
   D visit(TemplateDeclaration d)
   {
--- a/trunk/src/macros_dil.ddoc	Tue Feb 19 19:30:04 2008 +0100
+++ b/trunk/src/macros_dil.ddoc	Wed Feb 20 01:24:19 2008 +0100
@@ -1,3 +1,18 @@
+DDOC = <html>
+<head>
+  <META http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>$(TITLE)</title>
+</head>
+<body>
+<h1><a href="$(SRCFILE)">$(TITLE)</a></h1>
+$(BODY)
+<hr>
+<p class="footer">$(COPYRIGHT) Page generated by $(LINK2 http://code.google.com/p/dil, dil) on $(DATETIME).</p>
+</body>
+</html>
+
+MODFQN = $(TITLE)
+SRCFILE = ./htmlsrc/$(MODFQN).html
 COPYRIGHT = Copyright © 2007-$(YEAR), Aziz Köksal. All rights reserved.
-SYMBOL_ = <a href="http://hg.sharesource.org/dil/file/tip/trunk/src/$3#L$4">$1</a>
-SYMBOL = <a href="./htmlsrc/$2.html#L$4">$1</a>
+SYMBOL_ = <a href="http://hg.sharesource.org/dil/file/tip/trunk/src/$(MODPATH)#L$2">$1</a>
+SYMBOL = <a href="$(SRCFILE)#L$2">$1</a>