removed types and specs, since they are not supported in the default erlang's some linux distros supply

This commit is contained in:
alisdair sullivan 2010-08-25 21:28:13 -07:00
parent d58fc57ab4
commit 203ec6e5e0
15 changed files with 21 additions and 202 deletions

View file

@ -1,42 +0,0 @@
%% The MIT License
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% The above copyright notice and this permission notice shall be included in
%% all copies or substantial portions of the Software.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
-include("jsx_common.hrl").
-spec parser() -> jsx_parser().
-spec parser(Opts::jsx_opts()) -> jsx_parser().
-spec term_to_json(JSON::eep0018()) -> binary().
-spec term_to_json(JSON::eep0018(), Opts::encoder_opts()) -> binary().
-spec json_to_term(JSON::binary()) -> eep0018().
-spec json_to_term(JSON::binary(), Opts::decoder_opts()) -> eep0018().
-spec is_json(JSON::binary()) -> true | false.
-spec is_json(JSON::binary(), Opts::verify_opts()) -> true | false.
-spec format(JSON::binary()) -> binary() | iolist().
-spec format(JSON::binary(), Opts::format_opts()) -> binary() | iolist().
-spec eventify(List::list()) -> jsx_parser_result().

View file

@ -25,88 +25,3 @@
-define(is_utf_encoding(X),
X == utf8; X == utf16; X == utf32; X == {utf16, little}; X == {utf32, little}
).
-type jsx_opts() :: [jsx_opt()].
-type jsx_opt() :: {comments, true | false}
| {escaped_unicode, ascii | codepoint | none}
| {multi_term, true | false}
| {encoding, auto | utf8 | utf16 | {utf16, little} | utf32 | {utf32, little} }.
%% events emitted by the parser and component types
-type unicode_codepoint() :: 0..16#10ffff.
-type unicode_string() :: [unicode_codepoint()].
-type jsx_event() :: start_object
| end_object
| start_array
| end_array
| end_json
| {key, unicode_string()}
| {string, unicode_string()}
| {integer, unicode_string()}
| {float, unicode_string()}
| {literal, true}
| {literal, false}
| {literal, null}.
%% this probably doesn't work properly
-type jsx_parser() :: fun((binary()) -> jsx_parser_result()).
-type jsx_parser_result() :: {event, jsx_event(), fun(() -> jsx_parser_result())}
| {incomplete, jsx_parser()}
| {error, badjson}.
-type supported_utf() :: utf8 | utf16 | {utf16, little} | utf32 | {utf32, little}.
%% eep0018 json specification
-type eep0018() :: eep0018_object() | eep0018_array().
-type eep0018_array() :: [eep0018_term()].
-type eep0018_object() :: [{eep0018_key(), eep0018_term()}].
-type eep0018_key() :: binary() | atom().
-type eep0018_term() :: eep0018_array() | eep0018_object() | eep0018_string() | eep0018_number() | true | false | null.
-type eep0018_string() :: binary().
-type eep0018_number() :: float() | integer().
-type encoder_opts() :: [encoder_opt()].
-type encoder_opt() :: {strict, true | false}
| {encoding, supported_utf()}
| {space, integer()}
| space
| {indent, integer()}
| indent.
-type decoder_opts() :: [decoder_opt()].
-type decoder_opt() :: {strict, true | false}
| {comments, true | false}
| {encoding, supported_utf()}
| {label, atom | binary | existing_atom}
| {float, true | false}.
-type verify_opts() :: [verify_opt()].
-type verify_opt() :: {strict, true | false}
| {encoding, auto | supported_utf()}
| {comments, true | false}.
-type format_opts() :: [format_opt()].
-type format_opt() :: {strict, true | false}
| {encoding, auto | supported_utf()}
| {comments, true | false}
| {space, integer()}
| space
| {indent, integer()}
| indent
| {output_encoding, supported_utf()}.

View file

@ -26,13 +26,6 @@
%% should take that into account
-include("./include/jsx_common.hrl").
-spec parser(OptsList::jsx_opts()) -> jsx_parser().
%% opts record for decoder
-record(opts, {
comments = false,

View file

@ -1,30 +0,0 @@
%% The MIT License
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% The above copyright notice and this permission notice shall be included in
%% all copies or substantial portions of the Software.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
-include("jsx_common.hrl").
-spec json_to_term(JSON::binary(), Opts::decoder_opts()) -> eep0018().
-spec term_to_json(JSON::eep0018(), Opts::encoder_opts()) -> binary().

View file

@ -20,8 +20,6 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
-include("jsx_common.hrl").
-record(format_opts, {
@ -41,6 +39,3 @@
-define(end_object, $}).
-define(start_array, $[).
-define(end_array, $]).
-spec format(JSON::binary(), Opts::format_opts()) -> binary() | iolist().

View file

@ -1,27 +0,0 @@
%% The MIT License
%% Copyright (c) 2010 Alisdair Sullivan <alisdairsullivan@yahoo.ca>
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%% The above copyright notice and this permission notice shall be included in
%% all copies or substantial portions of the Software.
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
-include("jsx_common.hrl").
-spec is_json(JSON::binary(), Opts::verify_opts()) -> true | false.

View file

@ -40,8 +40,7 @@
-export([eventify/1]).
%% function and type specifications
-include("./include/jsx.hrl").
-include("./include/jsx_common.hrl").
%% @type jsx_parser() = (binary()) -> jsx_parser_result().

View file

@ -32,7 +32,7 @@
-export([json_to_term/2, term_to_json/2]).
-include("./include/jsx_eep0018.hrl").
-include("./include/jsx_common.hrl").
-ifdef(TEST).

View file

@ -32,6 +32,7 @@
-export([format/2]).
-include("./include/jsx_common.hrl").
-include("./include/jsx_format.hrl").

View file

@ -26,7 +26,10 @@
-module(jsx_utf16).
-define(utf16, true).
-include("./include/jsx_common.hrl").
-include("./include/jsx_decoder.hrl").
%% i've noticed you've noticed that there's no source here. very astute. see

View file

@ -26,7 +26,10 @@
-module(jsx_utf16le).
-define(utf16le, true).
-include("./include/jsx_common.hrl").
-include("./include/jsx_decoder.hrl").
%% i've noticed you've noticed that there's no source here. very astute. see

View file

@ -26,7 +26,10 @@
-module(jsx_utf32).
-define(utf32, true).
-include("./include/jsx_common.hrl").
-include("./include/jsx_decoder.hrl").
%% i've noticed you've noticed that there's no source here. very astute. see

View file

@ -26,7 +26,10 @@
-module(jsx_utf32le).
-define(utf32le, true).
-include("./include/jsx_common.hrl").
-include("./include/jsx_decoder.hrl").
%% i've noticed you've noticed that there's no source here. very astute. see

View file

@ -26,7 +26,10 @@
-module(jsx_utf8).
-define(utf8, true).
-include("./include/jsx_common.hrl").
-include("./include/jsx_decoder.hrl").
%% i've noticed you've noticed that there's no source here. very astute. see

View file

@ -32,7 +32,7 @@
-export([is_json/2]).
-include("./include/jsx_verify.hrl").
-include("./include/jsx_common.hrl").
-ifdef(TEST).