Commit Graph

227 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
89f33eab9b Add -spec to public functions
While here, fix some -type specifications.
2012-12-04 17:24:27 +01:00
Jean-Sébastien Pédron
c47ce9f789 Call proplists:unfold/1 before parsing options 2012-11-30 16:51:57 +01:00
Jean-Sébastien Pédron
5d4db4025b Fix #yamerl_parser.stream_state type definition
Also, give a default value to this record member to prevent 'undefined'
from being added to possible types in the type definition.
2012-11-23 16:07:39 +01:00
Jean-Sébastien Pédron
451a06c01f Fix yamerl_simple_doc() type definition 2012-11-23 16:03:39 +01:00
Jean-Sébastien Pédron
c8474a9f40 Remove dependency between yamerl_errors and yamerl_parser
At the same time, remove unused ad badly designed functions from
yamerl_errors.
2012-11-23 14:53:21 +01:00
Jean-Sébastien Pédron
3351e77036 Fix how Erlang string to converted to Unicode binary
We use unicode:characters_to_binary/1 instead of list_to_binary/1.

PR:	#858
2012-11-23 12:29:46 +01:00
Jean-Sébastien Pédron
0ab68d2949 Change "erlang.org,2011" tag to "yamerl,2012"
PR:	#848
2012-11-19 14:23:42 +01:00
Jean-Sébastien Pédron
015a1425cb Support Erlang atom autodetection and "only if exist"
Note that the implementation differs from the yamler's one:
single-quoted flow scalars are not automatically converted to Erlang
atoms by yamerl because it's against the YAML 1.2 specification. The
specification states that only "?" non-specific should be "tasted" (ie.
plain flow scalars). Single-quoted and double quoted flow scalars as
well as block scalars have an implicit "!" non-specific tag and should
be interpreted as string.

See "§3.3.2 Resolved Tags" in the YAML 1.2 specification.

PR:	#846
PR:	#847
2012-11-19 14:13:51 +01:00
Jean-Sébastien Pédron
c8bed4a143 Support "external" options (eg. targetted to node type modules) 2012-11-19 14:11:27 +01:00
Jean-Sébastien Pédron
180a0644f4 Use "yamerl" as the extensions namespace instead of "yakaz.com"
PR:	#842
2012-11-16 14:55:03 +01:00
Jean-Sébastien Pédron
2cd8688712 Add yamerl_node_float_ext testsuite and fix bugs accordingly
PR:	#838
2012-11-16 14:24:28 +01:00
Jean-Sébastien Pédron
5da1810828 Fix regexes: "\." becomes "\\." 2012-11-16 14:24:00 +01:00
Jean-Sébastien Pédron
7930aa8759 Float parsing: Prepare string before calling erlang:list_to_float/1
Changes made are:
    o  If the string starts with ".", prepend a "0".
    o  If the string doesn't have digits following ".", add a "0".
2012-11-16 14:20:07 +01:00
Jean-Sébastien Pédron
1e630d96cf Remove copied eunit_* modules
They were not compatible with Erlang R15B02's eunit anyway.
2012-11-15 17:16:58 +01:00
Jean-Sébastien Pédron
ef9c56f193 Rename application from "yaml" to "yamerl"
PR:	#836
2012-11-15 16:20:29 +01:00
Jean-Sébastien Pédron
12106527f3 Prepare release 0.2.0
PR:	#756
2012-09-11 16:15:20 +02:00
Jean-Sébastien Pédron
09932a0bca After "make check", copy test output to $TEST_OUTPUT_DIR
If $TEST_OUTPUT_DIR is set, create this directory and copy test output
data to it. This includes cover HTML report and JUnit-formatted report.

This is useful for integration with Jenkins for instance: one can run
make distcheck and still keep test output.
2012-07-20 15:39:34 +02:00
Jean-Sébastien Pédron
e943c17236 Refactor the debian rules file 2012-05-25 12:03:50 +02:00
Jean-Sébastien Pédron
287838c54e Add Christopher to the package uploaders 2012-05-25 12:03:22 +02:00
Jean-Sébastien Pédron
8e63b088aa Prepare release 0.1.1 2012-01-27 10:33:56 +01:00
Jean-Sébastien Pédron
e617cb8323 Add mochijson2 to the benchmark
This makes a nice target for any optimization! :)
2011-10-19 16:27:15 +02:00
Jean-Sébastien Pédron
d6f161f66e Always enable native code for yaml_parser
Using HiPE brings about 50% gain with the new benchmark test. With this,
this YAML parser is generally faster than the SAX parser from xmerl.
However, this is far from enough to compete with any JSON parser.
2011-10-19 16:15:33 +02:00
Jean-Sébastien Pédron
43ec36fa09 Add a micro benchmark in the testsuite
This benchmark uses xmerl_sax_parser and yaml_parser to parse 500 times
an input file found on http://json.org/example.html. It then reports the
average time taken for eeach run.
2011-10-19 12:11:11 +02:00
Jean-Sébastien Pédron
040140a2c6 Fix test for token_fun option
The message was modified but not the testsuite.
2011-10-18 16:45:16 +02:00
Jean-Sébastien Pédron
b04c7d4729 Accept 'acc' and 'drop' as token functions
'acc': accumulate tokens in the parser's state. This was previously
available by not specifying a token function.

'drop': just drop tokens when they're ready.
2011-10-18 16:17:24 +02:00
Jean-Sébastien Pédron
ec169974b5 Redeclare types not exported by calendar
We use types defined the "calendar" module (stdlib) but this module
doesn't export them. The workaround is to simply redeclare them.
2011-10-18 16:11:18 +02:00
Jean-Sébastien Pédron
3557b62f44 Replace set_default_tag/1 by specific macros
This optimization isn't that great though: merely 1%.
2011-10-17 12:30:34 +02:00
Jean-Sébastien Pédron
3e9126ed06 Remove warn_if_non_ascii_line_break/4 dead code 2011-10-05 15:57:58 +02:00
Jean-Sébastien Pédron
2a041048ff Convert warn_if_non_ascii_line_break/4 to a macro
This removes many functions calls. The performance gain is around 2%
with the source used during bench.
2011-10-05 15:46:49 +02:00
Jean-Sébastien Pédron
e9fe712c90 Avoid using '++' when possible
The performance gain is around 2% with the source used during bench.
2011-10-05 15:32:56 +02:00
Jean-Sébastien Pédron
1f26fa25ac Replace next_col/3 and next_line/4 by macros
The performance gain is around 5% with the source used during bench.
2011-10-05 14:45:58 +02:00
Jean-Sébastien Pédron
d316b7573a Split handling of escaped characters in flow scalar
Now, "normal" characters are treated in do_parse_flow_scalar/6 and
escaped characters are treated in do_parse_flow_scalar_escaped/6. The
"next_escaped" record member is gone. The performance gain is around
12% with the source used during the bench.
2011-10-05 12:01:03 +02:00
Jean-Sébastien Pédron
41991dd665 Remove a trailing space 2011-10-05 11:40:12 +02:00
Jean-Sébastien Pédron
0983bea3dd Remove next_state/6
Instead, the next state is called directly. The current state is saved
in #yaml_parser only when we need to suspend the parsing. The
performance gain is around 5%

While here, we convert some functions to macros, to take advantage of
the optimization described in §3.5 of the Efficiency Guide.
2011-10-05 11:06:10 +02:00
Jean-Sébastien Pédron
0eb4193ebd Maintain the input buffer outside of the #yaml_parser state
This removes frequent updates of the buffer and line/column numbers in
this state. It's only synchronized before return. The performance gain
is about 16% with the source used during bench.
2011-10-05 10:26:38 +02:00
Jean-Sébastien Pédron
46f645487e Use byte_size/1 instead of size/1 for binaries
This is recommended by Efficiency Guide, §3.6.
2011-09-30 11:30:11 +02:00
Jean-Sébastien Pédron
1299ee23f8 Fix float handling: we must use #yaml_float, not #yaml_int 2011-09-30 11:26:50 +02:00
Jean-Sébastien Pédron
f9d60f0679 Support hot upgrade from 0.1.0
Many modules were renamed, the safest way is to restart the application
entirely. And we don't loose anything by doing this because the
application doesn't start processes.
2011-09-29 14:34:35 +02:00
Jean-Sébastien Pédron
3d328825dd Fix .nan case
It's not .Nan but .NaN (trailing capital N).
2011-09-29 14:27:13 +02:00
Jean-Sébastien Pédron
766d7126c0 Add tests for .inf and .nan (infinity and not-a-number) 2011-09-29 14:26:41 +02:00
Jean-Sébastien Pédron
ecffaf1d7c Next version is 0.1.1 2011-09-29 14:15:05 +02:00
Jean-Sébastien Pédron
958ada0d22 Rename yaml_node_(json|ext)_$type to yaml_node_$type_(json|ext) 2011-09-29 14:04:09 +02:00
Jean-Sébastien Pédron
c3d2d217ca Fix sexagesimal test data
Having underscore in the non-first components is not allowed.
2011-09-29 12:21:30 +02:00
Jean-Sébastien Pédron
0eecd486e0 Use the "failsafe" schema and specify the module to test
This avoids that other modules (other than yaml_node_str) parse the
input data.
2011-09-29 12:20:20 +02:00
Jean-Sébastien Pédron
3a84809038 Add a testsuite for floats 2011-09-29 11:34:06 +02:00
Jean-Sébastien Pédron
8d0f5d3a31 Fix multiple regex by specifying /^...$/
Otherwise, they could match a part of the input string and be happy with
that.
2011-09-29 11:33:11 +02:00
Jean-Sébastien Pédron
624a037f99 Accept "-0" 2011-09-29 11:32:57 +02:00
Jean-Sébastien Pédron
f78cb1076d erlang:list_to_float/1 requires a decimal part
Now, before calling erlang:list_to_float/1, we add ".0" to the float if
it doesn't have a decimal part.
2011-09-29 11:31:31 +02:00
Jean-Sébastien Pédron
a48cfcd387 Expand the null testsuite for new module node variants 2011-09-28 16:27:29 +02:00
Jean-Sébastien Pédron
5bbf60cf42 Expand the booleans testsuite for new module node variants 2011-09-28 16:19:19 +02:00