Add -spec for next_fun/2 in yamerl_parser and yamerl_constr

PR:	#849
This commit is contained in:
Jean-Sébastien Pédron 2012-12-10 11:29:23 +01:00
parent 7b770b7b7c
commit 345ef4a63e
2 changed files with 21 additions and 7 deletions

View File

@ -92,6 +92,16 @@ new(Source, Options) ->
Parser_Options = initialize(Options),
yamerl_parser:new(Source, Parser_Options).
-spec next_chunk(Parser, Chunk) ->
Ret | no_return() when
Parser :: yamerl_parser:yamerl_parser(),
Chunk :: unicode_binary(),
Ret :: {continue, New_Parser},
New_Parser :: yamerl_parser:yamerl_parser().
next_chunk(Parser, Chunk) ->
next_chunk(Parser, Chunk, false).
-spec next_chunk(Parser, Chunk, Last_Chunk) ->
Ret | no_return() when
Parser :: yamerl_parser:yamerl_parser(),
@ -110,9 +120,6 @@ next_chunk(Parser, Chunk, EOS) ->
true -> Parser
end.
next_chunk(Parser, Chunk) ->
next_chunk(Parser, Chunk, false).
-spec last_chunk(Parser, Chunk) ->
Result | no_return() when
Parser :: yamerl_parser:yamerl_parser(),

View File

@ -14,8 +14,8 @@
string/2,
file/1,
file/2,
next_chunk/3,
next_chunk/2,
next_chunk/3,
last_chunk/2,
get_token_fun/1,
set_token_fun/2,
@ -276,6 +276,16 @@ new(Source, Options) ->
token_fun = proplists:get_value(token_fun, Options0, acc)
}.
-spec next_chunk(Parser, Chunk) ->
Ret | no_return() when
Parser :: yamerl_parser(),
Chunk :: unicode_binary(),
Ret :: {continue, New_Parser},
New_Parser :: yamerl_parser().
next_chunk(Parser, Chunk) ->
next_chunk(Parser, Chunk, false).
-spec next_chunk(Parser, Chunk, Last_Chunk) ->
Ret | no_return() when
Parser :: yamerl_parser(),
@ -297,9 +307,6 @@ next_chunk(#yamerl_parser{raw_data = Data} = Parser, Chunk, EOS) ->
},
decode_unicode(Parser1).
next_chunk(Parser, Chunk) ->
next_chunk(Parser, Chunk, false).
-spec last_chunk(Parser, Chunk) ->
Ret | no_return() when
Parser :: yamerl_parser(),