fix double quoted double escape

This commit is contained in:
Basile Burg 2014-07-31 09:23:29 +02:00
parent 94ddae34ad
commit fff3797348
1 changed files with 23 additions and 4 deletions

View File

@ -111,6 +111,7 @@ type
function readNext: Char; function readNext: Char;
function readCurr: Char; function readCurr: Char;
function readPrev: Char; function readPrev: Char;
function readPrevPrev: Char;
procedure setFoldKinds(aValue: TFoldKinds); procedure setFoldKinds(aValue: TFoldKinds);
procedure setWhiteAttrib(aValue: TSynHighlighterAttributes); procedure setWhiteAttrib(aValue: TSynHighlighterAttributes);
procedure setNumbrAttrib(aValue: TSynHighlighterAttributes); procedure setNumbrAttrib(aValue: TSynHighlighterAttributes);
@ -440,15 +441,19 @@ begin
result := fLineBuf[fTokStop-1]; result := fLineBuf[fTokStop-1];
end; end;
function TSynD2Syn.readPrevPrev: Char; {$IFNDEF DEBUG}inline;{$ENDIF}
begin
result := fLineBuf[fTokStop-2];
end;
//TODO-crange: asm range. //TODO-crange: asm range.
//TODO-cnumber literals: stricter. //TODO-cnumber literals: stricter.
//TODO-cnumber literals: binary. //TODO-cnumber literals: binary.
//TODO-cstring literals: delimited strings. //TODO-cstring literals: delimited strings.
//TODO-cstring literals: token strings. //TODO-cstring literals: token strings.
//TODO-cstring literals: escape bug: std.path/std.regex: "\\"
//TODO-ccomments: correct nested comments handling. //TODO-ccomments: correct nested comments handling.
//TODO-cidea: something like pascal {$region} : /*folder blabla*/ /*endfolder*/ //TODO-cfeature: something like pascal {$region} : /*folder blabla*/ /*endfolder*/
{$BOOLEVAL ON} {$BOOLEVAL ON}
procedure TSynD2Syn.next; procedure TSynD2Syn.next;
@ -596,7 +601,14 @@ begin
end; end;
end; end;
// go to end of string/eol // go to end of string/eol
while (((readNext <> '"') or (readPrev = '\')) and (not (readCurr = #10))) do (*!*); while (((readNext <> '"') or (readPrev = '\')) and (not (readCurr = #10))) do
begin
// test special case "//"
if readCurr = '"' then if
(readPrev = '\') then if
(readPrevPrev = '\') then
break;
end;
if (readCurr = #10) then fRange := rkString1 if (readCurr = #10) then fRange := rkString1
else else
begin begin
@ -610,7 +622,14 @@ begin
end; end;
if fRange = rkString1 then if fRange = rkString1 then
begin begin
if (readCurr <> '"') then while (((readNext <> '"') or (readPrev = '\')) and (not (readCurr = #10))) do (*!*); if (readCurr <> '"') then while (((readNext <> '"') or (readPrev = '\')) and (not (readCurr = #10))) do
begin
// test special case "//"
if readCurr = '"' then if
(readPrev = '\') then if
(readPrevPrev = '\') then
break;
end;
if (readCurr = #10) then if (readCurr = #10) then
begin begin
fTokKind := tkStrng; fTokKind := tkStrng;