SynEdit, Pas Highlighter: show ^x as string / fix pointer^

git-svn-id: trunk@47514 -
This commit is contained in:
martin 2015-01-25 14:28:56 +00:00
parent 3d34fff0a3
commit ccf26dd4cd
2 changed files with 39 additions and 7 deletions

View File

@ -86,6 +86,7 @@ type
// Also included after class modifiers "sealed" and "abstract"
rsAtClass,
rsAfterClass,
rsAfterIdentifier,
rsAtClosingBracket, // ')'
rsAtCaseLabel,
@ -2750,11 +2751,13 @@ begin
fTokenID := tkSymbol;
t := TopPascalCodeFoldBlockType;
if (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection,
( ( (t in [cfbtVarType, cfbtLocalVarType]) or
((t in [cfbtProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0))
) and
(fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual]) )
if ( (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection,
( ( (t in [cfbtVarType, cfbtLocalVarType]) or
((t in [cfbtProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0))
) and
(fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual])
)) and
not(rsAfterIdentifier in fRange)
then begin
if Run<fLineLen then begin
if (Run+1 < fLineLen) and (fLine[Run] = '{') and (fLine[Run+1] = '$') then begin
@ -3060,6 +3063,7 @@ begin
if (FTokenID = tkKey) then
fRange := fRange - [rsAtCaseLabel];
end;
if not (FTokenID in [tkSpace, tkComment, tkIDEDirective, tkDirective]) then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and
not(rsAtClosingBracket in fRange)
@ -3068,7 +3072,7 @@ begin
fRange := fRange -
(FOldRange * [rsAfterEqualOrColon, rsAtPropertyOrReadWrite, rsAfterClassField]) -
[rsAtClosingBracket];
[rsAtClosingBracket, rsAfterIdentifier];
if rsAtClass in fRange then begin
if FOldRange * [rsAtClass, rsAfterClass] <> [] then
@ -3082,6 +3086,9 @@ begin
if rsAtClass in fRange then
fRange := fRange + [rsAfterClass];
end;
if FTokenID = tkIdentifier then
fRange := fRange + [rsAfterIdentifier];
end
end;
if FAtLineStart and not(FTokenID in [tkSpace, tkComment, tkIDEDirective]) then

View File

@ -1096,7 +1096,13 @@ begin
'c=^char;',
'begin',
'i:=^f;',
'end;', // 15
'x:=GetTypeData(PropInfo^.PropType{$IFNDEF FPC}^{$ENDIF});', // 15
'c:=p^;',
'c:=p ^;',
'c:=p(**)^;',
'c:=p{} ^;',
'c:=p^+^i''e''^a#13^x;', //20
'end;',
''
]);
@ -1120,6 +1126,25 @@ begin
CheckTokensForLine('i:=^f', 14,
[tkIdentifier, tkSymbol, tkString, tkSymbol]);
CheckTokensForLine('x:=GetTypeData(PropInfo^.PropType{$IFNDEF FPC}^{$ENDIF});', 15,
[tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, // x:=GetTypeData(
tkIdentifier, tkSymbol, tkSymbol, tkIdentifier, // PropInfo^.PropType
tkDirective, tkSymbol, tkDirective, tkSymbol, tkSymbol]); // {$IFNDEF FPC}^{$ENDIF});
CheckTokensForLine('c:=p^;', 16,
[tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, tkSymbol]);
CheckTokensForLine('c:=p ^;', 17,
[tkIdentifier, tkSymbol, tkIdentifier, tkSpace, tkSymbol, tkSymbol]);
CheckTokensForLine('c:=p(**)^;', 18,
[tkIdentifier, tkSymbol, tkIdentifier, tkComment, tkSymbol, tkSymbol]);
CheckTokensForLine('c:=p{} ^;', 19,
[tkIdentifier, tkSymbol, tkIdentifier, tkComment, tkSpace, tkSymbol, tkSymbol]);
CheckTokensForLine('c:=p^+^i''e''^a#13^x;', 20,
[tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, tkSymbol, // c:=p^+
tkString, tkString, tkString, tkString, tkString, tkSymbol // ^i'e'^a#13^x;
]);
end;
procedure TTestHighlighterPas.TestFoldNodeInfo;