<!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 -- prettypr</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="no" title="erl_syntax_lib " expanded="false">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="loadscrollpos" title="prettypr " expanded="true">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>prettypr</h1></center> <h3>MODULE</h3> <div class="REFBODY">prettypr</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">A generic pretty printer library.</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>A generic pretty printer library. This module uses a strict-style context passing implementation of John Hughes algorithm, described in "The design of a Pretty-printing Library". The paragraph-style formatting, empty documents, floating documents, and null strings are my own additions to the algorithm.</p> <p>To get started, you should read about the <span class="bold_code"><a href="#type-document">document()</a></span> data type; the main constructor functions: <span class="bold_code"><a href="#text-1">text/1</a></span>, <span class="bold_code"><a href="#above-2">above/2</a></span>, <span class="bold_code"><a href="#beside-2">beside/2</a></span>, <span class="bold_code"><a href="#nest-2">nest/2</a></span>, <span class="bold_code"><a href="#sep-1">sep/1</a></span>, and <span class="bold_code"><a href="#par-2">par/2</a></span>; and the main layout function <span class="bold_code"><a href="#format-3">format/3</a></span>.</p> <p>If you simply want to format a paragraph of plain text, you probably want to use the <span class="bold_code"><a href="#text_par-2">text_par/2</a></span> function, as in the following example: </p><div class="example"><pre> prettypr:format(prettypr:text_par("Lorem ipsum dolor sit amet"), 20)</pre></div></p></div> <h3><a name="id103504">DATA TYPES</a></h3> <div class="REFBODY"> <a name="types"></a> <dl> <dt><strong><span class="code">document()</span></strong></dt> <dd> <a name="type-document"></a> <p>An abstract character-based "document" representing a number of possible layouts, which can be processed to produce a single concrete layout. A concrete layout can then be rendered as a sequence of characters containing linebreaks, which can be passed to a printer or terminal that uses a fixed-width font.</p> <p>For example, a document <span class="code">sep([text("foo"), text("bar")])</span> represents the two layouts </p> <div class="example"><pre> foo bar</pre></div> <p> and </p> <div class="example"><pre> foo bar</pre></div> <p>Which layout is chosen depends on the available horizontal space. When processing a document, the main parameters are the <strong>paper width</strong> and the <strong>line width</strong> (also known as the "ribbon width"). In the resulting layout, no text should be printed beyond the paper width (which by default is 80 characters) as long as it can be avoided, and each single line of text (its indentation not counted, hence "ribbon") should preferably be no wider than the specified line width (which by default is 65).</p> <p>Documents can be joined into a single new document using the constructor functions of this module. Note that the new document often represents a larger number of possible layouts than just the sum of the components.</p> </dd> </dl> </div> <h3>EXPORTS</h3> <p><a name="above-2"><span class="bold_code">above(D1::document(), D2::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="above-2"></a> <p>Concatenates documents vertically. Returns a document representing the concatenation of the documents <span class="code">D1</span> and <span class="code">D2</span> such that the first line of <span class="code">D2</span> follows directly below the last line of <span class="code">D1</span>, and the first character of <span class="code">D2</span> is in the same horizontal column as the first character of <span class="code">D1</span>, in all possible layouts.</p> <p>Examples: </p><div class="example"><pre> ab cd => ab cd abc abc fgh => de de ij fgh ij</pre></div> </p></div> <p><a name="beside-2"><span class="bold_code">beside(D1::document(), D2::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="beside-2"></a> <p>Concatenates documents horizontally. Returns a document representing the concatenation of the documents <span class="code">D1</span> and <span class="code">D2</span> such that the last character of <span class="code">D1</span> is horizontally adjacent to the first character of <span class="code">D2</span>, in all possible layouts. (Note: any indentation of <span class="code">D2</span> is lost.)</p> <p>Examples: </p><div class="example"><pre> ab cd => abcd ab ef ab cd gh => cdef gh</pre></div> </p></div> <p><a name="best-3"><span class="bold_code">best(D::document(), PaperWidth::integer(), LineWidth::integer()) -> empty | document()</span></a><br></p> <div class="REFBODY"><p><a name="best-3"></a> <p>Selects a "best" layout for a document, creating a corresponding fixed-layout document. If no layout could be produced, the atom <span class="code">empty</span> is returned instead. For details about <span class="code">PaperWidth</span> and <span class="code">LineWidth</span>, see <span class="bold_code"><a href="#format-3">format/3</a></span>. The function is idempotent.</p> <p>One possible use of this function is to compute a fixed layout for a document, which can then be included as part of a larger document. For example: </p><div class="example"><pre> above(text("Example:"), nest(8, best(D, W - 12, L - 6)))</pre></div><p> will format <span class="code">D</span> as a displayed-text example indented by 8, whose right margin is indented by 4 relative to the paper width <span class="code">W</span> of the surrounding document, and whose maximum individual line length is shorter by 6 than the line length <span class="code">L</span> of the surrounding document.</p> <p>This function is used by the <span class="bold_code"><a href="#format-3">format/3</a></span> function to prepare a document before being laid out as text.</p> </p></div> <p><a name="break-1"><span class="bold_code">break(D::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="break-1"></a> <p>Forces a line break at the end of the given document. This is a utility function; see <span class="bold_code"><a href="#empty-0">empty/0</a></span> for details.</p> </p></div> <p><a name="empty-0"><span class="bold_code">empty() -> document()</span></a><br></p> <div class="REFBODY"><p><a name="empty-0"></a> <p>Yields the empty document, which has neither height nor width. (<span class="code">empty</span> is thus different from an empty <span class="bold_code"><a href="#text-1">text</a></span> string, which has zero width but height 1.)</p> <p>Empty documents are occasionally useful; in particular, they have the property that <span class="code">above(X, empty())</span> will force a new line after <span class="code">X</span> without leaving an empty line below it; since this is a common idiom, the utility function <span class="bold_code"><a href="#break-1">break/1</a></span> will place a given document in such a context. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#text-1">text/1</a></span>.</p> </p></div> <p><a name="floating-1"><span class="bold_code">floating(D::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="floating-1"></a> <p>Equivalent to <span class="bold_code"><a href="#floating-3">floating(D, 0, 0)</a></span>.</p> </p></div> <p><a name="floating-3"><span class="bold_code">floating(D::document(), Hp::integer(), Vp::integer()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="floating-3"></a> <p>Creates a "floating" document. The result represents the same set of layouts as <span class="code">D</span>; however, a floating document may be moved relative to other floating documents immediately beside or above it, according to their relative horizontal and vertical priorities. These priorities are set with the <span class="code">Hp</span> and <span class="code">Vp</span> parameters; if omitted, both default to zero.</p> <p>Notes: Floating documents appear to work well, but are currently less general than you might wish, losing effect when embedded in certain contexts. It is possible to nest floating-operators (even with different priorities), but the effects may be difficult to predict. In any case, note that the way the algorithm reorders floating documents amounts to a "bubblesort", so don't expect it to be able to sort large sequences of floating documents quickly.</p> </p></div> <p><a name="follow-2"><span class="bold_code">follow(D1::document(), D2::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="follow-2"></a> <p>Equivalent to <span class="bold_code"><a href="#follow-3">follow(D1, D2, 0)</a></span>.</p> </p></div> <p><a name="follow-3"><span class="bold_code">follow(D1::document(), D2::document(), Offset::integer()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="follow-3"></a> <p>Separates two documents by either a single space, or a line break and intentation. In other words, one of the layouts </p><div class="example"><pre> abc def</pre></div><p> or </p><div class="example"><pre> abc def</pre></div><p> will be generated, using the optional offset in the latter case. This is often useful for typesetting programming language constructs.</p> <p>This is a utility function; see <span class="bold_code"><a href="#par-2">par/2</a></span> for further details. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#follow-2">follow/2</a></span>.</p> </p></div> <p><a name="format-1"><span class="bold_code">format(D::document()) -> string()</span></a><br></p> <div class="REFBODY"><p><a name="format-1"></a> <p>Equivalent to <span class="bold_code"><a href="#format-2">format(D, 80)</a></span>.</p> </p></div> <p><a name="format-2"><span class="bold_code">format(D::document(), PaperWidth::integer()) -> string()</span></a><br></p> <div class="REFBODY"><p><a name="format-2"></a> <p>Equivalent to <span class="bold_code"><a href="#format-3">format(D, PaperWidth, 65)</a></span>.</p> </p></div> <p><a name="format-3"><span class="bold_code">format(D::document(), PaperWidth::integer(), LineWidth::integer()) -> string()</span></a><br></p> <div class="REFBODY"><p><a name="format-3"></a> <p>Computes a layout for a document and returns the corresponding text. See <span class="bold_code"><a href="#type-document">document()</a></span> for further information. Throws <span class="code">no_layout</span> if no layout could be selected.</p> <p><span class="code">PaperWidth</span> specifies the total width (in character positions) of the field for which the text is to be laid out. <span class="code">LineWidth</span> specifies the desired maximum width (in number of characters) of the text printed on any single line, disregarding leading and trailing white space. These parameters need to be properly balanced in order to produce good layouts. By default, <span class="code">PaperWidth</span> is 80 and <span class="code">LineWidth</span> is 65. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#best-3">best/3</a></span>.</p> </p></div> <p><a name="nest-2"><span class="bold_code">nest(N::integer(), D::document()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="nest-2"></a> <p>Indents a document a number of character positions to the right. Note that <span class="code">N</span> may be negative, shifting the text to the left, or zero, in which case <span class="code">D</span> is returned unchanged.</p> </p></div> <p><a name="null_text-1"><span class="bold_code">null_text(Characters::string()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="null_text-1"></a> <p>Similar to <span class="bold_code"><a href="#text-1">text/1</a></span>, but the result is treated as having zero width. This is regardless of the actual length of the string. Null text is typically used for markup, which is supposed to have no effect on the actual layout.</p> <p>The standard example is when formatting source code as HTML to be placed within <span class="code"><pre>...</pre></span> markup, and using e.g. <span class="code"><i></span> and <span class="code"><b></span> to make parts of the source code stand out. In this case, the markup does not add to the width of the text when viewed in an HTML browser, so the layout engine should simply pretend that the markup has zero width. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#empty-0">empty/0</a></span>, <span class="bold_code"><a href="#text-1">text/1</a></span>.</p> </p></div> <p><a name="par-1"><span class="bold_code">par(Docs::[document()]) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="par-1"></a> <p>Equivalent to <span class="bold_code"><a href="#par-2">par(Ds, 0)</a></span>.</p> </p></div> <p><a name="par-2"><span class="bold_code">par(Docs::[document()], Offset::integer()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="par-2"></a> <p>Arranges documents in a paragraph-like layout. Returns a document representing all possible left-aligned paragraph-like layouts of the (nonempty) sequence <span class="code">Docs</span> of documents. Elements in <span class="code">Docs</span> are separated horizontally by a single space character and vertically with a single line break. All lines following the first (if any) are indented to the same left column, whose indentation is specified by the optional <span class="code">Offset</span> parameter relative to the position of the first element in <span class="code">Docs</span>. For example, with an offset of -4, the following layout can be produced, for a list of documents representing the numbers 0 to 15:</p> <div class="example"><pre> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15</pre></div><p> or with an offset of +2: </p><div class="example"><pre> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15</pre></div> <p>The utility function <span class="bold_code"><a href="#text_par-2">text_par/2</a></span> can be used to easily transform a string of text into a <span class="code">par</span> representation by splitting it into words.</p> <p>Note that whenever a document in <span class="code">Docs</span> contains a line break, it will be placed on a separate line. Thus, neither a layout such as </p><div class="example"><pre> ab cd ef</pre></div><p> nor </p><div class="example"><pre> ab cd ef</pre></div><p> will be generated. However, a useful idiom for making the former variant possible (when wanted) is <span class="code">beside(par([D1, text("")], N), D2)</span> for two documents <span class="code">D1</span> and <span class="code">D2</span>. This will break the line between <span class="code">D1</span> and <span class="code">D2</span> if <span class="code">D1</span> contains a line break (or if otherwise necessary), and optionally further indent <span class="code">D2</span> by <span class="code">N</span> character positions. The utility function <span class="bold_code"><a href="#follow-3">follow/3</a></span> creates this context for two documents <span class="code">D1</span> and <span class="code">D2</span>, and an optional integer <span class="code">N</span>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#par-1">par/1</a></span>, <span class="bold_code"><a href="#text_par-2">text_par/2</a></span>.</p> </p></div> <p><a name="sep-1"><span class="bold_code">sep(Docs::[document()]) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="sep-1"></a> <p>Arranges documents horizontally or vertically, separated by whitespace. Returns a document representing two alternative layouts of the (nonempty) sequence <span class="code">Docs</span> of documents, such that either all elements in <span class="code">Docs</span> are concatenated horizontally, and separated by a space character, or all elements are concatenated vertically (without extra separation).</p> <p>Note: If some document in <span class="code">Docs</span> contains a line break, the vertical layout will always be selected.</p> <p>Examples: </p><div class="example"><pre> ab ab cd ef => ab cd ef | cd ef ab ab cd ef => cd ef</pre></div><p> </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#par-2">par/2</a></span>.</p> </p></div> <p><a name="text-1"><span class="bold_code">text(Characters::string()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="text-1"></a> <p>Yields a document representing a fixed, unbreakable sequence of characters. The string should contain only <strong>printable</strong> characters (tabs allowed but not recommended), and <strong>not</strong> newline, line feed, vertical tab, etc. A tab character (<span class="code">\t</span>) is interpreted as padding of 1-8 space characters to the next column of 8 characters <strong>within the string</strong>. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#empty-0">empty/0</a></span>, <span class="bold_code"><a href="#null_text-1">null_text/1</a></span>, <span class="bold_code"><a href="#text_par-2">text_par/2</a></span>.</p> </p></div> <p><a name="text_par-1"><span class="bold_code">text_par(Text::string()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="text_par-1"></a> <p>Equivalent to <span class="bold_code"><a href="#text_par-2">text_par(Text, 0)</a></span>.</p> </p></div> <p><a name="text_par-2"><span class="bold_code">text_par(Text::string(), Indentation::integer()) -> document()</span></a><br></p> <div class="REFBODY"><p><a name="text_par-2"></a> <p>Yields a document representing paragraph-formatted plain text. The optional <span class="code">Indentation</span> parameter specifies the extra indentation of the first line of the paragraph. For example, <span class="code">text_par("Lorem ipsum dolor sit amet", N)</span> could represent </p><div class="example"><pre> Lorem ipsum dolor sit amet</pre></div><p> if <span class="code">N</span> = 0, or </p><div class="example"><pre> Lorem ipsum dolor sit amet</pre></div><p> if <span class="code">N</span> = 2, or </p><div class="example"><pre> Lorem ipsum dolor sit amet</pre></div><p> if <span class="code">N</span> = -2.</p> <p>(The sign of the indentation is thus reversed compared to the <span class="bold_code"><a href="#par-2">par/2</a></span> function, and the behaviour varies slightly depending on the sign in order to match the expected layout of a paragraph of text.)</p> <p>Note that this is just a utility function, which does all the work of splitting the given string into words separated by whitespace and setting up a <span class="bold_code"><a href="#par-2">par</a></span> with the proper indentation, containing a list of <span class="bold_code"><a href="#text-1">text</a></span> elements. </p> <p><strong>See also:</strong> <span class="bold_code"><a href="#par-2">par/2</a></span>, <span class="bold_code"><a href="#text-1">text/1</a></span>, <span class="bold_code"><a href="#text_par-1">text_par/1</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>