mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-03 00:07:28 +01:00
[PATCH 056/188] fix comments scanning
From 4933bad2fb89f856c5cfc5d60378e619c92a5413 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Sun, 24 Nov 2019 20:18:09 -0500 git-svn-id: branches/wasm@46052 -
This commit is contained in:
parent
47a39bb01b
commit
8b1d615a77
@ -222,7 +222,8 @@ begin
|
||||
if isSubStrMatch(s, index, substr) then begin
|
||||
inc(index, length(substr));
|
||||
Break;
|
||||
end;
|
||||
end else
|
||||
inc(index);
|
||||
end;
|
||||
Result:=Copy(s, i, index-i);
|
||||
end;
|
||||
|
||||
@ -192,13 +192,12 @@ begin
|
||||
Result := idx<=length(buf);
|
||||
if not Result then Exit;
|
||||
ofs:=idx;
|
||||
has2chars := idx<length(buf);
|
||||
if has2chars then begin
|
||||
if (buf[idx]=';') and (buf[idx+1]=';') then begin
|
||||
if (idx<length(buf)) and (buf[idx] in [';','(']) and (buf[idx+1]=';') then begin
|
||||
if (buf[idx]=';') then begin
|
||||
// comment until the end of the line
|
||||
cmt := ScanTo(buf, idx, EoLnChars);
|
||||
ScanWhile(buf, idx, EoLnChars);
|
||||
end else if (buf[idx]='(') and (buf[idx+1]=';') then
|
||||
end else
|
||||
// comment until the ;)
|
||||
cmt := ScanToSubstr(buf, idx, ';)');
|
||||
|
||||
@ -207,9 +206,7 @@ begin
|
||||
done:=true;
|
||||
end else
|
||||
DoComment(cmt);
|
||||
end;
|
||||
|
||||
if not done then begin
|
||||
end else begin
|
||||
done:=true;
|
||||
if buf[idx] = '(' then begin
|
||||
token:=weOpenBrace;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user