diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas
index 76ac3c0165483ef90d4066904540d1eef5b7a2dd..01c49b4bb1bb4e4360dd8e4c1057686e15b7c5ff 100644 (file)
--- a/src/shared/xparser.pas
+++ b/src/shared/xparser.pas
function expectStr (allowEmpty: Boolean=false): AnsiString;
function expectInt (): Integer;
+ function expectStrOrId (allowEmpty: Boolean=false): AnsiString;
+
procedure expectTT (ttype: Integer);
function eatTT (ttype: Integer): Boolean;
end;
+function TTextParser.expectStrOrId (allowEmpty: Boolean=false): AnsiString;
+begin
+ case mTokType of
+ TTStr:
+ if (not allowEmpty) and (Length(mTokStr) = 0) then raise Exception.Create('non-empty string expected');
+ TTId:
+ begin end;
+ else
+ raise Exception.Create('string or identifier expected');
+ end;
+ result := mTokStr;
+ skipToken();
+end;
+
+
function TTextParser.expectInt (): Integer;
begin
if (mTokType <> TTInt) then raise Exception.Create('string expected');