From 511f7928e6f92a3044a3777b718c13f87e7a4032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Wed, 12 Dec 2012 11:46:05 +0100 Subject: [PATCH] Use yamerl_constr:new({file, ...}), like yamerl_constr:file/{1, 2} --- doc/reference-manual/module-yamerl_constr.md | 4 ++-- doc/user-guide/recipe-basic-parsing.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/reference-manual/module-yamerl_constr.md b/doc/reference-manual/module-yamerl_constr.md index 9b8e865..a31d4c7 100644 --- a/doc/reference-manual/module-yamerl_constr.md +++ b/doc/reference-manual/module-yamerl_constr.md @@ -86,7 +86,7 @@ If parsing or construction fails, throw an exception. ##### Parse a valid stream ```erlang -Stream_St1 = yamerl_constr:new(""), +Stream_St1 = yamerl_constr:new({file, ""}), {continue, Stream_St2} = yamerl_constr:next_chunk(Stream_St1, <<"He">>), {continue, Stream_St3} = yamerl_constr:next_chunk(Stream_St2, <<"ll">>), yamerl_constr:last_chunk(Stream_St3, <<"o!">>). @@ -104,7 +104,7 @@ Returns: ##### Parse an invalid stream ```erlang -Stream_St1 = yamerl_constr:new(""), +Stream_St1 = yamerl_constr:new({file, ""}), {continue, Stream_St2} = yamerl_constr:next_chunk(Stream_St1, <<"'He">>), {continue, Stream_St3} = yamerl_constr:next_chunk(Stream_St2, <<"ll">>), yamerl_constr:last_chunk(Stream_St3, <<"o!">>) % Unfinished single-quoted scalar. diff --git a/doc/user-guide/recipe-basic-parsing.md b/doc/user-guide/recipe-basic-parsing.md index e3c1c23..8eef038 100644 --- a/doc/user-guide/recipe-basic-parsing.md +++ b/doc/user-guide/recipe-basic-parsing.md @@ -18,8 +18,9 @@ Documents = yamerl_constr:file("input.yaml"). * To parse a stream: ```erlang % Create a new construction state. The only required argument is an -% arbitrary term describing the source of the data. -Constr_State = yamerl_constr:new(""), +% arbitrary term describing the source of the data. Here, we use the +% same term structure as yamerl_constr:file/{1, 2}. +Constr_State = yamerl_constr:new({file, ""}), % Feed the parser with binary chunks. The developer is responsible for % reading the chunk from the underlying source.