DEADSOFTWARE

HolmesUI renamed to FlexUI (or simply UI); small fixes; changed FlexUI authorship...
[d2df-sdl.git] / src / shared / xparser.pas
index b985f1a30a781724b03a058c5b644621b9d0c851..4e45fc6849cf1e6861e94c87664996b1153e6b6d 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C)  DooM 2D:Forever Developers
+(* coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
+ * Understanding is not required. Only obedience.
  *
  * 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
@@ -11,7 +12,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *)
 {$INCLUDE a_modes.inc}
 {.$DEFINE XPARSER_DEBUG}
@@ -106,10 +107,13 @@ type
     function skipToken1 (): Boolean;
     {$ENDIF}
 
+    function isIdOrStr (): Boolean; inline;
+
     function expectId (): AnsiString;
     procedure expectId (const aid: AnsiString; caseSens: Boolean=true);
     function eatId (const aid: AnsiString; caseSens: Boolean=true): Boolean;
     function eatIdOrStr (const aid: AnsiString; caseSens: Boolean=true): Boolean;
+    function eatIdOrStrCI (const aid: AnsiString): Boolean; inline;
 
     function expectStr (allowEmpty: Boolean=false): AnsiString;
     function expectInt (): Integer;
@@ -650,6 +654,12 @@ begin
 end;
 
 
+function TTextParser.isIdOrStr (): Boolean; inline;
+begin
+  result := (mTokType = TTId) or (mTokType = TTStr);
+end;
+
+
 function TTextParser.expectId (): AnsiString;
 begin
   if (mTokType <> TTId) then raise Exception.Create('identifier expected');
@@ -702,6 +712,12 @@ begin
 end;
 
 
+function TTextParser.eatIdOrStrCI (const aid: AnsiString): Boolean; inline;
+begin
+  result := eatIdOrStr(aid, false);
+end;
+
+
 function TTextParser.expectStr (allowEmpty: Boolean=false): AnsiString;
 begin
   if (mTokType <> TTStr) then raise Exception.Create('string expected');