Menu

#76 Warning during parsing files starting with BOM

0.12.0
closed
parser (25)
4
2012-11-05
2010-11-02
No

During parsing files starting with BOM (http://goo.gl/mJKoU) PasDoc displays warning: Warning[2]: Error EPasDoc: Invalid character in Pascal input stream (at SourceFile.pas(1)) while parsing unit SourceFile.pas, continuing...

In this particular case source file is starting with the #$EF #$BB #$BF characteres.

Discussion

  • aguser

    aguser - 2010-11-02

    FPC, Delphi < 2009 or Delphi 2009+ .exe?

     
  • Grzegorz Skoczylas

    I have Delphi 2007 Professional

     
  • Michalis Kamburelis

    I can reproduce with FPC.

    Our TPasDoc.SkipBOM method stopped working correctly after changes in rev 1221 (BOM array was assumed to be 1-based by the following code). Also something else is broken, not sure yet what (even when TPasDoc.SkipBOM skips correctly, something else still sees the bom character in the stream).

    I have committed a partial fix, and will look into it more now :)

     
  • Michalis Kamburelis

    Ok, my fix was actually complete :) Closing.

    Testcase in tests/ok_bom.pas, so we will not break it again :)

    Tested with FPC, and should work equally good with non-Unicode Delphi (for Unicode Delphi, BOM is detected in other place, I assume that's working Ok). Please reopen if you still see the problem with Delphi.

     
  • Grzegorz Skoczylas

    So far I used the PasDoc.exe downloaded from SourceForge.net. Today I updated the PasDoc's source code and compiled (with Delphi2007). From now on, the PasDoc does not have any problem with BOM.

    Thanks!

     
  • aguser

    aguser - 2010-11-03

    Ok, my fix was actually complete :) Closing.

    Mea culpa, sorry, only I wonder why you did not just made the stack array 1-base?
    We are dealing with bytes there not with chars, anyway thanks for the fix.

     
  • Michalis Kamburelis

    only I wonder why you did not just made the stack array 1-base?

    That's because I planned to cleanup the SkipBOM code anyway, to avoid the loop at all, just like your TStreamReader.GetCodePageFromBOM. It is done now :)

     
  • Dr. Diettrich

    Dr. Diettrich - 2010-11-03

    Just a note on the FPC scanner: when the scanner skips the BOM, it erroneously returns the first char of the BOM, instead of the next char. Dunno whether the same bug was copied into the PasDoc code.

     
  • Michalis Kamburelis

    Just a note on the FPC scanner: when the scanner skips the BOM, it erroneously returns the first char of the BOM, instead of the next char.

    Our scanner is not based on the FPC scanner. The bug was our own :)

    In other news: 0.12.1 will be released later today to make this fixed also in released versions.

     

Log in to post a comment.