上回书,我们说到飞天玉虎蒋伯芳来到蜈蚣岭,不是,重来,上回咱们说到可以在Erlang Shell里面手工构造,加载并调用一个模块.在那个demo里面,我把多个Form单独生成出来,最后放在一起做compile:forms,是不是可以简单点?我们先看完整的module代码,erl_scan:string之后是什么样子的:erl_syntax123456789101112131415161718192021222324252627Eshell
V5.10.2 (abort with ^G)1>
Code ="-module(t).\n-export([say/0]).\n\nsay()
-> \"Hello world!!\". "."-module(t).\n-export([say/0]).\n\nsay()
-> \"Hello world!!\". "2>
{ok,Tokens,_} =erl_scan:string(Code).{ok,[{'-',1},{atom,1,module},{'(',1},{atom,1,t},{')',1},{dot,1},{'-',2},{atom,2,export},{'(',2},{'[',2},{atom,2,say},{'/',2},{integer,2,0},{']',2},{')',2},{dot,2},{atom,4,
...
继续阅读
(21)