Ignore:
Timestamp:
Nov 9, 2010, 12:21:56 PM (14 years ago)
Author:
george
Message:
  • Modified: Tokenizer was using slow Text property of TStringList. Replaced by fast native string variable.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Analyze/UAnalyzer.pas

    r12 r20  
    2929  end;
    3030
    31   TGetSourceEvent = function (Name: string; Source: TStringList): Boolean of object;
     31  TGetSourceEvent = function (Name: string; var SourceCode: string): Boolean of object;
    3232
    3333  { TAnalyzer }
     
    5151    CodeStreamPosition: Integer;
    5252    CodePosition: TPoint;
    53     SourceCodeText: TStringList;
     53    SourceCode: string;
    5454    Tokens: TObjectList; // TObjectList<TToken>
    5555    TokenIndex: Integer;
     
    225225  Tokens.Clear;
    226226  TokenIndex := 0;
    227   while CodeStreamPosition < Length(SourceCodeText.Text) do begin
     227  while CodeStreamPosition < Length(SourceCode) do begin
    228228    NewToken := TToken.Create;
    229229    GetNextToken;
     
    255255  FNextTokenType := ttNone;
    256256  FParserState := psNone;
    257   with SourceCodeText do
     257
    258258    while True do begin
    259       if CodeStreamPosition < Length(Text) then begin
    260         CurrentChar := Text[CodeStreamPosition];
     259      if CodeStreamPosition < Length(SourceCode) then begin
     260        CurrentChar := SourceCode[CodeStreamPosition];
    261261      end else begin
    262262        FNextToken := '';
Note: See TracChangeset for help on using the changeset viewer.