@@ -23,11 +23,13 @@ import dmd.dmodule;
23
23
import dmd.dstruct;
24
24
import dmd.dsymbol;
25
25
import dmd.dtemplate;
26
+ import dmd.escape;
26
27
import dmd.expression;
27
28
import dmd.func;
28
29
import dmd.globals;
29
30
import dmd.id;
30
31
import dmd.identifier;
32
+ import dmd.location;
31
33
import dmd.mtype;
32
34
import dmd.objc;
33
35
import dmd.rootobject;
@@ -42,6 +44,8 @@ import core.stdc.string;
42
44
// //////////////////////////////////////////////////////////////
43
45
alias countersType = uint [uint ]; // actually uint[Key]
44
46
alias EscapeInfer = RootObject[int ];
47
+ enum uint_1 : uint { initValue = 1 }
48
+
45
49
46
50
enum string [2 ][] dmdStatics =
47
51
[
@@ -108,6 +112,7 @@ enum string[2][] dmdStatics =
108
112
[" _D3dmd7arrayop7arrayOpFCQw10expression6BinExpPSQBt6dscope5ScopeZQByCQCo9dtemplate19TemplateDeclaration" , " TemplateDeclaration" ],
109
113
[" _D3dmd6errors18colorHighlightCodeFNbKSQBk6common9outbuffer9OutBufferZ6nestedi" , " int" ],
110
114
[" _D3dmd7dmodule6Module18loadCoreStdcConfigFZ16core_stdc_configCQCiQChQCc" , " Module" ],
115
+ // EscapeState.reset not accessible in package dmd
111
116
[" _D3dmd6escape11EscapeState17scopeInferFailureHiCQBu10rootobject10RootObject" , " EscapeInfer" ],
112
117
];
113
118
@@ -135,7 +140,7 @@ string genInitDmdStatics()
135
140
{
136
141
string s;
137
142
foreach (decl; dmdStatics)
138
- s ~= cmangled(decl[0 ]) ~ " = " ~ decl[1 ] ~ " .init;\n " ;
143
+ s ~= cmangled(decl[0 ]) ~ " = ( " ~ decl[1 ] ~ " ) .init;\n " ;
139
144
return s;
140
145
}
141
146
@@ -197,6 +202,7 @@ void dmdInit()
197
202
// Token._init();
198
203
Id.initialize();
199
204
Expression._init();
205
+ location_init();
200
206
201
207
target._init(global.params); // needed by Type._init
202
208
Type._init();
@@ -394,6 +400,63 @@ void dmdSetupParams(const ref Options opts)
394
400
global.filePath.setDim(0 );
395
401
foreach (i; opts.stringImportDirs)
396
402
global.filePath.push(toStringz(i));
403
+
404
+ dmdSetupCompileEnv();
405
+ }
406
+
407
+ void dmdSetupCompileEnv ()
408
+ {
409
+ import dmd.common.charactertables;
410
+
411
+ global.compileEnv.previewIn = global.params.previewIn;
412
+ global.compileEnv.transitionIn = global.params.v.vin;
413
+ global.compileEnv.ddocOutput = global.params.ddoc.doOutput;
414
+
415
+ final switch (global.params.cIdentifierTable)
416
+ {
417
+ case CLIIdentifierTable.C99 :
418
+ global.compileEnv.cCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.C99 );
419
+ break ;
420
+
421
+ case CLIIdentifierTable.C11 :
422
+ case CLIIdentifierTable.default_:
423
+ // ImportC is defined against C11, not C23.
424
+ // If it was C23 this needs to be changed to UAX31 instead.
425
+ global.compileEnv.cCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.C11 );
426
+ break ;
427
+
428
+ case CLIIdentifierTable.UAX31 :
429
+ global.compileEnv.cCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.UAX31 );
430
+ break ;
431
+
432
+ case CLIIdentifierTable.All:
433
+ global.compileEnv.cCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.LR );
434
+ break ;
435
+ }
436
+
437
+ final switch (global.params.dIdentifierTable)
438
+ {
439
+ case CLIIdentifierTable.C99 :
440
+ global.compileEnv.dCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.C99 );
441
+ break ;
442
+
443
+ case CLIIdentifierTable.C11 :
444
+ global.compileEnv.dCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.C11 );
445
+ break ;
446
+
447
+ case CLIIdentifierTable.UAX31 :
448
+ global.compileEnv.dCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.UAX31 );
449
+ break ;
450
+
451
+ case CLIIdentifierTable.All:
452
+ case CLIIdentifierTable.default_:
453
+ // @@@DEPRECATED_2.119@@@
454
+ // Change the default to UAX31,
455
+ // this is a breaking change as C99 (what D used for ~23 years),
456
+ // has characters that are not in UAX31.
457
+ global.compileEnv.dCharLookupTable = IdentifierCharLookup.forTable(IdentifierTable.LR );
458
+ break ;
459
+ }
397
460
}
398
461
399
462
// initialization that are necessary before restarting an analysis (which might run
0 commit comments