@@ -400,6 +400,63 @@ void dmdSetupParams(const ref Options opts)
400400 global.filePath.setDim(0 );
401401 foreach (i; opts.stringImportDirs)
402402 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+ }
403460}
404461
405462// initialization that are necessary before restarting an analysis (which might run
0 commit comments