parse_erl_exprs(Prompt) -> Result
parse_erl_exprs(IoDevice, Prompt) -> Result
parse_erl_exprs(IoDevice, Prompt, StartLocation) -> Result
parse_erl_exprs(IoDevice, Prompt, StartLocation, Options) ->
Result
OTP R16B
類型:
IoDevice = device()
Prompt = prompt()
StartLocation = location()
Options = erl_scan:options()
Result = parse_ret()
parse_ret() =
{好的,
表達式列表::[erl_parse:abstract_expr()],
結束地點::location()} |
{eof,結束位置::location()} |
{錯誤,
錯誤信息::erl_scan:error_info()|erl_parse:error_info(),
錯誤位置::location()} |
server_no_data()
{好的,
表達式列表::[erl_parse:abstract_expr()],
結束地點::location()} |
{eof,結束位置::location()} |
{錯誤,
錯誤信息::erl_scan:error_info()|erl_parse:error_info(),
錯誤位置::location()} |
server_no_data()
server_no_data() = {錯誤,錯誤說明::term()} |埃夫
從標準輸入讀取數據(IoDevice
),提示它Prompt
。在指定位置開始閱讀StartLocation
(1
)。爭論Options
作為參數傳遞Options
函數的
erl_scan:tokens/4
。數據被標記並解析,就像它是 Erlang 表達式序列一樣,直到最後一個點 (.
) 到達了。
該函數返回:
{ok, ExprList, EndLocation}
-
解析成功。
{eof, EndLocation}
-
標記生成器遇到文件結尾。
eof
-
I/O 服務器遇到文件結尾。
{error, ErrorInfo, ErrorLocation}
-
標記化或解析時發生錯誤。
{error, ErrorDescription}
-
其他(罕見)錯誤情況,例如從 NFS 文件係統讀取時為
{error, estale}
。
例子:
25> io:parse_erl_exprs('enter>').
enter>abc(), "hey".
{ok, [{call,1,{atom,1,abc},[]},{string,1,"hey"}],2}
26> io:parse_erl_exprs ('enter>').
enter>abc("hey".
{error,{1,erl_parse,["syntax error before: ",["'.'"]]},2}
相關用法
- erlang parse(URIString)用法及代碼示例
- erlang part(Subject, PosLen)用法及代碼示例
- erlang partition(Pred, List)用法及代碼示例
- erlang partition(SetOfSets)用法及代碼示例
- erlang partition(SetFun, Set)用法及代碼示例
- erlang partition(SetFun, Set1, Set2)用法及代碼示例
- erlang partition_family(SetFun, Set)用法及代碼示例
- erlang pad(String, Length)用法及代碼示例
- erlang put用法及代碼示例
- erlang ports用法及代碼示例
- erlang processes用法及代碼示例
- erlang pid_to_list用法及代碼示例
- erlang pid_to_list(Pid)用法及代碼示例
- erlang processes()用法及代碼示例
- erlang put(Key, Val)用法及代碼示例
- erlang print(DataOrStats, Options)用法及代碼示例
- erlang peek(Q :: queue(Item))用法及代碼示例
- erlang peek_r(Q :: queue(Item))用法及代碼示例
- erlang pseudo(Master, ServerList)用法及代碼示例
- erlang perf_counter(Unit)用法及代碼示例
- erlang put(Key, Value, Map1)用法及代碼示例
- erlang prefix(String :: unicode:chardata(), Prefix :: unicode:chardata())用法及代碼示例
- erlang product(TupleOfSets)用法及代碼示例
- erlang product(Set1, Set2)用法及代碼示例
- erlang projection(SetFun, Set1)用法及代碼示例
注:本文由純淨天空篩選整理自erlang.org大神的英文原創作品 parse_erl_exprs(Prompt) -> Result。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。