mirror of https://gitlab.com/basile.b/dexed.git
ce_dlang, fix #24, problem with nested comments
This commit is contained in:
parent
2b53620a94
commit
bb4bf42ccd
|
|
@ -351,6 +351,7 @@ procedure lex(const aText: string; aList: TLexTokenList; aCallBack: TLexFoundEve
|
|||
var
|
||||
reader: TReaderHead;
|
||||
identifier: string;
|
||||
nestedCom: integer;
|
||||
|
||||
function isOutOfBound: boolean;
|
||||
begin
|
||||
|
|
@ -446,11 +447,29 @@ begin
|
|||
begin
|
||||
if (reader.Next^ = '+') then
|
||||
begin
|
||||
nestedCom := 1;
|
||||
if isOutOfBound then
|
||||
exit;
|
||||
while (reader.head^ <> '+') or (reader.Next^ <> '/') do
|
||||
repeat
|
||||
while ((reader.head^ <> '+') or (reader.head^ <> '/')) or
|
||||
((reader.next^ <> '/') or (reader.head^ <> '+')) do
|
||||
begin
|
||||
if isOutOfBound then
|
||||
exit;
|
||||
if (reader.previous^ = '/') and (reader.next^ = '+') then
|
||||
begin
|
||||
nestedCom += 1;
|
||||
break;
|
||||
end;
|
||||
if (reader.previous^ = '+') and (reader.next^ = '/') then
|
||||
begin
|
||||
nestedCom -= 1;
|
||||
break;
|
||||
end;
|
||||
if isOutOfBound then
|
||||
exit;
|
||||
end;
|
||||
until nestedCom = 0;
|
||||
reader.Next;
|
||||
addToken(ltkComment);
|
||||
if callBackDoStop then
|
||||
|
|
|
|||
Loading…
Reference in New Issue