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
|
var
|
||||||
reader: TReaderHead;
|
reader: TReaderHead;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
|
nestedCom: integer;
|
||||||
|
|
||||||
function isOutOfBound: boolean;
|
function isOutOfBound: boolean;
|
||||||
begin
|
begin
|
||||||
|
|
@ -446,11 +447,29 @@ begin
|
||||||
begin
|
begin
|
||||||
if (reader.Next^ = '+') then
|
if (reader.Next^ = '+') then
|
||||||
begin
|
begin
|
||||||
|
nestedCom := 1;
|
||||||
if isOutOfBound then
|
if isOutOfBound then
|
||||||
exit;
|
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
|
if isOutOfBound then
|
||||||
exit;
|
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;
|
reader.Next;
|
||||||
addToken(ltkComment);
|
addToken(ltkComment);
|
||||||
if callBackDoStop then
|
if callBackDoStop then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue