Skip to content

Parser runs into stackoverflow (js_of_ocaml)  #209

@RCmerci

Description

@RCmerci

Test json:
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

Test codes:

open Js_of_ocaml
let _ =
  Js.export "XXX"
    (object%js
      method ppp s =
        let a = Angstrom.(parse_string RFC7159.json (Js.to_string s) ~consume:All) in
        Firebug.console##log Sys.backend_type;
        match a with
        | Ok v -> Firebug.console##log v;
        | Error e -> Firebug.console##log e;
    end
    )

Html:

<html>
  <script src="./main.js"></script>
</html>

Then, eval expression in browser's console: XXX.ppp("<test-json>")

Result:
image

RFC7159.json is the parser at examples/rFC7159.ml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions