@@ -23,11 +23,13 @@ import dmd.dmodule;
2323import dmd.dstruct;
2424import dmd.dsymbol;
2525import dmd.dtemplate;
26+ import dmd.escape;
2627import dmd.expression;
2728import dmd.func;
2829import dmd.globals;
2930import dmd.id;
3031import dmd.identifier;
32+ import dmd.location;
3133import dmd.mtype;
3234import dmd.objc;
3335import dmd.rootobject;
@@ -42,6 +44,8 @@ import core.stdc.string;
4244// //////////////////////////////////////////////////////////////
4345alias countersType = uint [uint ]; // actually uint[Key]
4446alias EscapeInfer = RootObject[int ];
47+ enum uint_1 : uint { initValue = 1 }
48+
4549
4650enum string [2 ][] dmdStatics =
4751[
@@ -108,6 +112,7 @@ enum string[2][] dmdStatics =
108112 [" _D3dmd7arrayop7arrayOpFCQw10expression6BinExpPSQBt6dscope5ScopeZQByCQCo9dtemplate19TemplateDeclaration" , " TemplateDeclaration" ],
109113 [" _D3dmd6errors18colorHighlightCodeFNbKSQBk6common9outbuffer9OutBufferZ6nestedi" , " int" ],
110114 [" _D3dmd7dmodule6Module18loadCoreStdcConfigFZ16core_stdc_configCQCiQChQCc" , " Module" ],
115+ // EscapeState.reset not accessible in package dmd
111116 [" _D3dmd6escape11EscapeState17scopeInferFailureHiCQBu10rootobject10RootObject" , " EscapeInfer" ],
112117];
113118
@@ -135,7 +140,7 @@ string genInitDmdStatics()
135140{
136141 string s;
137142 foreach (decl; dmdStatics)
138- s ~= cmangled(decl[0 ]) ~ " = " ~ decl[1 ] ~ " .init;\n " ;
143+ s ~= cmangled(decl[0 ]) ~ " = ( " ~ decl[1 ] ~ " ) .init;\n " ;
139144 return s;
140145}
141146
@@ -197,6 +202,7 @@ void dmdInit()
197202 // Token._init();
198203 Id.initialize();
199204 Expression._init();
205+ location_init();
200206
201207 target._init(global.params); // needed by Type._init
202208 Type._init();
@@ -394,6 +400,63 @@ void dmdSetupParams(const ref Options opts)
394400 global.filePath.setDim(0 );
395401 foreach (i; opts.stringImportDirs)
396402 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+ }
397460}
398461
399462// initialization that are necessary before restarting an analysis (which might run
0 commit comments