Skip to content
walter-weinmann edited this page May 23, 2016 · 1 revision

Example use

1> jpparse:parsetree_with_tokens("a:b").
{ok,{{':',<<"b">>,<<"a">>},
     [{'STRING',1,"a"},{':',1},{'STRING',1,"b"}]}}
2> jpparse:parsetree("a:b{1-2"). 
{parse_error,{1,"syntax error before: '-'",
              [{'STRING',1,"a"},
               {':',1},
               {'STRING',1,"b"},
               {'{',1},
               {'STRING',1,"1"},
               {'-',1},
               {'STRING',1,"2"}]}}
3> jpparse:parsetree("a:b[1-2").
{parse_error,{1,"syntax error before: '-'",
              [{'STRING',1,"a"},
               {':',1},
               {'STRING',1,"b"},
               {'[',1},
               {'STRING',1,"1"},
               {'-',1},
               {'STRING',1,"2"}]}}
4> jpparse:parsetree_with_tokens("a:b[1,2]").
{ok,{{'[]',{':',<<"b">>,<<"a">>},[1,2]},
     [{'STRING',1,"a"},
      {':',1},
      {'STRING',1,"b"},
      {'[',1},
      {'STRING',1,"1"},
      {',',1},
      {'STRING',1,"2"},
      {']',1}]}}
5> jpparse:parsetree_with_tokens("a:b{x,y}").
{ok,{{'{}',{':',<<"b">>,<<"a">>},[<<"x">>,<<"y">>]},
     [{'STRING',1,"a"},
      {':',1},
      {'STRING',1,"b"},
      {'{',1},
      {'STRING',1,"x"},
      {',',1},
      {'STRING',1,"y"},
      {'}',1}]}}
Clone this wiki locally