comparison trunk/src/dil/Token.d @ 391:33b566df6af4

Migrated project to Tango. Decremented the numbers of the format placeholders in the localized messages by one. Replaced all instances of writef/ln with Stdout. Added module common.d with string aliases and a global Layout!(char) instance. Replaced %s format specifiers with index placeholders in html/xml_tags. Changed member Information.arguments to string message. Copied std.metastring, std.uni and std.utf from Phobos.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 15 Sep 2007 17:12:26 +0200
parents 4d36eea1bbc9
children 4d9ee8e60712
comparison
equal deleted inserted replaced
390:4d36eea1bbc9 391:33b566df6af4
1 /++ 1 /++
2 Author: Aziz Köksal 2 Author: Aziz Köksal
3 License: GPL3 3 License: GPL3
4 +/ 4 +/
5 module dil.Token; 5 module dil.Token;
6 import std.c.stdlib : malloc, free; 6 import common;
7 import std.outofmemory; 7 import tango.stdc.stdlib : malloc, free;
8 import tango.core.Exception;
8 9
9 struct Position 10 struct Position
10 { 11 {
11 size_t loc; 12 size_t loc;
12 size_t col; 13 size_t col;
219 220
220 new(size_t size) 221 new(size_t size)
221 { 222 {
222 void* p = malloc(size); 223 void* p = malloc(size);
223 if (p is null) 224 if (p is null)
224 version(Tango) 225 throw new OutOfMemoryException(__FILE__, __LINE__);
225 throw new OutOfMemoryException(__FILE__, __LINE__);
226 else
227 throw new OutOfMemoryException();
228 *cast(Token*)p = Token.init; 226 *cast(Token*)p = Token.init;
229 return p; 227 return p;
230 } 228 }
231 229
232 delete(void* p) 230 delete(void* p)