Commit Graph

64 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
fb489eae92 Update tests about exceptions
The exception format has changed in yaml_parser.
2011-05-24 12:30:59 +02:00
Jean-Sébastien Pédron
ee220f1f16 Add option "default_tags" to set default tags list
This option must be specified like this:
  {default_tags, [
    {Prefix, Value}
  ]}

Prefix may be:
    o  {non_specific, "!"} or {non_specific, "?"}
    o  a string

Value must be a string.
2011-05-24 12:27:05 +02:00
Jean-Sébastien Pédron
d5462d677d Fix a bug in flow entry parsing
The parser would crash if a coma (',') was found outside a flow context.
This is now fixed.

While here, improve errors handling API. Now, when an exception is
thrown, the parser is insde a {yaml_parser, Parser} tuple. Thus, the
caller doesn't need to rely on the #yaml_parser record to identify the
exception and therefore, the definition of this record remains private.
2011-05-24 11:32:18 +02:00
Jean-Sébastien Pédron
270516a33e Add a description in the Debian package
The description is taken from the YAML specification. The description
also states the conforming version of the parser.
2011-05-24 11:29:26 +02:00
Jean-Sébastien Pédron
27b0bfd485 First version of representation layer
This first version knows how to represent:
    o  sequence and mapping
    o  sting
    o  Erlang anonymous function
2011-03-29 12:25:52 +02:00
Jean-Sébastien Pédron
0000dfcb97 Improve options handling
o  If an option is invalid, throw a #yaml_parser_error without any
   #yaml_parser enveloppe.
o  Add functions to get or change the token_fun function.
2011-03-29 10:48:45 +02:00
Jean-Sébastien Pédron
b0404a0290 Move supported versions declaration
Supported versions declaration is moved from "yaml_tokens.hrl" to
"yaml_parser.hrl" because it's used there.
2011-03-29 10:34:33 +02:00
Jean-Sébastien Pédron
fdadcf4500 Add yaml_parser_token_fun() spec
Add a yaml_parser_token_fun() spec. It corresponds to the callback
function called for each emitted token. It's used by the "token_fun"
parser option.
2011-03-23 16:19:25 +01:00
Jean-Sébastien Pédron
362ee1d6d3 Add option to force document version
The document version can be forced using the following option:
  {doc_version, {Major, Minor}}
where Major and Minor are positive integers.

When this option is specified, {Major, Minor} will be used, even if a
%YAML directive indicates another version.
2011-03-22 17:29:08 +01:00
Jean-Sébastien Pédron
afd9a53245 Remove 'vsn' module attribute
The 'vsn' module attribute was set to $Revision$ but this keyword
isn't replaced by default by Git. We'll have to figure out how to handle
this.
2011-03-22 16:01:13 +01:00
Jean-Sébastien Pédron
919d6562bf Check for the minimum supported version
The parser doesn't support version below YAML 1.1: raise an error
if the document if 1.0 or below.
2011-03-22 15:59:28 +01:00
Jean-Sébastien Pédron
554c88e8bb Testsuite for non-ASCII line breaks 2011-03-22 10:59:06 +01:00
Jean-Sébastien Pédron
69c522a57d Support YAML 1.1 line breaks
YAML 1.1 supports non-ASCII line breaks:
    o  Next Line (0x85)
    o  Line Separator (0x2028)
    o  Paragraph Separator (0x2029)
If the document is YAML 1.1, handle these line breaks. If it's YAML 1.2
or above, add a warning and treat them as non-break characters.
2011-03-22 10:56:29 +01:00
Jean-Sébastien Pédron
120ef7ea16 Initial version of a YAML 1.2 parser
This parser is written against the YAML 1.2 specification. It may
therefore be used as a JSON parser as well.

The project is an Erlang application. The module "yaml_parser" parses a
YAML source (a string, a file, whatever) and runs a callback function
for each token scanned. It's more or less like a SAX XML parser.

The testsuite provided isn't complete yet, though it contains all the
example found in the specification.
2011-03-07 11:43:52 +01:00