DEADSOFTWARE

changed license to GPLv3 only; sorry, no trust to FSF anymore
[d2df-sdl.git] / src / shared / xparser.pas
index de2dfb38a379ac52872a91caaffd71ac61a11db2..f18ff98b8efae3fd042feb270b3e03f209a5e1b5 100644 (file)
@@ -3,8 +3,7 @@
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -306,6 +305,14 @@ begin
   mTokInt := 0;
   mOptions := aopts;
   skipToken();
+  // fuck you, BOM!
+  {
+  if (mBufLen >= 3) and (mBuffer[0] = #$EF) and (mBuffer[1] = #$BB) and (mBuffer[2] = #$BF) then
+  begin
+    for f := 3 to mBufLen-1 do mBuffer[f-3] := mBuffer[f];
+    Dec(mBufLen, 3);
+  end;
+  }
 end;
 
 
@@ -426,6 +433,17 @@ function TTextParser.skipBlanks (): Boolean;
 var
   level: Integer;
 begin
+  //writeln('line=', mLine, '; col=', mCol, '; char0=', Integer(peekChar(0)));
+  if (mLine = 1) and (mCol = 1) and
+     (peekChar(0) = #$EF) and
+     (peekChar(1) = #$BB) and
+     (peekChar(2) = #$BF) then
+  begin
+    skipChar();
+    skipChar();
+    skipChar();
+  end;
+
   while (curChar <> #0) do
   begin
     if (curChar = '/') then