summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d5c517)
raw | patch | inline | side by side (parent: 2d5c517)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 19 Sep 2017 04:24:27 +0000 (07:24 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 19 Sep 2017 04:24:43 +0000 (07:24 +0300) |
src/shared/xparser.pas | patch | blob | history |
diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas
index b704c4b7016a65f119192cc325e07fe49e51bf85..6ecf7f029f90777e46e0382783100f0cef9aabe7 100644 (file)
--- a/src/shared/xparser.pas
+++ b/src/shared/xparser.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE a_modes.inc}
+{.$DEFINE XPARSER_DEBUG}
unit xparser;
interface
TOption = (
SignedNumbers, // allow signed numbers; otherwise sign will be TTDelim
DollarIsId, // allow dollar in identifiers; otherwise dollar will be TTDelim
- DotIsId // allow dot in identifiers; otherwise dot will be TTDelim
+ DotIsId, // allow dot in identifiers; otherwise dot will be TTDelim
+ PascalComments // allow `{}` pascal comments
);
TOptions = set of TOption;
function skipBlanks (): Boolean; // ...and comments; returns `false` on eof
function skipToken (): Boolean; // returns `false` on eof
- //function skipToken1 (): Boolean;
+ {$IFDEF XPARSER_DEBUG}
+ function skipToken1 (): Boolean;
+ {$ENDIF}
function expectId (): AnsiString;
procedure expectId (const aid: AnsiString);
skipChar();
end;
continue;
+ end
+ else if (curChar = '{') and (TOption.PascalComments in mOptions) then
+ begin
+ // pascal comment; skip comment start
+ skipChar();
+ while not isEOF do
+ begin
+ if (curChar = '}') then
+ begin
+ // skip comment end
+ skipChar();
+ break;
+ end;
+ skipChar();
+ end;
+ continue;
end;
if (curChar > ' ') then break;
skipChar(); // skip blank
end;
-{
+{$IFDEF XPARSER_DEBUG}
function TTextParser.skipToken (): Boolean;
begin
writeln('getting token...');
result := skipToken1();
writeln(' got token: ', mTokType, ' <', mTokStr, '> : <', mTokChar, '>');
end;
-}
-
+function TTextParser.skipToken1 (): Boolean;
+{$ELSE}
function TTextParser.skipToken (): Boolean;
-
+{$ENDIF}
procedure parseInt ();
var
neg: Boolean = false;