aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/doc/src/io_lib.xml3
-rw-r--r--lib/stdlib/src/io_lib.erl9
-rw-r--r--lib/stdlib/src/io_lib_fread.erl9
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/stdlib/doc/src/io_lib.xml b/lib/stdlib/doc/src/io_lib.xml
index 9cbc54d8bd..3312b08064 100644
--- a/lib/stdlib/doc/src/io_lib.xml
+++ b/lib/stdlib/doc/src/io_lib.xml
@@ -54,6 +54,9 @@
<name name="fread_error"/>
</datatype>
<datatype>
+ <name name="fread_item"/>
+ </datatype>
+ <datatype>
<name name="latin1_string"/>
</datatype>
</datatypes>
diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl
index 7c4c2742bc..53781e97f1 100644
--- a/lib/stdlib/src/io_lib.erl
+++ b/lib/stdlib/src/io_lib.erl
@@ -82,7 +82,8 @@
-export([write_unicode_string/1, write_unicode_char/1,
deep_unicode_char_list/1]).
--export_type([chars/0, latin1_string/0, continuation/0, fread_error/0]).
+-export_type([chars/0, latin1_string/0, continuation/0,
+ fread_error/0, fread_item/0]).
%%----------------------------------------------------------------------
@@ -105,6 +106,8 @@
| 'string'
| 'unsigned'.
+-type fread_item() :: string() | atom() | integer() | float().
+
%%----------------------------------------------------------------------
%% Interface calls to sub-modules.
@@ -119,7 +122,7 @@ fwrite(Format, Args) ->
-spec fread(Format, String) -> Result when
Format :: string(),
String :: string(),
- Result :: {'ok', InputList :: [term()], LeftOverChars :: string()}
+ Result :: {'ok', InputList :: [fread_item()], LeftOverChars :: string()}
| {'more', RestFormat :: string(),
Nchars :: non_neg_integer(),
InputStack :: chars()}
@@ -134,7 +137,7 @@ fread(Chars, Format) ->
Format :: string(),
Return :: {'more', Continuation1 :: continuation()}
| {'done', Result, LeftOverChars :: string()},
- Result :: {'ok', InputList :: [term()]}
+ Result :: {'ok', InputList :: [fread_item()]}
| 'eof'
| {'error', {'fread', What :: fread_error()}}.
diff --git a/lib/stdlib/src/io_lib_fread.erl b/lib/stdlib/src/io_lib_fread.erl
index 92a34995b8..491e1f40d7 100644
--- a/lib/stdlib/src/io_lib_fread.erl
+++ b/lib/stdlib/src/io_lib_fread.erl
@@ -41,9 +41,9 @@
Format :: string(),
Return :: {'more', Continuation1 :: io_lib:continuation()}
| {'done', Result, LeftOverChars :: string()},
- Result :: {'ok', InputList :: io_lib:chars()}
+ Result :: {'ok', InputList :: [io_lib:fread_item()]}
| 'eof'
- | {'error', {'read', What :: io_lib:fread_error()}}.
+ | {'error', {'fread', What :: io_lib:fread_error()}}.
fread([], Chars, Format) ->
%%io:format("FREAD: ~w `~s'~n", [Format,Chars]),
@@ -101,11 +101,12 @@ fread_line(Format0, Line, N0, Results0, More, Newline) ->
-spec fread(Format, String) -> Result when
Format :: string(),
String :: string(),
- Result :: {'ok', InputList :: io_lib:chars(), LeftOverChars :: string()}
+ Result :: {'ok', InputList :: [io_lib:fread_item()],
+ LeftOverChars :: string()}
| {'more', RestFormat :: string(),
Nchars :: non_neg_integer(),
InputStack :: io_lib:chars()}
- | {'error', What :: term()}.
+ | {'error', {'fread', What :: io_lib:fread_error()}}.
fread(Format, Line) ->
fread(Format, Line, 0, []).