merged in unified decoder branch

This commit is contained in:
alisdair sullivan 2010-06-07 16:21:22 -07:00
commit d25f96f798
7 changed files with 132 additions and 2778 deletions

View file

@ -63,16 +63,19 @@ start(Callbacks, Opts, F) ->
end.
parse_opts(Opts) ->
parse_opts(Opts, {false, codepoint}).
parse_opts(Opts, {false, codepoint, false}).
parse_opts([], Opts) ->
Opts;
parse_opts([{comments, Value}|Rest], {_Comments, EscapedUnicode}) ->
parse_opts([{comments, Value}|Rest], {_Comments, EscapedUnicode, Stream}) ->
true = lists:member(Value, [true, false]),
parse_opts(Rest, {Value, EscapedUnicode});
parse_opts([{escaped_unicode, Value}|Rest], {Comments, _EscapedUnicode}) ->
parse_opts(Rest, {Value, EscapedUnicode, Stream});
parse_opts([{escaped_unicode, Value}|Rest], {Comments, _EscapedUnicode, Stream}) ->
true = lists:member(Value, [ascii, codepoint, none]),
parse_opts(Rest, {Comments, Value});
parse_opts(Rest, {Comments, Value, Stream});
parse_opts([{stream_mode, Value}|Rest], {Comments, EscapedUnicode, _Stream}) ->
true = lists:member(Value, [true, false]),
parse_opts(Rest, {Comments, EscapedUnicode, Value});
parse_opts([_UnknownOpt|Rest], Opts) ->
parse_opts(Rest, Opts).