[erlang-questions] Problem parsing Erlang code

Joel Reymont <>
Tue Nov 20 18:28:48 CET 2007


On Nov 20, 2007, at 5:17 PM, Tony Garnock-Jones wrote:

> Did you want a "." instead of a ";" at the end of the string?


That's what I thought before sending the message. It doesn't help,  
though.

5> S1 = "show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4,  
\"bicycling, <10\").".
"show({'bicycling' = A, 1010 = B}) -> show_activity(A, B, 4,  
\"bicycling, <10\")."
6> {ok, Toks1, _} = erl_scan:string(S).
{ok,[{atom,1,show},
      {'(',1},
      {'{',1},
      {atom,1,bicycling},
      {'=',1},
      {var,1,'A'},
      {',',1},
      {integer,1,1010},
      {'=',1},
      {var,1,'B'},
      {'}',1},
      {')',1},
      {'->',1},
      {atom,1,show_activity},
      {'(',1},
      {var,1,'A'},
      {',',1},
      {var,1,'B'},
      {',',1},
      {integer,1,4},
      {',',1},
      {string,1,"bicycling, <10"},
      {')',1},
      {';',1}],
     1}
7> {ok, AbsForm} = erl_parse:parse(Toks1).
=ERROR REPORT==== 20-Nov-2007::17:05:35 ===
Error in process <0.37.0> with exit value: {{badmatch,{error, 
{999999,erl_parse,["syntax error before: ",[]]}}},[{erl_eval,expr,3}]}

** exited: {{badmatch,{error,{999999,erl_parse,["syntax error before:  
",[]]}}},
             [{erl_eval,expr,3}]} **

--
http://wagerlabs.com








More information about the erlang-questions mailing list