SynEdit: fixed number highlighting with exponent in various HL. Issue #0026245

git-svn-id: trunk@46388 -
This commit is contained in:
martin 2014-09-30 23:57:55 +00:00
parent 52d72af31a
commit d767272fa9
6 changed files with 88 additions and 55 deletions

View File

@ -1152,17 +1152,28 @@ end;
procedure TSynCppSyn.NumberProc;
begin
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in
['0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X'] do
if (FLine[Run] = '0') and (FLine[Run+1] in ['x', 'X'])then
begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
end;
inc(Run);
inc(Run, 2);
while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do inc(Run);
if FLine[Run] in ['u', 'U', 'l', 'L'] then inc(Run);
exit;
end;
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if FLine[Run] in ['u', 'U', 'l', 'L'] then inc(Run);
end;
procedure TSynCppSyn.OrSymbolProc;

View File

@ -993,17 +993,27 @@ end;
procedure TSynJavaSyn.NumberProc;
begin
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in
['0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f'] do
if (FLine[Run] = '0') and (FLine[Run+1] in ['x', 'X'])then
begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
end;
inc(Run);
inc(Run, 2);
while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do inc(Run);
if FLine[Run] in ['l', 'L'] then inc(Run);
exit;
end;
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if FLine[Run] in ['l', 'L'] then inc(Run);
end;
procedure TSynJavaSyn.OrSymbolProc;

View File

@ -1594,33 +1594,25 @@ begin
end;
procedure TSynJScriptSyn.NumberProc;
var
idx1: Integer; // token[1]
isHex: Boolean;
begin
fTokenID := tkNumber;
isHex := False;
idx1 := Run;
Inc(Run);
while FLine[Run] in ['0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X'] do
if (FLine[Run] = '0') and (FLine[Run+1] in ['x', 'X'])then
begin
case FLine[Run] of
'.':
if FLine[Succ(Run)] = '.' then
Break;
'a'..'f', 'A'..'F':
if not isHex then
Break;
'x', 'X':
begin
if (FLine[idx1] <> '0') or (Run > Succ(idx1)) then
Break;
if not (FLine[Succ(Run)] in ['0'..'9', 'a'..'f', 'A'..'F']) then
Break;
isHex := True;
end;
end;
Inc(Run);
inc(Run, 2);
while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do inc(Run);
exit;
end;
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
end;

View File

@ -2330,18 +2330,26 @@ begin
end;
end;
end;
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in
['0'..'9', '-', '_', '.', 'A'..'F', 'a'..'f', 'x', 'X'] do
if (FLine[Run] = '0') and (FLine[Run+1] in ['x', 'X'])then
begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
'-': {check for e notation}
if not ((FLine[Run + 1] = 'e') or (FLine[Run + 1] = 'E')) then break;
end;
inc(Run, 2);
while FLine[Run] in ['0'..'9', 'A'..'F', 'a'..'f'] do inc(Run);
exit;
end;
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
end;

View File

@ -1362,12 +1362,15 @@ procedure TSynSQLSyn.NumberProc;
begin
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in ['0'..'9', '.', '-'] do begin
case FLine[Run] of
'.':
if FLine[Run + 1] = '.' then break;
end;
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
end;

View File

@ -1119,7 +1119,16 @@ procedure TSynVBSyn.NumberProc;
begin
inc(Run);
fTokenID := tkNumber;
while FLine[Run] in ['0'..'9', '.', 'e', 'E'] do inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
if (FLine[Run]='.') and not(fLine[Run+1]='.') then begin
inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
if (FLine[Run]='e') or (fLine[Run]='E') then begin
inc(Run);
if (FLine[Run]='+') or (fLine[Run]='-') then inc(Run);
while FLine[Run] in ['0'..'9'] do inc(Run);
end;
end;
procedure TSynVBSyn.SpaceProc;