195 changes: 0 additions & 195 deletions src/parse.h

This file was deleted.

1 change: 0 additions & 1 deletion src/s2ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <time.h>

#include "mars.h"
#include "lexer.h"
#include "statement.h"
#include "expression.h"
#include "mtype.h"
Expand Down
36 changes: 17 additions & 19 deletions src/tokens.d
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ enum TOKwild = TOKinout;

/***********************************************************
*/
struct Token
extern (C++) struct Token
{
Token* next;
Loc loc;
Expand All @@ -574,15 +574,15 @@ struct Token
Identifier ident;
}

extern (C++) static __gshared const(char)*[TOKMAX] tochars;
static __gshared const(char)*[TOKMAX] tochars;

extern (C++) static void initTokens()
static void initTokens()
{
for (nkeywords = 0; keywords[nkeywords].name; nkeywords++)
foreach (kw; keywords)
{
//printf("keyword[%d] = '%s'\n",u, keywords[u].name);
const(char)* s = keywords[nkeywords].name;
TOK v = keywords[nkeywords].value;
const(char)* s = kw.name;
TOK v = kw.value;
Identifier id = Identifier.idPool(s);
id.value = v;
//printf("tochars[%d] = '%s'\n",v, s);
Expand Down Expand Up @@ -695,9 +695,9 @@ struct Token
Token.tochars[TOKon_scope_failure] = "scope(failure)";
}

extern (C++) static __gshared Token* freelist = null;
static __gshared Token* freelist = null;

extern (C++) static Token* alloc()
static Token* alloc()
{
if (Token.freelist)
{
Expand All @@ -709,33 +709,33 @@ struct Token
return new Token();
}

extern (C++) void free()
void free()
{
next = freelist;
freelist = &this;
}

extern (C++) int isKeyword()
int isKeyword()
{
foreach (size_t u; 0 .. nkeywords)
foreach (kw; keywords)
{
if (keywords[u].value == value)
if (kw.value == value)
return 1;
}
return 0;
}

debug
{
extern (C++) void print()
void print()
{
fprintf(stderr, "%s\n", toChars());
}
}

extern (C++) const(char)* toChars()
{
static __gshared char[3 + 3 * float80value.sizeof + 1] buffer;
__gshared char[3 + 3 * float80value.sizeof + 1] buffer;
const(char)* p = &buffer[0];
switch (value)
{
Expand Down Expand Up @@ -869,7 +869,7 @@ struct Token
return p;
}

extern (C++) static const(char)* toChars(TOK value)
static const(char)* toChars(TOK value)
{
static __gshared char[3 + 3 * value.sizeof + 1] buffer;
const(char)* p = tochars[value];
Expand All @@ -886,12 +886,11 @@ struct Token
*/
struct Keyword
{
const(char)* name;
immutable(char)* name;
TOK value;
}

extern (C++) __gshared size_t nkeywords;
extern (C++) __gshared Keyword* keywords =
immutable Keyword[] keywords =
[
Keyword("this", TOKthis),
Keyword("super", TOKsuper),
Expand Down Expand Up @@ -1006,5 +1005,4 @@ extern (C++) __gshared Keyword* keywords =
Keyword("__PRETTY_FUNCTION__", TOKprettyfunc),
Keyword("shared", TOKshared),
Keyword("immutable", TOKimmutable),
Keyword(null, TOKreserved)
];