Why include name in include define MUST be quoted?

Issue #216 wontfix
Alex Bespalov created an issue

According to pascal language standart, name in include define can be without quotes.

As per Delphi rules (https://docwiki.embarcadero.com/RADStudio/Sydney/en/Include_file_(Delphi)) only 1 case with quotes:

To specify a filename that includes a space, surround the file name with single quotation marks: {$I 'My file'}.

From my side, i comment lines 12286-12291 in dwsCompiler.pas (TdwsCompiler.ReadInstrSwitch)

// end else if not FTok.Test(ttStrVal) then begin
//
// FMsgs.AddCompilerError(FTok.HotPos, CPE_IncludeFileExpected);
// // skip in attempt to recover from error
// Result:=False;
// SkipUntilToken(ttCRIGHT);

Comments (3)

  1. Eric Grange repo owner

    It was a choice made early on not to support the legacy include syntax, as it resulted in too much ambiguity when special characters are present (note that in Delphi, space isn’t the only character for which you need to quote). In several of our end use case here, filename are actually akin to URIs, and references to database entries rather than actual files.

  2. Log in to comment