Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (31 sloc) 1.03 KB
import dmd.module_;
//import dmd.dsymbol;
import dmd.identifier, dmd.token, dmd.lexer, dmd.utils;
import std.stdio, std.file, std.array;
int main( string[] args)
char[] buf = readText!(char[])("main.d"); // Read this file into the buffer
// By the way, comments aren't implemented yet!
auto lex = new Lexer("Making it happen!", buf, /+lexingStyle=1+/ 1);
Token oneToken;
Appender!(Token[]) tokAppender;
// For measurements
writeln("struct Token size: ", Token.sizeof);
writeln("Lexing the file. Let's see what happens...");
foreach(i; 1..50)
oneToken = lex.scan();
// Try to get out before it's too late (btw, it's too late!)
if (oneToken.value == TOKeof)
writeln("done reading..., Press enter to write");
stdin.readln(); // Get a keypress
auto tokens =;
foreach(i, token; tokens)
writeln("Tok#", i, " ", token.toChars());
return 0;
Something went wrong with that request. Please try again.