Skip to content

Scanner remains stuck on incorrect syntax #11

@danfilip

Description

@danfilip

hello,

i've encountered an issue in the scanner when accidentally using "=" instead of "==" in an expression.

here's the test:

timeout_test_() ->
    [
        {timeout, 20, fun timeout/0}
    ].

timeout() ->
    Map = #{
        <<"root_key">> =>
            [
                #{<<"id">> => <<"95101841147">>, <<"type">> => <<"type1">>},
                #{<<"id">> => <<"1803962935345">>, <<"type">> => <<"type2">>}
            ]
    },

    R = ejsonpath:q("$.root_key[?(@.type = 'type2')].id", Map). % change = with == and it works

and here's the stacktrace after it's killed by eunit:

Test case timeout!
exception exit: killed
  in function  ejsonpath_scan:yystate/6 (src/ejsonpath_scan.erl, line 310)
  in call from ejsonpath_scan:string/4 (../../../../../.asdf/installs/erlang/25.2.2/lib/parsetools-2.4.1/include/leexinc.hrl, line 32)
  in call from ejsonpath:q/4 (src/ejsonpath.erl, line 64)
  in call from kycurl_jsonpath:timeout_test/0 (test/kycurl_jsonpath.erl, line 111)
  in call from eunit_test:'-mf_wrapper/2-fun-0-'/2 (eunit_test.erl, line 273)
  in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
  in call from eunit_proc:run_test/1 (eunit_proc.erl, line 531)
  in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)

regardless of the timeout, the scanner remains stuck.

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