Ignore:
Timestamp:
Jan 17, 2018, 5:27:23 PM (7 years ago)
Author:
chronos
Message:
  • Added: Unfinished support for variable arrays.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/easy compiler/USourceGenerator.pas

    r147 r148  
    4444    else if ValueType.Name = 'Integer' then
    4545      Result := Result + 'Integer'
     46    else if ValueType.Name = 'StringArray' then
     47      Result := Result + 'array of string'
     48    else if ValueType.Name = 'IntegerArray' then
     49      Result := Result + 'array of Integer'
    4650    else raise Exception.Create('Unsupported type');
    4751    Result := Result + ';' + LineEnding;
     
    6670  if Reference is TSourceReferenceVariable then begin
    6771    Result := Result + TSourceReferenceVariable(Reference).Variable.Name;
     72  end else
     73  if Reference is TSourceReferenceArray then begin
     74    Result := Result + TSourceReferenceArray(Reference).ArrayRef.Name +
     75      '[' + GenerateRef(TSourceReferenceArray(Reference).Index) + ']';
    6876  end else raise Exception.Create('Unsupported parameter type');
    6977end;
     
    116124    Result := Result + IndentStr + 'until False;' + LineEnding;
    117125  end else
    118   if Command is TCommandIfZero then begin
    119     Result := Result + IndentStr + 'if ' + TCommandIfZero(Command).Variable.Variable.Name + ' = 0 then ';
     126  if Command is TCommandIfEqual then begin
     127    Result := Result + IndentStr + 'if ' + GenerateRef(TCommandIfEqual(Command).Reference1) +
     128      ' = ' + GenerateRef(TCommandIfEqual(Command).Reference2) + ' then ';
    120129  end else
    121130  raise Exception.Create('Unsupported instruction');
Note: See TracChangeset for help on using the changeset viewer.