Showing with 37 additions and 320 deletions.
  1. +18 −18 src/lexer.d
  2. +0 −85 src/lexer.h
  3. +2 −2 src/parse.d
  4. +0 −195 src/parse.h
  5. +0 −1 src/s2ir.c
  6. +17 −19 src/tokens.d
36 changes: 18 additions & 18 deletions src/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.time;

import ddmd.entity;
import ddmd.errors;
import ddmd.globals;
Expand All @@ -33,29 +34,29 @@ enum PS = 0x2029; // UTF paragraph separator
/********************************************
* Do our own char maps
*/
extern (C++) __gshared ubyte[256] cmtable;
extern (C++) __gshared const(int) CMoctal = 0x1;
extern (C++) __gshared const(int) CMhex = 0x2;
extern (C++) __gshared const(int) CMidchar = 0x4;
immutable ubyte[256] cmtable;
enum CMoctal = 0x1;
enum CMhex = 0x2;
enum CMidchar = 0x4;

extern (C++) bool isoctal(char c)
bool isoctal(char c)
{
return (cmtable[c] & CMoctal) != 0;
}

extern (C++) bool ishex(char c)
bool ishex(char c)
{
return (cmtable[c] & CMhex) != 0;
}

extern (C++) bool isidchar(char c)
bool isidchar(char c)
{
return (cmtable[c] & CMidchar) != 0;
}

extern (C++) static void cmtable_init()
static this()
{
for (uint c = 0; c < 256; c++)
foreach (const c; 0 .. cmtable.length)
{
if ('0' <= c && c <= '7')
cmtable[c] |= CMoctal;
Expand All @@ -68,7 +69,7 @@ extern (C++) static void cmtable_init()

version (unittest)
{
extern (C++) void unittest_lexer()
void unittest_lexer()
{
//printf("unittest_lexer()\n");
/* Not much here, just trying things out.
Expand All @@ -88,10 +89,10 @@ version (unittest)

/***********************************************************
*/
extern (C++) class Lexer
class Lexer
{
public:
extern (C++) static __gshared OutBuffer stringbuffer;
__gshared OutBuffer stringbuffer;

Loc scanloc; // for error messages

Expand Down Expand Up @@ -157,7 +158,6 @@ public:

final static void initLexer()
{
cmtable_init();
Identifier.initTable();
Token.initTokens();
version (unittest)
Expand Down Expand Up @@ -360,10 +360,10 @@ public:
anyToken = 1;
if (*t.ptr == '_') // if special identifier token
{
static __gshared bool initdone = false;
static __gshared char[11 + 1] date;
static __gshared char[8 + 1] time;
static __gshared char[24 + 1] timestamp;
__gshared bool initdone = false;
__gshared char[11 + 1] date;
__gshared char[8 + 1] time;
__gshared char[24 + 1] timestamp;
if (!initdone) // lazy evaluation
{
initdone = true;
Expand Down Expand Up @@ -1441,7 +1441,7 @@ public:
if (startline && isalpha(c) && hereid)
{
Token tok;
const(char)* psave = p;
auto psave = p;
p--;
scan(&tok); // read in possible heredoc identifier
//printf("endid = '%s'\n", tok.ident->toChars());
Expand Down
85 changes: 0 additions & 85 deletions src/lexer.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum CARRAYDECL = 1;
/**********************************
* Set operator precedence for each operator.
*/
extern (C++) __gshared PREC[TOKMAX] precedence =
__gshared PREC[TOKMAX] precedence =
[
TOKtype : PREC_expr,
TOKerror : PREC_expr,
Expand Down Expand Up @@ -220,7 +220,7 @@ struct PrefixAttributes

/***********************************************************
*/
extern (C++) final class Parser : Lexer
final class Parser : Lexer
{
public:
Module mod;
Expand Down
Loading