Changeset 58 for trunk


Ignore:
Timestamp:
Jul 17, 2012, 6:05:13 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Wrong expression analyzing.
Location:
trunk/Compiler
Files:
2 edited

Legend:

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

    r57 r58  
    1515  private
    1616  public
     17    function DebugExpressions(List: TListExpression): string;
    1718    function ParseFile(Name: string): Boolean;
    1819    function ParseWhileDo(var WhileDo: TWhileDo; SourceCode: TCommonBlock): Boolean;
     
    8687{ TAnalyzerPascal }
    8788
     89function TAnalyzerPascal.DebugExpressions(List: TListExpression): string;
     90var
     91  I: Integer;
     92begin
     93  Result := Result + '(';
     94  for I := 0 to List.Count - 1 do begin
     95    Result := Result + IntToStr(I) + ': ';
     96    if Assigned(List[I]) then
     97      Result := Result + IntToStr(Integer(TExpression(List[I]).NodeType)) +
     98      DebugExpressions(TExpression(List[I]).SubItems);
     99    if I < List.Count - 1 then Result := Result + ', ';
     100  end;
     101  Result := Result + ')';
     102end;
     103
    88104function TAnalyzerPascal.ParseFile(Name: string): Boolean;
    89105var
     
    150166          ReadToken;
    151167        end;
    152         ShowMessage(IntToStr(TExpression(Expressions.Last).SubItems.Count) + ' ' + TExpression(Expressions.Last).OperatorName);
    153         if Assigned(TExpression(Expressions.First)) then
    154           ShowMessage('First ' + IntToStr(Integer(TExpression(Expressions.Last).SubItems.First)));
    155         if Assigned(TExpression(Expressions.Last)) then
    156           ShowMessage('Last ' + IntToStr(Integer(TExpression(Expressions.Last).SubItems.Last)));
     168        //ShowMessage(DebugExpressions(Expressions));
    157169      end;
    158170
     
    325337    if Assigned(NewExpression) then begin
    326338      TExpression(Expressions.Last).SubItems.Last := NewExpression;
    327       with Expressions.Items[Expressions.Add(TExpression.Create)] do
     339      with TExpression(Expressions.Items[Expressions.Add(TExpression.Create)]) do
    328340      begin
    329341        CommonBlock := SourceCode.CommonBlock;
  • trunk/Compiler/Target/Delphi/UProducerPascal.pas

    r44 r58  
    7373  ModuleName: string;
    7474begin
     75  if UsedModules.Count = 0 then Exit;
    7576  EmitLn('uses');
    7677  Inc(Indentation);
Note: See TracChangeset for help on using the changeset viewer.