erl_scan 模块 erl_scan 模块摘要 Erlang令牌扫描仪。 描述 该模块包含将字符标记(扫描)到Erlang令牌中的功能。 数据类型 category() = atom() error_description() = term() error_info() = {erl_anno:location(), module(),error_description()} ...
上面的代码其实很简单,最核心的部分,在于parse_func_string/1函数,他利用erl_scan:string/1将一段字符串转换成了tokens, 接下来用erl_parse:parse_form/1将这段tokens解析成ASF (就是erlang的erlang 的Abstract Format,关于ASF,大家可以移步erlang的文档http://www.erlang.org/doc/apps/erts/absform.html,这里...
{value, Value,_} =erl_eval:exprs(Parsed,[]), Value. 在Shell里面练习一下,为了简单就直接在Shelll里面定义fun使用了: Eshell V5.9(abort with ^G) 1> F=fun(S) -> {ok,Scanned,_} =erl_scan:string(S), {ok,Parsed} =erl_parse:parse_exprs(Scanned), {value, Value,_} =erl_eval:exprs...
功能column(),end_location(),line(),location(),和text()中erl_scan模块能够用于在令牌检查注释。 功能anno_from_term(),anno_to_term(),fold_anno(),map_anno(),mapfold_anno(),和new_anno(),在所述erl_parse模块可用于在抽象代码操纵注释。
通常情况下我们在eshell 里面输入的东西都是动态eval的. erl还支持命令行动态解释. erl -eval e init.erl start_it({eval,Bin}) -> Str = binary_to_list(Bin), {ok,Ts,_} = erl_scan:string(Str), Ts1 = case reverse(Ts) of [{dot,_}|_] -> Ts; ...
analysis结果已经保存到bar.analysis中,此文件可以通过erl_scan and erl_parse, file:consult/1 or io:read/2进行读取分析。 下面我们看看analysis内容: 引用 %% Analysis results: { analysis_options, [{callers, true}, {sort, acc}, {totals, false}, ...
23> io:scan_erl_exprs('enter>'). enter>abc(), "hey". {ok,[{atom,1,abc},{'(',1},{')',1},{',',1},{string,1,"hey"},{dot,1}],2} 24> io:scan_erl_exprs('enter>'). enter>1.0er. {error,{1,erl_scan,{illegal,float}},2}scan...
Argument Options is passed on as argument Options of function erl_scan:tokens/4. The data is tokenized and parsed as if it was a sequence of Erlang expressions until a final dot (.) is reached. The function returns: {ok, ExprList, EndLocation} The parsing was successful. {eof, End...
Example: 23> io:scan_erl_exprs('enter>'). enter>abc(), "hey". {ok,[{atom,1,abc},{'(',1},{')',1},{',',1},{string,1,"hey"},{dot,1}],2} 24> io:scan_erl_exprs('enter>'). enter>1.0er. {error,{1,erl_scan,{illegal,float}},2}scan...
the function findFile in erlsom_lib.erl. Restriction Supported as a way to create a derived complex type (but it is not checked whether this is really a restriction of the base type). Ignored on simpleTypes (all restrictions on simple types are ignored - those types are treated as ‘...