<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- erl_syntax_lib</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/syntax_tools-1.6.9.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Syntax_Tools</strong><br><strong>Reference Manual</strong><br><small>Version 1.6.9</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="no" title="epp_dodger " expanded="false">epp_dodger<ul> <li><a href="epp_dodger.html"> Top of manual page </a></li> <li title="parse-1"><a href="epp_dodger.html#parse-1">parse/1</a></li> <li title="parse-2"><a href="epp_dodger.html#parse-2">parse/2</a></li> <li title="parse-3"><a href="epp_dodger.html#parse-3">parse/3</a></li> <li title="parse_file-1"><a href="epp_dodger.html#parse_file-1">parse_file/1</a></li> <li title="parse_file-2"><a href="epp_dodger.html#parse_file-2">parse_file/2</a></li> <li title="parse_form-2"><a href="epp_dodger.html#parse_form-2">parse_form/2</a></li> <li title="parse_form-3"><a href="epp_dodger.html#parse_form-3">parse_form/3</a></li> <li title="quick_parse-1"><a href="epp_dodger.html#quick_parse-1">quick_parse/1</a></li> <li title="quick_parse-2"><a href="epp_dodger.html#quick_parse-2">quick_parse/2</a></li> <li title="quick_parse-3"><a href="epp_dodger.html#quick_parse-3">quick_parse/3</a></li> <li title="quick_parse_file-1"><a href="epp_dodger.html#quick_parse_file-1">quick_parse_file/1</a></li> <li title="quick_parse_file-2"><a href="epp_dodger.html#quick_parse_file-2">quick_parse_file/2</a></li> <li title="quick_parse_form-2"><a href="epp_dodger.html#quick_parse_form-2">quick_parse_form/2</a></li> <li title="quick_parse_form-3"><a href="epp_dodger.html#quick_parse_form-3">quick_parse_form/3</a></li> <li title="tokens_to_string-1"><a href="epp_dodger.html#tokens_to_string-1">tokens_to_string/1</a></li> </ul> </li> <li id="no" title="erl_comment_scan " expanded="false">erl_comment_scan<ul> <li><a href="erl_comment_scan.html"> Top of manual page </a></li> <li title="file-1"><a href="erl_comment_scan.html#file-1">file/1</a></li> <li title="join_lines-1"><a href="erl_comment_scan.html#join_lines-1">join_lines/1</a></li> <li title="scan_lines-1"><a href="erl_comment_scan.html#scan_lines-1">scan_lines/1</a></li> <li title="string-1"><a href="erl_comment_scan.html#string-1">string/1</a></li> </ul> </li> <li id="no" title="erl_prettypr " expanded="false">erl_prettypr<ul> <li><a href="erl_prettypr.html"> Top of manual page </a></li> <li title="best-1"><a href="erl_prettypr.html#best-1">best/1</a></li> <li title="best-2"><a href="erl_prettypr.html#best-2">best/2</a></li> <li title="format-1"><a href="erl_prettypr.html#format-1">format/1</a></li> <li title="format-2"><a href="erl_prettypr.html#format-2">format/2</a></li> <li title="get_ctxt_hook-1"><a href="erl_prettypr.html#get_ctxt_hook-1">get_ctxt_hook/1</a></li> <li title="get_ctxt_linewidth-1"><a href="erl_prettypr.html#get_ctxt_linewidth-1">get_ctxt_linewidth/1</a></li> <li title="get_ctxt_paperwidth-1"><a href="erl_prettypr.html#get_ctxt_paperwidth-1">get_ctxt_paperwidth/1</a></li> <li title="get_ctxt_precedence-1"><a href="erl_prettypr.html#get_ctxt_precedence-1">get_ctxt_precedence/1</a></li> <li title="get_ctxt_user-1"><a href="erl_prettypr.html#get_ctxt_user-1">get_ctxt_user/1</a></li> <li title="layout-1"><a href="erl_prettypr.html#layout-1">layout/1</a></li> <li title="layout-2"><a href="erl_prettypr.html#layout-2">layout/2</a></li> <li title="set_ctxt_hook-2"><a href="erl_prettypr.html#set_ctxt_hook-2">set_ctxt_hook/2</a></li> <li title="set_ctxt_linewidth-2"><a href="erl_prettypr.html#set_ctxt_linewidth-2">set_ctxt_linewidth/2</a></li> <li title="set_ctxt_paperwidth-2"><a href="erl_prettypr.html#set_ctxt_paperwidth-2">set_ctxt_paperwidth/2</a></li> <li title="set_ctxt_precedence-2"><a href="erl_prettypr.html#set_ctxt_precedence-2">set_ctxt_precedence/2</a></li> <li title="set_ctxt_user-2"><a href="erl_prettypr.html#set_ctxt_user-2">set_ctxt_user/2</a></li> </ul> </li> <li id="no" title="erl_recomment " expanded="false">erl_recomment<ul> <li><a href="erl_recomment.html"> Top of manual page </a></li> <li title="quick_recomment_forms-2"><a href="erl_recomment.html#quick_recomment_forms-2">quick_recomment_forms/2</a></li> <li title="recomment_forms-2"><a href="erl_recomment.html#recomment_forms-2">recomment_forms/2</a></li> <li title="recomment_tree-2"><a href="erl_recomment.html#recomment_tree-2">recomment_tree/2</a></li> </ul> </li> <li id="no" title="erl_syntax " expanded="false">erl_syntax<ul> <li><a href="erl_syntax.html"> Top of manual page </a></li> <li title="abstract-1"><a href="erl_syntax.html#abstract-1">abstract/1</a></li> <li title="add_ann-2"><a href="erl_syntax.html#add_ann-2">add_ann/2</a></li> <li title="add_postcomments-2"><a href="erl_syntax.html#add_postcomments-2">add_postcomments/2</a></li> <li title="add_precomments-2"><a href="erl_syntax.html#add_precomments-2">add_precomments/2</a></li> <li title="application-2"><a href="erl_syntax.html#application-2">application/2</a></li> <li title="application-3"><a href="erl_syntax.html#application-3">application/3</a></li> <li title="application_arguments-1"><a href="erl_syntax.html#application_arguments-1">application_arguments/1</a></li> <li title="application_operator-1"><a href="erl_syntax.html#application_operator-1">application_operator/1</a></li> <li title="arity_qualifier-2"><a href="erl_syntax.html#arity_qualifier-2">arity_qualifier/2</a></li> <li title="arity_qualifier_argument-1"><a href="erl_syntax.html#arity_qualifier_argument-1">arity_qualifier_argument/1</a></li> <li title="arity_qualifier_body-1"><a href="erl_syntax.html#arity_qualifier_body-1">arity_qualifier_body/1</a></li> <li title="atom-1"><a href="erl_syntax.html#atom-1">atom/1</a></li> <li title="atom_literal-1"><a href="erl_syntax.html#atom_literal-1">atom_literal/1</a></li> <li title="atom_name-1"><a href="erl_syntax.html#atom_name-1">atom_name/1</a></li> <li title="atom_value-1"><a href="erl_syntax.html#atom_value-1">atom_value/1</a></li> <li title="attribute-1"><a href="erl_syntax.html#attribute-1">attribute/1</a></li> <li title="attribute-2"><a href="erl_syntax.html#attribute-2">attribute/2</a></li> <li title="attribute_arguments-1"><a href="erl_syntax.html#attribute_arguments-1">attribute_arguments/1</a></li> <li title="attribute_name-1"><a href="erl_syntax.html#attribute_name-1">attribute_name/1</a></li> <li title="binary-1"><a href="erl_syntax.html#binary-1">binary/1</a></li> <li title="binary_comp-2"><a href="erl_syntax.html#binary_comp-2">binary_comp/2</a></li> <li title="binary_comp_body-1"><a href="erl_syntax.html#binary_comp_body-1">binary_comp_body/1</a></li> <li title="binary_comp_template-1"><a href="erl_syntax.html#binary_comp_template-1">binary_comp_template/1</a></li> <li title="binary_field-1"><a href="erl_syntax.html#binary_field-1">binary_field/1</a></li> <li title="binary_field-2"><a href="erl_syntax.html#binary_field-2">binary_field/2</a></li> <li title="binary_field-3"><a href="erl_syntax.html#binary_field-3">binary_field/3</a></li> <li title="binary_field_body-1"><a href="erl_syntax.html#binary_field_body-1">binary_field_body/1</a></li> <li title="binary_field_size-1"><a href="erl_syntax.html#binary_field_size-1">binary_field_size/1</a></li> <li title="binary_field_types-1"><a href="erl_syntax.html#binary_field_types-1">binary_field_types/1</a></li> <li title="binary_fields-1"><a href="erl_syntax.html#binary_fields-1">binary_fields/1</a></li> <li title="binary_generator-2"><a href="erl_syntax.html#binary_generator-2">binary_generator/2</a></li> <li title="binary_generator_body-1"><a href="erl_syntax.html#binary_generator_body-1">binary_generator_body/1</a></li> <li title="binary_generator_pattern-1"><a href="erl_syntax.html#binary_generator_pattern-1">binary_generator_pattern/1</a></li> <li title="block_expr-1"><a href="erl_syntax.html#block_expr-1">block_expr/1</a></li> <li title="block_expr_body-1"><a href="erl_syntax.html#block_expr_body-1">block_expr_body/1</a></li> <li title="case_expr-2"><a href="erl_syntax.html#case_expr-2">case_expr/2</a></li> <li title="case_expr_argument-1"><a href="erl_syntax.html#case_expr_argument-1">case_expr_argument/1</a></li> <li title="case_expr_clauses-1"><a href="erl_syntax.html#case_expr_clauses-1">case_expr_clauses/1</a></li> <li title="catch_expr-1"><a href="erl_syntax.html#catch_expr-1">catch_expr/1</a></li> <li title="catch_expr_body-1"><a href="erl_syntax.html#catch_expr_body-1">catch_expr_body/1</a></li> <li title="char-1"><a href="erl_syntax.html#char-1">char/1</a></li> <li title="char_literal-1"><a href="erl_syntax.html#char_literal-1">char_literal/1</a></li> <li title="char_value-1"><a href="erl_syntax.html#char_value-1">char_value/1</a></li> <li title="class_qualifier-2"><a href="erl_syntax.html#class_qualifier-2">class_qualifier/2</a></li> <li title="class_qualifier_argument-1"><a href="erl_syntax.html#class_qualifier_argument-1">class_qualifier_argument/1</a></li> <li title="class_qualifier_body-1"><a href="erl_syntax.html#class_qualifier_body-1">class_qualifier_body/1</a></li> <li title="clause-2"><a href="erl_syntax.html#clause-2">clause/2</a></li> <li title="clause-3"><a href="erl_syntax.html#clause-3">clause/3</a></li> <li title="clause_body-1"><a href="erl_syntax.html#clause_body-1">clause_body/1</a></li> <li title="clause_guard-1"><a href="erl_syntax.html#clause_guard-1">clause_guard/1</a></li> <li title="clause_patterns-1"><a href="erl_syntax.html#clause_patterns-1">clause_patterns/1</a></li> <li title="comment-1"><a href="erl_syntax.html#comment-1">comment/1</a></li> <li title="comment-2"><a href="erl_syntax.html#comment-2">comment/2</a></li> <li title="comment_padding-1"><a href="erl_syntax.html#comment_padding-1">comment_padding/1</a></li> <li title="comment_text-1"><a href="erl_syntax.html#comment_text-1">comment_text/1</a></li> <li title="compact_list-1"><a href="erl_syntax.html#compact_list-1">compact_list/1</a></li> <li title="concrete-1"><a href="erl_syntax.html#concrete-1">concrete/1</a></li> <li title="cond_expr-1"><a href="erl_syntax.html#cond_expr-1">cond_expr/1</a></li> <li title="cond_expr_clauses-1"><a href="erl_syntax.html#cond_expr_clauses-1">cond_expr_clauses/1</a></li> <li title="conjunction-1"><a href="erl_syntax.html#conjunction-1">conjunction/1</a></li> <li title="conjunction_body-1"><a href="erl_syntax.html#conjunction_body-1">conjunction_body/1</a></li> <li title="cons-2"><a href="erl_syntax.html#cons-2">cons/2</a></li> <li title="copy_ann-2"><a href="erl_syntax.html#copy_ann-2">copy_ann/2</a></li> <li title="copy_attrs-2"><a href="erl_syntax.html#copy_attrs-2">copy_attrs/2</a></li> <li title="copy_comments-2"><a href="erl_syntax.html#copy_comments-2">copy_comments/2</a></li> <li title="copy_pos-2"><a href="erl_syntax.html#copy_pos-2">copy_pos/2</a></li> <li title="data-1"><a href="erl_syntax.html#data-1">data/1</a></li> <li title="disjunction-1"><a href="erl_syntax.html#disjunction-1">disjunction/1</a></li> <li title="disjunction_body-1"><a href="erl_syntax.html#disjunction_body-1">disjunction_body/1</a></li> <li title="eof_marker-0"><a href="erl_syntax.html#eof_marker-0">eof_marker/0</a></li> <li title="error_marker-1"><a href="erl_syntax.html#error_marker-1">error_marker/1</a></li> <li title="error_marker_info-1"><a href="erl_syntax.html#error_marker_info-1">error_marker_info/1</a></li> <li title="flatten_form_list-1"><a href="erl_syntax.html#flatten_form_list-1">flatten_form_list/1</a></li> <li title="float-1"><a href="erl_syntax.html#float-1">float/1</a></li> <li title="float_literal-1"><a href="erl_syntax.html#float_literal-1">float_literal/1</a></li> <li title="float_value-1"><a href="erl_syntax.html#float_value-1">float_value/1</a></li> <li title="form_list-1"><a href="erl_syntax.html#form_list-1">form_list/1</a></li> <li title="form_list_elements-1"><a href="erl_syntax.html#form_list_elements-1">form_list_elements/1</a></li> <li title="fun_expr-1"><a href="erl_syntax.html#fun_expr-1">fun_expr/1</a></li> <li title="fun_expr_arity-1"><a href="erl_syntax.html#fun_expr_arity-1">fun_expr_arity/1</a></li> <li title="fun_expr_clauses-1"><a href="erl_syntax.html#fun_expr_clauses-1">fun_expr_clauses/1</a></li> <li title="function-2"><a href="erl_syntax.html#function-2">function/2</a></li> <li title="function_arity-1"><a href="erl_syntax.html#function_arity-1">function_arity/1</a></li> <li title="function_clauses-1"><a href="erl_syntax.html#function_clauses-1">function_clauses/1</a></li> <li title="function_name-1"><a href="erl_syntax.html#function_name-1">function_name/1</a></li> <li title="generator-2"><a href="erl_syntax.html#generator-2">generator/2</a></li> <li title="generator_body-1"><a href="erl_syntax.html#generator_body-1">generator_body/1</a></li> <li title="generator_pattern-1"><a href="erl_syntax.html#generator_pattern-1">generator_pattern/1</a></li> <li title="get_ann-1"><a href="erl_syntax.html#get_ann-1">get_ann/1</a></li> <li title="get_attrs-1"><a href="erl_syntax.html#get_attrs-1">get_attrs/1</a></li> <li title="get_pos-1"><a href="erl_syntax.html#get_pos-1">get_pos/1</a></li> <li title="get_postcomments-1"><a href="erl_syntax.html#get_postcomments-1">get_postcomments/1</a></li> <li title="get_precomments-1"><a href="erl_syntax.html#get_precomments-1">get_precomments/1</a></li> <li title="has_comments-1"><a href="erl_syntax.html#has_comments-1">has_comments/1</a></li> <li title="if_expr-1"><a href="erl_syntax.html#if_expr-1">if_expr/1</a></li> <li title="if_expr_clauses-1"><a href="erl_syntax.html#if_expr_clauses-1">if_expr_clauses/1</a></li> <li title="implicit_fun-1"><a href="erl_syntax.html#implicit_fun-1">implicit_fun/1</a></li> <li title="implicit_fun-2"><a href="erl_syntax.html#implicit_fun-2">implicit_fun/2</a></li> <li title="implicit_fun-3"><a href="erl_syntax.html#implicit_fun-3">implicit_fun/3</a></li> <li title="implicit_fun_name-1"><a href="erl_syntax.html#implicit_fun_name-1">implicit_fun_name/1</a></li> <li title="infix_expr-3"><a href="erl_syntax.html#infix_expr-3">infix_expr/3</a></li> <li title="infix_expr_left-1"><a href="erl_syntax.html#infix_expr_left-1">infix_expr_left/1</a></li> <li title="infix_expr_operator-1"><a href="erl_syntax.html#infix_expr_operator-1">infix_expr_operator/1</a></li> <li title="infix_expr_right-1"><a href="erl_syntax.html#infix_expr_right-1">infix_expr_right/1</a></li> <li title="integer-1"><a href="erl_syntax.html#integer-1">integer/1</a></li> <li title="integer_literal-1"><a href="erl_syntax.html#integer_literal-1">integer_literal/1</a></li> <li title="integer_value-1"><a href="erl_syntax.html#integer_value-1">integer_value/1</a></li> <li title="is_atom-2"><a href="erl_syntax.html#is_atom-2">is_atom/2</a></li> <li title="is_char-2"><a href="erl_syntax.html#is_char-2">is_char/2</a></li> <li title="is_form-1"><a href="erl_syntax.html#is_form-1">is_form/1</a></li> <li title="is_integer-2"><a href="erl_syntax.html#is_integer-2">is_integer/2</a></li> <li title="is_leaf-1"><a href="erl_syntax.html#is_leaf-1">is_leaf/1</a></li> <li title="is_list_skeleton-1"><a href="erl_syntax.html#is_list_skeleton-1">is_list_skeleton/1</a></li> <li title="is_literal-1"><a href="erl_syntax.html#is_literal-1">is_literal/1</a></li> <li title="is_proper_list-1"><a href="erl_syntax.html#is_proper_list-1">is_proper_list/1</a></li> <li title="is_string-2"><a href="erl_syntax.html#is_string-2">is_string/2</a></li> <li title="is_tree-1"><a href="erl_syntax.html#is_tree-1">is_tree/1</a></li> <li title="join_comments-2"><a href="erl_syntax.html#join_comments-2">join_comments/2</a></li> <li title="list-1"><a href="erl_syntax.html#list-1">list/1</a></li> <li title="list-2"><a href="erl_syntax.html#list-2">list/2</a></li> <li title="list_comp-2"><a href="erl_syntax.html#list_comp-2">list_comp/2</a></li> <li title="list_comp_body-1"><a href="erl_syntax.html#list_comp_body-1">list_comp_body/1</a></li> <li title="list_comp_template-1"><a href="erl_syntax.html#list_comp_template-1">list_comp_template/1</a></li> <li title="list_elements-1"><a href="erl_syntax.html#list_elements-1">list_elements/1</a></li> <li title="list_head-1"><a href="erl_syntax.html#list_head-1">list_head/1</a></li> <li title="list_length-1"><a href="erl_syntax.html#list_length-1">list_length/1</a></li> <li title="list_prefix-1"><a href="erl_syntax.html#list_prefix-1">list_prefix/1</a></li> <li title="list_suffix-1"><a href="erl_syntax.html#list_suffix-1">list_suffix/1</a></li> <li title="list_tail-1"><a href="erl_syntax.html#list_tail-1">list_tail/1</a></li> <li title="macro-1"><a href="erl_syntax.html#macro-1">macro/1</a></li> <li title="macro-2"><a href="erl_syntax.html#macro-2">macro/2</a></li> <li title="macro_arguments-1"><a href="erl_syntax.html#macro_arguments-1">macro_arguments/1</a></li> <li title="macro_name-1"><a href="erl_syntax.html#macro_name-1">macro_name/1</a></li> <li title="make_tree-2"><a href="erl_syntax.html#make_tree-2">make_tree/2</a></li> <li title="match_expr-2"><a href="erl_syntax.html#match_expr-2">match_expr/2</a></li> <li title="match_expr_body-1"><a href="erl_syntax.html#match_expr_body-1">match_expr_body/1</a></li> <li title="match_expr_pattern-1"><a href="erl_syntax.html#match_expr_pattern-1">match_expr_pattern/1</a></li> <li title="meta-1"><a href="erl_syntax.html#meta-1">meta/1</a></li> <li title="module_qualifier-2"><a href="erl_syntax.html#module_qualifier-2">module_qualifier/2</a></li> <li title="module_qualifier_argument-1"><a href="erl_syntax.html#module_qualifier_argument-1">module_qualifier_argument/1</a></li> <li title="module_qualifier_body-1"><a href="erl_syntax.html#module_qualifier_body-1">module_qualifier_body/1</a></li> <li title="nil-0"><a href="erl_syntax.html#nil-0">nil/0</a></li> <li title="normalize_list-1"><a href="erl_syntax.html#normalize_list-1">normalize_list/1</a></li> <li title="operator-1"><a href="erl_syntax.html#operator-1">operator/1</a></li> <li title="operator_literal-1"><a href="erl_syntax.html#operator_literal-1">operator_literal/1</a></li> <li title="operator_name-1"><a href="erl_syntax.html#operator_name-1">operator_name/1</a></li> <li title="parentheses-1"><a href="erl_syntax.html#parentheses-1">parentheses/1</a></li> <li title="parentheses_body-1"><a href="erl_syntax.html#parentheses_body-1">parentheses_body/1</a></li> <li title="prefix_expr-2"><a href="erl_syntax.html#prefix_expr-2">prefix_expr/2</a></li> <li title="prefix_expr_argument-1"><a href="erl_syntax.html#prefix_expr_argument-1">prefix_expr_argument/1</a></li> <li title="prefix_expr_operator-1"><a href="erl_syntax.html#prefix_expr_operator-1">prefix_expr_operator/1</a></li> <li title="qualified_name-1"><a href="erl_syntax.html#qualified_name-1">qualified_name/1</a></li> <li title="qualified_name_segments-1"><a href="erl_syntax.html#qualified_name_segments-1">qualified_name_segments/1</a></li> <li title="query_expr-1"><a href="erl_syntax.html#query_expr-1">query_expr/1</a></li> <li title="query_expr_body-1"><a href="erl_syntax.html#query_expr_body-1">query_expr_body/1</a></li> <li title="receive_expr-1"><a href="erl_syntax.html#receive_expr-1">receive_expr/1</a></li> <li title="receive_expr-3"><a href="erl_syntax.html#receive_expr-3">receive_expr/3</a></li> <li title="receive_expr_action-1"><a href="erl_syntax.html#receive_expr_action-1">receive_expr_action/1</a></li> <li title="receive_expr_clauses-1"><a href="erl_syntax.html#receive_expr_clauses-1">receive_expr_clauses/1</a></li> <li title="receive_expr_timeout-1"><a href="erl_syntax.html#receive_expr_timeout-1">receive_expr_timeout/1</a></li> <li title="record_access-2"><a href="erl_syntax.html#record_access-2">record_access/2</a></li> <li title="record_access-3"><a href="erl_syntax.html#record_access-3">record_access/3</a></li> <li title="record_access_argument-1"><a href="erl_syntax.html#record_access_argument-1">record_access_argument/1</a></li> <li title="record_access_field-1"><a href="erl_syntax.html#record_access_field-1">record_access_field/1</a></li> <li title="record_access_type-1"><a href="erl_syntax.html#record_access_type-1">record_access_type/1</a></li> <li title="record_expr-2"><a href="erl_syntax.html#record_expr-2">record_expr/2</a></li> <li title="record_expr-3"><a href="erl_syntax.html#record_expr-3">record_expr/3</a></li> <li title="record_expr_argument-1"><a href="erl_syntax.html#record_expr_argument-1">record_expr_argument/1</a></li> <li title="record_expr_fields-1"><a href="erl_syntax.html#record_expr_fields-1">record_expr_fields/1</a></li> <li title="record_expr_type-1"><a href="erl_syntax.html#record_expr_type-1">record_expr_type/1</a></li> <li title="record_field-1"><a href="erl_syntax.html#record_field-1">record_field/1</a></li> <li title="record_field-2"><a href="erl_syntax.html#record_field-2">record_field/2</a></li> <li title="record_field_name-1"><a href="erl_syntax.html#record_field_name-1">record_field_name/1</a></li> <li title="record_field_value-1"><a href="erl_syntax.html#record_field_value-1">record_field_value/1</a></li> <li title="record_index_expr-2"><a href="erl_syntax.html#record_index_expr-2">record_index_expr/2</a></li> <li title="record_index_expr_field-1"><a href="erl_syntax.html#record_index_expr_field-1">record_index_expr_field/1</a></li> <li title="record_index_expr_type-1"><a href="erl_syntax.html#record_index_expr_type-1">record_index_expr_type/1</a></li> <li title="remove_comments-1"><a href="erl_syntax.html#remove_comments-1">remove_comments/1</a></li> <li title="revert-1"><a href="erl_syntax.html#revert-1">revert/1</a></li> <li title="revert_forms-1"><a href="erl_syntax.html#revert_forms-1">revert_forms/1</a></li> <li title="rule-2"><a href="erl_syntax.html#rule-2">rule/2</a></li> <li title="rule_arity-1"><a href="erl_syntax.html#rule_arity-1">rule_arity/1</a></li> <li title="rule_clauses-1"><a href="erl_syntax.html#rule_clauses-1">rule_clauses/1</a></li> <li title="rule_name-1"><a href="erl_syntax.html#rule_name-1">rule_name/1</a></li> <li title="set_ann-2"><a href="erl_syntax.html#set_ann-2">set_ann/2</a></li> <li title="set_attrs-2"><a href="erl_syntax.html#set_attrs-2">set_attrs/2</a></li> <li title="set_pos-2"><a href="erl_syntax.html#set_pos-2">set_pos/2</a></li> <li title="set_postcomments-2"><a href="erl_syntax.html#set_postcomments-2">set_postcomments/2</a></li> <li title="set_precomments-2"><a href="erl_syntax.html#set_precomments-2">set_precomments/2</a></li> <li title="size_qualifier-2"><a href="erl_syntax.html#size_qualifier-2">size_qualifier/2</a></li> <li title="size_qualifier_argument-1"><a href="erl_syntax.html#size_qualifier_argument-1">size_qualifier_argument/1</a></li> <li title="size_qualifier_body-1"><a href="erl_syntax.html#size_qualifier_body-1">size_qualifier_body/1</a></li> <li title="string-1"><a href="erl_syntax.html#string-1">string/1</a></li> <li title="string_literal-1"><a href="erl_syntax.html#string_literal-1">string_literal/1</a></li> <li title="string_value-1"><a href="erl_syntax.html#string_value-1">string_value/1</a></li> <li title="subtrees-1"><a href="erl_syntax.html#subtrees-1">subtrees/1</a></li> <li title="text-1"><a href="erl_syntax.html#text-1">text/1</a></li> <li title="text_string-1"><a href="erl_syntax.html#text_string-1">text_string/1</a></li> <li title="tree-1"><a href="erl_syntax.html#tree-1">tree/1</a></li> <li title="tree-2"><a href="erl_syntax.html#tree-2">tree/2</a></li> <li title="try_after_expr-2"><a href="erl_syntax.html#try_after_expr-2">try_after_expr/2</a></li> <li title="try_expr-2"><a href="erl_syntax.html#try_expr-2">try_expr/2</a></li> <li title="try_expr-3"><a href="erl_syntax.html#try_expr-3">try_expr/3</a></li> <li title="try_expr-4"><a href="erl_syntax.html#try_expr-4">try_expr/4</a></li> <li title="try_expr_after-1"><a href="erl_syntax.html#try_expr_after-1">try_expr_after/1</a></li> <li title="try_expr_body-1"><a href="erl_syntax.html#try_expr_body-1">try_expr_body/1</a></li> <li title="try_expr_clauses-1"><a href="erl_syntax.html#try_expr_clauses-1">try_expr_clauses/1</a></li> <li title="try_expr_handlers-1"><a href="erl_syntax.html#try_expr_handlers-1">try_expr_handlers/1</a></li> <li title="tuple-1"><a href="erl_syntax.html#tuple-1">tuple/1</a></li> <li title="tuple_elements-1"><a href="erl_syntax.html#tuple_elements-1">tuple_elements/1</a></li> <li title="tuple_size-1"><a href="erl_syntax.html#tuple_size-1">tuple_size/1</a></li> <li title="type-1"><a href="erl_syntax.html#type-1">type/1</a></li> <li title="underscore-0"><a href="erl_syntax.html#underscore-0">underscore/0</a></li> <li title="update_tree-2"><a href="erl_syntax.html#update_tree-2">update_tree/2</a></li> <li title="variable-1"><a href="erl_syntax.html#variable-1">variable/1</a></li> <li title="variable_literal-1"><a href="erl_syntax.html#variable_literal-1">variable_literal/1</a></li> <li title="variable_name-1"><a href="erl_syntax.html#variable_name-1">variable_name/1</a></li> <li title="warning_marker-1"><a href="erl_syntax.html#warning_marker-1">warning_marker/1</a></li> <li title="warning_marker_info-1"><a href="erl_syntax.html#warning_marker_info-1">warning_marker_info/1</a></li> </ul> </li> <li id="loadscrollpos" title="erl_syntax_lib " expanded="true">erl_syntax_lib<ul> <li><a href="erl_syntax_lib.html"> Top of manual page </a></li> <li title="analyze_application-1"><a href="erl_syntax_lib.html#analyze_application-1">analyze_application/1</a></li> <li title="analyze_attribute-1"><a href="erl_syntax_lib.html#analyze_attribute-1">analyze_attribute/1</a></li> <li title="analyze_export_attribute-1"><a href="erl_syntax_lib.html#analyze_export_attribute-1">analyze_export_attribute/1</a></li> <li title="analyze_file_attribute-1"><a href="erl_syntax_lib.html#analyze_file_attribute-1">analyze_file_attribute/1</a></li> <li title="analyze_form-1"><a href="erl_syntax_lib.html#analyze_form-1">analyze_form/1</a></li> <li title="analyze_forms-1"><a href="erl_syntax_lib.html#analyze_forms-1">analyze_forms/1</a></li> <li title="analyze_function-1"><a href="erl_syntax_lib.html#analyze_function-1">analyze_function/1</a></li> <li title="analyze_function_name-1"><a href="erl_syntax_lib.html#analyze_function_name-1">analyze_function_name/1</a></li> <li title="analyze_implicit_fun-1"><a href="erl_syntax_lib.html#analyze_implicit_fun-1">analyze_implicit_fun/1</a></li> <li title="analyze_import_attribute-1"><a href="erl_syntax_lib.html#analyze_import_attribute-1">analyze_import_attribute/1</a></li> <li title="analyze_module_attribute-1"><a href="erl_syntax_lib.html#analyze_module_attribute-1">analyze_module_attribute/1</a></li> <li title="analyze_record_attribute-1"><a href="erl_syntax_lib.html#analyze_record_attribute-1">analyze_record_attribute/1</a></li> <li title="analyze_record_expr-1"><a href="erl_syntax_lib.html#analyze_record_expr-1">analyze_record_expr/1</a></li> <li title="analyze_record_field-1"><a href="erl_syntax_lib.html#analyze_record_field-1">analyze_record_field/1</a></li> <li title="analyze_rule-1"><a href="erl_syntax_lib.html#analyze_rule-1">analyze_rule/1</a></li> <li title="analyze_wild_attribute-1"><a href="erl_syntax_lib.html#analyze_wild_attribute-1">analyze_wild_attribute/1</a></li> <li title="annotate_bindings-1"><a href="erl_syntax_lib.html#annotate_bindings-1">annotate_bindings/1</a></li> <li title="annotate_bindings-2"><a href="erl_syntax_lib.html#annotate_bindings-2">annotate_bindings/2</a></li> <li title="fold-3"><a href="erl_syntax_lib.html#fold-3">fold/3</a></li> <li title="fold_subtrees-3"><a href="erl_syntax_lib.html#fold_subtrees-3">fold_subtrees/3</a></li> <li title="foldl_listlist-3"><a href="erl_syntax_lib.html#foldl_listlist-3">foldl_listlist/3</a></li> <li title="function_name_expansions-1"><a href="erl_syntax_lib.html#function_name_expansions-1">function_name_expansions/1</a></li> <li title="is_fail_expr-1"><a href="erl_syntax_lib.html#is_fail_expr-1">is_fail_expr/1</a></li> <li title="limit-2"><a href="erl_syntax_lib.html#limit-2">limit/2</a></li> <li title="limit-3"><a href="erl_syntax_lib.html#limit-3">limit/3</a></li> <li title="map-2"><a href="erl_syntax_lib.html#map-2">map/2</a></li> <li title="map_subtrees-2"><a href="erl_syntax_lib.html#map_subtrees-2">map_subtrees/2</a></li> <li title="mapfold-3"><a href="erl_syntax_lib.html#mapfold-3">mapfold/3</a></li> <li title="mapfold_subtrees-3"><a href="erl_syntax_lib.html#mapfold_subtrees-3">mapfold_subtrees/3</a></li> <li title="mapfoldl_listlist-3"><a href="erl_syntax_lib.html#mapfoldl_listlist-3">mapfoldl_listlist/3</a></li> <li title="new_variable_name-1"><a href="erl_syntax_lib.html#new_variable_name-1">new_variable_name/1</a></li> <li title="new_variable_name-2"><a href="erl_syntax_lib.html#new_variable_name-2">new_variable_name/2</a></li> <li title="new_variable_names-2"><a href="erl_syntax_lib.html#new_variable_names-2">new_variable_names/2</a></li> <li title="new_variable_names-3"><a href="erl_syntax_lib.html#new_variable_names-3">new_variable_names/3</a></li> <li title="strip_comments-1"><a href="erl_syntax_lib.html#strip_comments-1">strip_comments/1</a></li> <li title="to_comment-1"><a href="erl_syntax_lib.html#to_comment-1">to_comment/1</a></li> <li title="to_comment-2"><a href="erl_syntax_lib.html#to_comment-2">to_comment/2</a></li> <li title="to_comment-3"><a href="erl_syntax_lib.html#to_comment-3">to_comment/3</a></li> <li title="variables-1"><a href="erl_syntax_lib.html#variables-1">variables/1</a></li> </ul> </li> <li id="no" title="erl_tidy " expanded="false">erl_tidy<ul> <li><a href="erl_tidy.html"> Top of manual page </a></li> <li title="dir-0"><a href="erl_tidy.html#dir-0">dir/0</a></li> <li title="dir-1"><a href="erl_tidy.html#dir-1">dir/1</a></li> <li title="dir-2"><a href="erl_tidy.html#dir-2">dir/2</a></li> <li title="file-1"><a href="erl_tidy.html#file-1">file/1</a></li> <li title="file-2"><a href="erl_tidy.html#file-2">file/2</a></li> <li title="module-1"><a href="erl_tidy.html#module-1">module/1</a></li> <li title="module-2"><a href="erl_tidy.html#module-2">module/2</a></li> </ul> </li> <li id="no" title="igor " expanded="false">igor<ul> <li><a href="igor.html"> Top of manual page </a></li> <li title="create_stubs-2"><a href="igor.html#create_stubs-2">create_stubs/2</a></li> <li title="merge-2"><a href="igor.html#merge-2">merge/2</a></li> <li title="merge-3"><a href="igor.html#merge-3">merge/3</a></li> <li title="merge_files-3"><a href="igor.html#merge_files-3">merge_files/3</a></li> <li title="merge_files-4"><a href="igor.html#merge_files-4">merge_files/4</a></li> <li title="merge_sources-3"><a href="igor.html#merge_sources-3">merge_sources/3</a></li> <li title="parse_transform-2"><a href="igor.html#parse_transform-2">parse_transform/2</a></li> <li title="rename-2"><a href="igor.html#rename-2">rename/2</a></li> <li title="rename-3"><a href="igor.html#rename-3">rename/3</a></li> </ul> </li> <li id="no" title="prettypr " expanded="false">prettypr<ul> <li><a href="prettypr.html"> Top of manual page </a></li> <li title="above-2"><a href="prettypr.html#above-2">above/2</a></li> <li title="beside-2"><a href="prettypr.html#beside-2">beside/2</a></li> <li title="best-3"><a href="prettypr.html#best-3">best/3</a></li> <li title="break-1"><a href="prettypr.html#break-1">break/1</a></li> <li title="empty-0"><a href="prettypr.html#empty-0">empty/0</a></li> <li title="floating-1"><a href="prettypr.html#floating-1">floating/1</a></li> <li title="floating-3"><a href="prettypr.html#floating-3">floating/3</a></li> <li title="follow-2"><a href="prettypr.html#follow-2">follow/2</a></li> <li title="follow-3"><a href="prettypr.html#follow-3">follow/3</a></li> <li title="format-1"><a href="prettypr.html#format-1">format/1</a></li> <li title="format-2"><a href="prettypr.html#format-2">format/2</a></li> <li title="format-3"><a href="prettypr.html#format-3">format/3</a></li> <li title="nest-2"><a href="prettypr.html#nest-2">nest/2</a></li> <li title="null_text-1"><a href="prettypr.html#null_text-1">null_text/1</a></li> <li title="par-1"><a href="prettypr.html#par-1">par/1</a></li> <li title="par-2"><a href="prettypr.html#par-2">par/2</a></li> <li title="sep-1"><a href="prettypr.html#sep-1">sep/1</a></li> <li title="text-1"><a href="prettypr.html#text-1">text/1</a></li> <li title="text_par-1"><a href="prettypr.html#text_par-1">text_par/1</a></li> <li title="text_par-2"><a href="prettypr.html#text_par-2">text_par/2</a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>erl_syntax_lib</h1></center> <h3>MODULE</h3> <div class="REFBODY">erl_syntax_lib</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">Support library for abstract Erlang syntax trees.</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>Support library for abstract Erlang syntax trees.</p> <p>This module contains utility functions for working with the abstract data type defined in the module <span class="bold_code"><a href="erl_syntax.html">erl_syntax</a></span>. </p></p></div> <h3><a name="id97604">DATA TYPES</a></h3> <div class="REFBODY"> <a name="types"></a> <dl> <dt><strong><span class="code">info_pair() = {key(), term()}</span></strong></dt> <dd> <a name="type-info_pair"></a> </dd> <dt><strong><span class="code">key() = attributes | errors | exports | functions | imports | module | records | rules | warnings</span></strong></dt> <dd> <a name="type-key"></a> </dd> <dt><strong><span class="code">ordset(T) = ordset(T) (see module //stdlib/ordsets)</span></strong></dt> <dd> <a name="type-ordset"></a> </dd> <dt><strong><span class="code">syntaxTree() = syntaxTree() (see module erl_syntax)</span></strong></dt> <dd> <a name="type-syntaxTree"></a> <p>An abstract syntax tree. See the <span class="bold_code"><a href="erl_syntax.html">erl_syntax</a></span> module for details.</p> </dd> </dl> </div> <h3>EXPORTS</h3> <p><a name="analyze_application-1"><span class="bold_code">analyze_application(Node::syntaxTree()) -> FunctionName | Arity</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">FunctionName = {atom(), Arity} | {ModuleName, FunctionName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Arity = integer()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ModuleName = atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_application-1"></a> <p>Returns the name of a called function. The result is a representation of the name of the applied function <span class="code">F/A</span>, if <span class="code">Node</span> represents a function application "<span class="code"><em>F</em>(<em>X_1</em>, ..., <em>X_A</em>)</span>". If the function is not explicitly named (i.e., <span class="code">F</span> is given by some expression), only the arity <span class="code">A</span> is returned.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed application expression. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_function_name-1">analyze_function_name/1</a></span>.</p> </p></div> <p><a name="analyze_attribute-1"><span class="bold_code">analyze_attribute(Node::syntaxTree()) -> preprocessor | {atom(), atom()}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_attribute-1"></a> <p>Analyzes an attribute node. If <span class="code">Node</span> represents a preprocessor directive, the atom <span class="code">preprocessor</span> is returned. Otherwise, if <span class="code">Node</span> represents a module attribute "<span class="code">-<em>Name</em>...</span>", a tuple <span class="code">{Name, Info}</span> is returned, where <span class="code">Info</span> depends on <span class="code">Name</span>, as follows: </p><dl> <dt><strong><span class="code">{module, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_module_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{export, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_export_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{import, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_import_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{file, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_file_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{record, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_record_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{Name, Info}</span></strong></dt> <dd><p>where <span class="code">{Name, Info} = analyze_wild_attribute(Node)</span>.</p></dd> </dl><p> The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed module attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_export_attribute-1">analyze_export_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_file_attribute-1">analyze_file_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_import_attribute-1">analyze_import_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_module_attribute-1">analyze_module_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_record_attribute-1">analyze_record_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_wild_attribute-1">analyze_wild_attribute/1</a></span>.</p> </p></div> <p><a name="analyze_export_attribute-1"><span class="bold_code">analyze_export_attribute(Node::syntaxTree()) -> [FunctionName]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ModuleName = atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_export_attribute-1"></a> <p>Returns the list of function names declared by an export attribute. We do not guarantee that each name occurs at most once in the list. The order of listing is not defined.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed export attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>.</p> </p></div> <p><a name="analyze_file_attribute-1"><span class="bold_code">analyze_file_attribute(Node::syntaxTree()) -> {string(), integer()}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_file_attribute-1"></a> <p>Returns the file name and line number of a <span class="code">file</span> attribute. The result is the pair <span class="code">{File, Line}</span> if <span class="code">Node</span> represents "<span class="code">-file(File, Line).</span>".</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed <span class="code">file</span> attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>.</p> </p></div> <p><a name="analyze_form-1"><span class="bold_code">analyze_form(Node::syntaxTree()) -> {atom(), term()} | atom()</span></a><br></p> <div class="REFBODY"><p><a name="analyze_form-1"></a> <p>Analyzes a "source code form" node. If <span class="code">Node</span> is a "form" type (cf. <span class="code">erl_syntax:is_form/1</span>), the returned value is a tuple <span class="code">{Type, Info}</span> where <span class="code">Type</span> is the node type and <span class="code">Info</span> depends on <span class="code">Type</span>, as follows: </p><dl> <dt><strong><span class="code">{attribute, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_attribute(Node)</span>.</p></dd> <dt><strong><span class="code">{error_marker, Info}</span></strong></dt> <dd><p>where <span class="code">Info = erl_syntax:error_marker_info(Node)</span>.</p></dd> <dt><strong><span class="code">{function, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_function(Node)</span>.</p></dd> <dt><strong><span class="code">{rule, Info}</span></strong></dt> <dd><p>where <span class="code">Info = analyze_rule(Node)</span>.</p></dd> <dt><strong><span class="code">{warning_marker, Info}</span></strong></dt> <dd><p>where <span class="code">Info = erl_syntax:warning_marker_info(Node)</span>.</p></dd> </dl><p> For other types of forms, only the node type is returned.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> is not well-formed. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_function-1">analyze_function/1</a></span>, <span class="bold_code"><a href="#analyze_rule-1">analyze_rule/1</a></span>, <span class="bold_code"><a href="erl_syntax.html#error_marker_info-1">erl_syntax:error_marker_info/1</a></span>, <span class="bold_code"><a href="erl_syntax.html#is_form-1">erl_syntax:is_form/1</a></span>, <span class="bold_code"><a href="erl_syntax.html#warning_marker_info-1">erl_syntax:warning_marker_info/1</a></span>.</p> </p></div> <p><a name="analyze_forms-1"><span class="bold_code">analyze_forms(Forms) -> [{Key, term()}]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Forms = syntaxTree() | [syntaxTree()]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Key = attributes | errors | exports | functions | imports | module | records | rules | warnings</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_forms-1"></a> <p>Analyzes a sequence of "program forms". The given <span class="code">Forms</span> may be a single syntax tree of type <span class="code">form_list</span>, or a list of "program form" syntax trees. The returned value is a list of pairs <span class="code">{Key, Info}</span>, where each value of <span class="code">Key</span> occurs at most once in the list; the absence of a particular key indicates that there is no well-defined value for that key.</p> <p>Each entry in the resulting list contains the following corresponding information about the program forms: </p><dl> <dt><strong><span class="code">{attributes, Attributes}</span></strong></dt> <dd> <ul> <li><p><span class="code">Attributes = [{atom(), term()}]</span></p></li> </ul> <p> <span class="code">Attributes</span> is a list of pairs representing the names and corresponding values of all so-called "wild" attributes (as e.g. "<span class="code">-compile(...)</span>") occurring in <span class="code">Forms</span> (cf. <span class="code">analyze_wild_attribute/1</span>). We do not guarantee that each name occurs at most once in the list. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{errors, Errors}</span></strong></dt> <dd> <ul> <li><p><span class="code">Errors = [term()]</span></p></li> </ul> <p> <span class="code">Errors</span> is the list of error descriptors of all <span class="code">error_marker</span> nodes that occur in <span class="code">Forms</span>. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{exports, Exports}</span></strong></dt> <dd> <ul> <li><p><span class="code">Exports = [FunctionName]</span></p></li> <li><p><span class="code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span></p></li> <li><p><span class="code">ModuleName = atom()</span></p></li> </ul> <p> <span class="code">Exports</span> is a list of representations of those function names that are listed by export declaration attributes in <span class="code">Forms</span> (cf. <span class="code">analyze_export_attribute/1</span>). We do not guarantee that each name occurs at most once in the list. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{functions, Functions}</span></strong></dt> <dd> <ul> <li><p><span class="code">Functions = [{atom(), integer()}]</span></p></li> </ul> <p> <span class="code">Functions</span> is a list of the names of the functions that are defined in <span class="code">Forms</span> (cf. <span class="code">analyze_function/1</span>). We do not guarantee that each name occurs at most once in the list. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{imports, Imports}</span></strong></dt> <dd> <ul> <li><p><span class="code">Imports = [{Module, Names}]</span></p></li> <li><p><span class="code">Module = atom()</span></p></li> <li><p><span class="code">Names = [FunctionName]</span></p></li> <li><p><span class="code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span></p></li> <li><p><span class="code">ModuleName = atom()</span></p></li> </ul> <p> <span class="code">Imports</span> is a list of pairs representing those module names and corresponding function names that are listed by import declaration attributes in <span class="code">Forms</span> (cf. <span class="code">analyze_import_attribute/1</span>), where each <span class="code">Module</span> occurs at most once in <span class="code">Imports</span>. We do not guarantee that each name occurs at most once in the lists of function names. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{module, ModuleName}</span></strong></dt> <dd> <ul> <li><p><span class="code">ModuleName = atom()</span></p></li> </ul> <p> <span class="code">ModuleName</span> is the name declared by a module attribute in <span class="code">Forms</span>. If no module name is defined in <span class="code">Forms</span>, the result will contain no entry for the <span class="code">module</span> key. If multiple module name declarations should occur, all but the first will be ignored.</p> </dd> <dt><strong><span class="code">{records, Records}</span></strong></dt> <dd> <ul> <li><p><span class="code">Records = [{atom(), Fields}]</span></p></li> <li><p><span class="code">Fields = [{atom(), Default}]</span></p></li> <li><p><span class="code">Default = none | syntaxTree()</span></p></li> </ul> <p> <span class="code">Records</span> is a list of pairs representing the names and corresponding field declarations of all record declaration attributes occurring in <span class="code">Forms</span>. For fields declared without a default value, the corresponding value for <span class="code">Default</span> is the atom <span class="code">none</span> (cf. <span class="code">analyze_record_attribute/1</span>). We do not guarantee that each record name occurs at most once in the list. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{rules, Rules}</span></strong></dt> <dd> <ul> <li><p><span class="code">Rules = [{atom(), integer()}]</span></p></li> </ul> <p> <span class="code">Rules</span> is a list of the names of the rules that are defined in <span class="code">Forms</span> (cf. <span class="code">analyze_rule/1</span>). We do not guarantee that each name occurs at most once in the list. The order of listing is not defined.</p> </dd> <dt><strong><span class="code">{warnings, Warnings}</span></strong></dt> <dd> <ul> <li><p><span class="code">Warnings = [term()]</span></p></li> </ul> <p> <span class="code">Warnings</span> is the list of error descriptors of all <span class="code">warning_marker</span> nodes that occur in <span class="code">Forms</span>. The order of listing is not defined.</p> </dd> </dl> <p>The evaluation throws <span class="code">syntax_error</span> if an ill-formed Erlang construct is encountered. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_export_attribute-1">analyze_export_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_function-1">analyze_function/1</a></span>, <span class="bold_code"><a href="#analyze_import_attribute-1">analyze_import_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_record_attribute-1">analyze_record_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_rule-1">analyze_rule/1</a></span>, <span class="bold_code"><a href="#analyze_wild_attribute-1">analyze_wild_attribute/1</a></span>, <span class="bold_code"><a href="erl_syntax.html#error_marker_info-1">erl_syntax:error_marker_info/1</a></span>, <span class="bold_code"><a href="erl_syntax.html#warning_marker_info-1">erl_syntax:warning_marker_info/1</a></span>.</p> </p></div> <p><a name="analyze_function-1"><span class="bold_code">analyze_function(Node::syntaxTree()) -> {atom(), integer()}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_function-1"></a> <p>Returns the name and arity of a function definition. The result is a pair <span class="code">{Name, A}</span> if <span class="code">Node</span> represents a function definition "<span class="code">Name(<em>P_1</em>, ..., <em>P_A</em>) -> ...</span>".</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed function definition. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_rule-1">analyze_rule/1</a></span>.</p> </p></div> <p><a name="analyze_function_name-1"><span class="bold_code">analyze_function_name(Node::syntaxTree()) -> FunctionName</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ModuleName = atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_function_name-1"></a> <p>Returns the function name represented by a syntax tree. If <span class="code">Node</span> represents a function name, such as "<span class="code">foo/1</span>" or "<span class="code">bloggs:fred/2</span>", a uniform representation of that name is returned. Different nestings of arity and module name qualifiers in the syntax tree does not affect the result.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed function name.</p> </p></div> <p><a name="analyze_implicit_fun-1"><span class="bold_code">analyze_implicit_fun(Node::syntaxTree()) -> FunctionName</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ModuleName = atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_implicit_fun-1"></a> <p>Returns the name of an implicit fun expression "<span class="code">fun <em>F</em></span>". The result is a representation of the function name <span class="code">F</span>. (Cf. <span class="code">analyze_function_name/1</span>.)</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed implicit fun. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_function_name-1">analyze_function_name/1</a></span>.</p> </p></div> <p><a name="analyze_import_attribute-1"><span class="bold_code">analyze_import_attribute(Node::syntaxTree()) -> {atom(), [FunctionName]} | atom()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">FunctionName = atom() | {atom(), integer()} | {ModuleName, FunctionName}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ModuleName = atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_import_attribute-1"></a> <p>Returns the module name and (if present) list of function names declared by an import attribute. The returned value is an atom <span class="code">Module</span> or a pair <span class="code">{Module, Names}</span>, where <span class="code">Names</span> is a list of function names declared as imported from the module named by <span class="code">Module</span>. We do not guarantee that each name occurs at most once in <span class="code">Names</span>. The order of listing is not defined.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed import attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>.</p> </p></div> <p><a name="analyze_module_attribute-1"><span class="bold_code">analyze_module_attribute(Node::syntaxTree()) -> Name::atom() | {Name::atom(), Variables::[atom()]}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_module_attribute-1"></a> <p>Returns the module name and possible parameters declared by a module attribute. If the attribute is a plain module declaration such as <span class="code">-module(name)</span>, the result is the module name. If the attribute is a parameterized module declaration, the result is a tuple containing the module name and a list of the parameter variable names.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed module attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>.</p> </p></div> <p><a name="analyze_record_attribute-1"><span class="bold_code">analyze_record_attribute(Node::syntaxTree()) -> {atom(), Fields}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Fields = [{atom(), none | syntaxTree()}]</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_record_attribute-1"></a> <p>Returns the name and the list of fields of a record declaration attribute. The result is a pair <span class="code">{Name, Fields}</span>, if <span class="code">Node</span> represents "<span class="code">-record(Name, {...}).</span>", where <span class="code">Fields</span> is a list of pairs <span class="code">{Label, Default}</span> for each field "<span class="code">Label</span>" or "<span class="code">Label = <em>Default</em></span>" in the declaration, listed in left-to-right order. If the field has no default-value declaration, the value for <span class="code">Default</span> will be the atom <span class="code">none</span>. We do not guarantee that each label occurs at most one in the list.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed record declaration attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_record_field-1">analyze_record_field/1</a></span>.</p> </p></div> <p><a name="analyze_record_expr-1"><span class="bold_code">analyze_record_expr(Node::syntaxTree()) -> {atom(), Info} | atom()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Info = {atom(), [{atom(), Value}]} | {atom(), atom()} | atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Value = none | syntaxTree()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_record_expr-1"></a> <p>Returns the record name and field name/names of a record expression. If <span class="code">Node</span> has type <span class="code">record_expr</span>, <span class="code">record_index_expr</span> or <span class="code">record_access</span>, a pair <span class="code">{Type, Info}</span> is returned, otherwise an atom <span class="code">Type</span> is returned. <span class="code">Type</span> is the node type of <span class="code">Node</span>, and <span class="code">Info</span> depends on <span class="code">Type</span>, as follows: </p><dl> <dt><strong><span class="code">record_expr</span>:</strong></dt> <dd><p><span class="code">{atom(), [{atom(), Value}]}</span></p></dd> <dt><strong><span class="code">record_access</span>:</strong></dt> <dd><p><span class="code">{atom(), atom()} | atom()</span></p></dd> <dt><strong><span class="code">record_index_expr</span>:</strong></dt> <dd><p><span class="code">{atom(), atom()}</span></p></dd> </dl><p> </p><p>For a <span class="code">record_expr</span> node, <span class="code">Info</span> represents the record name and the list of descriptors for the involved fields, listed in the order they appear. (See <span class="code">analyze_record_field/1</span> for details on the field descriptors). For a <span class="code">record_access</span> node, <span class="code">Info</span> represents the record name and the field name (or if the record name is not included, only the field name; this is allowed only in Mnemosyne-query syntax). For a <span class="code">record_index_expr</span> node, <span class="code">Info</span> represents the record name and the name field name.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> represents a record expression that is not well-formed. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_record_attribute-1">analyze_record_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_record_field-1">analyze_record_field/1</a></span>.</p> </p></div> <p><a name="analyze_record_field-1"><span class="bold_code">analyze_record_field(Node::syntaxTree()) -> {atom(), Value}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Value = none | syntaxTree()</span><br> </div> </div> <div class="REFBODY"><p><a name="analyze_record_field-1"></a> <p>Returns the label and value-expression of a record field specifier. The result is a pair <span class="code">{Label, Value}</span>, if <span class="code">Node</span> represents "<span class="code">Label = <em>Value</em></span>" or "<span class="code">Label</span>", where in the first case, <span class="code">Value</span> is a syntax tree, and in the second case <span class="code">Value</span> is <span class="code">none</span>.</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed record field specifier. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_record_attribute-1">analyze_record_attribute/1</a></span>, <span class="bold_code"><a href="#analyze_record_expr-1">analyze_record_expr/1</a></span>.</p> </p></div> <p><a name="analyze_rule-1"><span class="bold_code">analyze_rule(Node::syntaxTree()) -> {atom(), integer()}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_rule-1"></a> <p>Returns the name and arity of a Mnemosyne rule. The result is a pair <span class="code">{Name, A}</span> if <span class="code">Node</span> represents a rule "<span class="code">Name(<em>P_1</em>, ..., <em>P_A</em>) :- ...</span>".</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed Mnemosyne rule. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_function-1">analyze_function/1</a></span>.</p> </p></div> <p><a name="analyze_wild_attribute-1"><span class="bold_code">analyze_wild_attribute(Node::syntaxTree()) -> {atom(), term()}</span></a><br></p> <div class="REFBODY"><p><a name="analyze_wild_attribute-1"></a> <p>Returns the name and value of a "wild" attribute. The result is the pair <span class="code">{Name, Value}</span>, if <span class="code">Node</span> represents "<span class="code">-Name(Value)</span>".</p> <p>Note that no checking is done whether <span class="code">Name</span> is a reserved attribute name such as <span class="code">module</span> or <span class="code">export</span>: it is assumed that the attribute is "wild".</p> <p>The evaluation throws <span class="code">syntax_error</span> if <span class="code">Node</span> does not represent a well-formed wild attribute. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_attribute-1">analyze_attribute/1</a></span>.</p> </p></div> <p><a name="annotate_bindings-1"><span class="bold_code">annotate_bindings(Tree::syntaxTree()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="annotate_bindings-1"></a> <p>Adds or updates annotations on nodes in a syntax tree. Equivalent to <span class="code">annotate_bindings(Tree, Bindings)</span> where the top-level environment <span class="code">Bindings</span> is taken from the annotation <span class="code">{env, Bindings}</span> on the root node of <span class="code">Tree</span>. An exception is thrown if no such annotation should exist. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#annotate_bindings-2">annotate_bindings/2</a></span>.</p> </p></div> <p><a name="annotate_bindings-2"><span class="bold_code">annotate_bindings(Tree::syntaxTree(), Bindings::ordset(atom())) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="annotate_bindings-2"></a> <p>Adds or updates annotations on nodes in a syntax tree. <span class="code">Bindings</span> specifies the set of bound variables in the environment of the top level node. The following annotations are affected: </p><ul> <li><p><span class="code">{env, Vars}</span>, representing the input environment of the subtree.</p></li> <li><p><span class="code">{bound, Vars}</span>, representing the variables that are bound in the subtree.</p></li> <li><p><span class="code">{free, Vars}</span>, representing the free variables in the subtree.</p></li> </ul><p> <span class="code">Bindings</span> and <span class="code">Vars</span> are ordered-set lists (cf. module <span class="code">ordsets</span>) of atoms representing variable names. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','ordsets.html');">ordsets(3)</a></span>, <span class="bold_code"><a href="#annotate_bindings-1">annotate_bindings/1</a></span>.</p> </p></div> <p><a name="fold-3"><span class="bold_code">fold(F::Function, Start::term(), Tree::syntaxTree()) -> term()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (syntaxTree(), term()) -> term()</span><br> </div> </div> <div class="REFBODY"><p><a name="fold-3"></a> <p>Folds a function over all nodes of a syntax tree. The result is the value of <span class="code">Function(X1, Function(X2, ... Function(Xn, Start) ... ))</span>, where <span class="code">[X1, X2, ..., Xn]</span> are the nodes of <span class="code">Tree</span> in a post-order traversal. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#fold_subtrees-3">fold_subtrees/3</a></span>, <span class="bold_code"><a href="#foldl_listlist-3">foldl_listlist/3</a></span>.</p> </p></div> <p><a name="fold_subtrees-3"><span class="bold_code">fold_subtrees(F::Function, Start::term(), Tree::syntaxTree()) -> term()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (syntaxTree(), term()) -> term()</span><br> </div> </div> <div class="REFBODY"><p><a name="fold_subtrees-3"></a> <p>Folds a function over the immediate subtrees of a syntax tree. This is similar to <span class="code">fold/3</span>, but only on the immediate subtrees of <span class="code">Tree</span>, in left-to-right order; it does not include the root node of <span class="code">Tree</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#fold-3">fold/3</a></span>.</p> </p></div> <p><a name="foldl_listlist-3"><span class="bold_code">foldl_listlist(F::Function, Start::term(), Ls::[[term()]]) -> term()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (term(), term()) -> term()</span><br> </div> </div> <div class="REFBODY"><p><a name="foldl_listlist-3"></a> <p>Like <span class="code">lists:foldl/3</span>, but over a list of lists. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','lists.html#foldl-3');">lists:foldl/3</a></span>, <span class="bold_code"><a href="#fold-3">fold/3</a></span>.</p> </p></div> <p><a name="function_name_expansions-1"><span class="bold_code">function_name_expansions(Names::[Name]) -> [{ShortName, Name}]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Name = ShortName | {atom(), Name}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">ShortName = atom() | {atom(), integer()}</span><br> </div> </div> <div class="REFBODY"><p><a name="function_name_expansions-1"></a> <p>Creates a mapping from corresponding short names to full function names. Names are represented by nested tuples of atoms and integers (cf. <span class="code">analyze_function_name/1</span>). The result is a list containing a pair <span class="code">{ShortName, Name}</span> for each element <span class="code">Name</span> in the given list, where the corresponding <span class="code">ShortName</span> is the rightmost-innermost part of <span class="code">Name</span>. The list thus represents a finite mapping from unqualified names to the corresponding qualified names.</p> <p>Note: the resulting list can contain more than one tuple <span class="code">{ShortName, Name}</span> for the same <span class="code">ShortName</span>, possibly with different values for <span class="code">Name</span>, depending on the given list. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#analyze_function_name-1">analyze_function_name/1</a></span>.</p> </p></div> <p><a name="is_fail_expr-1"><span class="bold_code">is_fail_expr(Tree::syntaxTree()) -> boolean()</span></a><br></p> <div class="REFBODY"><p><a name="is_fail_expr-1"></a> <p>Returns <span class="code">true</span> if <span class="code">Tree</span> represents an expression which never terminates normally. Note that the reverse does not apply. Currently, the detected cases are calls to <span class="code">exit/1</span>, <span class="code">throw/1</span>, <span class="code">erlang:error/1</span> and <span class="code">erlang:error/2</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#error-1');">erlang:error/1</a></span>, <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#error-2');">erlang:error/2</a></span>, <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#exit-1');">erlang:exit/1</a></span>, <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#throw-1');">erlang:throw/1</a></span>.</p> </p></div> <p><a name="limit-2"><span class="bold_code">limit(Tree, Depth) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="limit-2"></a> <p>Equivalent to <span class="code">limit(Tree, Depth, Text)</span> using the text <span class="code">"..."</span> as default replacement. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#limit-3">limit/3</a></span>, <span class="bold_code"><a href="erl_syntax.html#text-1">erl_syntax:text/1</a></span>.</p> </p></div> <p><a name="limit-3"><span class="bold_code">limit(Tree::syntaxTree(), Depth::integer(), Node::syntaxTree()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="limit-3"></a> <p>Limits a syntax tree to a specified depth. Replaces all non-leaf subtrees in <span class="code">Tree</span> at the given <span class="code">Depth</span> by <span class="code">Node</span>. If <span class="code">Depth</span> is negative, the result is always <span class="code">Node</span>, even if <span class="code">Tree</span> has no subtrees.</p> <p>When a group of subtrees (as e.g., the argument list of an <span class="code">application</span> node) is at the specified depth, and there are two or more subtrees in the group, these will be collectively replaced by <span class="code">Node</span> even if they are leaf nodes. Groups of subtrees that are above the specified depth will be limited in size, as if each subsequent tree in the group were one level deeper than the previous. E.g., if <span class="code">Tree</span> represents a list of integers "<span class="code">[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]</span>", the result of <span class="code">limit(Tree, 5)</span> will represent <span class="code">[1, 2, 3, 4, ...]</span>.</p> <p>The resulting syntax tree is typically only useful for pretty-printing or similar visual formatting. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#limit-2">limit/2</a></span>.</p> </p></div> <p><a name="map-2"><span class="bold_code">map(F::Function, Tree::syntaxTree()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (syntaxTree()) -> syntaxTree()</span><br> </div> </div> <div class="REFBODY"><p><a name="map-2"></a> <p>Applies a function to each node of a syntax tree. The result of each application replaces the corresponding original node. The order of traversal is bottom-up. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#map_subtrees-2">map_subtrees/2</a></span>.</p> </p></div> <p><a name="map_subtrees-2"><span class="bold_code">map_subtrees(F::Function, Tree::syntaxTree()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (Tree) -> Tree1</span><br> </div> </div> <div class="REFBODY"><p><a name="map_subtrees-2"></a> <p>Applies a function to each immediate subtree of a syntax tree. The result of each application replaces the corresponding original node. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#map-2">map/2</a></span>.</p> </p></div> <p><a name="mapfold-3"><span class="bold_code">mapfold(F::Function, Start::term(), Tree::syntaxTree()) -> {syntaxTree(), term()}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (syntaxTree(), term()) -> {syntaxTree(), term()}</span><br> </div> </div> <div class="REFBODY"><p><a name="mapfold-3"></a> <p>Combines map and fold in a single operation. This is similar to <span class="code">map/2</span>, but also propagates an extra value from each application of the <span class="code">Function</span> to the next, while doing a post-order traversal of the tree like <span class="code">fold/3</span>. The value <span class="code">Start</span> is passed to the first function application, and the final result is the result of the last application. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#fold-3">fold/3</a></span>, <span class="bold_code"><a href="#map-2">map/2</a></span>.</p> </p></div> <p><a name="mapfold_subtrees-3"><span class="bold_code">mapfold_subtrees(F::Function, Start::term(), Tree::syntaxTree()) -> {syntaxTree(), term()}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (syntaxTree(), term()) -> {syntaxTree(), term()}</span><br> </div> </div> <div class="REFBODY"><p><a name="mapfold_subtrees-3"></a> <p>Does a mapfold operation over the immediate subtrees of a syntax tree. This is similar to <span class="code">mapfold/3</span>, but only on the immediate subtrees of <span class="code">Tree</span>, in left-to-right order; it does not include the root node of <span class="code">Tree</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#mapfold-3">mapfold/3</a></span>.</p> </p></div> <p><a name="mapfoldl_listlist-3"><span class="bold_code">mapfoldl_listlist(F::Function, S::State, Ls::[[term()]]) -> {[[term()]], term()}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (term(), term()) -> {term(), term()}</span><br> </div> </div> <div class="REFBODY"><p><a name="mapfoldl_listlist-3"></a> <p>Like <span class="code">lists:mapfoldl/3</span>, but over a list of lists. The list of lists in the result has the same structure as the given list of lists.</p> </p></div> <p><a name="new_variable_name-1"><span class="bold_code">new_variable_name(Used::set(atom())) -> atom()</span></a><br></p> <div class="REFBODY"><p><a name="new_variable_name-1"></a> <p>Returns an atom which is not already in the set <span class="code">Used</span>. This is equivalent to <span class="code">new_variable_name(Function, Used)</span>, where <span class="code">Function</span> maps a given integer <span class="code">N</span> to the atom whose name consists of "<span class="code">V</span>" followed by the numeral for <span class="code">N</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#new_variable_name-2">new_variable_name/2</a></span>.</p> </p></div> <p><a name="new_variable_name-2"><span class="bold_code">new_variable_name(F::Function, Used::set(atom())) -> atom()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (integer()) -> atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="new_variable_name-2"></a> <p>Returns a user-named atom which is not already in the set <span class="code">Used</span>. The atom is generated by applying the given <span class="code">Function</span> to a generated integer. Integers are generated using an algorithm which tries to keep the names randomly distributed within a reasonably small range relative to the number of elements in the set.</p> <p>This function uses the module <span class="code">random</span> to generate new keys. The seed it uses may be initialized by calling <span class="code">random:seed/0</span> or <span class="code">random:seed/3</span> before this function is first called. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','random.html');">random(3)</a></span>, <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','sets.html');">sets(3)</a></span>, <span class="bold_code"><a href="#new_variable_name-1">new_variable_name/1</a></span>.</p> </p></div> <p><a name="new_variable_names-2"><span class="bold_code">new_variable_names(N::integer(), Used::set(atom())) -> [atom()]</span></a><br></p> <div class="REFBODY"><p><a name="new_variable_names-2"></a> <p>Like <span class="code">new_variable_name/1</span>, but generates a list of <span class="code">N</span> new names. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#new_variable_name-1">new_variable_name/1</a></span>.</p> </p></div> <p><a name="new_variable_names-3"><span class="bold_code">new_variable_names(N::integer(), F::Function, Used::set(atom())) -> [atom()]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Function = (integer()) -> atom()</span><br> </div> </div> <div class="REFBODY"><p><a name="new_variable_names-3"></a> <p>Like <span class="code">new_variable_name/2</span>, but generates a list of <span class="code">N</span> new names. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#new_variable_name-2">new_variable_name/2</a></span>.</p> </p></div> <p><a name="strip_comments-1"><span class="bold_code">strip_comments(Tree::syntaxTree()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="strip_comments-1"></a> <p>Removes all comments from all nodes of a syntax tree. All other attributes (such as position information) remain unchanged. Standalone comments in form lists are removed; any other standalone comments are changed into null-comments (no text, no indentation).</p> </p></div> <p><a name="to_comment-1"><span class="bold_code">to_comment(Tree) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="to_comment-1"></a> <p>Equivalent to <span class="bold_code"><a href="#to_comment-2">to_comment(Tree, "% ")</a></span>.</p> </p></div> <p><a name="to_comment-2"><span class="bold_code">to_comment(Tree::syntaxTree(), Prefix::string()) -> syntaxTree()</span></a><br></p> <div class="REFBODY"><p><a name="to_comment-2"></a> <p>Equivalent to <span class="code">to_comment(Tree, Prefix, F)</span> for a default formatting function <span class="code">F</span>. The default <span class="code">F</span> simply calls <span class="code">erl_prettypr:format/1</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#to_comment-3">to_comment/3</a></span>, <span class="bold_code"><a href="erl_prettypr.html#format-1">erl_prettypr:format/1</a></span>.</p> </p></div> <p><a name="to_comment-3"><span class="bold_code">to_comment(Tree::syntaxTree(), Prefix::string(), F::Printer) -> syntaxTree()</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Printer = (syntaxTree()) -> string()</span><br> </div> </div> <div class="REFBODY"><p><a name="to_comment-3"></a> <p>Transforms a syntax tree into an abstract comment. The lines of the comment contain the text for <span class="code">Node</span>, as produced by the given <span class="code">Printer</span> function. Each line of the comment is prefixed by the string <span class="code">Prefix</span> (this does not include the initial "<span class="code">%</span>" character of the comment line).</p> <p>For example, the result of <span class="code">to_comment(erl_syntax:abstract([a,b,c]))</span> represents </p><div class="example"><pre> %% [a,b,c]</pre></div><p> (cf. <span class="code">to_comment/1</span>).</p> <p>Note: the text returned by the formatting function will be split automatically into separate comment lines at each line break. No extra work is needed. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#to_comment-1">to_comment/1</a></span>, <span class="bold_code"><a href="#to_comment-2">to_comment/2</a></span>.</p> </p></div> <p><a name="variables-1"><span class="bold_code">variables(Tree::syntaxTree()) -> set(atom())</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">set(T) (see module //stdlib/sets)</span><br> </div> </div> <div class="REFBODY"><p><a name="variables-1"></a> <p>Returns the names of variables occurring in a syntax tree, The result is a set of variable names represented by atoms. Macro names are not included. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','stdlib','sets.html');">sets(3)</a></span>.</p> </p></div> Richard Carlsson carlsson.richard@gmail.com</div> <div class="footer"> <hr> <p>Copyright © 2006-2012 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>