From c6e01fe15d02dc704e5a9e77b59d2ee2db235976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=97=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=B2=D1=81=D0=BA=D0=B8=D0=B9?= Date: Mon, 19 Dec 2011 02:43:21 +0800 Subject: Add support for NULL value in odbc:param_query Support atom 'null' in odbc:param_query as database NULL value Fix "ODBC: received unexpected info:{tcp_closed, ...}" when connection is terminating. Fix possible access violation with 64bit ODBC. --- lib/odbc/c_src/odbcserver.c | 60 +++++++++++++++++++++++++++++++++------------ lib/odbc/c_src/odbcserver.h | 2 +- lib/odbc/src/odbc.erl | 31 +++++++++++++---------- 3 files changed, 63 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/odbc/c_src/odbcserver.c b/lib/odbc/c_src/odbcserver.c index ab2d7fe210..6d4460014f 100644 --- a/lib/odbc/c_src/odbcserver.c +++ b/lib/odbc/c_src/odbcserver.c @@ -176,7 +176,7 @@ static void encode_column_dyn(db_column column, int column_nr, static void encode_data_type(SQLSMALLINT sql_type, SQLINTEGER size, SQLSMALLINT decimal_digits, db_state *state); static Boolean decode_params(db_state *state, byte *buffer, int *index, param_array **params, - int i, int j); + int i, int j, int num_param_values); /*------------- Erlang port communication functions ----------------------*/ @@ -212,6 +212,7 @@ static db_column * alloc_column_buffer(int n); static void free_column_buffer(db_column **columns, int n); static void free_params(param_array **params, int cols); static void clean_state(db_state *state); +static SQLLEN* alloc_strlen_indptr(int n, int val); /* ------------- Init/map/bind/retrive functions -------------------------*/ @@ -1157,7 +1158,7 @@ static db_result_msg encode_out_params(db_state *state, break; case SQL_C_BIT: ei_x_encode_atom(&dynamic_buffer(state), - ((Boolean*)values)[j]==TRUE?"true":"false"); + ((byte*)values)[j]==TRUE?"true":"false"); break; default: ei_x_encode_atom(&dynamic_buffer(state), "error"); @@ -1579,37 +1580,48 @@ static void encode_data_type(SQLSMALLINT sql_type, SQLINTEGER size, } static Boolean decode_params(db_state *state, byte *buffer, int *index, param_array **params, - int i, int j) + int i, int j, int num_param_values) { int erl_type, size; long bin_size, l64; long val; param_array* param; TIMESTAMP_STRUCT* ts; + char atomarray[MAXATOMLEN+1]; ei_get_type(buffer, index, &erl_type, &size); param = &(*params)[i]; + if(erl_type == ERL_ATOM_EXT) { + ei_decode_atom(buffer, index, atomarray); + if(strncmp(atomarray, "null", 4) == 0 ) { + param->offset += param->type.len; + + if(!param->type.strlen_or_indptr_array) + param->type.strlen_or_indptr_array = alloc_strlen_indptr(num_param_values, param->type.len); + + param->type.strlen_or_indptr_array[j] = SQL_NULL_DATA; + return TRUE; + } + } + switch (param->type.c) { case SQL_C_CHAR: if (binary_strings(state)) { ei_decode_binary(buffer, index, &(param->values.string[param->offset]), &bin_size); param->offset += param->type.len; - param->type.strlen_or_indptr_array[j] = SQL_NTS; } else { if(erl_type != ERL_STRING_EXT) { return FALSE; } ei_decode_string(buffer, index, &(param->values.string[param->offset])); param->offset += param->type.len; - param->type.strlen_or_indptr_array[j] = SQL_NTS; } break; case SQL_C_WCHAR: ei_decode_binary(buffer, index, &(param->values.string[param->offset]), &bin_size); param->offset += param->type.len; - param->type.strlen_or_indptr_array[j] = SQL_NTS; break; case SQL_C_TYPE_TIMESTAMP: ts = (TIMESTAMP_STRUCT*) param->values.string; @@ -1661,9 +1673,13 @@ static Boolean decode_params(db_state *state, byte *buffer, int *index, param_ar if((erl_type != ERL_ATOM_EXT)) { return FALSE; } - ei_decode_boolean(buffer, index, &(param->values.bool[j])); + if (strncmp((char*)atomarray,"true",4) == 0) + param->values.bool[j] = TRUE; + else if (strncmp((char*)atomarray,"false",5) == 0) + param->values.bool[j] = FALSE; + else + return -1; break; - default: return FALSE; } @@ -2014,6 +2030,18 @@ static void clean_state(db_state *state) nr_of_columns(state) = 0; } +/* Allocates and fill with default value StrLen_or_IndPtr array */ +static SQLLEN* alloc_strlen_indptr(int n, int val) +{ + int i; + SQLLEN* arr = (SQLLEN*)safe_malloc(n * sizeof(SQLLEN)); + + for( i=0; i < n; ++i ) + arr[i] = val; + + return arr; +} + /* ------------- Init/map/bind/retrive functions ------------------------*/ /* Prepare the state for a connection */ @@ -2118,7 +2146,7 @@ static void init_param_column(param_array *params, byte *buffer, int *index, (double *)safe_malloc(num_param_values * params->type.len); } else if(params->type.c == SQL_C_CHAR) { params->type.strlen_or_indptr_array - = (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER)); + = alloc_strlen_indptr(num_param_values, SQL_NTS); params->values.string = (byte *)safe_malloc(num_param_values * sizeof(byte)* params->type.len); @@ -2136,8 +2164,8 @@ static void init_param_column(param_array *params, byte *buffer, int *index, params->type.len = length+1; params->type.c = SQL_C_CHAR; params->type.col_size = (SQLUINTEGER)length; - params->type.strlen_or_indptr_array = - (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER)); + params->type.strlen_or_indptr_array + = alloc_strlen_indptr(num_param_values, SQL_NTS); params->values.string = (byte *)safe_malloc(num_param_values * sizeof(byte)* params->type.len); @@ -2159,8 +2187,8 @@ static void init_param_column(param_array *params, byte *buffer, int *index, params->type.len = (length+1)*sizeof(SQLWCHAR); params->type.c = SQL_C_WCHAR; params->type.col_size = (SQLUINTEGER)length; - params->type.strlen_or_indptr_array = - (SQLLEN*)safe_malloc(num_param_values * sizeof(SQLINTEGER)); + params->type.strlen_or_indptr_array + = alloc_strlen_indptr(num_param_values, SQL_NTS); params->values.string = (byte *)safe_malloc(num_param_values * sizeof(byte) * params->type.len); @@ -2201,10 +2229,10 @@ static void init_param_column(param_array *params, byte *buffer, int *index, case USER_BOOLEAN: params->type.sql = SQL_BIT; params->type.c = SQL_C_BIT; - params->type.len = sizeof(Boolean); + params->type.len = sizeof(byte); params->type.col_size = params->type.len; params->values.bool = - (Boolean *)safe_malloc(num_param_values * params->type.len); + (byte *)safe_malloc(num_param_values * params->type.len); break; } params->offset = 0; @@ -2411,7 +2439,7 @@ static param_array * bind_parameter_arrays(byte *buffer, int *index, } for (j = 0; j < num_param_values; j++) { - if(!decode_params(state, buffer, index, ¶ms, i, j)) { + if(!decode_params(state, buffer, index, ¶ms, i, j, num_param_values)) { /* An input parameter was not of the expected type */ free_params(¶ms, i); return params; diff --git a/lib/odbc/c_src/odbcserver.h b/lib/odbc/c_src/odbcserver.h index 56b6148777..a76cedf1af 100644 --- a/lib/odbc/c_src/odbcserver.h +++ b/lib/odbc/c_src/odbcserver.h @@ -156,7 +156,7 @@ typedef struct { byte *string; SQLINTEGER *integer; double *floating; - Boolean *bool; + byte *bool; }values; } param_array; diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl index 36afd1abcf..e187679dc3 100644 --- a/lib/odbc/src/odbc.erl +++ b/lib/odbc/src/odbc.erl @@ -755,7 +755,10 @@ handle_info({'DOWN', _Ref, _Type, _Process, shutdown}, State) -> handle_info({'DOWN', _Ref, _Type, Process, Reason}, State) -> {stop, {stopped, {'EXIT', Process, Reason}}, State#state{reply_to = undefined}}; - + +handle_info({tcp_closed, Socket}, State = #state{odbc_socket=Socket, + state = disconnecting}) -> + {stop, normal, State}; %--------------------------------------------------------------------------- %% Catch all - throws away unknown messages (This could happen by "accident" %% so we do not want to crash, but we make a log entry as it is an @@ -942,9 +945,11 @@ fix_params({sql_bit, InOut, Values}) -> fix_params({'sql_timestamp', InOut, Values}) -> NewValues = case (catch - lists:map(fun({{Year,Month,Day},{Hour,Minute,Second}}) -> - {Year,Month,Day,Hour,Minute,Second} - end, Values)) of + lists:map( + fun({{Year,Month,Day},{Hour,Minute,Second}}) -> + {Year,Month,Day,Hour,Minute,Second}; + (null) -> null + end, Values)) of Result -> Result end, @@ -960,15 +965,15 @@ fix_inout(out) -> fix_inout(inout) -> ?INOUT. -string_terminate([Value| _ ] = Values) when is_list(Value)-> - case (catch - lists:map(fun(Str) -> Str ++ [?STR_TERMINATOR] end, Values)) of - Result -> - Result - end; -string_terminate([Value| _ ] = Values) when is_binary(Value)-> - case (catch - lists:map(fun(B) -> <> end, Values)) of +string_terminate(Values) -> + case (catch lists:map(fun string_terminate_value/1, Values)) of Result -> Result end. + +string_terminate_value(String) when is_list(String) -> + String ++ [?STR_TERMINATOR]; +string_terminate_value(Binary) when is_binary(Binary) -> + <>; +string_terminate_value(null) -> + null. -- cgit v1.2.3 From 933e701dac1936c6f15c765b5687fbc623464ec7 Mon Sep 17 00:00:00 2001 From: Mike Sperber Date: Thu, 22 Mar 2012 18:00:31 +0100 Subject: Unbreak floating point on middle-endian machines. On some ARMs (and maybe other platforms), doubles are stored with the the two 32-bit words reversed with respect to more common architectures. The symptom is this: > io_lib:write(1.0). "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005299808824" Detect that and account for it when decoding floats. --- lib/erl_interface/aclocal.m4 | 63 ++++++++++++++++++++++++++++++++++++++++++++ lib/odbc/aclocal.m4 | 63 ++++++++++++++++++++++++++++++++++++++++++++ lib/wx/aclocal.m4 | 63 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 189 insertions(+) (limited to 'lib') diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index 339a15a2bb..9c5bcd6dc6 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) @@ -606,6 +607,60 @@ ifelse([$5], , , [$5 fi ]) +dnl ---------------------------------------------------------------------- +dnl +dnl AC_DOUBLE_MIDDLE_ENDIAN +dnl +dnl Checks whether doubles are represented in "middle-endian" format. +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly, +dnl as well as DOUBLE_MIDDLE_ENDIAN. +dnl +dnl + +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, +[# It does not; compile a test program. +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[int +main(void) +{ + int i = 0; + int zero = 0; + union + { + double d; + char c[sizeof (double)]; + } v; + v.d = 1.0; + + + while (i < sizeof(double) / 2) + { + if (v.c[i] != 0) + zero = 1; + ++i; + } + exit (zero); +} +]])], + [ac_cv_c_double_middle_endian=no], + [ac_cv_c_double_middle_endian=yes], + [ac_cv_c_double_middle=unknown])]) +case $ac_cv_c_double_middle_endian in + yes) + m4_default([$1], + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1, + [Define to 1 if your processor stores the words in a double in + middle-endian format (like some ARMs).])]) ;; + no) + $2 ;; + *) + m4_default([$3], + [AC_MSG_ERROR([unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; +esac +])# AC_C_DOUBLE_MIDDLE_ENDIAN + dnl ---------------------------------------------------------------------- dnl @@ -1337,6 +1392,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian]) fi +case X$erl_xcomp_double_middle_endian in + X) ;; + Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; +esac + +AC_C_DOUBLE_MIDDLE_ENDIAN + AC_ARG_ENABLE(native-ethr-impls, AS_HELP_STRING([--disable-native-ethr-impls], [disable native ethread implementations]), diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index 339a15a2bb..9c5bcd6dc6 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) @@ -606,6 +607,60 @@ ifelse([$5], , , [$5 fi ]) +dnl ---------------------------------------------------------------------- +dnl +dnl AC_DOUBLE_MIDDLE_ENDIAN +dnl +dnl Checks whether doubles are represented in "middle-endian" format. +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly, +dnl as well as DOUBLE_MIDDLE_ENDIAN. +dnl +dnl + +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, +[# It does not; compile a test program. +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[int +main(void) +{ + int i = 0; + int zero = 0; + union + { + double d; + char c[sizeof (double)]; + } v; + v.d = 1.0; + + + while (i < sizeof(double) / 2) + { + if (v.c[i] != 0) + zero = 1; + ++i; + } + exit (zero); +} +]])], + [ac_cv_c_double_middle_endian=no], + [ac_cv_c_double_middle_endian=yes], + [ac_cv_c_double_middle=unknown])]) +case $ac_cv_c_double_middle_endian in + yes) + m4_default([$1], + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1, + [Define to 1 if your processor stores the words in a double in + middle-endian format (like some ARMs).])]) ;; + no) + $2 ;; + *) + m4_default([$3], + [AC_MSG_ERROR([unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; +esac +])# AC_C_DOUBLE_MIDDLE_ENDIAN + dnl ---------------------------------------------------------------------- dnl @@ -1337,6 +1392,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian]) fi +case X$erl_xcomp_double_middle_endian in + X) ;; + Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; +esac + +AC_C_DOUBLE_MIDDLE_ENDIAN + AC_ARG_ENABLE(native-ethr-impls, AS_HELP_STRING([--disable-native-ethr-impls], [disable native ethread implementations]), diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index 339a15a2bb..9c5bcd6dc6 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -59,6 +59,7 @@ AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only us dnl Cross compilation variables AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_double_middle_endian, [double-middle-endian system: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) @@ -606,6 +607,60 @@ ifelse([$5], , , [$5 fi ]) +dnl ---------------------------------------------------------------------- +dnl +dnl AC_DOUBLE_MIDDLE_ENDIAN +dnl +dnl Checks whether doubles are represented in "middle-endian" format. +dnl Sets ac_cv_double_middle_endian={no,yes,unknown} accordingly, +dnl as well as DOUBLE_MIDDLE_ENDIAN. +dnl +dnl + +AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], +[AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, +[# It does not; compile a test program. +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[int +main(void) +{ + int i = 0; + int zero = 0; + union + { + double d; + char c[sizeof (double)]; + } v; + v.d = 1.0; + + + while (i < sizeof(double) / 2) + { + if (v.c[i] != 0) + zero = 1; + ++i; + } + exit (zero); +} +]])], + [ac_cv_c_double_middle_endian=no], + [ac_cv_c_double_middle_endian=yes], + [ac_cv_c_double_middle=unknown])]) +case $ac_cv_c_double_middle_endian in + yes) + m4_default([$1], + [AC_DEFINE([DOUBLE_MIDDLE_ENDIAN], 1, + [Define to 1 if your processor stores the words in a double in + middle-endian format (like some ARMs).])]) ;; + no) + $2 ;; + *) + m4_default([$3], + [AC_MSG_ERROR([unknown double endianness +presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; +esac +])# AC_C_DOUBLE_MIDDLE_ENDIAN + dnl ---------------------------------------------------------------------- dnl @@ -1337,6 +1392,14 @@ if test "$ac_cv_c_bigendian" = "yes"; then AC_DEFINE(ETHR_BIGENDIAN, 1, [Define if bigendian]) fi +case X$erl_xcomp_double_middle_endian in + X) ;; + Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; +esac + +AC_C_DOUBLE_MIDDLE_ENDIAN + AC_ARG_ENABLE(native-ethr-impls, AS_HELP_STRING([--disable-native-ethr-impls], [disable native ethread implementations]), -- cgit v1.2.3 From eba4d247740189c3b8045edeaf8224651e77a3e0 Mon Sep 17 00:00:00 2001 From: Mike Sperber Date: Fri, 20 Jul 2012 11:27:47 +0200 Subject: Revise the autoconf tests for double middle endianness. The previous iteration didn't work for big-endian systems. Now use code very close to what Erts does internally. Also, only warn when the double endianness is unknown - i.e. when we're cross-compiling. --- lib/erl_interface/aclocal.m4 | 65 ++++++++++++++++++++++++++++++++++++-------- lib/odbc/aclocal.m4 | 65 ++++++++++++++++++++++++++++++++++++-------- lib/wx/aclocal.m4 | 65 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 162 insertions(+), 33 deletions(-) (limited to 'lib') diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index 9c5bcd6dc6..a76594d86f 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -621,25 +621,68 @@ AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], [AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, [# It does not; compile a test program. AC_RUN_IFELSE( -[AC_LANG_SOURCE([[int +[AC_LANG_SOURCE([[#include + +int main(void) { int i = 0; int zero = 0; + int bigendian; + int zero_index = 0; + + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + union { double d; - char c[sizeof (double)]; - } v; - v.d = 1.0; - - - while (i < sizeof(double) / 2) + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) + { + if (vint.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned long) == 4) + { + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) { - if (v.c[i] != 0) + if (vshort.c[zero_index] != 0) zero = 1; - ++i; } + exit (zero); } ]])], @@ -656,7 +699,7 @@ case $ac_cv_c_double_middle_endian in $2 ;; *) m4_default([$3], - [AC_MSG_ERROR([unknown double endianness + [AC_MSG_WARN([unknown double endianness presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; esac ])# AC_C_DOUBLE_MIDDLE_ENDIAN @@ -1394,7 +1437,7 @@ fi case X$erl_xcomp_double_middle_endian in X) ;; - Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; esac diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index 9c5bcd6dc6..a76594d86f 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -621,25 +621,68 @@ AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], [AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, [# It does not; compile a test program. AC_RUN_IFELSE( -[AC_LANG_SOURCE([[int +[AC_LANG_SOURCE([[#include + +int main(void) { int i = 0; int zero = 0; + int bigendian; + int zero_index = 0; + + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + union { double d; - char c[sizeof (double)]; - } v; - v.d = 1.0; - - - while (i < sizeof(double) / 2) + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) + { + if (vint.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned long) == 4) + { + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) { - if (v.c[i] != 0) + if (vshort.c[zero_index] != 0) zero = 1; - ++i; } + exit (zero); } ]])], @@ -656,7 +699,7 @@ case $ac_cv_c_double_middle_endian in $2 ;; *) m4_default([$3], - [AC_MSG_ERROR([unknown double endianness + [AC_MSG_WARN([unknown double endianness presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; esac ])# AC_C_DOUBLE_MIDDLE_ENDIAN @@ -1394,7 +1437,7 @@ fi case X$erl_xcomp_double_middle_endian in X) ;; - Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; esac diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index 9c5bcd6dc6..a76594d86f 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -621,25 +621,68 @@ AC_DEFUN([AC_C_DOUBLE_MIDDLE_ENDIAN], [AC_CACHE_CHECK(whether double word ordering is middle-endian, ac_cv_c_double_middle_endian, [# It does not; compile a test program. AC_RUN_IFELSE( -[AC_LANG_SOURCE([[int +[AC_LANG_SOURCE([[#include + +int main(void) { int i = 0; int zero = 0; + int bigendian; + int zero_index = 0; + + union + { + long int l; + char c[sizeof (long int)]; + } u; + + /* we'll use the one with 32-bit words */ + union + { + double d; + unsigned int c[2]; + } vint; + + union + { + double d; + unsigned long c[2]; + } vlong; + union { double d; - char c[sizeof (double)]; - } v; - v.d = 1.0; - - - while (i < sizeof(double) / 2) + unsigned short c[2]; + } vshort; + + + /* Are we little or big endian? From Harbison&Steele. */ + u.l = 1; + bigendian = (u.c[sizeof (long int) - 1] == 1); + + zero_index = bigendian ? 1 : 0; + + vint.d = 1.0; + vlong.d = 1.0; + vshort.d = 1.0; + + if (sizeof(unsigned int) == 4) + { + if (vint.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned long) == 4) + { + if (vlong.c[zero_index] != 0) + zero = 1; + } + else if (sizeof(unsigned short) == 4) { - if (v.c[i] != 0) + if (vshort.c[zero_index] != 0) zero = 1; - ++i; } + exit (zero); } ]])], @@ -656,7 +699,7 @@ case $ac_cv_c_double_middle_endian in $2 ;; *) m4_default([$3], - [AC_MSG_ERROR([unknown double endianness + [AC_MSG_WARN([unknown double endianness presetting ac_cv_c_double_middle_endian=no (or yes) will help])]) ;; esac ])# AC_C_DOUBLE_MIDDLE_ENDIAN @@ -1394,7 +1437,7 @@ fi case X$erl_xcomp_double_middle_endian in X) ;; - Xyes|Xno) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; + Xyes|Xno|Xunknown) ac_cv_c_double_middle_endian=$erl_xcomp_double_middle_endian;; *) AC_MSG_ERROR([Bad erl_xcomp_double_middle_endian value: $erl_xcomp_double_middle_endian]);; esac -- cgit v1.2.3 From 047ed337859241db5c7befebf8eee1c5333ee0dc Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Thu, 4 Aug 2011 22:32:22 +0200 Subject: removed CVS keywords from source files --- lib/syntax_tools/src/epp_dodger.erl | 2 -- lib/syntax_tools/src/erl_prettypr.erl | 2 -- lib/syntax_tools/src/erl_recomment.erl | 2 -- lib/syntax_tools/src/erl_syntax.erl | 2 -- lib/syntax_tools/src/erl_syntax_lib.erl | 2 -- lib/syntax_tools/src/erl_tidy.erl | 2 -- lib/syntax_tools/src/igor.erl | 2 -- lib/syntax_tools/src/prettypr.erl | 2 -- 8 files changed, 16 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl index 9f6f7d815e..c13dea2725 100644 --- a/lib/syntax_tools/src/epp_dodger.erl +++ b/lib/syntax_tools/src/epp_dodger.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 2001-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl index 7caf0b3db6..40975fde91 100644 --- a/lib/syntax_tools/src/erl_prettypr.erl +++ b/lib/syntax_tools/src/erl_prettypr.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1997-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/erl_recomment.erl b/lib/syntax_tools/src/erl_recomment.erl index fc7c515700..b5054b14fe 100644 --- a/lib/syntax_tools/src/erl_recomment.erl +++ b/lib/syntax_tools/src/erl_recomment.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1997-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 32fd3722d6..34ea2e81c1 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1997-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/erl_syntax_lib.erl b/lib/syntax_tools/src/erl_syntax_lib.erl index 97dfbfd7cd..f80e6732fc 100644 --- a/lib/syntax_tools/src/erl_syntax_lib.erl +++ b/lib/syntax_tools/src/erl_syntax_lib.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1997-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl index 09efc9c392..74bb4c855e 100644 --- a/lib/syntax_tools/src/erl_tidy.erl +++ b/lib/syntax_tools/src/erl_tidy.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1999-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl index aa933eb54b..82db686bfb 100644 --- a/lib/syntax_tools/src/igor.erl +++ b/lib/syntax_tools/src/igor.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 1998-2006 Richard Carlsson %% @author Richard Carlsson %% @end diff --git a/lib/syntax_tools/src/prettypr.erl b/lib/syntax_tools/src/prettypr.erl index c13fa30998..15bfc6c061 100644 --- a/lib/syntax_tools/src/prettypr.erl +++ b/lib/syntax_tools/src/prettypr.erl @@ -14,8 +14,6 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% %% @copyright 2000-2006 Richard Carlsson %% @author Richard Carlsson %% @end -- cgit v1.2.3 From f5c4822046d5c5434cd9a28b765ec6764566f17b Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Thu, 4 Aug 2011 22:40:45 +0200 Subject: updated author e-mail --- lib/syntax_tools/doc/overview.edoc | 6 +++++- lib/syntax_tools/src/epp_dodger.erl | 2 +- lib/syntax_tools/src/erl_comment_scan.erl | 2 +- lib/syntax_tools/src/erl_prettypr.erl | 2 +- lib/syntax_tools/src/erl_recomment.erl | 2 +- lib/syntax_tools/src/erl_syntax.erl | 2 +- lib/syntax_tools/src/erl_syntax_lib.erl | 2 +- lib/syntax_tools/src/erl_tidy.erl | 2 +- lib/syntax_tools/src/igor.erl | 2 +- lib/syntax_tools/src/prettypr.erl | 2 +- 10 files changed, 14 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/doc/overview.edoc b/lib/syntax_tools/doc/overview.edoc index 23eadce8fe..df02ad0b3a 100644 --- a/lib/syntax_tools/doc/overview.edoc +++ b/lib/syntax_tools/doc/overview.edoc @@ -1,5 +1,9 @@ + -*- html -*- -@author Richard Carlsson + Syntax Tools overview page + + +@author Richard Carlsson @copyright 1997-2004 Richard Carlsson @version {@version} @title Erlang Syntax Tools diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl index c13dea2725..b3ced34c14 100644 --- a/lib/syntax_tools/src/epp_dodger.erl +++ b/lib/syntax_tools/src/epp_dodger.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 2001-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl index 108ab3bffd..b833e1c069 100644 --- a/lib/syntax_tools/src/erl_comment_scan.erl +++ b/lib/syntax_tools/src/erl_comment_scan.erl @@ -16,7 +16,7 @@ %% %% ===================================================================== %% @copyright 1997-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl index 40975fde91..f4bbf975c3 100644 --- a/lib/syntax_tools/src/erl_prettypr.erl +++ b/lib/syntax_tools/src/erl_prettypr.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1997-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_recomment.erl b/lib/syntax_tools/src/erl_recomment.erl index b5054b14fe..7b2f9f7adb 100644 --- a/lib/syntax_tools/src/erl_recomment.erl +++ b/lib/syntax_tools/src/erl_recomment.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1997-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 34ea2e81c1..eaaafa2c67 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1997-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_syntax_lib.erl b/lib/syntax_tools/src/erl_syntax_lib.erl index f80e6732fc..36cd35f15d 100644 --- a/lib/syntax_tools/src/erl_syntax_lib.erl +++ b/lib/syntax_tools/src/erl_syntax_lib.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1997-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl index 74bb4c855e..59cf6c0a92 100644 --- a/lib/syntax_tools/src/erl_tidy.erl +++ b/lib/syntax_tools/src/erl_tidy.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1999-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl index 82db686bfb..37e561cbbe 100644 --- a/lib/syntax_tools/src/igor.erl +++ b/lib/syntax_tools/src/igor.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 1998-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== diff --git a/lib/syntax_tools/src/prettypr.erl b/lib/syntax_tools/src/prettypr.erl index 15bfc6c061..1b5ba6b05a 100644 --- a/lib/syntax_tools/src/prettypr.erl +++ b/lib/syntax_tools/src/prettypr.erl @@ -15,7 +15,7 @@ %% USA %% %% @copyright 2000-2006 Richard Carlsson -%% @author Richard Carlsson +%% @author Richard Carlsson %% @end %% ===================================================================== -- cgit v1.2.3 From 93f3ac8b57033237e7d4fc0c6ba0d32217f68668 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Fri, 20 Apr 2012 16:48:55 +0200 Subject: preserve line numbers when reverting representation --- lib/syntax_tools/src/erl_syntax.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index eaaafa2c67..67a2b4daa3 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -6491,9 +6491,13 @@ is_literal(T) -> revert(Node) -> case is_tree(Node) of false -> - %% Just remove any wrapper. `erl_parse' nodes never contain - %% abstract syntax tree nodes as subtrees. - unwrap(Node); + %% Just remove any wrapper and copy the position. `erl_parse' + %% nodes never contain abstract syntax tree nodes as subtrees. + case unwrap(Node) of + {error, Info} -> {error, setelement(1,Info,get_pos(Node))}; + {warning, Info} -> {warning, setelement(1,Info,get_pos(Node))}; + Node1 -> setelement(2,Node1,get_pos(Node)) + end; true -> case is_leaf(Node) of true -> -- cgit v1.2.3 From e22a2e7beb3337b2096f5bd1cd16fe3877e00d94 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Sat, 21 Apr 2012 00:16:42 +0200 Subject: removed obsolete @spec annotations and fixed some -spec and -type annotations --- lib/syntax_tools/src/erl_syntax.erl | 541 ++---------------------------------- 1 file changed, 23 insertions(+), 518 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 67a2b4daa3..a3cc8ba084 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -307,7 +307,7 @@ data/1, is_tree/1]). --export_type([forms/0, syntaxTree/0, syntaxTreeAttributes/0]). +-export_type([forms/0, syntaxTree/0, syntaxTreeAttributes/0, padding/0]). %% ===================================================================== %% IMPLEMENTATION NOTES: @@ -388,11 +388,16 @@ -record(wrapper, {type :: atom(), attr = #attr{} :: #attr{}, - tree :: term()}). + tree :: erl_parse()}). %% ===================================================================== --type syntaxTree() :: #tree{} | #wrapper{} | tuple(). % XXX: refine +-type syntaxTree() :: #tree{} | #wrapper{} | erl_parse(). + +-type erl_parse() :: erl_parse:abstract_form() | erl_parse:abstract_expr(). +%% The representation built by the Erlang standard library parser +%% `erl_parse'. This is a subset of the `syntaxTree' type. %% ===================================================================== %% @@ -402,8 +407,6 @@ %% ===================================================================== -%% @spec type(Node::syntaxTree()) -> atom() -%% %% @doc Returns the type tag of Node. If Node %% does not represent a syntax tree, evaluation fails with reason %% badarg. Node types currently defined by this module are: @@ -604,8 +607,6 @@ type(Node) -> %% ===================================================================== -%% @spec is_leaf(Node::syntaxTree()) -> boolean() -%% %% @doc Returns true if Node is a leaf node, %% otherwise false. The currently recognised leaf node %% types are: @@ -664,8 +665,6 @@ is_leaf(Node) -> %% ===================================================================== -%% @spec is_form(Node::syntaxTree()) -> boolean() -%% %% @doc Returns true if Node is a syntax tree %% representing a so-called "source code form", otherwise %% false. Forms are the Erlang source code units which, @@ -713,8 +712,6 @@ is_form(Node) -> %% ===================================================================== -%% @spec get_pos(Node::syntaxTree()) -> term() -%% %% @doc Returns the position information associated with %% Node. This is usually a nonnegative integer (indicating %% the source code line number), but may be any term. By default, all @@ -748,8 +745,6 @@ get_pos(Node) -> %% ===================================================================== -%% @spec set_pos(Node::syntaxTree(), Pos::term()) -> syntaxTree() -%% %% @doc Sets the position information of Node to %% Pos. %% @@ -772,9 +767,6 @@ set_pos(Node, Pos) -> %% ===================================================================== -%% @spec copy_pos(Source::syntaxTree(), Target::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Copies the position information from Source to %% Target. %% @@ -809,8 +801,6 @@ set_com(Node, Com) -> %% ===================================================================== -%% @spec get_precomments(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the associated pre-comments of a node. This is a %% possibly empty list of abstract comments, in top-down textual order. %% When the code is formatted, pre-comments are typically displayed @@ -844,9 +834,6 @@ get_precomments_1(#attr{com = #com{pre = Cs}}) -> Cs. %% ===================================================================== -%% @spec set_precomments(Node::syntaxTree(), -%% Comments::[syntaxTree()]) -> syntaxTree() -%% %% @doc Sets the pre-comments of Node to %% Comments. Comments should be a possibly %% empty list of abstract comments, in top-down textual order. @@ -878,9 +865,6 @@ set_precomments_1(#attr{com = Com} = Attr, Cs) -> %% ===================================================================== -%% @spec add_precomments(Comments::[syntaxTree()], -%% Node::syntaxTree()) -> syntaxTree() -%% %% @doc Appends Comments to the pre-comments of %% Node. %% @@ -913,8 +897,6 @@ add_precomments_1(Cs, #attr{com = Com} = Attr) -> %% ===================================================================== -%% @spec get_postcomments(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the associated post-comments of a node. This is a %% possibly empty list of abstract comments, in top-down textual order. %% When the code is formatted, post-comments are typically displayed to @@ -948,9 +930,6 @@ get_postcomments_1(#attr{com = #com{post = Cs}}) -> Cs. %% ===================================================================== -%% @spec set_postcomments(Node::syntaxTree(), -%% Comments::[syntaxTree()]) -> syntaxTree() -%% %% @doc Sets the post-comments of Node to %% Comments. Comments should be a possibly %% empty list of abstract comments, in top-down textual order @@ -982,9 +961,6 @@ set_postcomments_1(#attr{com = Com} = Attr, Cs) -> %% ===================================================================== -%% @spec add_postcomments(Comments::[syntaxTree()], -%% Node::syntaxTree()) -> syntaxTree() -%% %% @doc Appends Comments to the post-comments of %% Node. %% @@ -1017,8 +993,6 @@ add_postcomments_1(Cs, #attr{com = Com} = Attr) -> %% ===================================================================== -%% @spec has_comments(Node::syntaxTree()) -> boolean() -%% %% @doc Yields false if the node has no associated %% comments, and true otherwise. %% @@ -1048,8 +1022,6 @@ has_comments(_) -> false. %% ===================================================================== -%% @spec remove_comments(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Clears the associated comments of Node. %% %%

Note: This is equivalent to @@ -1073,9 +1045,6 @@ remove_comments(Node) -> %% ===================================================================== -%% @spec copy_comments(Source::syntaxTree(), Target::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Copies the pre- and postcomments from Source to %% Target. %% @@ -1097,9 +1066,6 @@ copy_comments(Source, Target) -> %% ===================================================================== -%% @spec join_comments(Source::syntaxTree(), Target::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Appends the comments of Source to the current %% comments of Target. %% @@ -1123,8 +1089,6 @@ join_comments(Source, Target) -> %% ===================================================================== -%% @spec get_ann(syntaxTree()) -> [term()] -%% %% @doc Returns the list of user annotations associated with a syntax %% tree node. For a newly created node, this is the empty list. The %% annotations may be any terms. @@ -1140,9 +1104,6 @@ get_ann(_) -> []. %% ===================================================================== -%% @spec set_ann(Node::syntaxTree(), Annotations::[term()]) -> -%% syntaxTree() -%% %% @doc Sets the list of user annotations of Node to %% Annotations. %% @@ -1166,8 +1127,6 @@ set_ann(Node, As) -> %% ===================================================================== -%% @spec add_ann(Annotation::term(), Node::syntaxTree()) -> syntaxTree() -%% %% @doc Appends the term Annotation to the list of user %% annotations of Node. %% @@ -1193,9 +1152,6 @@ add_ann(A, Node) -> %% ===================================================================== -%% @spec copy_ann(Source::syntaxTree(), Target::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Copies the list of user annotations from Source to %% Target. %% @@ -1212,8 +1168,6 @@ copy_ann(Source, Target) -> %% ===================================================================== -%% @spec get_attrs(syntaxTree()) -> syntaxTreeAttributes() -%% %% @doc Returns a representation of the attributes associated with a %% syntax tree node. The attributes are all the extra information that %% can be attached to a node. Currently, this includes position @@ -1245,9 +1199,6 @@ get_attrs(Node) -> #attr{pos = get_pos(Node), %% ===================================================================== -%% @spec set_attrs(Node::syntaxTree(), -%% Attributes::syntaxTreeAttributes()) -> syntaxTree() -%% %% @doc Sets the attributes of Node to %% Attributes. %% @@ -1268,9 +1219,6 @@ set_attrs(Node, Attr) -> %% ===================================================================== -%% @spec copy_attrs(Source::syntaxTree(), Target::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Copies the attributes from Source to %% Target. %% @@ -1287,7 +1235,6 @@ copy_attrs(S, T) -> %% ===================================================================== -%% @spec comment(Strings) -> syntaxTree() %% @equiv comment(none, Strings) -spec comment([string()]) -> syntaxTree(). @@ -1297,9 +1244,6 @@ comment(Strings) -> %% ===================================================================== -%% @spec comment(Padding, Strings::[string()]) -> syntaxTree() -%% Padding = none | integer() -%% %% @doc Creates an abstract comment with the given padding and text. If %% Strings is a (possibly empty) list %% ["Txt1", ..., "TxtN"], the result @@ -1336,8 +1280,6 @@ comment(Pad, Strings) -> %% ===================================================================== -%% @spec comment_text(syntaxTree()) -> [string()] -%% %% @doc Returns the lines of text of the abstract comment. %% %% @see comment/2 @@ -1349,8 +1291,6 @@ comment_text(Node) -> %% ===================================================================== -%% @spec comment_padding(syntaxTree()) -> none | integer() -%% %% @doc Returns the amount of padding before the comment, or %% none. The latter means that a default padding may be %% used. @@ -1364,8 +1304,6 @@ comment_padding(Node) -> %% ===================================================================== -%% @spec form_list(Forms::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract sequence of "source code forms". If %% Forms is [F1, ..., Fn], where each %% Fi is a form (cf. is_form/1, the result @@ -1399,8 +1337,6 @@ form_list(Forms) -> %% ===================================================================== -%% @spec form_list_elements(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of subnodes of a form_list node. %% %% @see form_list/1 @@ -1412,8 +1348,6 @@ form_list_elements(Node) -> %% ===================================================================== -%% @spec flatten_form_list(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Flattens sublists of a form_list node. Returns %% Node with all subtrees of type form_list %% recursively expanded, yielding a single "flat" abstract form @@ -1441,8 +1375,6 @@ flatten_form_list_1([], As) -> %% ===================================================================== -%% @spec text(String::string()) -> syntaxTree() -%% %% @doc Creates an abstract piece of source code text. The result %% represents exactly the sequence of characters in String. %% This is useful in cases when one wants full control of the resulting @@ -1461,8 +1393,6 @@ text(String) -> %% ===================================================================== -%% @spec text_string(syntaxTree()) -> string() -%% %% @doc Returns the character sequence represented by a %% text node. %% @@ -1475,9 +1405,6 @@ text_string(Node) -> %% ===================================================================== -%% @spec variable(Name) -> syntaxTree() -%% Name = atom() | string() -%% %% @doc Creates an abstract variable with the given name. %% Name may be any atom or string that represents a %% lexically valid variable name, but not a single underscore @@ -1515,8 +1442,6 @@ revert_variable(Node) -> %% ===================================================================== -%% @spec variable_name(syntaxTree()) -> atom() -%% %% @doc Returns the name of a variable node as an atom. %% %% @see variable/1 @@ -1533,8 +1458,6 @@ variable_name(Node) -> %% ===================================================================== -%% @spec variable_literal(syntaxTree()) -> string() -%% %% @doc Returns the name of a variable node as a string. %% %% @see variable/1 @@ -1551,8 +1474,6 @@ variable_literal(Node) -> %% ===================================================================== -%% @spec underscore() -> syntaxTree() -%% %% @doc Creates an abstract universal pattern ("_"). The %% lexical representation is a single underscore character. Note that %% this is not a variable, lexically speaking. @@ -1577,8 +1498,6 @@ revert_underscore(Node) -> %% ===================================================================== -%% @spec integer(Value::integer()) -> syntaxTree() -%% %% @doc Creates an abstract integer literal. The lexical representation %% is the canonical decimal numeral of Value. %% @@ -1606,8 +1525,6 @@ revert_integer(Node) -> %% ===================================================================== -%% @spec is_integer(Node::syntaxTree(), Value::integer()) -> boolean() -%% %% @doc Returns true if Node has type %% integer and represents Value, otherwise %% false. @@ -1628,8 +1545,6 @@ is_integer(Node, Value) -> %% ===================================================================== -%% @spec integer_value(syntaxTree()) -> integer() -%% %% @doc Returns the value represented by an integer node. %% %% @see integer/1 @@ -1646,8 +1561,6 @@ integer_value(Node) -> %% ===================================================================== -%% @spec integer_literal(syntaxTree()) -> string() -%% %% @doc Returns the numeral string represented by an %% integer node. %% @@ -1660,8 +1573,6 @@ integer_literal(Node) -> %% ===================================================================== -%% @spec float(Value::float()) -> syntaxTree() -%% %% @doc Creates an abstract floating-point literal. The lexical %% representation is the decimal floating-point numeral of %% Value. @@ -1699,8 +1610,6 @@ revert_float(Node) -> %% ===================================================================== -%% @spec float_value(syntaxTree()) -> float() -%% %% @doc Returns the value represented by a float node. Note %% that floating-point values should usually not be compared for %% equality. @@ -1719,8 +1628,6 @@ float_value(Node) -> %% ===================================================================== -%% @spec float_literal(syntaxTree()) -> string() -%% %% @doc Returns the numeral string represented by a float %% node. %% @@ -1733,8 +1640,6 @@ float_literal(Node) -> %% ===================================================================== -%% @spec char(Value::char()) -> syntaxTree() -%% %% @doc Creates an abstract character literal. The result represents %% "$Name", where Name corresponds to %% Value. @@ -1769,8 +1674,6 @@ revert_char(Node) -> %% ===================================================================== -%% @spec is_char(Node::syntaxTree(), Value::char()) -> boolean() -%% %% @doc Returns true if Node has type %% char and represents Value, otherwise %% false. @@ -1791,8 +1694,6 @@ is_char(Node, Value) -> %% ===================================================================== -%% @spec char_value(syntaxTree()) -> char() -%% %% @doc Returns the value represented by a char node. %% %% @see char/1 @@ -1809,8 +1710,6 @@ char_value(Node) -> %% ===================================================================== -%% @spec char_literal(syntaxTree()) -> string() -%% %% @doc Returns the literal string represented by a char %% node. This includes the leading "$" character. %% @@ -1823,8 +1722,6 @@ char_literal(Node) -> %% ===================================================================== -%% @spec string(Value::string()) -> syntaxTree() -%% %% @doc Creates an abstract string literal. The result represents %% "Text" (including the surrounding %% double-quotes), where Text corresponds to the sequence @@ -1859,8 +1756,6 @@ revert_string(Node) -> %% ===================================================================== -%% @spec is_string(Node::syntaxTree(), Value::string()) -> boolean() -%% %% @doc Returns true if Node has type %% string and represents Value, otherwise %% false. @@ -1881,8 +1776,6 @@ is_string(Node, Value) -> %% ===================================================================== -%% @spec string_value(syntaxTree()) -> string() -%% %% @doc Returns the value represented by a string node. %% %% @see string/1 @@ -1899,8 +1792,6 @@ string_value(Node) -> %% ===================================================================== -%% @spec string_literal(syntaxTree()) -> string() -%% %% @doc Returns the literal string represented by a string %% node. This includes surrounding double-quote characters. %% @@ -1913,9 +1804,6 @@ string_literal(Node) -> %% ===================================================================== -%% @spec atom(Name) -> syntaxTree() -%% Name = atom() | string() -%% %% @doc Creates an abstract atom literal. The print name of the atom is %% the character sequence represented by Name. %% @@ -1946,8 +1834,6 @@ revert_atom(Node) -> %% ===================================================================== -%% @spec is_atom(Node::syntaxTree(), Value::atom()) -> boolean() -%% %% @doc Returns true if Node has type %% atom and represents Value, otherwise %% false. @@ -1968,8 +1854,6 @@ is_atom(Node, Value) -> %% ===================================================================== -%% @spec atom_value(syntaxTree()) -> atom() -%% %% @doc Returns the value represented by an atom node. %% %% @see atom/1 @@ -1986,8 +1870,6 @@ atom_value(Node) -> %% ===================================================================== -%% @spec atom_name(syntaxTree()) -> string() -%% %% @doc Returns the printname of an atom node. %% %% @see atom/1 @@ -1999,8 +1881,6 @@ atom_name(Node) -> %% ===================================================================== -%% @spec atom_literal(syntaxTree()) -> string() -%% %% @doc Returns the literal string represented by an atom %% node. This includes surrounding single-quote characters if necessary. %% @@ -2019,8 +1899,6 @@ atom_literal(Node) -> %% ===================================================================== -%% @spec tuple(Elements::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract tuple. If Elements is %% [X1, ..., Xn], the result represents %% "{X1, ..., Xn}". @@ -2053,8 +1931,6 @@ revert_tuple(Node) -> %% ===================================================================== -%% @spec tuple_elements(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of element subtrees of a tuple %% node. %% @@ -2072,8 +1948,6 @@ tuple_elements(Node) -> %% ===================================================================== -%% @spec tuple_size(syntaxTree()) -> integer() -%% %% @doc Returns the number of elements of a tuple node. %% %%

Note: this is equivalent to @@ -2090,7 +1964,6 @@ tuple_size(Node) -> %% ===================================================================== -%% @spec list(List) -> syntaxTree() %% @equiv list(List, none) -spec list([syntaxTree()]) -> syntaxTree(). @@ -2100,10 +1973,6 @@ list(List) -> %% ===================================================================== -%% @spec list(List, Tail) -> syntaxTree() -%% List = [syntaxTree()] -%% Tail = none | syntaxTree() -%% %% @doc Constructs an abstract list skeleton. The result has type %% list or nil. If List is a %% nonempty list [E1, ..., En], the result has type @@ -2185,8 +2054,6 @@ revert_list(Node) -> S, P). %% ===================================================================== -%% @spec nil() -> syntaxTree() -%% %% @doc Creates an abstract empty list. The result represents %% "[]". The empty list is traditionally called "nil". %% @@ -2211,8 +2078,6 @@ revert_nil(Node) -> %% ===================================================================== -%% @spec list_prefix(Node::syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the prefix element subtrees of a list node. %% If Node represents "[E1, ..., %% En]" or "[E1, ..., En | @@ -2233,8 +2098,6 @@ list_prefix(Node) -> %% ===================================================================== -%% @spec list_suffix(Node::syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the suffix subtree of a list node, if one %% exists. If Node represents "[E1, ..., %% En | Tail]", the returned value is @@ -2271,8 +2134,6 @@ list_suffix(Node) -> %% ===================================================================== -%% @spec cons(Head::syntaxTree(), Tail::syntaxTree()) -> syntaxTree() -%% %% @doc "Optimising" list skeleton cons operation. Creates an abstract %% list skeleton whose first element is Head and whose tail %% corresponds to Tail. This is similar to @@ -2306,8 +2167,6 @@ cons(Head, Tail) -> %% ===================================================================== -%% @spec list_head(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Returns the head element subtree of a list node. If %% Node represents "[Head ...]", the %% result will represent "Head". @@ -2323,8 +2182,6 @@ list_head(Node) -> %% ===================================================================== -%% @spec list_tail(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Returns the tail of a list node. If %% Node represents a single-element list %% "[E]", then the result has type @@ -2356,8 +2213,6 @@ list_tail(Node) -> %% ===================================================================== -%% @spec is_list_skeleton(syntaxTree()) -> boolean() -%% %% @doc Returns true if Node has type %% list or nil, otherwise false. %% @@ -2375,8 +2230,6 @@ is_list_skeleton(Node) -> %% ===================================================================== -%% @spec is_proper_list(Node::syntaxTree()) -> boolean() -%% %% @doc Returns true if Node represents a %% proper list, and false otherwise. A proper list is a %% list skeleton either on the form "[]" or @@ -2415,8 +2268,6 @@ is_proper_list(Node) -> %% ===================================================================== -%% @spec list_elements(Node::syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of element subtrees of a list skeleton. %% Node must represent a proper list. E.g., if %% Node represents "[X1, X2 | @@ -2448,8 +2299,6 @@ list_elements(Node, As) -> %% ===================================================================== -%% @spec list_length(Node::syntaxTree()) -> integer() -%% %% @doc Returns the number of element subtrees of a list skeleton. %% Node must represent a proper list. E.g., if %% Node represents "[X1 | [X2, X3 | [X4, X5, @@ -2485,8 +2334,6 @@ list_length(Node, A) -> %% ===================================================================== -%% @spec normalize_list(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Expands an abstract list skeleton to its most explicit form. If %% Node represents "[E1, ..., En | %% Tail]", the result represents "[E1 | @@ -2526,8 +2373,6 @@ normalize_list_1(Es, Tail) -> %% ===================================================================== -%% @spec compact_list(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Yields the most compact form for an abstract list skeleton. The %% result either represents "[E1, ..., En | %% Tail]", where Tail is not a list @@ -2573,8 +2418,6 @@ compact_list(Node) -> %% ===================================================================== -%% @spec binary(Fields::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract binary-object template. If %% Fields is [F1, ..., Fn], the result %% represents "<<F1, ..., @@ -2609,8 +2452,6 @@ revert_binary(Node) -> %% ===================================================================== -%% @spec binary_fields(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of field subtrees of a binary %% node. %% @@ -2629,7 +2470,6 @@ binary_fields(Node) -> %% ===================================================================== -%% @spec binary_field(Body) -> syntaxTree() %% @equiv binary_field(Body, []) -spec binary_field(syntaxTree()) -> syntaxTree(). @@ -2639,10 +2479,6 @@ binary_field(Body) -> %% ===================================================================== -%% @spec binary_field(Body::syntaxTree(), Size, -%% Types::[syntaxTree()]) -> syntaxTree() -%% Size = none | syntaxTree() -%% %% @doc Creates an abstract binary template field. %% If Size is none, this is equivalent to %% "binary_field(Body, Types)", otherwise it is @@ -2665,9 +2501,6 @@ binary_field(Body, Size, Types) -> %% ===================================================================== -%% @spec binary_field(Body::syntaxTree(), Types::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract binary template field. If %% Types is the empty list, the result simply represents %% "Body", otherwise, if Types is @@ -2725,8 +2558,6 @@ revert_binary_field(Node) -> %% ===================================================================== -%% @spec binary_field_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a binary_field. %% %% @see binary_field/2 @@ -2747,8 +2578,6 @@ binary_field_body(Node) -> %% ===================================================================== -%% @spec binary_field_types(Node::syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of type-specifier subtrees of a %% binary_field node. If Node represents %% ".../T1, ..., Tn", the result is @@ -2772,8 +2601,6 @@ binary_field_types(Node) -> %% ===================================================================== -%% @spec binary_field_size(Node::syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the size specifier subtree of a %% binary_field node, if any. If Node %% represents "Body:Size" or @@ -2808,9 +2635,6 @@ binary_field_size(Node) -> %% ===================================================================== -%% @spec size_qualifier(Body::syntaxTree(), Size::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract size qualifier. The result represents %% "Body:Size". %% @@ -2832,8 +2656,6 @@ size_qualifier(Body, Size) -> %% ===================================================================== -%% @spec size_qualifier_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a size_qualifier %% node. %% @@ -2846,8 +2668,6 @@ size_qualifier_body(Node) -> %% ===================================================================== -%% @spec size_qualifier_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument subtree (the size) of a %% size_qualifier node. %% @@ -2860,8 +2680,6 @@ size_qualifier_argument(Node) -> %% ===================================================================== -%% @spec error_marker(Error::term()) -> syntaxTree() -%% %% @doc Creates an abstract error marker. The result represents an %% occurrence of an error in the source code, with an associated Erlang %% I/O ErrorInfo structure given by Error (see module @@ -2900,8 +2718,6 @@ revert_error_marker(Node) -> %% ===================================================================== -%% @spec error_marker_info(syntaxTree()) -> term() -%% %% @doc Returns the ErrorInfo structure of an error_marker %% node. %% @@ -2919,8 +2735,6 @@ error_marker_info(Node) -> %% ===================================================================== -%% @spec warning_marker(Error::term()) -> syntaxTree() -%% %% @doc Creates an abstract warning marker. The result represents an %% occurrence of a possible problem in the source code, with an %% associated Erlang I/O ErrorInfo structure given by Error @@ -2959,8 +2773,6 @@ revert_warning_marker(Node) -> %% ===================================================================== -%% @spec warning_marker_info(syntaxTree()) -> term() -%% %% @doc Returns the ErrorInfo structure of a warning_marker %% node. %% @@ -2978,8 +2790,6 @@ warning_marker_info(Node) -> %% ===================================================================== -%% @spec eof_marker() -> syntaxTree() -%% %% @doc Creates an abstract end-of-file marker. This represents the %% end of input when reading a sequence of source code forms. An %% end-of-file marker is itself regarded as a source code form @@ -3011,7 +2821,6 @@ revert_eof_marker(Node) -> %% ===================================================================== -%% @spec attribute(Name) -> syntaxTree() %% @equiv attribute(Name, none) -spec attribute(syntaxTree()) -> syntaxTree(). @@ -3021,9 +2830,6 @@ attribute(Name) -> %% ===================================================================== -%% @spec attribute(Name::syntaxTree(), Arguments) -> syntaxTree() -%% Arguments = none | [syntaxTree()] -%% %% @doc Creates an abstract program attribute. If %% Arguments is [A1, ..., An], the result %% represents "-Name(A1, ..., @@ -3231,8 +3037,6 @@ revert_module_name(A) -> %% ===================================================================== -%% @spec attribute_name(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of an attribute node. %% %% @see attribute/1 @@ -3249,9 +3053,6 @@ attribute_name(Node) -> %% ===================================================================== -%% @spec attribute_arguments(Node::syntaxTree()) -> -%% none | [syntaxTree()] -%% %% @doc Returns the list of argument subtrees of an %% attribute node, if any. If Node %% represents "-Name.", the result is @@ -3324,9 +3125,6 @@ attribute_arguments(Node) -> %% ===================================================================== -%% @spec arity_qualifier(Body::syntaxTree(), Arity::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract arity qualifier. The result represents %% "Body/Arity". %% @@ -3348,8 +3146,6 @@ arity_qualifier(Body, Arity) -> %% ===================================================================== -%% @spec arity_qualifier_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of an arity_qualifier %% node. %% @@ -3362,8 +3158,6 @@ arity_qualifier_body(Node) -> %% ===================================================================== -%% @spec arity_qualifier_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument (the arity) subtree of an %% arity_qualifier node. %% @@ -3376,9 +3170,6 @@ arity_qualifier_argument(Node) -> %% ===================================================================== -%% @spec module_qualifier(Module::syntaxTree(), Body::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract module qualifier. The result represents %% "Module:Body". %% @@ -3412,8 +3203,6 @@ revert_module_qualifier(Node) -> %% ===================================================================== -%% @spec module_qualifier_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument (the module) subtree of a %% module_qualifier node. %% @@ -3431,8 +3220,6 @@ module_qualifier_argument(Node) -> %% ===================================================================== -%% @spec module_qualifier_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a module_qualifier %% node. %% @@ -3450,8 +3237,6 @@ module_qualifier_body(Node) -> %% ===================================================================== -%% @spec qualified_name(Segments::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract qualified name. The result represents %% "S1.S2. ... .Sn", if %% Segments is [S1, S2, ..., Sn]. @@ -3482,8 +3267,6 @@ revert_qualified_name(Node) -> %% ===================================================================== -%% @spec qualified_name_segments(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of name segments of a %% qualified_name node. %% @@ -3501,9 +3284,6 @@ qualified_name_segments(Node) -> %% ===================================================================== -%% @spec function(Name::syntaxTree(), Clauses::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract function definition. If Clauses %% is [C1, ..., Cn], the result represents %% "Name C1; ...; Name @@ -3521,13 +3301,12 @@ qualified_name_segments(Node) -> %% @see is_form/1 %% @see rule/2 --record(function, {name, clauses}). -%% XXX: This one is problematic because there is a tuple with the same -%% tag and size that comes from 'erl_parse' -%% -record(function, {name :: syntaxTree(), clauses :: [syntaxTree()]}). +%% Don't use the name 'function' for this record, to avoid confusion with +%% the tuples on the form {function,Name,Arity} used by erl_parse. +-record(func, {name :: syntaxTree(), clauses :: [syntaxTree()]}). %% type(Node) = function -%% data(Node) = #function{name :: Name, clauses :: Clauses} +%% data(Node) = #func{name :: Name, clauses :: Clauses} %% %% Name = syntaxTree() %% Clauses = [syntaxTree()] @@ -3554,7 +3333,7 @@ qualified_name_segments(Node) -> -spec function(syntaxTree(), [syntaxTree()]) -> syntaxTree(). function(Name, Clauses) -> - tree(function, #function{name = Name, clauses = Clauses}). + tree(function, #func{name = Name, clauses = Clauses}). revert_function(Node) -> Name = function_name(Node), @@ -3570,8 +3349,6 @@ revert_function(Node) -> %% ===================================================================== -%% @spec function_name(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of a function node. %% %% @see function/2 @@ -3583,13 +3360,11 @@ function_name(Node) -> {function, Pos, Name, _, _} -> set_pos(atom(Name), Pos); Node1 -> - (data(Node1))#function.name + (data(Node1))#func.name end. %% ===================================================================== -%% @spec function_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of a function %% node. %% @@ -3602,13 +3377,11 @@ function_clauses(Node) -> {function, _, _, _, Clauses} -> Clauses; Node1 -> - (data(Node1))#function.clauses + (data(Node1))#func.clauses end. %% ===================================================================== -%% @spec function_arity(Node::syntaxTree()) -> integer() -%% %% @doc Returns the arity of a function node. The result %% is the number of parameter patterns in the first clause of the %% function; subsequent clauses are ignored. @@ -3632,7 +3405,6 @@ function_arity(Node) -> %% ===================================================================== -%% @spec clause(Guard, Body) -> syntaxTree() %% @equiv clause([], Guard, Body) -type guard() :: 'none' | syntaxTree() | [syntaxTree()] | [[syntaxTree()]]. @@ -3644,11 +3416,6 @@ clause(Guard, Body) -> %% ===================================================================== -%% @spec clause(Patterns::[syntaxTree()], Guard, -%% Body::[syntaxTree()]) -> syntaxTree() -%% Guard = none | syntaxTree() -%% | [syntaxTree()] | [[syntaxTree()]] -%% %% @doc Creates an abstract clause. If Patterns is %% [P1, ..., Pn] and Body is [B1, ..., %% Bm], then if Guard is none, the @@ -3787,8 +3554,6 @@ unfold_try_clause({clause, Pos, [{tuple, _, [C, V, _]}], %% ===================================================================== -%% @spec clause_patterns(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of pattern subtrees of a clause %% node. %% @@ -3806,8 +3571,6 @@ clause_patterns(Node) -> %% ===================================================================== -%% @spec clause_guard(Node::syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the guard subtree of a clause node, if %% any. If Node represents "(P1, ..., %% Pn) when Guard -> B1, ..., @@ -3834,8 +3597,6 @@ clause_guard(Node) -> %% ===================================================================== -%% @spec clause_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Return the list of body subtrees of a clause %% node. %% @@ -3853,8 +3614,6 @@ clause_body(Node) -> %% ===================================================================== -%% @spec disjunction(List::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract disjunction. If List is %% [E1, ..., En], the result represents %% "E1; ...; En". @@ -3872,8 +3631,6 @@ disjunction(Tests) -> %% ===================================================================== -%% @spec disjunction_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a %% disjunction node. %% @@ -3886,8 +3643,6 @@ disjunction_body(Node) -> %% ===================================================================== -%% @spec conjunction(List::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract conjunction. If List is %% [E1, ..., En], the result represents %% "E1, ..., En". @@ -3905,8 +3660,6 @@ conjunction(Tests) -> %% ===================================================================== -%% @spec conjunction_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a %% conjunction node. %% @@ -3919,8 +3672,6 @@ conjunction_body(Node) -> %% ===================================================================== -%% @spec catch_expr(Expr::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract catch-expression. The result represents %% "catch Expr". %% @@ -3947,8 +3698,6 @@ revert_catch_expr(Node) -> %% ===================================================================== -%% @spec catch_expr_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a catch_expr node. %% %% @see catch_expr/1 @@ -3965,9 +3714,6 @@ catch_expr_body(Node) -> %% ===================================================================== -%% @spec match_expr(Pattern::syntaxTree(), Body::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract match-expression. The result represents %% "Pattern = Body". %% @@ -4000,8 +3746,6 @@ revert_match_expr(Node) -> %% ===================================================================== -%% @spec match_expr_pattern(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the pattern subtree of a match_expr node. %% %% @see match_expr/2 @@ -4018,8 +3762,6 @@ match_expr_pattern(Node) -> %% ===================================================================== -%% @spec match_expr_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a match_expr node. %% %% @see match_expr/2 @@ -4036,9 +3778,6 @@ match_expr_body(Node) -> %% ===================================================================== -%% @spec operator(Name) -> syntaxTree() -%% Name = atom() | string() -%% %% @doc Creates an abstract operator. The name of the operator is the %% character sequence represented by Name. This is %% analogous to the print name of an atom, but an operator is never @@ -4062,8 +3801,6 @@ operator(Name) -> %% ===================================================================== -%% @spec operator_name(syntaxTree()) -> atom() -%% %% @doc Returns the name of an operator node. Note that %% the name is returned as an atom. %% @@ -4076,8 +3813,6 @@ operator_name(Node) -> %% ===================================================================== -%% @spec operator_literal(syntaxTree()) -> string() -%% %% @doc Returns the literal string represented by an %% operator node. This is simply the operator name as a %% string. @@ -4091,9 +3826,6 @@ operator_literal(Node) -> %% ===================================================================== -%% @spec infix_expr(Left::syntaxTree(), Operator::syntaxTree(), -%% Right::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract infix operator expression. The result %% represents "Left Operator %% Right". @@ -4142,8 +3874,6 @@ revert_infix_expr(Node) -> %% ===================================================================== -%% @spec infix_expr_left(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the left argument subtree of an %% infix_expr node. %% @@ -4161,8 +3891,6 @@ infix_expr_left(Node) -> %% ===================================================================== -%% @spec infix_expr_operator(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the operator subtree of an infix_expr %% node. %% @@ -4180,8 +3908,6 @@ infix_expr_operator(Node) -> %% ===================================================================== -%% @spec infix_expr_right(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the right argument subtree of an %% infix_expr node. %% @@ -4199,9 +3925,6 @@ infix_expr_right(Node) -> %% ===================================================================== -%% @spec prefix_expr(Operator::syntaxTree(), Argument::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract prefix operator expression. The result %% represents "Operator Argument". %% @@ -4245,8 +3968,6 @@ revert_prefix_expr(Node) -> %% ===================================================================== -%% @spec prefix_expr_operator(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the operator subtree of a prefix_expr %% node. %% @@ -4264,8 +3985,6 @@ prefix_expr_operator(Node) -> %% ===================================================================== -%% @spec prefix_expr_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument subtree of a prefix_expr %% node. %% @@ -4283,7 +4002,6 @@ prefix_expr_argument(Node) -> %% ===================================================================== -%% @spec record_field(Name) -> syntaxTree() %% @equiv record_field(Name, none) -spec record_field(syntaxTree()) -> syntaxTree(). @@ -4293,9 +4011,6 @@ record_field(Name) -> %% ===================================================================== -%% @spec record_field(Name::syntaxTree(), Value) -> syntaxTree() -%% Value = none | syntaxTree() -%% %% @doc Creates an abstract record field specification. If %% Value is none, the result represents %% simply "Name", otherwise it represents @@ -4319,8 +4034,6 @@ record_field(Name, Value) -> %% ===================================================================== -%% @spec record_field_name(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of a record_field node. %% %% @see record_field/2 @@ -4332,8 +4045,6 @@ record_field_name(Node) -> %% ===================================================================== -%% @spec record_field_value(syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the value subtree of a record_field node, %% if any. If Node represents %% "Name", none is @@ -4350,9 +4061,6 @@ record_field_value(Node) -> %% ===================================================================== -%% @spec record_index_expr(Type::syntaxTree(), Field::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract record field index expression. The result %% represents "#Type.Field". %% @@ -4397,8 +4105,6 @@ revert_record_index_expr(Node) -> %% ===================================================================== -%% @spec record_index_expr_type(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the type subtree of a record_index_expr %% node. %% @@ -4416,8 +4122,6 @@ record_index_expr_type(Node) -> %% ===================================================================== -%% @spec record_index_expr_field(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the field subtree of a record_index_expr %% node. %% @@ -4435,7 +4139,6 @@ record_index_expr_field(Node) -> %% ===================================================================== -%% @spec record_access(Argument, Field) -> syntaxTree() %% @equiv record_access(Argument, none, Field) -spec record_access(syntaxTree(), syntaxTree()) -> syntaxTree(). @@ -4445,10 +4148,6 @@ record_access(Argument, Field) -> %% ===================================================================== -%% @spec record_access(Argument::syntaxTree(), Type, -%% Field::syntaxTree()) -> syntaxTree() -%% Type = none | syntaxTree() -%% %% @doc Creates an abstract record field access expression. If %% Type is not none, the result represents %% "Argument#Type.Field". @@ -4510,8 +4209,6 @@ revert_record_access(Node) -> %% ===================================================================== -%% @spec record_access_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument subtree of a record_access %% node. %% @@ -4531,8 +4228,6 @@ record_access_argument(Node) -> %% ===================================================================== -%% @spec record_access_type(syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the type subtree of a record_access node, %% if any. If Node represents %% "Argument.Field", none @@ -4556,8 +4251,6 @@ record_access_type(Node) -> %% ===================================================================== -%% @spec record_access_field(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the field subtree of a record_access %% node. %% @@ -4577,7 +4270,6 @@ record_access_field(Node) -> %% ===================================================================== -%% @spec record_expr(Type, Fields) -> syntaxTree() %% @equiv record_expr(none, Type, Fields) -spec record_expr(syntaxTree(), [syntaxTree()]) -> syntaxTree(). @@ -4587,10 +4279,6 @@ record_expr(Type, Fields) -> %% ===================================================================== -%% @spec record_expr(Argument, Type::syntaxTree(), -%% Fields::[syntaxTree()]) -> syntaxTree() -%% Argument = none | syntaxTree() -%% %% @doc Creates an abstract record expression. If Fields is %% [F1, ..., Fn], then if Argument is %% none, the result represents @@ -4659,8 +4347,6 @@ revert_record_expr(Node) -> %% ===================================================================== -%% @spec record_expr_argument(syntaxTree()) -> none | syntaxTree() -%% %% @doc Returns the argument subtree of a record_expr node, %% if any. If Node represents %% "#Type{...}", none is returned. @@ -4684,8 +4370,6 @@ record_expr_argument(Node) -> %% ===================================================================== -%% @spec record_expr_type(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the type subtree of a record_expr node. %% %% @see record_expr/3 @@ -4704,8 +4388,6 @@ record_expr_type(Node) -> %% ===================================================================== -%% @spec record_expr_fields(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of field subtrees of a %% record_expr node. %% @@ -4725,10 +4407,6 @@ record_expr_fields(Node) -> %% ===================================================================== -%% @spec application(Module, Function::syntaxTree(), -%% Arguments::[syntaxTree()]) -> syntaxTree() -%% Module = none | syntaxTree() -%% %% @doc Creates an abstract function application expression. If %% Module is none, this is call is equivalent %% to application(Function, Arguments), otherwise it is @@ -4750,9 +4428,6 @@ application(Module, Name, Arguments) -> %% ===================================================================== -%% @spec application(Operator::syntaxTree(), -%% Arguments::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract function application expression. If %% Arguments is [A1, ..., An], the result %% represents "Operator(A1, ..., @@ -4792,8 +4467,6 @@ revert_application(Node) -> %% ===================================================================== -%% @spec application_operator(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the operator subtree of an application %% node. %% @@ -4816,8 +4489,6 @@ application_operator(Node) -> %% ===================================================================== -%% @spec application_arguments(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of argument subtrees of an %% application node. %% @@ -4835,9 +4506,6 @@ application_arguments(Node) -> %% ===================================================================== -%% @spec list_comp(Template::syntaxTree(), Body::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract list comprehension. If Body is %% [E1, ..., En], the result represents %% "[Template || E1, ..., En]". @@ -4874,8 +4542,6 @@ revert_list_comp(Node) -> %% ===================================================================== -%% @spec list_comp_template(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the template subtree of a list_comp node. %% %% @see list_comp/2 @@ -4892,8 +4558,6 @@ list_comp_template(Node) -> %% ===================================================================== -%% @spec list_comp_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a list_comp %% node. %% @@ -4910,9 +4574,6 @@ list_comp_body(Node) -> end. %% ===================================================================== -%% @spec binary_comp(Template::syntaxTree(), Body::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract binary comprehension. If Body is %% [E1, ..., En], the result represents %% "<<Template || E1, ..., En>>". @@ -4949,8 +4610,6 @@ revert_binary_comp(Node) -> %% ===================================================================== -%% @spec binary_comp_template(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the template subtree of a binary_comp node. %% %% @see binary_comp/2 @@ -4967,8 +4626,6 @@ binary_comp_template(Node) -> %% ===================================================================== -%% @spec binary_comp_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a binary_comp %% node. %% @@ -4986,8 +4643,6 @@ binary_comp_body(Node) -> %% ===================================================================== -%% @spec query_expr(Body::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract Mnemosyne query expression. The result %% represents "query Body end". %% @@ -5016,8 +4671,6 @@ revert_query_expr(Node) -> %% ===================================================================== -%% @spec query_expr_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a query_expr node. %% %% @see query_expr/1 @@ -5034,9 +4687,6 @@ query_expr_body(Node) -> %% ===================================================================== -%% @spec rule(Name::syntaxTree(), Clauses::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract Mnemosyne rule. If Clauses is %% [C1, ..., Cn], the results represents %% "Name C1; ...; Name @@ -5095,8 +4745,6 @@ revert_rule(Node) -> %% ===================================================================== -%% @spec rule_name(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of a rule node. %% %% @see rule/2 @@ -5112,8 +4760,6 @@ rule_name(Node) -> end. %% ===================================================================== -%% @spec rule_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of a rule node. %% %% @see rule/2 @@ -5129,8 +4775,6 @@ rule_clauses(Node) -> end. %% ===================================================================== -%% @spec rule_arity(Node::syntaxTree()) -> integer() -%% %% @doc Returns the arity of a rule node. The result is the %% number of parameter patterns in the first clause of the rule; %% subsequent clauses are ignored. @@ -5154,9 +4798,6 @@ rule_arity(Node) -> %% ===================================================================== -%% @spec generator(Pattern::syntaxTree(), Body::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract generator. The result represents %% "Pattern <- Body". %% @@ -5191,8 +4832,6 @@ revert_generator(Node) -> %% ===================================================================== -%% @spec generator_pattern(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the pattern subtree of a generator node. %% %% @see generator/2 @@ -5209,8 +4848,6 @@ generator_pattern(Node) -> %% ===================================================================== -%% @spec generator_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a generator node. %% %% @see generator/2 @@ -5227,9 +4864,6 @@ generator_body(Node) -> %% ===================================================================== -%% @spec binary_generator(Pattern::syntaxTree(), Body::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract binary_generator. The result represents %% "Pattern <- Body". %% @@ -5264,8 +4898,6 @@ revert_binary_generator(Node) -> %% ===================================================================== -%% @spec binary_generator_pattern(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the pattern subtree of a generator node. %% %% @see binary_generator/2 @@ -5282,8 +4914,6 @@ binary_generator_pattern(Node) -> %% ===================================================================== -%% @spec binary_generator_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a generator node. %% %% @see binary_generator/2 @@ -5300,8 +4930,6 @@ binary_generator_body(Node) -> %% ===================================================================== -%% @spec block_expr(Body::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract block expression. If Body is %% [B1, ..., Bn], the result represents "begin %% B1, ..., Bn end". @@ -5319,7 +4947,7 @@ binary_generator_body(Node) -> %% %% Body = [erl_parse()] \ [] --spec block_expr(Body::[syntaxTree()]) -> syntaxTree(). +-spec block_expr([syntaxTree()]) -> syntaxTree(). block_expr(Body) -> tree(block_expr, Body). @@ -5331,8 +4959,6 @@ revert_block_expr(Node) -> %% ===================================================================== -%% @spec block_expr_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a block_expr %% node. %% @@ -5350,8 +4976,6 @@ block_expr_body(Node) -> %% ===================================================================== -%% @spec if_expr(Clauses::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract if-expression. If Clauses is %% [C1, ..., Cn], the result represents "if %% C1; ...; Cn end". More exactly, if each @@ -5390,8 +5014,6 @@ revert_if_expr(Node) -> %% ===================================================================== -%% @spec if_expr_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of an if_expr %% node. %% @@ -5409,9 +5031,6 @@ if_expr_clauses(Node) -> %% ===================================================================== -%% @spec case_expr(Argument::syntaxTree(), Clauses::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract case-expression. If Clauses is %% [C1, ..., Cn], the result represents "case %% Argument of C1; ...; Cn end". More @@ -5459,8 +5078,6 @@ revert_case_expr(Node) -> %% ===================================================================== -%% @spec case_expr_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument subtree of a case_expr node. %% %% @see case_expr/2 @@ -5477,8 +5094,6 @@ case_expr_argument(Node) -> %% ===================================================================== -%% @spec case_expr_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of a case_expr %% node. %% @@ -5496,8 +5111,6 @@ case_expr_clauses(Node) -> %% ===================================================================== -%% @spec cond_expr(Clauses::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract cond-expression. If Clauses is %% [C1, ..., Cn], the result represents "cond %% C1; ...; Cn end". More exactly, if each @@ -5536,8 +5149,6 @@ revert_cond_expr(Node) -> %% ===================================================================== -%% @spec cond_expr_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of a cond_expr %% node. %% @@ -5555,7 +5166,6 @@ cond_expr_clauses(Node) -> %% ===================================================================== -%% @spec receive_expr(Clauses) -> syntaxTree() %% @equiv receive_expr(Clauses, none, []) -spec receive_expr([syntaxTree()]) -> syntaxTree(). @@ -5565,10 +5175,6 @@ receive_expr(Clauses) -> %% ===================================================================== -%% @spec receive_expr(Clauses::[syntaxTree()], Timeout, -%% Action::[syntaxTree()]) -> syntaxTree() -%% Timeout = none | syntaxTree() -%% %% @doc Creates an abstract receive-expression. If Timeout %% is none, the result represents "receive %% C1; ...; Cn end" (the Action @@ -5647,9 +5253,6 @@ revert_receive_expr(Node) -> %% ===================================================================== -%% @spec receive_expr_clauses(syntaxTree()) -> [syntaxTree()] -%% type(Node) = receive_expr -%% %% @doc Returns the list of clause subtrees of a %% receive_expr node. %% @@ -5669,9 +5272,6 @@ receive_expr_clauses(Node) -> %% ===================================================================== -%% @spec receive_expr_timeout(Node::syntaxTree()) -> Timeout -%% Timeout = none | syntaxTree() -%% %% @doc Returns the timeout subtree of a receive_expr node, %% if any. If Node represents "receive C1; %% ...; Cn end", none is returned. @@ -5695,8 +5295,6 @@ receive_expr_timeout(Node) -> %% ===================================================================== -%% @spec receive_expr_action(Node::syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of action body subtrees of a %% receive_expr node. If Node represents %% "receive C1; ...; Cn end", this is the @@ -5718,8 +5316,6 @@ receive_expr_action(Node) -> %% ===================================================================== -%% @spec try_expr(Body::syntaxTree(), Handlers::[syntaxTree()]) -> -%% syntaxTree() %% @equiv try_expr(Body, [], Handlers) -spec try_expr([syntaxTree()], [syntaxTree()]) -> syntaxTree(). @@ -5729,8 +5325,6 @@ try_expr(Body, Handlers) -> %% ===================================================================== -%% @spec try_expr(Body::syntaxTree(), Clauses::[syntaxTree()], -%% Handlers::[syntaxTree()]) -> syntaxTree() %% @equiv try_expr(Body, Clauses, Handlers, []) -spec try_expr([syntaxTree()], [syntaxTree()], [syntaxTree()]) -> syntaxTree(). @@ -5740,8 +5334,6 @@ try_expr(Body, Clauses, Handlers) -> %% ===================================================================== -%% @spec try_after_expr(Body::syntaxTree(), After::[syntaxTree()]) -> -%% syntaxTree() %% @equiv try_expr(Body, [], [], After) -spec try_after_expr([syntaxTree()], [syntaxTree()]) -> syntaxTree(). @@ -5751,10 +5343,6 @@ try_after_expr(Body, After) -> %% ===================================================================== -%% @spec try_expr(Body::[syntaxTree()], Clauses::[syntaxTree()], -%% Handlers::[syntaxTree()], After::[syntaxTree()]) -> -%% syntaxTree() -%% %% @doc Creates an abstract try-expression. If Body is %% [B1, ..., Bn], Clauses is [C1, ..., %% Cj], Handlers is [H1, ..., Hk], and @@ -5832,8 +5420,6 @@ revert_try_expr(Node) -> %% ===================================================================== -%% @spec try_expr_body(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of body subtrees of a try_expr %% node. %% @@ -5851,8 +5437,6 @@ try_expr_body(Node) -> %% ===================================================================== -%% @spec try_expr_clauses(Node::syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of case-clause subtrees of a %% try_expr node. If Node represents %% "try Body catch H1; ...; Hn @@ -5872,8 +5456,6 @@ try_expr_clauses(Node) -> %% ===================================================================== -%% @spec try_expr_handlers(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of handler-clause subtrees of a %% try_expr node. %% @@ -5891,8 +5473,6 @@ try_expr_handlers(Node) -> %% ===================================================================== -%% @spec try_expr_after(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of "after" subtrees of a try_expr %% node. %% @@ -5910,9 +5490,6 @@ try_expr_after(Node) -> %% ===================================================================== -%% @spec class_qualifier(Class::syntaxTree(), Body::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract class qualifier. The result represents %% "Class:Body". %% @@ -5935,8 +5512,6 @@ class_qualifier(Class, Body) -> %% ===================================================================== -%% @spec class_qualifier_argument(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the argument (the class) subtree of a %% class_qualifier node. %% @@ -5949,8 +5524,6 @@ class_qualifier_argument(Node) -> %% ===================================================================== -%% @spec class_qualifier_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a class_qualifier node. %% %% @see class_qualifier/2 @@ -5962,9 +5535,6 @@ class_qualifier_body(Node) -> %% ===================================================================== -%% @spec implicit_fun(Name::syntaxTree(), Arity::syntaxTree()) -> -%% syntaxTree() -%% %% @doc Creates an abstract "implicit fun" expression. If %% Arity is none, this is equivalent to %% implicit_fun(Name), otherwise it is equivalent to @@ -5984,9 +5554,6 @@ implicit_fun(Name, Arity) -> %% ===================================================================== -%% @spec implicit_fun(Module::syntaxTree(), Name::syntaxTree(), -%% Arity::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract module-qualified "implicit fun" expression. %% If Module is none, this is equivalent to %% implicit_fun(Name, Arity), otherwise it is equivalent to @@ -6008,8 +5575,6 @@ implicit_fun(Module, Name, Arity) -> %% ===================================================================== -%% @spec implicit_fun(Name::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract "implicit fun" expression. The result %% represents "fun Name". Name should %% represent either F/A or @@ -6070,8 +5635,6 @@ revert_implicit_fun(Node) -> %% ===================================================================== -%% @spec implicit_fun_name(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of an implicit_fun node. %% %%

Note: if Node represents "fun @@ -6108,8 +5671,6 @@ implicit_fun_name(Node) -> %% ===================================================================== -%% @spec fun_expr(Clauses::[syntaxTree()]) -> syntaxTree() -%% %% @doc Creates an abstract fun-expression. If Clauses is %% [C1, ..., Cn], the result represents "fun %% C1; ...; Cn end". More exactly, if each @@ -6150,8 +5711,6 @@ revert_fun_expr(Node) -> %% ===================================================================== -%% @spec fun_expr_clauses(syntaxTree()) -> [syntaxTree()] -%% %% @doc Returns the list of clause subtrees of a fun_expr %% node. %% @@ -6169,8 +5728,6 @@ fun_expr_clauses(Node) -> %% ===================================================================== -%% @spec fun_expr_arity(syntaxTree()) -> integer() -%% %% @doc Returns the arity of a fun_expr node. The result is %% the number of parameter patterns in the first clause of the %% fun-expression; subsequent clauses are ignored. @@ -6192,8 +5749,6 @@ fun_expr_arity(Node) -> %% ===================================================================== -%% @spec parentheses(Body::syntaxTree()) -> syntaxTree() -%% %% @doc Creates an abstract parenthesised expression. The result %% represents "(Body)", independently of the %% context. @@ -6213,8 +5768,6 @@ revert_parentheses(Node) -> %% ===================================================================== -%% @spec parentheses_body(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the body subtree of a parentheses node. %% %% @see parentheses/1 @@ -6226,7 +5779,6 @@ parentheses_body(Node) -> %% ===================================================================== -%% @spec macro(Name) -> syntaxTree() %% @equiv macro(Name, none) -spec macro(syntaxTree()) -> syntaxTree(). @@ -6236,9 +5788,6 @@ macro(Name) -> %% ===================================================================== -%% @spec macro(Name::syntaxTree(), Arguments) -> syntaxTree() -%% Arguments = none | [syntaxTree()] -%% %% @doc Creates an abstract macro application. If Arguments %% is none, the result represents %% "?Name", otherwise, if Arguments @@ -6276,8 +5825,6 @@ macro(Name, Arguments) -> %% ===================================================================== -%% @spec macro_name(syntaxTree()) -> syntaxTree() -%% %% @doc Returns the name subtree of a macro node. %% %% @see macro/2 @@ -6289,8 +5836,6 @@ macro_name(Node) -> %% ===================================================================== -%% @spec macro_arguments(Node::syntaxTree()) -> none | [syntaxTree()] -%% %% @doc Returns the list of argument subtrees of a macro %% node, if any. If Node represents %% "?Name", none is returned. @@ -6307,8 +5852,6 @@ macro_arguments(Node) -> %% ===================================================================== -%% @spec abstract(Term::term()) -> syntaxTree() -%% %% @doc Returns the syntax tree corresponding to an Erlang term. %% Term must be a literal term, i.e., one that can be %% represented as a source code literal. Thus, it may not contain a @@ -6365,8 +5908,6 @@ abstract_tail(H, T) -> %% ===================================================================== -%% @spec concrete(Node::syntaxTree()) -> term() -%% %% @doc Returns the Erlang term represented by a syntax tree. Evaluation %% fails with reason badarg if Node does not %% represent a literal term. @@ -6431,8 +5972,6 @@ concrete_list([]) -> %% ===================================================================== -%% @spec is_literal(Node::syntaxTree()) -> boolean() -%% %% @doc Returns true if Node represents a %% literal term, otherwise false. This function returns %% true if and only if the value of @@ -6467,8 +6006,6 @@ is_literal(T) -> %% ===================================================================== -%% @spec revert(Tree::syntaxTree()) -> syntaxTree() -%% %% @doc Returns an erl_parse-compatible representation of a %% syntax tree, if possible. If Tree represents a %% well-formed Erlang program or expression, the conversion should work @@ -6617,10 +6154,6 @@ revert_root(Node) -> %% ===================================================================== -%% @spec revert_forms(Forms) -> [erl_parse()] -%% -%% Forms = syntaxTree() | [syntaxTree()] -%% %% @doc Reverts a sequence of Erlang source code forms. The sequence can %% be given either as a form_list syntax tree (possibly %% nested), or as a list of "program form" syntax trees. If successful, @@ -6635,10 +6168,10 @@ revert_root(Node) -> -type forms() :: syntaxTree() | [syntaxTree()]. -%% -spec revert_forms(forms()) -> [erl_parse()]. +-spec revert_forms(forms()) -> [erl_parse()]. -revert_forms(L) when is_list(L) -> - revert_forms(form_list(L)); +revert_forms(Forms) when is_list(Forms) -> + revert_forms(form_list(Forms)); revert_forms(T) -> case type(T) of form_list -> @@ -6675,8 +6208,6 @@ revert_forms_1([]) -> %% ===================================================================== -%% @spec subtrees(Node::syntaxTree()) -> [[syntaxTree()]] -%% %% @doc Returns the grouped list of all subtrees of a syntax tree. If %% Node is a leaf node (cf. is_leaf/1), this %% is the empty list, otherwise the result is always a nonempty list, @@ -6898,9 +6429,6 @@ subtrees(T) -> %% ===================================================================== -%% @spec update_tree(Node::syntaxTree(), Groups::[[syntaxTree()]]) -> -%% syntaxTree() -%% %% @doc Creates a syntax tree with the same type and attributes as the %% given tree. This is equivalent to copy_attrs(Node, %% make_tree(type(Node), Groups)). @@ -6916,9 +6444,6 @@ update_tree(Node, Groups) -> %% ===================================================================== -%% @spec make_tree(Type::atom(), Groups::[[syntaxTree()]]) -> -%% syntaxTree() -%% %% @doc Creates a syntax tree with the given type and subtrees. %% Type must be a node type name (cf. type/1) %% that does not denote a leaf node type (cf. is_leaf/1). @@ -6997,8 +6522,6 @@ make_tree(tuple, [E]) -> tuple(E). %% ===================================================================== -%% @spec meta(Tree::syntaxTree()) -> syntaxTree() -%% %% @doc Creates a meta-representation of a syntax tree. The result %% represents an Erlang expression "MetaTree" %% which, if evaluated, will yield a new syntax tree representing the @@ -7163,17 +6686,14 @@ meta_call(F, As) -> %% ===================================================================== -%% @spec tree(Type) -> syntaxTree() %% @equiv tree(Type, []) --spec tree(atom()) -> syntaxTree(). +-spec tree(atom()) -> #tree{}. tree(Type) -> tree(Type, []). %% ===================================================================== -%% @spec tree(Type::atom(), Data::term()) -> syntaxTree() -%% %% @doc For special purposes only. Creates an abstract syntax %% tree node with type tag Type and associated data %% Data. @@ -7202,15 +6722,13 @@ tree(Type) -> %% @see data/1 %% @see type/1 --spec tree(atom(), term()) -> syntaxTree(). +-spec tree(atom(), term()) -> #tree{}. tree(Type, Data) -> #tree{type = Type, data = Data}. %% ===================================================================== -%% @spec is_tree(Tree::syntaxTree()) -> boolean() -%% %% @doc For special purposes only. Returns true if %% Tree is an abstract syntax tree and false %% otherwise. @@ -7229,8 +6747,6 @@ is_tree(_) -> %% ===================================================================== -%% @spec data(Tree::syntaxTree()) -> term() -%% %% @doc For special purposes only. Returns the associated data %% of a syntax tree node. Evaluation fails with reason %% badarg if is_tree(Node) does not yield @@ -7250,13 +6766,6 @@ data(T) -> erlang:error({badarg, T}). %% ===================================================================== -%% @spec wrap(Node::erl_parse()) -> syntaxTree() -%% -%% @type erl_parse() = erl_parse:parse_tree(). The "parse tree" -%% representation built by the Erlang standard library parser -%% erl_parse. This is a subset of the -%% syntaxTree type. -%% %% @doc Creates a wrapper structure around an erl_parse %% "parse tree". %% @@ -7269,7 +6778,7 @@ data(T) -> erlang:error({badarg, T}). %% trees. Attaching a wrapper onto another wrapper structure is an %% error.

-%%-spec wrap(erl_parse:parse_tree()) -> syntaxTree(). +-spec wrap(erl_parse()) -> #wrapper{}. wrap(Node) -> %% We assume that Node is an old-school `erl_parse' tree. @@ -7278,22 +6787,18 @@ wrap(Node) -> %% ===================================================================== -%% @spec unwrap(Node::syntaxTree()) -> syntaxTree() -%% %% @doc Removes any wrapper structure, if present. If Node %% is a wrapper structure, this function returns the wrapped %% erl_parse tree; otherwise it returns Node %% itself. --spec unwrap(syntaxTree()) -> syntaxTree(). +-spec unwrap(syntaxTree()) -> #tree{} | erl_parse(). unwrap(#wrapper{tree = Node}) -> Node; unwrap(Node) -> Node. % This could also be a new-form node. %% ===================================================================== -%% @spec is_wrapper(Term::term()) -> boolean() -%% %% @doc Returns true if the argument is a wrapper %% structure, otherwise false. -- cgit v1.2.3 From 7dc58ca03d6c59dadfb6c570b97e05c08644041b Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Sat, 21 Apr 2012 01:24:37 +0200 Subject: modernized and cleaned up edoc documentation --- lib/syntax_tools/src/erl_syntax.erl | 1346 +++++++++++++++++------------------ 1 file changed, 642 insertions(+), 704 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index a3cc8ba084..beae6f4a01 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -24,23 +24,20 @@ %% This module defines an abstract data type for representing Erlang %% source code as syntax trees, in a way that is backwards compatible %% with the data structures created by the Erlang standard library -%% parser module erl_parse (often referred to as "parse +%% parser module `erl_parse' (often referred to as "parse %% trees", which is a bit of a misnomer). This means that all -%% erl_parse trees are valid abstract syntax trees, but the +%% `erl_parse' trees are valid abstract syntax trees, but the %% reverse is not true: abstract syntax trees can in general not be used -%% as input to functions expecting an erl_parse tree. +%% as input to functions expecting an `erl_parse' tree. %% However, as long as an abstract syntax tree represents a correct -%% Erlang program, the function revert/1 should be able to -%% transform it to the corresponding erl_parse +%% Erlang program, the function {@link revert/1} should be able to +%% transform it to the corresponding `erl_parse' %% representation. %% -%% A recommended starting point for the first-time user is the -%% documentation of the syntaxTree() data type, and -%% the function type/1. +%% A recommended starting point for the first-time user is the documentation +%% of the {@link syntaxTree()} data type, and the function {@link type/1}. %% -%%

NOTES:

+%% == NOTES: == %% %% This module deals with the composition and decomposition of %% syntactic entities (as opposed to semantic ones); its @@ -50,36 +47,31 @@ %% in general, the user is assumed to pass type-correct arguments - if %% this is not done, the effects are not defined. %% -%% With the exception of the erl_parse data structures, +%% With the exception of the {@link erl_parse()} data structures, %% the internal representations of abstract syntax trees are subject to %% change without notice, and should not be documented outside this %% module. Furthermore, we do not give any guarantees on how an abstract %% syntax tree may or may not be represented, with the following %% exceptions: no syntax tree is represented by a single atom, such -%% as none, by a list constructor [X | Y], or -%% by the empty list []. This can be relied on when writing +%% as `none', by a list constructor `[X | Y]', or +%% by the empty list `[]'. This can be relied on when writing %% functions that operate on syntax trees. -%% @type syntaxTree(). An abstract syntax tree. The -%% erl_parse "parse tree" representation is a subset of the -%% syntaxTree() representation. +%% @type syntaxTree(). An abstract syntax tree. The {@link erl_parse()} +%% "parse tree" representation is a proper subset of the `syntaxTree()' +%% representation. %% %% Every abstract syntax tree node has a type, given by the -%% function type/1. Each node also -%% has associated attributes; see get_attrs/1 for details. The -%% functions make_tree/2 and subtrees/1 are generic +%% function {@link type/1}. Each node also has associated +%% attributes; see {@link get_attrs/1} for details. The functions +%% {@link make_tree/2} and {@link subtrees/1} are generic %% constructor/decomposition functions for abstract syntax trees. The -%% functions abstract/1 and concrete/1 convert between +%% functions {@link abstract/1} and {@link concrete/1} convert between %% constant Erlang terms and their syntactic representations. The set of -%% syntax tree nodes is extensible through the tree/2 function. +%% syntax tree nodes is extensible through the {@link tree/2} function. %% -%% A syntax tree can be transformed to the erl_parse -%% representation with the revert/1 -%% function. +%% A syntax tree can be transformed to the {@link erl_parse()} +%% representation with the {@link revert/1} function. -module(erl_syntax). @@ -396,8 +388,7 @@ -type erl_parse() :: erl_parse:abstract_form() | erl_parse:abstract_expr(). %% The representation built by the Erlang standard library parser -%% `erl_parse'. This is a subset of the `syntaxTree' type. +%% `erl_parse'. This is a subset of the {@link syntaxTree()} type. %% ===================================================================== %% @@ -407,10 +398,11 @@ %% ===================================================================== -%% @doc Returns the type tag of Node. If Node +%% @doc Returns the type tag of `Node'. If `Node' %% does not represent a syntax tree, evaluation fails with reason -%% badarg. Node types currently defined by this module are: -%%

+%% `badarg'. Node types currently defined by this module are: +%% +%%
%% %% %% @@ -477,12 +469,13 @@ %% %% %% -%%
applicationarity_qualifiervariablewarning_marker

-%%

The user may (for special purposes) create additional nodes -%% with other type tags, using the tree/2 function.

+%% +%% +%% The user may (for special purposes) create additional nodes +%% with other type tags, using the {@link tree/2} function. %% -%%

Note: The primary constructor functions for a node type should -%% always have the same name as the node type itself.

+%% Note: The primary constructor functions for a node type should +%% always have the same name as the node type itself. %% %% @see tree/2 %% @see application/3 @@ -607,37 +600,38 @@ type(Node) -> %% ===================================================================== -%% @doc Returns true if Node is a leaf node, -%% otherwise false. The currently recognised leaf node +%% @doc Returns `true' if `Node' is a leaf node, +%% otherwise `false'. The currently recognised leaf node %% types are: -%%

+%% +%%
%% -%% -%% -%% -%% -%% +%% +%% +%% +%% +%% %% -%% -%% -%% -%% -%% +%% +%% +%% +%% +%% %% -%% -%% -%% -%% +%% +%% +%% +%% %% -%%
atomcharcommenteof_markererror_marker`atom'`char'`comment'`eof_marker'`error_marker'
floatintegerniloperatorstring`float'`integer'`nil'`operator'`string'
textunderscorevariablewarning_marker`text'`underscore'`variable'`warning_marker'

-%%

A node of type tuple is a leaf node if and only if -%% its arity is zero.

+%% +%% +%% A node of type `tuple' is a leaf node if and only if its arity is zero. %% -%%

Note: not all literals are leaf nodes, and vice versa. E.g., +%% Note: not all literals are leaf nodes, and vice versa. E.g., %% tuples with nonzero arity and nonempty lists may be literals, but are %% not leaf nodes. Variables, on the other hand, are leaf nodes but not -%% literals.

-%% +%% literals. +%% %% @see type/1 %% @see is_literal/1 @@ -665,27 +659,29 @@ is_leaf(Node) -> %% ===================================================================== -%% @doc Returns true if Node is a syntax tree +%% @doc Returns `true' if `Node' is a syntax tree %% representing a so-called "source code form", otherwise -%% false. Forms are the Erlang source code units which, +%% `false'. Forms are the Erlang source code units which, %% placed in sequence, constitute an Erlang program. Current form types %% are: -%%

+%% +%%
%% -%% -%% -%% -%% -%% +%% +%% +%% +%% +%% %% -%% -%% -%% -%% +%% +%% +%% +%% %% -%%
attributecommenterror_markereof_markerform_list`attribute'`comment'`error_marker'`eof_marker'`form_list'
functionrulewarning_markertext`function'`rule'`warning_marker'`text'

+%% +%% %% @see type/1 -%% @see attribute/2 +%% @see attribute/2 %% @see comment/2 %% @see eof_marker/0 %% @see error_marker/1 @@ -713,7 +709,7 @@ is_form(Node) -> %% ===================================================================== %% @doc Returns the position information associated with -%% Node. This is usually a nonnegative integer (indicating +%% `Node'. This is usually a nonnegative integer (indicating %% the source code line number), but may be any term. By default, all %% new tree nodes have their associated position information set to the %% integer zero. @@ -745,8 +741,7 @@ get_pos(Node) -> %% ===================================================================== -%% @doc Sets the position information of Node to -%% Pos. +%% @doc Sets the position information of `Node' to `Pos'. %% %% @see get_pos/1 %% @see copy_pos/2 @@ -767,11 +762,10 @@ set_pos(Node, Pos) -> %% ===================================================================== -%% @doc Copies the position information from Source to -%% Target. +%% @doc Copies the position information from `Source' to `Target'. %% -%%

This is equivalent to set_pos(Target, -%% get_pos(Source)), but potentially more efficient.

+%% This is equivalent to `set_pos(Target, +%% get_pos(Source))', but potentially more efficient. %% %% @see get_pos/1 %% @see set_pos/2 @@ -805,18 +799,16 @@ set_com(Node, Com) -> %% possibly empty list of abstract comments, in top-down textual order. %% When the code is formatted, pre-comments are typically displayed %% directly above the node. For example: -%%
-%%         % Pre-comment of function
-%%         foo(X) -> {bar, X}.
+%% ```% Pre-comment of function +%% foo(X) -> {bar, X}.''' %% -%%

If possible, the comment should be moved before any preceding +%% If possible, the comment should be moved before any preceding %% separator characters on the same line. E.g.: -%%

-%%         foo([X | Xs]) ->
-%%             % Pre-comment of 'bar(X)' node
-%%             [bar(X) | foo(Xs)];
-%%         ...
-%% (where the comment is moved before the "[").

+%% ```foo([X | Xs]) -> +%% % Pre-comment of 'bar(X)' node +%% [bar(X) | foo(Xs)]; +%% ...''' +%% (where the comment is moved before the "`['"). %% %% @see comment/2 %% @see set_precomments/2 @@ -834,8 +826,8 @@ get_precomments_1(#attr{com = #com{pre = Cs}}) -> Cs. %% ===================================================================== -%% @doc Sets the pre-comments of Node to -%% Comments. Comments should be a possibly +%% @doc Sets the pre-comments of `Node' to +%% `Comments'. `Comments' should be a possibly %% empty list of abstract comments, in top-down textual order. %% %% @see comment/2 @@ -865,12 +857,11 @@ set_precomments_1(#attr{com = Com} = Attr, Cs) -> %% ===================================================================== -%% @doc Appends Comments to the pre-comments of -%% Node. +%% @doc Appends `Comments' to the pre-comments of `Node'. %% -%%

Note: This is equivalent to set_precomments(Node, -%% get_precomments(Node) ++ Comments), but potentially more -%% efficient.

+%% Note: This is equivalent to `set_precomments(Node, +%% get_precomments(Node) ++ Comments)', but potentially more +%% efficient. %% %% @see comment/2 %% @see get_precomments/1 @@ -901,18 +892,16 @@ add_precomments_1(Cs, #attr{com = Com} = Attr) -> %% possibly empty list of abstract comments, in top-down textual order. %% When the code is formatted, post-comments are typically displayed to %% the right of and/or below the node. For example: -%%
-%%         {foo, X, Y}     % Post-comment of tuple
+%% ```{foo, X, Y} % Post-comment of tuple''' %% -%%

If possible, the comment should be moved past any following +%% If possible, the comment should be moved past any following %% separator characters on the same line, rather than placing the %% separators on the following line. E.g.: -%%

-%%         foo([X | Xs], Y) ->
-%%             foo(Xs, bar(X));     % Post-comment of 'bar(X)' node
-%%          ...
-%% (where the comment is moved past the rightmost ")" and -%% the ";").

+%% ```foo([X | Xs], Y) -> +%% foo(Xs, bar(X)); % Post-comment of 'bar(X)' node +%% ...''' +%% (where the comment is moved past the rightmost "`)'" and +%% the "`;'"). %% %% @see comment/2 %% @see set_postcomments/2 @@ -930,8 +919,8 @@ get_postcomments_1(#attr{com = #com{post = Cs}}) -> Cs. %% ===================================================================== -%% @doc Sets the post-comments of Node to -%% Comments. Comments should be a possibly +%% @doc Sets the post-comments of `Node' to +%% `Comments'. `Comments' should be a possibly %% empty list of abstract comments, in top-down textual order %% %% @see comment/2 @@ -961,12 +950,11 @@ set_postcomments_1(#attr{com = Com} = Attr, Cs) -> %% ===================================================================== -%% @doc Appends Comments to the post-comments of -%% Node. +%% @doc Appends `Comments' to the post-comments of `Node'. %% -%%

Note: This is equivalent to set_postcomments(Node, -%% get_postcomments(Node) ++ Comments), but potentially more -%% efficient.

+%% Note: This is equivalent to `set_postcomments(Node, +%% get_postcomments(Node) ++ Comments)', but potentially more +%% efficient. %% %% @see comment/2 %% @see get_postcomments/1 @@ -993,12 +981,12 @@ add_postcomments_1(Cs, #attr{com = Com} = Attr) -> %% ===================================================================== -%% @doc Yields false if the node has no associated -%% comments, and true otherwise. +%% @doc Yields `false' if the node has no associated +%% comments, and `true' otherwise. %% -%%

Note: This is equivalent to (get_precomments(Node) == []) -%% and (get_postcomments(Node) == []), but potentially more -%% efficient.

+%% Note: This is equivalent to `(get_precomments(Node) == []) +%% and (get_postcomments(Node) == [])', but potentially more +%% efficient. %% %% @see get_precomments/1 %% @see get_postcomments/1 @@ -1022,11 +1010,11 @@ has_comments(_) -> false. %% ===================================================================== -%% @doc Clears the associated comments of Node. +%% @doc Clears the associated comments of `Node'. %% -%%

Note: This is equivalent to -%% set_precomments(set_postcomments(Node, []), []), but -%% potentially more efficient.

+%% Note: This is equivalent to +%% `set_precomments(set_postcomments(Node, []), [])', but +%% potentially more efficient. %% %% @see set_precomments/2 %% @see set_postcomments/2 @@ -1045,13 +1033,12 @@ remove_comments(Node) -> %% ===================================================================== -%% @doc Copies the pre- and postcomments from Source to -%% Target. +%% @doc Copies the pre- and postcomments from `Source' to `Target'. %% -%%

Note: This is equivalent to -%% set_postcomments(set_precomments(Target, -%% get_precomments(Source)), get_postcomments(Source)), but -%% potentially more efficient.

+%% Note: This is equivalent to +%% `set_postcomments(set_precomments(Target, +%% get_precomments(Source)), get_postcomments(Source))', but +%% potentially more efficient. %% %% @see comment/2 %% @see get_precomments/1 @@ -1066,13 +1053,13 @@ copy_comments(Source, Target) -> %% ===================================================================== -%% @doc Appends the comments of Source to the current -%% comments of Target. +%% @doc Appends the comments of `Source' to the current +%% comments of `Target'. %% -%%

Note: This is equivalent to -%% add_postcomments(get_postcomments(Source), -%% add_precomments(get_precomments(Source), Target)), but -%% potentially more efficient.

+%% Note: This is equivalent to +%% `add_postcomments(get_postcomments(Source), +%% add_precomments(get_precomments(Source), Target))', but +%% potentially more efficient. %% %% @see comment/2 %% @see get_precomments/1 @@ -1104,8 +1091,7 @@ get_ann(_) -> []. %% ===================================================================== -%% @doc Sets the list of user annotations of Node to -%% Annotations. +%% @doc Sets the list of user annotations of `Node' to `Annotations'. %% %% @see get_ann/1 %% @see add_ann/2 @@ -1127,11 +1113,11 @@ set_ann(Node, As) -> %% ===================================================================== -%% @doc Appends the term Annotation to the list of user -%% annotations of Node. +%% @doc Appends the term `Annotation' to the list of user +%% annotations of `Node'. %% -%%

Note: this is equivalent to set_ann(Node, [Annotation | -%% get_ann(Node)]), but potentially more efficient.

+%% Note: this is equivalent to `set_ann(Node, [Annotation | +%% get_ann(Node)])', but potentially more efficient. %% %% @see get_ann/1 %% @see set_ann/2 @@ -1152,11 +1138,10 @@ add_ann(A, Node) -> %% ===================================================================== -%% @doc Copies the list of user annotations from Source to -%% Target. +%% @doc Copies the list of user annotations from `Source' to `Target'. %% -%%

Note: this is equivalent to set_ann(Target, -%% get_ann(Source)), but potentially more efficient.

+%% Note: this is equivalent to `set_ann(Target, +%% get_ann(Source))', but potentially more efficient. %% %% @see get_ann/1 %% @see set_ann/2 @@ -1173,16 +1158,15 @@ copy_ann(Source, Target) -> %% can be attached to a node. Currently, this includes position %% information, source code comments, and user annotations. The result %% of this function cannot be inspected directly; only attached to -%% another node (cf. set_attrs/2). +%% another node (see {@link set_attrs/2}). %% -%%

For accessing individual attributes, see get_pos/1, -%% get_ann/1, get_precomments/1 and -%% get_postcomments/1.

+%% For accessing individual attributes, see {@link get_pos/1}, +%% {@link get_ann/1}, {@link get_precomments/1} and +%% {@link get_postcomments/1}. %% %% @type syntaxTreeAttributes(). This is an abstract representation of -%% syntax tree node attributes; see the function get_attrs/1. -%% +%% syntax tree node attributes; see the function {@link get_attrs/1}. +%% %% @see set_attrs/2 %% @see get_pos/1 %% @see get_ann/1 @@ -1199,8 +1183,7 @@ get_attrs(Node) -> #attr{pos = get_pos(Node), %% ===================================================================== -%% @doc Sets the attributes of Node to -%% Attributes. +%% @doc Sets the attributes of `Node' to `Attributes'. %% %% @see get_attrs/1 %% @see copy_attrs/2 @@ -1219,11 +1202,10 @@ set_attrs(Node, Attr) -> %% ===================================================================== -%% @doc Copies the attributes from Source to -%% Target. +%% @doc Copies the attributes from `Source' to `Target'. %% -%%

Note: this is equivalent to set_attrs(Target, -%% get_attrs(Source)), but potentially more efficient.

+%% Note: this is equivalent to `set_attrs(Target, +%% get_attrs(Source))', but potentially more efficient. %% %% @see get_attrs/1 %% @see set_attrs/2 @@ -1245,18 +1227,18 @@ comment(Strings) -> %% ===================================================================== %% @doc Creates an abstract comment with the given padding and text. If -%% Strings is a (possibly empty) list +%% `Strings' is a (possibly empty) list %% ["Txt1", ..., "TxtN"], the result %% represents the source code text %%
-%%     %Txt1
-%%     ...
-%%     %TxtN
-%% Padding states the number of empty character positions +%% %Txt1 +%% ... +%% %TxtN +%% `Padding' states the number of empty character positions %% to the left of the comment separating it horizontally from -%% source code on the same line (if any). If Padding is -%% none, a default positive number is used. If -%% Padding is an integer less than 1, there should be no +%% source code on the same line (if any). If `Padding' is +%% `none', a default positive number is used. If +%% `Padding' is an integer less than 1, there should be no %% separating space. Comments are in themselves regarded as source %% program forms. %% @@ -1292,8 +1274,7 @@ comment_text(Node) -> %% ===================================================================== %% @doc Returns the amount of padding before the comment, or -%% none. The latter means that a default padding may be -%% used. +%% `none'. The latter means that a default padding may be used. %% %% @see comment/2 @@ -1305,20 +1286,20 @@ comment_padding(Node) -> %% ===================================================================== %% @doc Creates an abstract sequence of "source code forms". If -%% Forms is [F1, ..., Fn], where each -%% Fi is a form (cf. is_form/1, the result +%% `Forms' is `[F1, ..., Fn]', where each +%% `Fi' is a form (see {@link is_form/1}, the result %% represents %%
-%%     F1
-%%     ...
-%%     Fn
-%% where the Fi are separated by one or more line breaks. A -%% node of type form_list is itself regarded as a source -%% code form; cf. flatten_form_list/1. -%% -%%

Note: this is simply a way of grouping source code forms as a +%% F1 +%% ... +%% Fn +%% where the `Fi' are separated by one or more line breaks. A +%% node of type `form_list' is itself regarded as a source +%% code form; see {@link flatten_form_list/1}. +%% +%% Note: this is simply a way of grouping source code forms as a %% single syntax tree, usually in order to form an Erlang module -%% definition.

+%% definition. %% %% @see form_list_elements/1 %% @see is_form/1 @@ -1337,7 +1318,7 @@ form_list(Forms) -> %% ===================================================================== -%% @doc Returns the list of subnodes of a form_list node. +%% @doc Returns the list of subnodes of a `form_list' node. %% %% @see form_list/1 @@ -1348,8 +1329,8 @@ form_list_elements(Node) -> %% ===================================================================== -%% @doc Flattens sublists of a form_list node. Returns -%% Node with all subtrees of type form_list +%% @doc Flattens sublists of a `form_list' node. Returns +%% `Node' with all subtrees of type `form_list' %% recursively expanded, yielding a single "flat" abstract form %% sequence. %% @@ -1376,7 +1357,7 @@ flatten_form_list_1([], As) -> %% ===================================================================== %% @doc Creates an abstract piece of source code text. The result -%% represents exactly the sequence of characters in String. +%% represents exactly the sequence of characters in `String'. %% This is useful in cases when one wants full control of the resulting %% output, e.g., for the appearance of floating-point numbers or macro %% definitions. @@ -1393,8 +1374,7 @@ text(String) -> %% ===================================================================== -%% @doc Returns the character sequence represented by a -%% text node. +%% @doc Returns the character sequence represented by a `text' node. %% %% @see text/1 @@ -1406,14 +1386,14 @@ text_string(Node) -> %% ===================================================================== %% @doc Creates an abstract variable with the given name. -%% Name may be any atom or string that represents a +%% `Name' may be any atom or string that represents a %% lexically valid variable name, but not a single underscore -%% character; cf. underscore/0. +%% character; see {@link underscore/0}. %% -%%

Note: no checking is done whether the character sequence +%% Note: no checking is done whether the character sequence %% represents a proper variable name, i.e., whether or not its first %% character is an uppercase Erlang character, or whether it does not -%% contain control characters, whitespace, etc.

+%% contain control characters, whitespace, etc. %% %% @see variable_name/1 %% @see variable_literal/1 @@ -1442,7 +1422,7 @@ revert_variable(Node) -> %% ===================================================================== -%% @doc Returns the name of a variable node as an atom. +%% @doc Returns the name of a `variable' node as an atom. %% %% @see variable/1 @@ -1458,7 +1438,7 @@ variable_name(Node) -> %% ===================================================================== -%% @doc Returns the name of a variable node as a string. +%% @doc Returns the name of a `variable' node as a string. %% %% @see variable/1 @@ -1474,7 +1454,7 @@ variable_literal(Node) -> %% ===================================================================== -%% @doc Creates an abstract universal pattern ("_"). The +%% @doc Creates an abstract universal pattern ("`_'"). The %% lexical representation is a single underscore character. Note that %% this is not a variable, lexically speaking. %% @@ -1499,7 +1479,7 @@ revert_underscore(Node) -> %% ===================================================================== %% @doc Creates an abstract integer literal. The lexical representation -%% is the canonical decimal numeral of Value. +%% is the canonical decimal numeral of `Value'. %% %% @see integer_value/1 %% @see integer_literal/1 @@ -1525,9 +1505,8 @@ revert_integer(Node) -> %% ===================================================================== -%% @doc Returns true if Node has type -%% integer and represents Value, otherwise -%% false. +%% @doc Returns `true' if `Node' has type +%% `integer' and represents `Value', otherwise `false'. %% %% @see integer/1 @@ -1545,7 +1524,7 @@ is_integer(Node, Value) -> %% ===================================================================== -%% @doc Returns the value represented by an integer node. +%% @doc Returns the value represented by an `integer' node. %% %% @see integer/1 @@ -1561,8 +1540,7 @@ integer_value(Node) -> %% ===================================================================== -%% @doc Returns the numeral string represented by an -%% integer node. +%% @doc Returns the numeral string represented by an `integer' node. %% %% @see integer/1 @@ -1574,8 +1552,7 @@ integer_literal(Node) -> %% ===================================================================== %% @doc Creates an abstract floating-point literal. The lexical -%% representation is the decimal floating-point numeral of -%% Value. +%% representation is the decimal floating-point numeral of `Value'. %% %% @see float_value/1 %% @see float_literal/1 @@ -1610,7 +1587,7 @@ revert_float(Node) -> %% ===================================================================== -%% @doc Returns the value represented by a float node. Note +%% @doc Returns the value represented by a `float' node. Note %% that floating-point values should usually not be compared for %% equality. %% @@ -1628,8 +1605,7 @@ float_value(Node) -> %% ===================================================================== -%% @doc Returns the numeral string represented by a float -%% node. +%% @doc Returns the numeral string represented by a `float' node. %% %% @see float/1 @@ -1641,14 +1617,14 @@ float_literal(Node) -> %% ===================================================================== %% @doc Creates an abstract character literal. The result represents -%% "$Name", where Name corresponds to -%% Value. +%% "$Name", where `Name' corresponds to +%% `Value'. %% -%%

Note: the literal corresponding to a particular character value is -%% not uniquely defined. E.g., the character "a" can be -%% written both as "$a" and "$\141", and a Tab -%% character can be written as "$\11", "$\011" -%% or "$\t".

+%% Note: the literal corresponding to a particular character value is +%% not uniquely defined. E.g., the character "`a'" can be +%% written both as "`$a'" and "`$\141'", and a Tab +%% character can be written as "`$\11'", "`$\011'" +%% or "`$\t'". %% %% @see char_value/1 %% @see char_literal/1 @@ -1674,9 +1650,8 @@ revert_char(Node) -> %% ===================================================================== -%% @doc Returns true if Node has type -%% char and represents Value, otherwise -%% false. +%% @doc Returns `true' if `Node' has type +%% `char' and represents `Value', otherwise `false'. %% %% @see char/1 @@ -1694,7 +1669,7 @@ is_char(Node, Value) -> %% ===================================================================== -%% @doc Returns the value represented by a char node. +%% @doc Returns the value represented by a `char' node. %% %% @see char/1 @@ -1710,8 +1685,8 @@ char_value(Node) -> %% ===================================================================== -%% @doc Returns the literal string represented by a char -%% node. This includes the leading "$" character. +%% @doc Returns the literal string represented by a `char' +%% node. This includes the leading "`$'" character. %% %% @see char/1 @@ -1724,12 +1699,12 @@ char_literal(Node) -> %% ===================================================================== %% @doc Creates an abstract string literal. The result represents %% "Text" (including the surrounding -%% double-quotes), where Text corresponds to the sequence -%% of characters in Value, but not representing a -%% specific string literal. E.g., the result of -%% string("x\ny") represents any and all of -%% "x\ny", "x\12y", "x\012y" and -%% "x\^Jy"; cf. char/1. +%% double-quotes), where `Text' corresponds to the sequence +%% of characters in `Value', but not representing a +%% specific string literal. +%% +%% For example, the result of `string("x\ny")' represents any and all of +%% `"x\ny"', `"x\12y"', `"x\012y"' and `"x\^Jy"'; see {@link char/1}. %% %% @see string_value/1 %% @see string_literal/1 @@ -1756,9 +1731,8 @@ revert_string(Node) -> %% ===================================================================== -%% @doc Returns true if Node has type -%% string and represents Value, otherwise -%% false. +%% @doc Returns `true' if `Node' has type +%% `string' and represents `Value', otherwise `false'. %% %% @see string/1 @@ -1776,7 +1750,7 @@ is_string(Node, Value) -> %% ===================================================================== -%% @doc Returns the value represented by a string node. +%% @doc Returns the value represented by a `string' node. %% %% @see string/1 @@ -1792,7 +1766,7 @@ string_value(Node) -> %% ===================================================================== -%% @doc Returns the literal string represented by a string +%% @doc Returns the literal string represented by a `string' %% node. This includes surrounding double-quote characters. %% %% @see string/1 @@ -1805,7 +1779,7 @@ string_literal(Node) -> %% ===================================================================== %% @doc Creates an abstract atom literal. The print name of the atom is -%% the character sequence represented by Name. +%% the character sequence represented by `Name'. %% %% @see atom_value/1 %% @see atom_name/1 @@ -1834,9 +1808,8 @@ revert_atom(Node) -> %% ===================================================================== -%% @doc Returns true if Node has type -%% atom and represents Value, otherwise -%% false. +%% @doc Returns `true' if `Node' has type +%% `atom' and represents `Value', otherwise `false'. %% %% @see atom/1 @@ -1854,7 +1827,7 @@ is_atom(Node, Value) -> %% ===================================================================== -%% @doc Returns the value represented by an atom node. +%% @doc Returns the value represented by an `atom' node. %% %% @see atom/1 @@ -1870,7 +1843,7 @@ atom_value(Node) -> %% ===================================================================== -%% @doc Returns the printname of an atom node. +%% @doc Returns the printname of an `atom' node. %% %% @see atom/1 @@ -1881,13 +1854,12 @@ atom_name(Node) -> %% ===================================================================== -%% @doc Returns the literal string represented by an atom +%% @doc Returns the literal string represented by an `atom' %% node. This includes surrounding single-quote characters if necessary. %% -%%

Note that e.g. the result of atom("x\ny") represents -%% any and all of 'x\ny', 'x\12y', -%% 'x\012y' and 'x\^Jy\'; cf. -%% string/1.

+%% Note that e.g. the result of `atom("x\ny")' represents +%% any and all of `'x\ny'', `'x\12y'', +%% `'x\012y'' and `'x\^Jy\''; see {@link string/1}. %% %% @see atom/1 %% @see string/1 @@ -1899,12 +1871,12 @@ atom_literal(Node) -> %% ===================================================================== -%% @doc Creates an abstract tuple. If Elements is -%% [X1, ..., Xn], the result represents +%% @doc Creates an abstract tuple. If `Elements' is +%% `[X1, ..., Xn]', the result represents %% "{X1, ..., Xn}". %% -%%

Note: The Erlang language has distinct 1-tuples, i.e., -%% {X} is always distinct from X itself.

+%% Note: The Erlang language has distinct 1-tuples, i.e., +%% `{X}' is always distinct from `X' itself. %% %% @see tuple_elements/1 %% @see tuple_size/1 @@ -1931,8 +1903,7 @@ revert_tuple(Node) -> %% ===================================================================== -%% @doc Returns the list of element subtrees of a tuple -%% node. +%% @doc Returns the list of element subtrees of a `tuple' node. %% %% @see tuple/1 @@ -1948,11 +1919,11 @@ tuple_elements(Node) -> %% ===================================================================== -%% @doc Returns the number of elements of a tuple node. +%% @doc Returns the number of elements of a `tuple' node. %% -%%

Note: this is equivalent to -%% length(tuple_elements(Node)), but potentially more -%% efficient.

+%% Note: this is equivalent to +%% `length(tuple_elements(Node))', but potentially more +%% efficient. %% %% @see tuple/1 %% @see tuple_elements/1 @@ -1974,30 +1945,30 @@ list(List) -> %% ===================================================================== %% @doc Constructs an abstract list skeleton. The result has type -%% list or nil. If List is a -%% nonempty list [E1, ..., En], the result has type -%% list and represents either "[E1, ..., -%% En]", if Tail is none, or +%% `list' or `nil'. If `List' is a +%% nonempty list `[E1, ..., En]', the result has type +%% `list' and represents either "[E1, ..., +%% En]", if `Tail' is `none', or %% otherwise "[E1, ..., En | -%% Tail]". If List is the empty list, -%% Tail must be none, and in that -%% case the result has type nil and represents -%% "[]" (cf. nil/0). +%% Tail]
". If `List' is the empty list, +%% `Tail' must be `none', and in that +%% case the result has type `nil' and represents +%% "`[]'" (see {@link nil/0}). %% -%%

The difference between lists as semantic objects (built up of +%% The difference between lists as semantic objects (built up of %% individual "cons" and "nil" terms) and the various syntactic forms %% for denoting lists may be bewildering at first. This module provides %% functions both for exact control of the syntactic representation as %% well as for the simple composition and deconstruction in terms of -%% cons and head/tail operations.

+%% cons and head/tail operations. %% -%%

Note: in list(Elements, none), the "nil" list -%% terminator is implicit and has no associated information (cf. -%% get_attrs/1), while in the seemingly equivalent -%% list(Elements, Tail) when Tail has type -%% nil, the list terminator subtree Tail may +%% Note: in `list(Elements, none)', the "nil" list +%% terminator is implicit and has no associated information (see +%% {@link get_attrs/1}), while in the seemingly equivalent +%% `list(Elements, Tail)' when `Tail' has type +%% `nil', the list terminator subtree `Tail' may %% have attached attributes such as position, comments, and annotations, -%% which will be preserved in the result.

+%% which will be preserved in the result. %% %% @see nil/0 %% @see list/1 @@ -2055,7 +2026,7 @@ revert_list(Node) -> %% ===================================================================== %% @doc Creates an abstract empty list. The result represents -%% "[]". The empty list is traditionally called "nil". +%% "`[]'". The empty list is traditionally called "nil". %% %% @see list/2 %% @see is_list_skeleton/1 @@ -2078,11 +2049,11 @@ revert_nil(Node) -> %% ===================================================================== -%% @doc Returns the prefix element subtrees of a list node. -%% If Node represents "[E1, ..., +%% @doc Returns the prefix element subtrees of a `list' node. +%% If `Node' represents "[E1, ..., %% En]" or "[E1, ..., En | -%% Tail]", the returned value is [E1, ..., -%% En]. +%% Tail]", the returned value is `[E1, ..., +%% En]'. %% %% @see list/2 @@ -2098,18 +2069,17 @@ list_prefix(Node) -> %% ===================================================================== -%% @doc Returns the suffix subtree of a list node, if one -%% exists. If Node represents "[E1, ..., +%% @doc Returns the suffix subtree of a `list' node, if one +%% exists. If `Node' represents "[E1, ..., %% En | Tail]", the returned value is -%% Tail, otherwise, i.e., if Node represents -%% "[E1, ..., En]", none is +%% `Tail', otherwise, i.e., if `Node' represents +%% "[E1, ..., En]", `none' is %% returned. %% -%%

Note that even if this function returns some Tail -%% that is not none, the type of Tail can be -%% nil, if the tail has been given explicitly, and the list -%% skeleton has not been compacted (cf. -%% compact_list/1).

+%% Note that even if this function returns some `Tail' +%% that is not `none', the type of `Tail' can be +%% `nil', if the tail has been given explicitly, and the list +%% skeleton has not been compacted (see {@link compact_list/1}). %% %% @see list/2 %% @see nil/0 @@ -2135,17 +2105,17 @@ list_suffix(Node) -> %% ===================================================================== %% @doc "Optimising" list skeleton cons operation. Creates an abstract -%% list skeleton whose first element is Head and whose tail -%% corresponds to Tail. This is similar to -%% list([Head], Tail), except that Tail may -%% not be none, and that the result does not necessarily +%% list skeleton whose first element is `Head' and whose tail +%% corresponds to `Tail'. This is similar to +%% `list([Head], Tail)', except that `Tail' may +%% not be `none', and that the result does not necessarily %% represent exactly "[Head | Tail]", but -%% may depend on the Tail subtree. E.g., if -%% Tail represents [X, Y], the result may +%% may depend on the `Tail' subtree. E.g., if +%% `Tail' represents `[X, Y]', the result may %% represent "[Head, X, Y]", rather than %% "[Head | [X, Y]]". Annotations on -%% Tail itself may be lost if Tail represents -%% a list skeleton, but comments on Tail are propagated to +%% `Tail' itself may be lost if `Tail' represents +%% a list skeleton, but comments on `Tail' are propagated to %% the result. %% %% @see list/2 @@ -2167,8 +2137,8 @@ cons(Head, Tail) -> %% ===================================================================== -%% @doc Returns the head element subtree of a list node. If -%% Node represents "[Head ...]", the +%% @doc Returns the head element subtree of a `list' node. If +%% `Node' represents "[Head ...]", the %% result will represent "Head". %% %% @see list/2 @@ -2182,13 +2152,13 @@ list_head(Node) -> %% ===================================================================== -%% @doc Returns the tail of a list node. If -%% Node represents a single-element list +%% @doc Returns the tail of a `list' node. If +%% `Node' represents a single-element list %% "[E]", then the result has type -%% nil, representing "[]". If -%% Node represents "[E1, E2 +%% `nil', representing "`[]'". If +%% `Node' represents "[E1, E2 %% ...]", the result will represent "[E2 -%% ...]", and if Node represents +%% ...]", and if `Node' represents %% "[Head | Tail]", the result will %% represent "Tail". %% @@ -2213,8 +2183,8 @@ list_tail(Node) -> %% ===================================================================== -%% @doc Returns true if Node has type -%% list or nil, otherwise false. +%% @doc Returns `true' if `Node' has type +%% `list' or `nil', otherwise `false'. %% %% @see list/2 %% @see nil/0 @@ -2230,22 +2200,22 @@ is_list_skeleton(Node) -> %% ===================================================================== -%% @doc Returns true if Node represents a -%% proper list, and false otherwise. A proper list is a -%% list skeleton either on the form "[]" or +%% @doc Returns `true' if `Node' represents a +%% proper list, and `false' otherwise. A proper list is a +%% list skeleton either on the form "`[]'" or %% "[E1, ..., En]", or "[... | -%% Tail]" where recursively Tail also +%% Tail]
" where recursively `Tail' also %% represents a proper list. %% -%%

Note: Since Node is a syntax tree, the actual +%% Note: Since `Node' is a syntax tree, the actual %% run-time values corresponding to its subtrees may often be partially -%% or completely unknown. Thus, if Node represents e.g. -%% "[... | Ns]" (where Ns is a variable), then -%% the function will return false, because it is not known -%% whether Ns will be bound to a list at run-time. If -%% Node instead represents e.g. "[1, 2, 3]" or -%% "[A | []]", then the function will return -%% true.

+%% or completely unknown. Thus, if `Node' represents e.g. +%% "`[... | Ns]'" (where `Ns' is a variable), then +%% the function will return `false', because it is not known +%% whether `Ns' will be bound to a list at run-time. If +%% `Node' instead represents e.g. "`[1, 2, 3]'" or +%% "`[A | []]'", then the function will return +%% `true'. %% %% @see list/2 @@ -2269,11 +2239,10 @@ is_proper_list(Node) -> %% ===================================================================== %% @doc Returns the list of element subtrees of a list skeleton. -%% Node must represent a proper list. E.g., if -%% Node represents "[X1, X2 | +%% `Node' must represent a proper list. E.g., if +%% `Node' represents "[X1, X2 | %% [X3, X4 | []]", then -%% list_elements(Node) yields the list [X1, X2, X3, -%% X4]. +%% `list_elements(Node)' yields the list `[X1, X2, X3, X4]'. %% %% @see list/2 %% @see is_proper_list/1 @@ -2300,14 +2269,14 @@ list_elements(Node, As) -> %% ===================================================================== %% @doc Returns the number of element subtrees of a list skeleton. -%% Node must represent a proper list. E.g., if -%% Node represents "[X1 | [X2, X3 | [X4, X5, -%% X6]]]", then list_length(Node) returns the +%% `Node' must represent a proper list. E.g., if +%% `Node' represents "`[X1 | [X2, X3 | [X4, X5, +%% X6]]]'", then `list_length(Node)' returns the %% integer 6. %% -%%

Note: this is equivalent to -%% length(list_elements(Node)), but potentially more -%% efficient.

+%% Note: this is equivalent to +%% `length(list_elements(Node))', but potentially more +%% efficient. %% %% @see list/2 %% @see is_proper_list/1 @@ -2335,15 +2304,15 @@ list_length(Node, A) -> %% ===================================================================== %% @doc Expands an abstract list skeleton to its most explicit form. If -%% Node represents "[E1, ..., En | +%% `Node' represents "[E1, ..., En | %% Tail]", the result represents "[E1 | %% ... [En | Tail1] ... ]", where -%% Tail1 is the result of -%% normalize_list(Tail). If Node represents +%% `Tail1' is the result of +%% `normalize_list(Tail)'. If `Node' represents %% "[E1, ..., En]", the result simply %% represents "[E1 | ... [En | []] ... -%% ]". If Node does not represent a list skeleton, -%% Node itself is returned. +%% ]". If `Node' does not represent a list skeleton, +%% `Node' itself is returned. %% %% @see list/2 %% @see compact_list/1 @@ -2375,12 +2344,12 @@ normalize_list_1(Es, Tail) -> %% ===================================================================== %% @doc Yields the most compact form for an abstract list skeleton. The %% result either represents "[E1, ..., En | -%% Tail]", where Tail is not a list +%% Tail]
", where `Tail' is not a list %% skeleton, or otherwise simply "[E1, ..., -%% En]". Annotations on subtrees of Node +%% En]
". Annotations on subtrees of `Node' %% that represent list skeletons may be lost, but comments will be -%% propagated to the result. Returns Node itself if -%% Node does not represent a list skeleton. +%% propagated to the result. Returns `Node' itself if +%% `Node' does not represent a list skeleton. %% %% @see list/2 %% @see normalize_list/1 @@ -2419,7 +2388,7 @@ compact_list(Node) -> %% ===================================================================== %% @doc Creates an abstract binary-object template. If -%% Fields is [F1, ..., Fn], the result +%% `Fields' is `[F1, ..., Fn]', the result %% represents "<<F1, ..., %% Fn>>". %% @@ -2452,8 +2421,7 @@ revert_binary(Node) -> %% ===================================================================== -%% @doc Returns the list of field subtrees of a binary -%% node. +%% @doc Returns the list of field subtrees of a `binary' node. %% %% @see binary/1 %% @see binary_field/2 @@ -2480,10 +2448,10 @@ binary_field(Body) -> %% ===================================================================== %% @doc Creates an abstract binary template field. -%% If Size is none, this is equivalent to -%% "binary_field(Body, Types)", otherwise it is -%% equivalent to "binary_field(size_qualifier(Body, Size), -%% Types)". +%% If `Size' is `none', this is equivalent to +%% "`binary_field(Body, Types)'", otherwise it is +%% equivalent to "`binary_field(size_qualifier(Body, Size), +%% Types)'". %% %% (This is a utility function.) %% @@ -2502,9 +2470,9 @@ binary_field(Body, Size, Types) -> %% ===================================================================== %% @doc Creates an abstract binary template field. If -%% Types is the empty list, the result simply represents -%% "Body", otherwise, if Types is -%% [T1, ..., Tn], the result represents +%% `Types' is the empty list, the result simply represents +%% "Body", otherwise, if `Types' is +%% `[T1, ..., Tn]', the result represents %% "Body/T1-...-Tn". %% %% @see binary/1 @@ -2558,7 +2526,7 @@ revert_binary_field(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a binary_field. +%% @doc Returns the body subtree of a `binary_field'. %% %% @see binary_field/2 @@ -2579,9 +2547,9 @@ binary_field_body(Node) -> %% ===================================================================== %% @doc Returns the list of type-specifier subtrees of a -%% binary_field node. If Node represents +%% `binary_field' node. If `Node' represents %% ".../T1, ..., Tn", the result is -%% [T1, ..., Tn], otherwise the result is the empty list. +%% `[T1, ..., Tn]', otherwise the result is the empty list. %% %% @see binary_field/2 @@ -2602,11 +2570,11 @@ binary_field_types(Node) -> %% ===================================================================== %% @doc Returns the size specifier subtree of a -%% binary_field node, if any. If Node +%% `binary_field' node, if any. If `Node' %% represents "Body:Size" or %% "Body:Size/T1, ..., -%% Tn", the result is Size, otherwise -%% none is returned. +%% Tn", the result is `Size', otherwise +%% `none' is returned. %% %% (This is a utility function.) %% @@ -2656,8 +2624,7 @@ size_qualifier(Body, Size) -> %% ===================================================================== -%% @doc Returns the body subtree of a size_qualifier -%% node. +%% @doc Returns the body subtree of a `size_qualifier' node. %% %% @see size_qualifier/2 @@ -2669,7 +2636,7 @@ size_qualifier_body(Node) -> %% ===================================================================== %% @doc Returns the argument subtree (the size) of a -%% size_qualifier node. +%% `size_qualifier' node. %% %% @see size_qualifier/2 @@ -2682,12 +2649,12 @@ size_qualifier_argument(Node) -> %% ===================================================================== %% @doc Creates an abstract error marker. The result represents an %% occurrence of an error in the source code, with an associated Erlang -%% I/O ErrorInfo structure given by Error (see module +%% I/O ErrorInfo structure given by `Error' (see module %% {@link //stdlib/io} for details). Error markers are regarded as source %% code forms, but have no defined lexical form. %% -%%

Note: this is supported only for backwards compatibility with -%% existing parsers and tools.

+%% Note: this is supported only for backwards compatibility with +%% existing parsers and tools. %% %% @see error_marker_info/1 %% @see warning_marker/1 @@ -2718,8 +2685,7 @@ revert_error_marker(Node) -> %% ===================================================================== -%% @doc Returns the ErrorInfo structure of an error_marker -%% node. +%% @doc Returns the ErrorInfo structure of an `error_marker' node. %% %% @see error_marker/1 @@ -2737,12 +2703,12 @@ error_marker_info(Node) -> %% ===================================================================== %% @doc Creates an abstract warning marker. The result represents an %% occurrence of a possible problem in the source code, with an -%% associated Erlang I/O ErrorInfo structure given by Error +%% associated Erlang I/O ErrorInfo structure given by `Error' %% (see module {@link //stdlib/io} for details). Warning markers are %% regarded as source code forms, but have no defined lexical form. %% -%%

Note: this is supported only for backwards compatibility with -%% existing parsers and tools.

+%% Note: this is supported only for backwards compatibility with +%% existing parsers and tools. %% %% @see warning_marker_info/1 %% @see error_marker/1 @@ -2773,8 +2739,7 @@ revert_warning_marker(Node) -> %% ===================================================================== -%% @doc Returns the ErrorInfo structure of a warning_marker -%% node. +%% @doc Returns the ErrorInfo structure of a `warning_marker' node. %% %% @see warning_marker/1 @@ -2796,8 +2761,8 @@ warning_marker_info(Node) -> %% (namely, the last in any sequence in which it occurs). It has no %% defined lexical form. %% -%%

Note: this is retained only for backwards compatibility with -%% existing parsers and tools.

+%% Note: this is retained only for backwards compatibility with +%% existing parsers and tools. %% %% @see error_marker/1 %% @see warning_marker/1 @@ -2831,19 +2796,19 @@ attribute(Name) -> %% ===================================================================== %% @doc Creates an abstract program attribute. If -%% Arguments is [A1, ..., An], the result +%% `Arguments' is `[A1, ..., An]', the result %% represents "-Name(A1, ..., -%% An).". Otherwise, if Arguments is -%% none, the result represents +%% An).". Otherwise, if `Arguments' is +%% `none', the result represents %% "-Name.". The latter form makes it possible %% to represent preprocessor directives such as -%% "-endif.". Attributes are source code forms. +%% "`-endif.'". Attributes are source code forms. %% -%%

Note: The preprocessor macro definition directive +%% Note: The preprocessor macro definition directive %% "-define(Name, Body)." has relatively -%% few requirements on the syntactical form of Body (viewed -%% as a sequence of tokens). The text node type can be used -%% for a Body that is not a normal Erlang construct.

+%% few requirements on the syntactical form of `Body' (viewed +%% as a sequence of tokens). The `text' node type can be used +%% for a `Body' that is not a normal Erlang construct. %% %% @see attribute/1 %% @see attribute_name/1 @@ -3037,7 +3002,7 @@ revert_module_name(A) -> %% ===================================================================== -%% @doc Returns the name subtree of an attribute node. +%% @doc Returns the name subtree of an `attribute' node. %% %% @see attribute/1 @@ -3054,11 +3019,11 @@ attribute_name(Node) -> %% ===================================================================== %% @doc Returns the list of argument subtrees of an -%% attribute node, if any. If Node +%% `attribute' node, if any. If `Node' %% represents "-Name.", the result is -%% none. Otherwise, if Node represents +%% `none'. Otherwise, if `Node' represents %% "-Name(E1, ..., En).", -%% [E1, ..., E1] is returned. +%% `[E1, ..., E1]' is returned. %% %% @see attribute/1 @@ -3146,8 +3111,7 @@ arity_qualifier(Body, Arity) -> %% ===================================================================== -%% @doc Returns the body subtree of an arity_qualifier -%% node. +%% @doc Returns the body subtree of an `arity_qualifier' node. %% %% @see arity_qualifier/2 @@ -3159,7 +3123,7 @@ arity_qualifier_body(Node) -> %% ===================================================================== %% @doc Returns the argument (the arity) subtree of an -%% arity_qualifier node. +%% `arity_qualifier' node. %% %% @see arity_qualifier/2 @@ -3204,7 +3168,7 @@ revert_module_qualifier(Node) -> %% ===================================================================== %% @doc Returns the argument (the module) subtree of a -%% module_qualifier node. +%% `module_qualifier' node. %% %% @see module_qualifier/2 @@ -3220,8 +3184,7 @@ module_qualifier_argument(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a module_qualifier -%% node. +%% @doc Returns the body subtree of a `module_qualifier' node. %% %% @see module_qualifier/2 @@ -3239,7 +3202,7 @@ module_qualifier_body(Node) -> %% ===================================================================== %% @doc Creates an abstract qualified name. The result represents %% "S1.S2. ... .Sn", if -%% Segments is [S1, S2, ..., Sn]. +%% `Segments' is `[S1, S2, ..., Sn]'. %% %% @see qualified_name_segments/1 @@ -3268,7 +3231,7 @@ revert_qualified_name(Node) -> %% ===================================================================== %% @doc Returns the list of name segments of a -%% qualified_name node. +%% `qualified_name' node. %% %% @see qualified_name/1 @@ -3284,10 +3247,10 @@ qualified_name_segments(Node) -> %% ===================================================================== -%% @doc Creates an abstract function definition. If Clauses -%% is [C1, ..., Cn], the result represents +%% @doc Creates an abstract function definition. If `Clauses' +%% is `[C1, ..., Cn]', the result represents %% "Name C1; ...; Name -%% Cn.". More exactly, if each Ci +%% Cn.". More exactly, if each `Ci' %% represents "(Pi1, ..., Pim) Gi -> %% Bi", then the result represents %% "Name(P11, ..., P1m) G1 -> @@ -3349,7 +3312,7 @@ revert_function(Node) -> %% ===================================================================== -%% @doc Returns the name subtree of a function node. +%% @doc Returns the name subtree of a `function' node. %% %% @see function/2 @@ -3365,8 +3328,7 @@ function_name(Node) -> %% ===================================================================== -%% @doc Returns the list of clause subtrees of a function -%% node. +%% @doc Returns the list of clause subtrees of a `function' node. %% %% @see function/2 @@ -3382,14 +3344,14 @@ function_clauses(Node) -> %% ===================================================================== -%% @doc Returns the arity of a function node. The result +%% @doc Returns the arity of a `function' node. The result %% is the number of parameter patterns in the first clause of the %% function; subsequent clauses are ignored. %% -%%

An exception is thrown if function_clauses(Node) +%% An exception is thrown if `function_clauses(Node)' %% returns an empty list, or if the first element of that list is not -%% a syntax tree C of type clause such that -%% clause_patterns(C) is a nonempty list.

+%% a syntax tree `C' of type `clause' such that +%% `clause_patterns(C)' is a nonempty list. %% %% @see function/2 %% @see function_clauses/1 @@ -3416,29 +3378,28 @@ clause(Guard, Body) -> %% ===================================================================== -%% @doc Creates an abstract clause. If Patterns is -%% [P1, ..., Pn] and Body is [B1, ..., -%% Bm], then if Guard is none, the +%% @doc Creates an abstract clause. If `Patterns' is +%% `[P1, ..., Pn]' and `Body' is `[B1, ..., +%% Bm]', then if `Guard' is `none', the %% result represents "(P1, ..., Pn) -> %% B1, ..., Bm", otherwise, unless -%% Guard is a list, the result represents +%% `Guard' is a list, the result represents %% "(P1, ..., Pn) when Guard -> %% B1, ..., Bm". %% -%%

For simplicity, the Guard argument may also be any +%% For simplicity, the `Guard' argument may also be any %% of the following: %%

    -%%
  • An empty list []. This is equivalent to passing -%% none.
  • -%%
  • A nonempty list [E1, ..., Ej] of syntax trees. -%% This is equivalent to passing conjunction([E1, ..., -%% Ej]).
  • -%%
  • A nonempty list of lists of syntax trees [[E1_1, ..., -%% E1_k1], ..., [Ej_1, ..., Ej_kj]], which is equivalent -%% to passing disjunction([conjunction([E1_1, ..., -%% E1_k1]), ..., conjunction([Ej_1, ..., Ej_kj])]).
  • +%%
  • An empty list `[]'. This is equivalent to passing +%% `none'.
  • +%%
  • A nonempty list `[E1, ..., Ej]' of syntax trees. +%% This is equivalent to passing `conjunction([E1, ..., +%% Ej])'.
  • +%%
  • A nonempty list of lists of syntax trees `[[E1_1, ..., +%% E1_k1], ..., [Ej_1, ..., Ej_kj]]', which is equivalent +%% to passing `disjunction([conjunction([E1_1, ..., +%% E1_k1]), ..., conjunction([Ej_1, ..., Ej_kj])])'.
  • %%
-%%

%% %% @see clause/2 %% @see clause_patterns/1 @@ -3554,8 +3515,7 @@ unfold_try_clause({clause, Pos, [{tuple, _, [C, V, _]}], %% ===================================================================== -%% @doc Returns the list of pattern subtrees of a clause -%% node. +%% @doc Returns the list of pattern subtrees of a `clause' node. %% %% @see clause/3 @@ -3571,11 +3531,11 @@ clause_patterns(Node) -> %% ===================================================================== -%% @doc Returns the guard subtree of a clause node, if -%% any. If Node represents "(P1, ..., +%% @doc Returns the guard subtree of a `clause' node, if +%% any. If `Node' represents "(P1, ..., %% Pn) when Guard -> B1, ..., -%% Bm", Guard is returned. Otherwise, the -%% result is none. +%% Bm", `Guard' is returned. Otherwise, the +%% result is `none'. %% %% @see clause/3 @@ -3597,8 +3557,7 @@ clause_guard(Node) -> %% ===================================================================== -%% @doc Return the list of body subtrees of a clause -%% node. +%% @doc Return the list of body subtrees of a `clause' node. %% %% @see clause/3 @@ -3614,8 +3573,8 @@ clause_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract disjunction. If List is -%% [E1, ..., En], the result represents +%% @doc Creates an abstract disjunction. If `List' is +%% `[E1, ..., En]', the result represents %% "E1; ...; En". %% %% @see disjunction_body/1 @@ -3632,7 +3591,7 @@ disjunction(Tests) -> %% ===================================================================== %% @doc Returns the list of body subtrees of a -%% disjunction node. +%% `disjunction' node. %% %% @see disjunction/1 @@ -3643,8 +3602,8 @@ disjunction_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract conjunction. If List is -%% [E1, ..., En], the result represents +%% @doc Creates an abstract conjunction. If `List' is +%% `[E1, ..., En]', the result represents %% "E1, ..., En". %% %% @see conjunction_body/1 @@ -3661,7 +3620,7 @@ conjunction(Tests) -> %% ===================================================================== %% @doc Returns the list of body subtrees of a -%% conjunction node. +%% `conjunction' node. %% %% @see conjunction/1 @@ -3698,7 +3657,7 @@ revert_catch_expr(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a catch_expr node. +%% @doc Returns the body subtree of a `catch_expr' node. %% %% @see catch_expr/1 @@ -3746,7 +3705,7 @@ revert_match_expr(Node) -> %% ===================================================================== -%% @doc Returns the pattern subtree of a match_expr node. +%% @doc Returns the pattern subtree of a `match_expr' node. %% %% @see match_expr/2 @@ -3762,7 +3721,7 @@ match_expr_pattern(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a match_expr node. +%% @doc Returns the body subtree of a `match_expr' node. %% %% @see match_expr/2 @@ -3779,11 +3738,11 @@ match_expr_body(Node) -> %% ===================================================================== %% @doc Creates an abstract operator. The name of the operator is the -%% character sequence represented by Name. This is +%% character sequence represented by `Name'. This is %% analogous to the print name of an atom, but an operator is never %% written within single-quotes; e.g., the result of -%% operator('++') represents "++" rather -%% than "'++'". +%% `operator('++')' represents "`++'" rather +%% than "`'++''". %% %% @see operator_name/1 %% @see operator_literal/1 @@ -3801,7 +3760,7 @@ operator(Name) -> %% ===================================================================== -%% @doc Returns the name of an operator node. Note that +%% @doc Returns the name of an `operator' node. Note that %% the name is returned as an atom. %% %% @see operator/1 @@ -3814,8 +3773,7 @@ operator_name(Node) -> %% ===================================================================== %% @doc Returns the literal string represented by an -%% operator node. This is simply the operator name as a -%% string. +%% `operator' node. This is simply the operator name as a string. %% %% @see operator/1 @@ -3875,7 +3833,7 @@ revert_infix_expr(Node) -> %% ===================================================================== %% @doc Returns the left argument subtree of an -%% infix_expr node. +%% `infix_expr' node. %% %% @see infix_expr/3 @@ -3891,8 +3849,7 @@ infix_expr_left(Node) -> %% ===================================================================== -%% @doc Returns the operator subtree of an infix_expr -%% node. +%% @doc Returns the operator subtree of an `infix_expr' node. %% %% @see infix_expr/3 @@ -3909,7 +3866,7 @@ infix_expr_operator(Node) -> %% ===================================================================== %% @doc Returns the right argument subtree of an -%% infix_expr node. +%% `infix_expr' node. %% %% @see infix_expr/3 @@ -3968,8 +3925,7 @@ revert_prefix_expr(Node) -> %% ===================================================================== -%% @doc Returns the operator subtree of a prefix_expr -%% node. +%% @doc Returns the operator subtree of a `prefix_expr' node. %% %% @see prefix_expr/2 @@ -3985,8 +3941,7 @@ prefix_expr_operator(Node) -> %% ===================================================================== -%% @doc Returns the argument subtree of a prefix_expr -%% node. +%% @doc Returns the argument subtree of a `prefix_expr' node. %% %% @see prefix_expr/2 @@ -4012,7 +3967,7 @@ record_field(Name) -> %% ===================================================================== %% @doc Creates an abstract record field specification. If -%% Value is none, the result represents +%% `Value' is `none', the result represents %% simply "Name", otherwise it represents %% "Name = Value". %% @@ -4034,7 +3989,7 @@ record_field(Name, Value) -> %% ===================================================================== -%% @doc Returns the name subtree of a record_field node. +%% @doc Returns the name subtree of a `record_field' node. %% %% @see record_field/2 @@ -4045,11 +4000,11 @@ record_field_name(Node) -> %% ===================================================================== -%% @doc Returns the value subtree of a record_field node, -%% if any. If Node represents -%% "Name", none is -%% returned. Otherwise, if Node represents -%% "Name = Value", Value +%% @doc Returns the value subtree of a `record_field' node, +%% if any. If `Node' represents +%% "Name", `none' is +%% returned. Otherwise, if `Node' represents +%% "Name = Value", `Value' %% is returned. %% %% @see record_field/2 @@ -4064,9 +4019,9 @@ record_field_value(Node) -> %% @doc Creates an abstract record field index expression. The result %% represents "#Type.Field". %% -%%

(Note: the function name record_index/2 is reserved +%% (Note: the function name `record_index/2' is reserved %% by the Erlang compiler, which is why that name could not be used -%% for this constructor.)

+%% for this constructor.) %% %% @see record_index_expr_type/1 %% @see record_index_expr_field/1 @@ -4105,8 +4060,7 @@ revert_record_index_expr(Node) -> %% ===================================================================== -%% @doc Returns the type subtree of a record_index_expr -%% node. +%% @doc Returns the type subtree of a `record_index_expr' node. %% %% @see record_index_expr/2 @@ -4122,8 +4076,7 @@ record_index_expr_type(Node) -> %% ===================================================================== -%% @doc Returns the field subtree of a record_index_expr -%% node. +%% @doc Returns the field subtree of a `record_index_expr' node. %% %% @see record_index_expr/2 @@ -4149,12 +4102,12 @@ record_access(Argument, Field) -> %% ===================================================================== %% @doc Creates an abstract record field access expression. If -%% Type is not none, the result represents +%% `Type' is not `none', the result represents %% "Argument#Type.Field". %% -%%

If Type is none, the result represents +%% If `Type' is `none', the result represents %% "Argument.Field". This is a special -%% form only allowed within Mnemosyne queries.

+%% form only allowed within Mnemosyne queries. %% %% @see record_access/2 %% @see record_access_argument/1 @@ -4209,8 +4162,7 @@ revert_record_access(Node) -> %% ===================================================================== -%% @doc Returns the argument subtree of a record_access -%% node. +%% @doc Returns the argument subtree of a `record_access' node. %% %% @see record_access/3 @@ -4228,12 +4180,12 @@ record_access_argument(Node) -> %% ===================================================================== -%% @doc Returns the type subtree of a record_access node, -%% if any. If Node represents -%% "Argument.Field", none -%% is returned, otherwise if Node represents +%% @doc Returns the type subtree of a `record_access' node, +%% if any. If `Node' represents +%% "Argument.Field", `none' +%% is returned, otherwise if `Node' represents %% "Argument#Type.Field", -%% Type is returned. +%% `Type' is returned. %% %% @see record_access/3 @@ -4251,8 +4203,7 @@ record_access_type(Node) -> %% ===================================================================== -%% @doc Returns the field subtree of a record_access -%% node. +%% @doc Returns the field subtree of a `record_access' node. %% %% @see record_access/3 @@ -4279,9 +4230,9 @@ record_expr(Type, Fields) -> %% ===================================================================== -%% @doc Creates an abstract record expression. If Fields is -%% [F1, ..., Fn], then if Argument is -%% none, the result represents +%% @doc Creates an abstract record expression. If `Fields' is +%% `[F1, ..., Fn]', then if `Argument' is +%% `none', the result represents %% "#Type{F1, ..., Fn}", %% otherwise it represents %% "Argument#Type{F1, ..., @@ -4347,12 +4298,12 @@ revert_record_expr(Node) -> %% ===================================================================== -%% @doc Returns the argument subtree of a record_expr node, -%% if any. If Node represents -%% "#Type{...}", none is returned. -%% Otherwise, if Node represents +%% @doc Returns the argument subtree of a `record_expr' node, +%% if any. If `Node' represents +%% "#Type{...}", `none' is returned. +%% Otherwise, if `Node' represents %% "Argument#Type{...}", -%% Argument is returned. +%% `Argument' is returned. %% %% @see record_expr/3 @@ -4370,7 +4321,7 @@ record_expr_argument(Node) -> %% ===================================================================== -%% @doc Returns the type subtree of a record_expr node. +%% @doc Returns the type subtree of a `record_expr' node. %% %% @see record_expr/3 @@ -4389,7 +4340,7 @@ record_expr_type(Node) -> %% ===================================================================== %% @doc Returns the list of field subtrees of a -%% record_expr node. +%% `record_expr' node. %% %% @see record_expr/3 @@ -4408,10 +4359,10 @@ record_expr_fields(Node) -> %% ===================================================================== %% @doc Creates an abstract function application expression. If -%% Module is none, this is call is equivalent -%% to application(Function, Arguments), otherwise it is -%% equivalent to application(module_qualifier(Module, Function), -%% Arguments). +%% `Module' is `none', this is call is equivalent +%% to `application(Function, Arguments)', otherwise it is +%% equivalent to `application(module_qualifier(Module, Function), +%% Arguments)'. %% %% (This is a utility function.) %% @@ -4429,7 +4380,7 @@ application(Module, Name, Arguments) -> %% ===================================================================== %% @doc Creates an abstract function application expression. If -%% Arguments is [A1, ..., An], the result +%% `Arguments' is `[A1, ..., An]', the result %% represents "Operator(A1, ..., %% An)". %% @@ -4467,12 +4418,11 @@ revert_application(Node) -> %% ===================================================================== -%% @doc Returns the operator subtree of an application -%% node. +%% @doc Returns the operator subtree of an `application' node. %% -%%

Note: if Node represents +%% Note: if `Node' represents %% "M:F(...)", then the result is the -%% subtree representing "M:F".

+%% subtree representing "M:F". %% %% @see application/2 %% @see module_qualifier/2 @@ -4490,7 +4440,7 @@ application_operator(Node) -> %% ===================================================================== %% @doc Returns the list of argument subtrees of an -%% application node. +%% `application' node. %% %% @see application/2 @@ -4506,8 +4456,8 @@ application_arguments(Node) -> %% ===================================================================== -%% @doc Creates an abstract list comprehension. If Body is -%% [E1, ..., En], the result represents +%% @doc Creates an abstract list comprehension. If `Body' is +%% `[E1, ..., En]', the result represents %% "[Template || E1, ..., En]". %% %% @see list_comp_template/1 @@ -4542,7 +4492,7 @@ revert_list_comp(Node) -> %% ===================================================================== -%% @doc Returns the template subtree of a list_comp node. +%% @doc Returns the template subtree of a `list_comp' node. %% %% @see list_comp/2 @@ -4558,8 +4508,7 @@ list_comp_template(Node) -> %% ===================================================================== -%% @doc Returns the list of body subtrees of a list_comp -%% node. +%% @doc Returns the list of body subtrees of a `list_comp' node. %% %% @see list_comp/2 @@ -4574,8 +4523,8 @@ list_comp_body(Node) -> end. %% ===================================================================== -%% @doc Creates an abstract binary comprehension. If Body is -%% [E1, ..., En], the result represents +%% @doc Creates an abstract binary comprehension. If `Body' is +%% `[E1, ..., En]', the result represents %% "<<Template || E1, ..., En>>". %% %% @see binary_comp_template/1 @@ -4610,7 +4559,7 @@ revert_binary_comp(Node) -> %% ===================================================================== -%% @doc Returns the template subtree of a binary_comp node. +%% @doc Returns the template subtree of a `binary_comp' node. %% %% @see binary_comp/2 @@ -4626,8 +4575,7 @@ binary_comp_template(Node) -> %% ===================================================================== -%% @doc Returns the list of body subtrees of a binary_comp -%% node. +%% @doc Returns the list of body subtrees of a `binary_comp' node. %% %% @see binary_comp/2 @@ -4671,7 +4619,7 @@ revert_query_expr(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a query_expr node. +%% @doc Returns the body subtree of a `query_expr' node. %% %% @see query_expr/1 @@ -4687,10 +4635,10 @@ query_expr_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract Mnemosyne rule. If Clauses is -%% [C1, ..., Cn], the results represents +%% @doc Creates an abstract Mnemosyne rule. If `Clauses' is +%% `[C1, ..., Cn]', the results represents %% "Name C1; ...; Name -%% Cn.". More exactly, if each Ci +%% Cn.
". More exactly, if each `Ci' %% represents "(Pi1, ..., Pim) Gi -> %% Bi", then the result represents %% "Name(P11, ..., P1m) G1 :- @@ -4745,7 +4693,7 @@ revert_rule(Node) -> %% ===================================================================== -%% @doc Returns the name subtree of a rule node. +%% @doc Returns the name subtree of a `rule' node. %% %% @see rule/2 @@ -4760,7 +4708,7 @@ rule_name(Node) -> end. %% ===================================================================== -%% @doc Returns the list of clause subtrees of a rule node. +%% @doc Returns the list of clause subtrees of a `rule' node. %% %% @see rule/2 @@ -4775,14 +4723,14 @@ rule_clauses(Node) -> end. %% ===================================================================== -%% @doc Returns the arity of a rule node. The result is the +%% @doc Returns the arity of a `rule' node. The result is the %% number of parameter patterns in the first clause of the rule; %% subsequent clauses are ignored. %% -%%

An exception is thrown if rule_clauses(Node) returns +%% An exception is thrown if `rule_clauses(Node)' returns %% an empty list, or if the first element of that list is not a syntax -%% tree C of type clause such that -%% clause_patterns(C) is a nonempty list.

+%% tree `C' of type `clause' such that +%% `clause_patterns(C)' is a nonempty list. %% %% @see rule/2 %% @see rule_clauses/1 @@ -4832,7 +4780,7 @@ revert_generator(Node) -> %% ===================================================================== -%% @doc Returns the pattern subtree of a generator node. +%% @doc Returns the pattern subtree of a `generator' node. %% %% @see generator/2 @@ -4848,7 +4796,7 @@ generator_pattern(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a generator node. +%% @doc Returns the body subtree of a `generator' node. %% %% @see generator/2 @@ -4898,7 +4846,7 @@ revert_binary_generator(Node) -> %% ===================================================================== -%% @doc Returns the pattern subtree of a generator node. +%% @doc Returns the pattern subtree of a `generator' node. %% %% @see binary_generator/2 @@ -4914,7 +4862,7 @@ binary_generator_pattern(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a generator node. +%% @doc Returns the body subtree of a `generator' node. %% %% @see binary_generator/2 @@ -4930,8 +4878,8 @@ binary_generator_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract block expression. If Body is -%% [B1, ..., Bn], the result represents "begin +%% @doc Creates an abstract block expression. If `Body' is +%% `[B1, ..., Bn]', the result represents "begin %% B1, ..., Bn end". %% %% @see block_expr_body/1 @@ -4959,8 +4907,7 @@ revert_block_expr(Node) -> %% ===================================================================== -%% @doc Returns the list of body subtrees of a block_expr -%% node. +%% @doc Returns the list of body subtrees of a `block_expr' node. %% %% @see block_expr/1 @@ -4976,10 +4923,10 @@ block_expr_body(Node) -> %% ===================================================================== -%% @doc Creates an abstract if-expression. If Clauses is -%% [C1, ..., Cn], the result represents "if +%% @doc Creates an abstract if-expression. If `Clauses' is +%% `[C1, ..., Cn]', the result represents "if %% C1; ...; Cn end". More exactly, if each -%% Ci represents "() Gi -> +%% `Ci' represents "() Gi -> %% Bi", then the result represents "if %% G1 -> B1; ...; Gn -> Bn %% end". @@ -5014,8 +4961,7 @@ revert_if_expr(Node) -> %% ===================================================================== -%% @doc Returns the list of clause subtrees of an if_expr -%% node. +%% @doc Returns the list of clause subtrees of an `if_expr' node. %% %% @see if_expr/1 @@ -5031,10 +4977,10 @@ if_expr_clauses(Node) -> %% ===================================================================== -%% @doc Creates an abstract case-expression. If Clauses is -%% [C1, ..., Cn], the result represents "case +%% @doc Creates an abstract case-expression. If `Clauses' is +%% `[C1, ..., Cn]', the result represents "case %% Argument of C1; ...; Cn end". More -%% exactly, if each Ci represents "(Pi) +%% exactly, if each `Ci' represents "(Pi) %% Gi -> Bi", then the result represents %% "case Argument of P1 G1 -> %% B1; ...; Pn Gn -> Bn end". @@ -5078,7 +5024,7 @@ revert_case_expr(Node) -> %% ===================================================================== -%% @doc Returns the argument subtree of a case_expr node. +%% @doc Returns the argument subtree of a `case_expr' node. %% %% @see case_expr/2 @@ -5094,8 +5040,7 @@ case_expr_argument(Node) -> %% ===================================================================== -%% @doc Returns the list of clause subtrees of a case_expr -%% node. +%% @doc Returns the list of clause subtrees of a `case_expr' node. %% %% @see case_expr/2 @@ -5111,10 +5056,10 @@ case_expr_clauses(Node) -> %% ===================================================================== -%% @doc Creates an abstract cond-expression. If Clauses is -%% [C1, ..., Cn], the result represents "cond +%% @doc Creates an abstract cond-expression. If `Clauses' is +%% `[C1, ..., Cn]', the result represents "cond %% C1; ...; Cn end". More exactly, if each -%% Ci represents "() Ei -> +%% `Ci' represents "() Ei -> %% Bi", then the result represents "cond %% E1 -> B1; ...; En -> Bn %% end". @@ -5149,8 +5094,7 @@ revert_cond_expr(Node) -> %% ===================================================================== -%% @doc Returns the list of clause subtrees of a cond_expr -%% node. +%% @doc Returns the list of clause subtrees of a `cond_expr' node. %% %% @see cond_expr/1 @@ -5175,21 +5119,21 @@ receive_expr(Clauses) -> %% ===================================================================== -%% @doc Creates an abstract receive-expression. If Timeout -%% is none, the result represents "receive -%% C1; ...; Cn end" (the Action -%% argument is ignored). Otherwise, if Clauses is -%% [C1, ..., Cn] and Action is [A1, ..., -%% Am], the result represents "receive C1; ...; +%% @doc Creates an abstract receive-expression. If `Timeout' +%% is `none', the result represents "receive +%% C1; ...; Cn end" (the `Action' +%% argument is ignored). Otherwise, if `Clauses' is +%% `[C1, ..., Cn]' and `Action' is `[A1, ..., +%% Am]', the result represents "receive C1; ...; %% Cn after Timeout -> A1, ..., Am -%% end". More exactly, if each Ci represents +%% end". More exactly, if each `Ci' represents %% "(Pi) Gi -> Bi", then the %% result represents "receive P1 G1 -> %% B1; ...; Pn Gn -> Bn ... %% end". %% -%%

Note that in Erlang, a receive-expression must have at least one -%% clause if no timeout part is specified.

+%% Note that in Erlang, a receive-expression must have at least one +%% clause if no timeout part is specified. %% %% @see receive_expr_clauses/1 %% @see receive_expr_timeout/1 @@ -5254,7 +5198,7 @@ revert_receive_expr(Node) -> %% ===================================================================== %% @doc Returns the list of clause subtrees of a -%% receive_expr node. +%% `receive_expr' node. %% %% @see receive_expr/3 @@ -5272,12 +5216,12 @@ receive_expr_clauses(Node) -> %% ===================================================================== -%% @doc Returns the timeout subtree of a receive_expr node, -%% if any. If Node represents "receive C1; -%% ...; Cn end", none is returned. -%% Otherwise, if Node represents "receive +%% @doc Returns the timeout subtree of a `receive_expr' node, +%% if any. If `Node' represents "receive C1; +%% ...; Cn end", `none' is returned. +%% Otherwise, if `Node' represents "receive %% C1; ...; Cn after Timeout -> ... end", -%% Timeout is returned. +%% `Timeout' is returned. %% %% @see receive_expr/3 @@ -5296,7 +5240,7 @@ receive_expr_timeout(Node) -> %% ===================================================================== %% @doc Returns the list of action body subtrees of a -%% receive_expr node. If Node represents +%% `receive_expr' node. If `Node' represents %% "receive C1; ...; Cn end", this is the %% empty list. %% @@ -5343,26 +5287,26 @@ try_after_expr(Body, After) -> %% ===================================================================== -%% @doc Creates an abstract try-expression. If Body is -%% [B1, ..., Bn], Clauses is [C1, ..., -%% Cj], Handlers is [H1, ..., Hk], and -%% After is [A1, ..., Am], the result +%% @doc Creates an abstract try-expression. If `Body' is +%% `[B1, ..., Bn]', `Clauses' is `[C1, ..., +%% Cj]', `Handlers' is `[H1, ..., Hk]', and +%% `After' is `[A1, ..., Am]', the result %% represents "try B1, ..., Bn of C1; %% ...; Cj catch H1; ...; Hk after %% A1, ..., Am end". More exactly, if each -%% Ci represents "(CPi) CGi -> -%% CBi", and each Hi represents +%% `Ci' represents "(CPi) CGi -> +%% CBi", and each `Hi' represents %% "(HPi) HGi -> HBi", then the %% result represents "try B1, ..., Bn of %% CP1 CG1 -> CB1; ...; CPj %% CGj -> CBj catch HP1 HG1 -> %% HB1; ...; HPk HGk -> HBk after -%% A1, ..., Am end"; cf. -%% case_expr/2. If Clauses is the empty list, -%% the of ... section is left out. If After is -%% the empty list, the after ... section is left out. If -%% Handlers is the empty list, and After is -%% nonempty, the catch ... section is left out. +%% A1, ..., Am end"; see +%% {@link case_expr/2}. If `Clauses' is the empty list, +%% the `of ...' section is left out. If `After' is +%% the empty list, the `after ...' section is left out. If +%% `Handlers' is the empty list, and `After' is +%% nonempty, the `catch ...' section is left out. %% %% @see try_expr_body/1 %% @see try_expr_clauses/1 @@ -5420,8 +5364,7 @@ revert_try_expr(Node) -> %% ===================================================================== -%% @doc Returns the list of body subtrees of a try_expr -%% node. +%% @doc Returns the list of body subtrees of a `try_expr' node. %% %% @see try_expr/4 @@ -5438,7 +5381,7 @@ try_expr_body(Node) -> %% ===================================================================== %% @doc Returns the list of case-clause subtrees of a -%% try_expr node. If Node represents +%% `try_expr' node. If `Node' represents %% "try Body catch H1; ...; Hn %% end", the result is the empty list. %% @@ -5457,7 +5400,7 @@ try_expr_clauses(Node) -> %% ===================================================================== %% @doc Returns the list of handler-clause subtrees of a -%% try_expr node. +%% `try_expr' node. %% %% @see try_expr/4 @@ -5473,8 +5416,7 @@ try_expr_handlers(Node) -> %% ===================================================================== -%% @doc Returns the list of "after" subtrees of a try_expr -%% node. +%% @doc Returns the list of "after" subtrees of a `try_expr' node. %% %% @see try_expr/4 @@ -5513,7 +5455,7 @@ class_qualifier(Class, Body) -> %% ===================================================================== %% @doc Returns the argument (the class) subtree of a -%% class_qualifier node. +%% `class_qualifier' node. %% %% @see class_qualifier/2 @@ -5524,7 +5466,7 @@ class_qualifier_argument(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a class_qualifier node. +%% @doc Returns the body subtree of a `class_qualifier' node. %% %% @see class_qualifier/2 @@ -5536,9 +5478,9 @@ class_qualifier_body(Node) -> %% ===================================================================== %% @doc Creates an abstract "implicit fun" expression. If -%% Arity is none, this is equivalent to -%% implicit_fun(Name), otherwise it is equivalent to -%% implicit_fun(arity_qualifier(Name, Arity)). +%% `Arity' is `none', this is equivalent to +%% `implicit_fun(Name)', otherwise it is equivalent to +%% `implicit_fun(arity_qualifier(Name, Arity))'. %% %% (This is a utility function.) %% @@ -5555,10 +5497,10 @@ implicit_fun(Name, Arity) -> %% ===================================================================== %% @doc Creates an abstract module-qualified "implicit fun" expression. -%% If Module is none, this is equivalent to -%% implicit_fun(Name, Arity), otherwise it is equivalent to -%% implicit_fun(module_qualifier(Module, arity_qualifier(Name, -%% Arity)). +%% If `Module' is `none', this is equivalent to +%% `implicit_fun(Name, Arity)', otherwise it is equivalent to +%% `implicit_fun(module_qualifier(Module, arity_qualifier(Name, +%% Arity))'. %% %% (This is a utility function.) %% @@ -5576,7 +5518,7 @@ implicit_fun(Module, Name, Arity) -> %% ===================================================================== %% @doc Creates an abstract "implicit fun" expression. The result -%% represents "fun Name". Name should +%% represents "fun Name". `Name' should %% represent either F/A or %% M:F/A %% @@ -5635,13 +5577,13 @@ revert_implicit_fun(Node) -> %% ===================================================================== -%% @doc Returns the name subtree of an implicit_fun node. +%% @doc Returns the name subtree of an `implicit_fun' node. %% -%%

Note: if Node represents "fun +%% Note: if `Node' represents "fun %% N/A" or "fun %% M:N/A", then the result is the %% subtree representing "N/A" or -%% "M:N/A", respectively.

+%% "M:N/A", respectively. %% %% @see implicit_fun/1 %% @see arity_qualifier/2 @@ -5671,10 +5613,10 @@ implicit_fun_name(Node) -> %% ===================================================================== -%% @doc Creates an abstract fun-expression. If Clauses is -%% [C1, ..., Cn], the result represents "fun +%% @doc Creates an abstract fun-expression. If `Clauses' is +%% `[C1, ..., Cn]', the result represents "fun %% C1; ...; Cn end". More exactly, if each -%% Ci represents "(Pi1, ..., Pim) +%% `Ci' represents "(Pi1, ..., Pim) %% Gi -> Bi", then the result represents %% "fun (P11, ..., P1m) G1 -> %% B1; ...; (Pn1, ..., Pnm) Gn -> @@ -5711,8 +5653,7 @@ revert_fun_expr(Node) -> %% ===================================================================== -%% @doc Returns the list of clause subtrees of a fun_expr -%% node. +%% @doc Returns the list of clause subtrees of a `fun_expr' node. %% %% @see fun_expr/1 @@ -5728,14 +5669,14 @@ fun_expr_clauses(Node) -> %% ===================================================================== -%% @doc Returns the arity of a fun_expr node. The result is +%% @doc Returns the arity of a `fun_expr' node. The result is %% the number of parameter patterns in the first clause of the %% fun-expression; subsequent clauses are ignored. %% -%%

An exception is thrown if fun_expr_clauses(Node) +%% An exception is thrown if `fun_expr_clauses(Node)' %% returns an empty list, or if the first element of that list is not a -%% syntax tree C of type clause such that -%% clause_patterns(C) is a nonempty list.

+%% syntax tree `C' of type `clause' such that +%% `clause_patterns(C)' is a nonempty list. %% %% @see fun_expr/1 %% @see fun_expr_clauses/1 @@ -5768,7 +5709,7 @@ revert_parentheses(Node) -> %% ===================================================================== -%% @doc Returns the body subtree of a parentheses node. +%% @doc Returns the body subtree of a `parentheses' node. %% %% @see parentheses/1 @@ -5788,22 +5729,22 @@ macro(Name) -> %% ===================================================================== -%% @doc Creates an abstract macro application. If Arguments -%% is none, the result represents -%% "?Name", otherwise, if Arguments -%% is [A1, ..., An], the result represents +%% @doc Creates an abstract macro application. If `Arguments' +%% is `none', the result represents +%% "?Name", otherwise, if `Arguments' +%% is `[A1, ..., An]', the result represents %% "?Name(A1, ..., An)". %% -%%

Notes: if Arguments is the empty list, the result +%% Notes: if `Arguments' is the empty list, the result %% will thus represent "?Name()", including a pair -%% of matching parentheses.

+%% of matching parentheses. %% -%%

The only syntactical limitation imposed by the preprocessor on the +%% The only syntactical limitation imposed by the preprocessor on the %% arguments to a macro application (viewed as sequences of tokens) is %% that they must be balanced with respect to parentheses, brackets, -%% begin ... end, case ... end, etc. The -%% text node type can be used to represent arguments which -%% are not regular Erlang constructs.

+%% `begin ... end', `case ... end', etc. The +%% `text' node type can be used to represent arguments which +%% are not regular Erlang constructs. %% %% @see macro_name/1 %% @see macro_arguments/1 @@ -5825,7 +5766,7 @@ macro(Name, Arguments) -> %% ===================================================================== -%% @doc Returns the name subtree of a macro node. +%% @doc Returns the name subtree of a `macro' node. %% %% @see macro/2 @@ -5836,12 +5777,12 @@ macro_name(Node) -> %% ===================================================================== -%% @doc Returns the list of argument subtrees of a macro -%% node, if any. If Node represents -%% "?Name", none is returned. -%% Otherwise, if Node represents +%% @doc Returns the list of argument subtrees of a `macro' +%% node, if any. If `Node' represents +%% "?Name", `none' is returned. +%% Otherwise, if `Node' represents %% "?Name(A1, ..., An)", -%% [A1, ..., An] is returned. +%% `[A1, ..., An]' is returned. %% %% @see macro/2 @@ -5853,12 +5794,12 @@ macro_arguments(Node) -> %% ===================================================================== %% @doc Returns the syntax tree corresponding to an Erlang term. -%% Term must be a literal term, i.e., one that can be +%% `Term' must be a literal term, i.e., one that can be %% represented as a source code literal. Thus, it may not contain a %% process identifier, port, reference, binary or function value as a %% subterm. The function recognises printable strings, in order to get a %% compact and readable representation. Evaluation fails with reason -%% badarg if Term is not a literal term. +%% `badarg' if `Term' is not a literal term. %% %% @see concrete/1 %% @see is_literal/1 @@ -5909,16 +5850,16 @@ abstract_tail(H, T) -> %% ===================================================================== %% @doc Returns the Erlang term represented by a syntax tree. Evaluation -%% fails with reason badarg if Node does not +%% fails with reason `badarg' if `Node' does not %% represent a literal term. %% -%%

Note: Currently, the set of syntax trees which have a concrete +%% Note: Currently, the set of syntax trees which have a concrete %% representation is larger than the set of trees which can be built -%% using the function abstract/1. An abstract character -%% will be concretised as an integer, while abstract/1 does +%% using the function {@link abstract/1}. An abstract character +%% will be concretised as an integer, while {@link abstract/1} does %% not at present yield an abstract character for any input. (Use the -%% char/1 function to explicitly create an abstract -%% character.)

+%% {@link char/1} function to explicitly create an abstract +%% character.) %% %% @see abstract/1 %% @see is_literal/1 @@ -5961,7 +5902,7 @@ concrete(Node) -> {value, concrete(F), []} end, [], true), B; - _ -> + _ -> erlang:error({badarg, Node}) end. @@ -5972,10 +5913,10 @@ concrete_list([]) -> %% ===================================================================== -%% @doc Returns true if Node represents a -%% literal term, otherwise false. This function returns -%% true if and only if the value of -%% concrete(Node) is defined. +%% @doc Returns `true' if `Node' represents a +%% literal term, otherwise `false'. This function returns +%% `true' if and only if the value of +%% `concrete(Node)' is defined. %% %% @see abstract/1 %% @see concrete/1 @@ -6006,19 +5947,19 @@ is_literal(T) -> %% ===================================================================== -%% @doc Returns an erl_parse-compatible representation of a -%% syntax tree, if possible. If Tree represents a +%% @doc Returns an `erl_parse'-compatible representation of a +%% syntax tree, if possible. If `Tree' represents a %% well-formed Erlang program or expression, the conversion should work -%% without problems. Typically, is_tree/1 yields -%% true if conversion failed (i.e., the result is still an -%% abstract syntax tree), and false otherwise. +%% without problems. Typically, {@link is_tree/1} yields +%% `true' if conversion failed (i.e., the result is still an +%% abstract syntax tree), and `false' otherwise. %% -%%

The is_tree/1 test is not completely foolproof. For a -%% few special node types (e.g. arity_qualifier), if such a +%% The {@link is_tree/1} test is not completely foolproof. For a +%% few special node types (e.g. `arity_qualifier'), if such a %% node occurs in a context where it is not expected, it will be left %% unchanged as a non-reverted subtree of the result. This can only -%% happen if Tree does not actually represent legal Erlang -%% code.

+%% happen if `Tree' does not actually represent legal Erlang +%% code. %% %% @see revert_forms/1 %% @see //stdlib/erl_parse @@ -6155,11 +6096,11 @@ revert_root(Node) -> %% ===================================================================== %% @doc Reverts a sequence of Erlang source code forms. The sequence can -%% be given either as a form_list syntax tree (possibly +%% be given either as a `form_list' syntax tree (possibly %% nested), or as a list of "program form" syntax trees. If successful, -%% the corresponding flat list of erl_parse-compatible -%% syntax trees is returned (cf. revert/1). If some program -%% form could not be reverted, {error, Form} is thrown. +%% the corresponding flat list of `erl_parse'-compatible +%% syntax trees is returned (see {@link revert/1}). If some program +%% form could not be reverted, `{error, Form}' is thrown. %% Standalone comments in the form sequence are discarded. %% %% @see revert/1 @@ -6209,57 +6150,53 @@ revert_forms_1([]) -> %% ===================================================================== %% @doc Returns the grouped list of all subtrees of a syntax tree. If -%% Node is a leaf node (cf. is_leaf/1), this +%% `Node' is a leaf node (see {@link is_leaf/1}), this %% is the empty list, otherwise the result is always a nonempty list, -%% containing the lists of subtrees of Node, in +%% containing the lists of subtrees of `Node', in %% left-to-right order as they occur in the printed program text, and %% grouped by category. Often, each group contains only a single %% subtree. %% -%%

Depending on the type of Node, the size of some +%% Depending on the type of `Node', the size of some %% groups may be variable (e.g., the group consisting of all the %% elements of a tuple), while others always contain the same number of %% elements - usually exactly one (e.g., the group containing the %% argument expression of a case-expression). Note, however, that the %% exact structure of the returned list (for a given node type) should %% in general not be depended upon, since it might be subject to change -%% without notice.

+%% without notice. %% -%%

The function subtrees/1 and the constructor functions -%% make_tree/2 and update_tree/2 can be a +%% The function {@link subtrees/1} and the constructor functions +%% {@link make_tree/2} and {@link update_tree/2} can be a %% great help if one wants to traverse a syntax tree, visiting all its %% subtrees, but treat nodes of the tree in a uniform way in most or all %% cases. Using these functions makes this simple, and also assures that %% your code is not overly sensitive to extensions of the syntax tree %% data type, because any node types not explicitly handled by your code -%% can be left to a default case.

+%% can be left to a default case. %% -%%

For example: -%%

-%%   postorder(F, Tree) ->
+%% For example:
+%% ```postorder(F, Tree) ->
 %%       F(case subtrees(Tree) of
 %%           [] -> Tree;
 %%           List -> update_tree(Tree,
 %%                               [[postorder(F, Subtree)
 %%                                 || Subtree <- Group]
 %%                                || Group <- List])
-%%         end).
-%% 
-%% maps the function F on Tree and all its +%% end).''' +%% maps the function `F' on `Tree' and all its %% subtrees, doing a post-order traversal of the syntax tree. (Note the -%% use of update_tree/2 to preserve node attributes.) For a +%% use of {@link update_tree/2} to preserve node attributes.) For a %% simple function like: -%%
-%%   f(Node) ->
+%% ```f(Node) ->
 %%       case type(Node) of
 %%           atom -> atom("a_" ++ atom_name(Node));
 %%           _ -> Node
-%%       end.
-%% 
-%% the call postorder(fun f/1, Tree) will yield a new -%% representation of Tree in which all atom names have been +%% end.''' +%% the call `postorder(fun f/1, Tree)' will yield a new +%% representation of `Tree' in which all atom names have been %% extended with the prefix "a_", but nothing else (including comments, -%% annotations and line numbers) has been changed.

+%% annotations and line numbers) has been changed. %% %% @see make_tree/2 %% @see type/1 @@ -6430,8 +6367,8 @@ subtrees(T) -> %% ===================================================================== %% @doc Creates a syntax tree with the same type and attributes as the -%% given tree. This is equivalent to copy_attrs(Node, -%% make_tree(type(Node), Groups)). +%% given tree. This is equivalent to `copy_attrs(Node, +%% make_tree(type(Node), Groups))'. %% %% @see make_tree/2 %% @see copy_attrs/2 @@ -6445,19 +6382,19 @@ update_tree(Node, Groups) -> %% ===================================================================== %% @doc Creates a syntax tree with the given type and subtrees. -%% Type must be a node type name (cf. type/1) -%% that does not denote a leaf node type (cf. is_leaf/1). -%% Groups must be a nonempty list of groups of +%% `Type' must be a node type name (see {@link type/1}) +%% that does not denote a leaf node type (see {@link is_leaf/1}). +%% `Groups' must be a nonempty list of groups of %% syntax trees, representing the subtrees of a node of the given type, %% in left-to-right order as they would occur in the printed program -%% text, grouped by category as done by subtrees/1. +%% text, grouped by category as done by {@link subtrees/1}. %% -%%

The result of copy_attrs(Node, make_tree(type(Node), -%% subtrees(Node))) (cf. update_tree/2) represents -%% the same source code text as the original Node, assuming -%% that subtrees(Node) yields a nonempty list. However, it +%% The result of `copy_attrs(Node, make_tree(type(Node), +%% subtrees(Node)))' (see {@link update_tree/2}) represents +%% the same source code text as the original `Node', assuming +%% that `subtrees(Node)' yields a nonempty list. However, it %% does not necessarily have the same data representation as -%% Node.

+%% `Node'. %% %% @see update_tree/2 %% @see subtrees/1 @@ -6525,37 +6462,37 @@ make_tree(tuple, [E]) -> tuple(E). %% @doc Creates a meta-representation of a syntax tree. The result %% represents an Erlang expression "MetaTree" %% which, if evaluated, will yield a new syntax tree representing the -%% same source code text as Tree (although the actual data +%% same source code text as `Tree' (although the actual data %% representation may be different). The expression represented by -%% MetaTree is implementation independent with +%% `MetaTree' is implementation independent with %% regard to the data structures used by the abstract syntax tree -%% implementation. Comments attached to nodes of Tree will +%% implementation. Comments attached to nodes of `Tree' will %% be preserved, but other attributes are lost. %% -%%

Any node in Tree whose node type is -%% variable (cf. type/1), and whose list of -%% annotations (cf. get_ann/1) contains the atom -%% meta_var, will remain unchanged in the resulting tree, -%% except that exactly one occurrence of meta_var is -%% removed from its annotation list.

+%% Any node in `Tree' whose node type is +%% `variable' (see {@link type/1}), and whose list of +%% annotations (see {@link get_ann/1}) contains the atom +%% `meta_var', will remain unchanged in the resulting tree, +%% except that exactly one occurrence of `meta_var' is +%% removed from its annotation list. %% -%%

The main use of the function meta/1 is to transform a -%% data structure Tree, which represents a piece of program +%% The main use of the function `meta/1' is to transform a +%% data structure `Tree', which represents a piece of program %% code, into a form that is representation independent when -%% printed. E.g., suppose Tree represents a variable -%% named "V". Then (assuming a function print/1 for -%% printing syntax trees), evaluating print(abstract(Tree)) -%% - simply using abstract/1 to map the actual data +%% printed. E.g., suppose `Tree' represents a variable +%% named "V". Then (assuming a function `print/1' for +%% printing syntax trees), evaluating `print(abstract(Tree))' +%% - simply using {@link abstract/1} to map the actual data %% structure onto a syntax tree representation - would output a string -%% that might look something like "{tree, variable, ..., "V", -%% ...}", which is obviously dependent on the implementation of +%% that might look something like "`{tree, variable, ..., "V", +%% ...}'", which is obviously dependent on the implementation of %% the abstract syntax trees. This could e.g. be useful for caching a %% syntax tree in a file. However, in some situations like in a program %% generator generator (with two "generator"), it may be unacceptable. -%% Using print(meta(Tree)) instead would output a +%% Using `print(meta(Tree))' instead would output a %% representation independent syntax tree generating %% expression; in the above case, something like -%% "erl_syntax:variable("V")".

+%% "`erl_syntax:variable("V")'". %% %% @see abstract/1 %% @see type/1 @@ -6695,29 +6632,30 @@ tree(Type) -> %% ===================================================================== %% @doc For special purposes only. Creates an abstract syntax -%% tree node with type tag Type and associated data -%% Data. +%% tree node with type tag `Type' and associated data +%% `Data'. %% -%%

This function and the related is_tree/1 and -%% data/1 provide a uniform way to extend the set of -%% erl_parse node types. The associated data is any term, -%% whose format may depend on the type tag.

+%% This function and the related {@link is_tree/1} and +%% {@link data/1} provide a uniform way to extend the set of +%% `erl_parse' node types. The associated data is any term, +%% whose format may depend on the type tag. %% -%%

Notes:

+%% === Notes: === %%
    %%
  • Any nodes created outside of this module must have type tags %% distinct from those currently defined by this module; see -%% type/1 for a complete list.
  • +%% {@link type/1} for a complete list. %%
  • The type tag of a syntax tree node may also be used -%% as a primary tag by the erl_parse representation; +%% as a primary tag by the `erl_parse' representation; %% in that case, the selector functions for that node type %% must handle both the abstract syntax tree and the -%% erl_parse form. The function type(T) +%% `erl_parse' form. The function `type(T)' %% should return the correct type tag regardless of the -%% representation of T, so that the user sees no -%% difference between erl_syntax and -%% erl_parse nodes.
  • +%% representation of `T', so that the user sees no +%% difference between `erl_syntax' and +%% `erl_parse' nodes. %%
+%% %% @see is_tree/1 %% @see data/1 %% @see type/1 @@ -6729,12 +6667,12 @@ tree(Type, Data) -> %% ===================================================================== -%% @doc For special purposes only. Returns true if -%% Tree is an abstract syntax tree and false +%% @doc For special purposes only. Returns `true' if +%% `Tree' is an abstract syntax tree and `false' %% otherwise. %% -%%

Note: this function yields false for all -%% "old-style" erl_parse-compatible "parse trees".

+%% Note: this function yields `false' for all +%% "old-style" `erl_parse'-compatible "parse trees". %% %% @see tree/2 @@ -6749,8 +6687,8 @@ is_tree(_) -> %% ===================================================================== %% @doc For special purposes only. Returns the associated data %% of a syntax tree node. Evaluation fails with reason -%% badarg if is_tree(Node) does not yield -%% true. +%% `badarg' if `is_tree(Node)' does not yield +%% `true'. %% %% @see tree/2 @@ -6766,17 +6704,17 @@ data(T) -> erlang:error({badarg, T}). %% ===================================================================== -%% @doc Creates a wrapper structure around an erl_parse +%% @doc Creates a wrapper structure around an `erl_parse' %% "parse tree". %% -%%

This function and the related unwrap/1 and -%% is_wrapper/1 provide a uniform way to attach arbitrary -%% information to an erl_parse tree. Some information about +%% This function and the related {@link unwrap/1} and +%% {@link is_wrapper/1} provide a uniform way to attach arbitrary +%% information to an `erl_parse' tree. Some information about %% the encapsuled tree may be cached in the wrapper, such as the node %% type. All functions on syntax trees must behave so that the user sees -%% no difference between wrapped and non-wrapped erl_parse +%% no difference between wrapped and non-wrapped `erl_parse' %% trees. Attaching a wrapper onto another wrapper structure is an -%% error.

+%% error. -spec wrap(erl_parse()) -> #wrapper{}. @@ -6787,9 +6725,9 @@ wrap(Node) -> %% ===================================================================== -%% @doc Removes any wrapper structure, if present. If Node +%% @doc Removes any wrapper structure, if present. If `Node' %% is a wrapper structure, this function returns the wrapped -%% erl_parse tree; otherwise it returns Node +%% `erl_parse' tree; otherwise it returns `Node' %% itself. -spec unwrap(syntaxTree()) -> #tree{} | erl_parse(). @@ -6799,8 +6737,8 @@ unwrap(Node) -> Node. % This could also be a new-form node. %% ===================================================================== -%% @doc Returns true if the argument is a wrapper -%% structure, otherwise false. +%% @doc Returns `true' if the argument is a wrapper +%% structure, otherwise `false'. -ifndef(NO_UNUSED). -spec is_wrapper(term()) -> boolean(). -- cgit v1.2.3 From 53746070b5de7d1e9f809d516648948b0a246561 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Sun, 22 Apr 2012 22:32:20 +0200 Subject: make list_suffix/1 and list_prefix/1 handle erl_parse() cons sequences --- lib/syntax_tools/src/erl_syntax.erl | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index beae6f4a01..76a6a6dc36 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -2061,12 +2061,18 @@ revert_nil(Node) -> list_prefix(Node) -> case unwrap(Node) of - {cons, _, Head, _} -> - [Head]; + {cons, _, Head, Tail} -> + [Head | cons_prefix(Tail)]; Node1 -> (data(Node1))#list.prefix end. +%% collects sequences of conses; cf. cons_suffix/1 below +cons_prefix({cons, _, Head, Tail}) -> + [Head | cons_prefix(Tail)]; +cons_prefix(_) -> + []. + %% ===================================================================== %% @doc Returns the suffix subtree of a `list' node, if one @@ -2090,18 +2096,22 @@ list_prefix(Node) -> list_suffix(Node) -> case unwrap(Node) of {cons, _, _, Tail} -> - %% If there could be comments/annotations on the tail node, - %% we should not return `none' even if it has type `nil'. - case Tail of + case cons_suffix(Tail) of {nil, _} -> - none; % no interesting information is lost - _ -> - Tail + none; + Tail1 -> + Tail1 end; Node1 -> (data(Node1))#list.suffix end. +%% skips sequences of conses; cf. cons_prefix/1 above +cons_suffix({cons, _, _, Tail}) -> + cons_suffix(Tail); +cons_suffix(Tail) -> + Tail. + %% ===================================================================== %% @doc "Optimising" list skeleton cons operation. Creates an abstract -- cgit v1.2.3 From 88ad50177efbaad42bfd6bdde2dd4a127fd0d30f Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Wed, 8 Aug 2012 11:15:02 +0300 Subject: bumped revision --- lib/syntax_tools/vsn.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/syntax_tools/vsn.mk b/lib/syntax_tools/vsn.mk index 2b9a08e192..8f774c5d75 100644 --- a/lib/syntax_tools/vsn.mk +++ b/lib/syntax_tools/vsn.mk @@ -1 +1 @@ -SYNTAX_TOOLS_VSN = 1.6.8 +SYNTAX_TOOLS_VSN = 1.6.9 -- cgit v1.2.3 From 4be9622555222e9ec7f1c49d8a86cc336da2875a Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Fri, 24 Aug 2012 11:23:05 +0200 Subject: Bumped version nr --- lib/odbc/src/odbc.appup.src | 8 ++------ lib/odbc/vsn.mk | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/odbc/src/odbc.appup.src b/lib/odbc/src/odbc.appup.src index 853323da09..c7c83ea079 100644 --- a/lib/odbc/src/odbc.appup.src +++ b/lib/odbc/src/odbc.appup.src @@ -1,12 +1,8 @@ %% -*- erlang -*- {"%VSN%", [ - {"2.10.11", [{restart_application, odbc}]}, - {"2.10.10", [{restart_application, odbc}]}, - {"2.10.9", [{restart_application, odbc}]} + {<<"2\\.*">>, [{restart_application, odbc}]} ], [ - {"2.10.11", [{restart_application, odbc}]}, - {"2.10.10", [{restart_application, odbc}]}, - {"2.10.9", [{restart_application, odbc}]} + {<<"2\\.*">>, [{restart_application, odbc}]} ]}. diff --git a/lib/odbc/vsn.mk b/lib/odbc/vsn.mk index fb6e208a52..3bb2fe5bce 100644 --- a/lib/odbc/vsn.mk +++ b/lib/odbc/vsn.mk @@ -1 +1 @@ -ODBC_VSN = 2.10.12 +ODBC_VSN = 2.10.13 -- cgit v1.2.3