Skip to content

Commit

Permalink
Made FPC version of TStringStream compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Wosi committed May 14, 2015
1 parent a4ce30e commit be36295
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Source/DelphiAST.pas
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,36 @@ TPasSyntaxTreeBuilder = class(TmwSimplePasPar)

implementation

{$IFDEF FPC}
type

TStringStreamHelper = class helper for TStringStream
class function Create: TStringStream; overload;
procedure LoadFromFile(const FileName: string);
end;

{ TStringStreamHelper }

class function TStringStreamHelper.Create: TStringStream;
begin
Result := TStringStream.Create('');
end;

procedure TStringStreamHelper.LoadFromFile(const FileName: string);
var
Strings: TStringList;
begin
Strings := TStringList.Create;
try
Strings.LoadFromFile(FileName);
Strings.SaveToStream(Self);
finally
FreeAndNil(Strings);
end;
end;
{$ENDIF}


{ TPasSyntaxTreeBuilder }

procedure TPasSyntaxTreeBuilder.AccessSpecifier;
Expand Down

0 comments on commit be36295

Please sign in to comment.