did you know the module definition must be the first non-whitespace, non-comment line in a module? i did not

This commit is contained in:
alisdair sullivan 2010-05-25 22:23:06 -07:00
parent c16351ad12
commit 86333b8e7f
6 changed files with 12 additions and 14 deletions

View file

@ -20,10 +20,9 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx_parser). -module(jsx_parser).
-author("alisdairsullivan@yahoo.ca").
-export([decode/1, event/2]). -export([decode/1, event/2]).
-export([literal/1, string/1, number/1]). -export([literal/1, string/1, number/1]).

View file

@ -20,10 +20,10 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx_prettify). -module(jsx_prettify).
-author("alisdairsullivan@yahoo.ca").
-export([pretty/2, jsx_event/2]). -export([pretty/2, jsx_event/2]).

View file

@ -20,10 +20,9 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx_stream_parser). -module(jsx_stream_parser).
-author("alisdairsullivan@yahoo.ca").
-export([decoder/1, event/2]). -export([decoder/1, event/2]).
@ -35,6 +34,7 @@ decoder(Opts) ->
catch catch
throw:{ok, Result} -> Result throw:{ok, Result} -> Result
; throw:not_found -> not_found ; throw:not_found -> not_found
; _:_ -> throw(badarg)
end end
end. end.

View file

@ -20,10 +20,9 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx). -module(jsx).
-author("alisdairsullivan@yahoo.ca").
-export([decoder/0, decoder/2, tail_clean/1]). -export([decoder/0, decoder/2, tail_clean/1]).

View file

@ -20,10 +20,9 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx_decoder). -module(jsx_decoder).
-author("alisdairsullivan@yahoo.ca").
-export([start/4]). -export([start/4]).

View file

@ -20,10 +20,9 @@
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE. %% THE SOFTWARE.
-author("alisdairsullivan@yahoo.ca").
-module(jsx_test). -module(jsx_test).
-author("alisdairsullivan@yahoo.ca").
-export([test/1]). -export([test/1]).
@ -62,7 +61,8 @@ test_body(TestSpec, Dir) ->
end. end.
incremental_decode(F, <<>>) -> incremental_decode(F, <<>>) ->
{Result, _} = F(<<>>), {Result, Rest} = F(<<>>),
true = tail_clean(Rest),
Result; Result;
incremental_decode(F, <<A/utf8, Rest/binary>>) -> incremental_decode(F, <<A/utf8, Rest/binary>>) ->
case F(<<A/utf8>>) of case F(<<A/utf8>>) of
@ -77,7 +77,8 @@ decode(F, JSON) ->
G when is_function(G) -> G when is_function(G) ->
{Result, <<>>} = G(<<>>), {Result, <<>>} = G(<<>>),
Result Result
; {Result, _} -> ; {Result, Rest} ->
true = tail_clean(Rest),
Result Result
end. end.