Bug, feature or limitation of erl_parse?

Musumeci, Antonio S <>
Tue Aug 24 22:08:23 CEST 2010


It doesn't appear to understand the "test" ++ Else shortcut for [$t,$e,$s,$t|Else]. Reason I noticed was I'm reading in terms as strings and passing them to mnesia:select. erl_parse works fine with [$t|'_'] but not "t" ++ '_'.

> S = "[$t,$e,$s,$t|'_']".
"[$t,$e,$s,$t|'_']"
> T = "\"test\" ++ '_'".
"\"test\" ++ '_'"
> [$t,$e,$s,$t|'_'] = "test" ++ '_'.
[116,101,115,116|'_']
> {ok,S2,_} = erl_scan:string(S).
{ok,[{'[',1},
     {char,1,116},
     {',',1},
     {char,1,101},
     {',',1},
     {char,1,115},
     {',',1},
     {char,1,116},
     {'|',1},
     {atom,1,'_'},
     {']',1}],
    1}
> {ok,T2,_} = erl_scan:string(T).
{ok,[{string,1,"test"},{'++',1},{atom,1,'_'}],1}
> erl_parse:parse_term(S2++[{dot,1}]).
{ok,[116,101,115,116|'_']}
> erl_parse:parse_term(T2++[{dot,1}]).
{error,{1,erl_parse,"bad term"}}

--------------------------------------------------------------------------
NOTICE: If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.


More information about the erlang-questions mailing list