diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas
index b985f1a30a781724b03a058c5b644621b9d0c851..4e45fc6849cf1e6861e94c87664996b1153e6b6d 100644 (file)
--- a/src/shared/xparser.pas
+++ b/src/shared/xparser.pas
-(* 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
* 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}
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;
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');
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');