Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser runs into stackoverflow (js_of_ocaml) #209

Open
RCmerci opened this issue Feb 23, 2021 · 0 comments
Open

Parser runs into stackoverflow (js_of_ocaml) #209

RCmerci opened this issue Feb 23, 2021 · 0 comments

Comments

@RCmerci
Copy link

RCmerci commented Feb 23, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant