Commit Graph

109 Commits

Author SHA1 Message Date
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
Jean-Sébastien Pédron
5a34f4c8ec style(9) 2011-09-28 16:18:57 +02:00
Jean-Sébastien Pédron
ccac7b2680 Expand the integers testsuite for new module node variants 2011-09-28 15:34:37 +02:00
Jean-Sébastien Pédron
7bde37ac06 Allow "-0"
While here, call yaml_node_int:base*_to_integer/1 instead of
yaml_node_ext_int:base*_to_integer, because JSON doesn't accept
underscores (_) either.
2011-09-28 15:33:47 +02:00
Jean-Sébastien Pédron
192ca06067 Underscores (_) are not allowed in integers
This is only allowed for integers defined in the Types repository.
2011-09-28 15:32:10 +02:00
Jean-Sébastien Pédron
e65bda25db The "0o" prefix is only supported by YAML 1.2 integer spec
In the Types repository, the prefix for base 8 is "0" only.
2011-09-28 15:30:48 +02:00
Jean-Sébastien Pédron
781b27791e Update testsuite following modules renaming 2011-09-27 18:26:56 +02:00
Jean-Sébastien Pédron
4438800ad0 Fix a bug where we tried to do "-1 * error"
Now the result from integer/float parsing is checked before trying to
multiply by -1.

While here, fix a typo: s/not_an_float/not_a_float/.
2011-09-27 18:25:24 +02:00
Jean-Sébastien Pédron
0e46307e29 Compile yaml_node_ext_bool.erl too 2011-09-27 18:24:30 +02:00
Jean-Sébastien Pédron
41d0ae689e Resurrect eunit_lib.erl to fix truncated reports
The vanilla eunit_lib module truncates reports when a term has more than
20 levels.
2011-09-27 18:22:48 +02:00
Jean-Sébastien Pédron
6ea38548ad Rename "Repr" variables to "Constr" 2011-09-27 17:28:21 +02:00
Jean-Sébastien Pédron
6c1578188f Add two options to add node modules and specify a schema
o  {node_mods, [Mod]} where Mod is the name of a module implementing a
   node (eg. yaml_node_timestamp).

o  {schema, failsafe | json | core}. The schema defines a list of
   node modules to use. See include/yaml_nodes.hrl.
2011-09-27 15:25:28 +02:00
Jean-Sébastien Pédron
6d8b7da8dd Export is_node_mod/1
This function is used to check if a module implements a node.
2011-09-27 15:25:28 +02:00
Jean-Sébastien Pédron
a5b244c82a Define Failsafe and JSON schemas 2011-09-27 15:25:28 +02:00
Jean-Sébastien Pédron
34e62e795c Complete node modules for all standard types
The modules "yaml_node_bool" and "yaml_node_int" are renamed to
"yaml_node_ext_bool" and "yaml_node_ext_int", because they do not
implement what is written in the YAML 1.2 specification but the ones
from the types repository (http://yaml.org/type/).

New modules are added to implement the officiel YAML 1.2 types and the
JSON types (defined in this same specification). Note that these new
modules are untested material.
2011-09-27 15:25:19 +02:00
Jean-Sébastien Pédron
734788df4a Fix terminology: replace "represent" by "construct"
Representation is a completely unrelated step during YAML dump. The
correct name is "Construction".
2011-09-27 10:13:42 +02:00
Jean-Sébastien Pédron
5567c718d3 Remove debugging io:format/3 2011-06-30 17:41:36 +02:00
Jean-Sébastien Pédron
828eb0aead Fix include directories given to cover:compile/2
The directories, taken from src/Emakefile are relative to src/, not
testsuite/: they need to be adapted.
2011-06-30 17:34:50 +02:00
Jean-Sébastien Pédron
3c7db77ed7 Enable Surefire reports of EUnit
This produces XML files in testsuite/. They should be accepted by Bamboo
or Jenkins Continuous Integration systems.
2011-06-30 16:50:41 +02:00