On Sun, 30 Oct 2016, leledumbo wrote:

Has anybody tried the FPC JSON parser with these tests?

I just did with the following program:

{$mode objfpc}
uses
 Classes,SysUtils,fpjson,jsonparser;
var
 Input: TStringList;
 JSON: TJSONData;
begin
 try
   try
     Input := TStringList.Create;
     Input.LoadFromFile(ParamStr(1));
     JSON := GetJSON('[""],');

Ehm. This is not parsing anything parametrizable?


I had a look at some of the constructs.
Some of them are not meant to be supported.

I did some random test, for instance

n_array_1_true_without_comma.json : [1 true]

FPC reports an error, as expected. In your HTML, it is in color for 'parsing should have failed but succeeded'

So I have some doubts as to your results...

Michael.

This is the program I used:

{$mode objfpc}
uses
  Classes,SysUtils,fpjson,jsonparser;

var
  Input: TStream;
  JSON: TJSONData;

begin
  JSON:=Nil;
  INPUT:=Nil;
  ExitCode:=0;
  try
    try
      Input := TFileStream.Create(ParamStr(1),fmOpenRead or fmShareDenyWrite);
      JSON := GetJSON(Input);
    finally
      JSON.Free;
      Input.Free;
    end;
  except
    on e: EParserError do begin
      ExitCode := 1;
    end;
    on e: Exception do begin
      ExitCode := 2;
    end;
  end;
end.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to