parser: decouple from lyaml.c.

* parser.c (lyaml_parser, parser_delete_event)
(parser_generate_error_message): New functions refactored...
(struct lua_yaml_loader, delete_event, generate_error_message):
...from here.
Adjust all callers.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
parser: factor away lyaml_parser.error.

* parser.c (lyaml_parser): Remove error field.
Adjust all clients.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
parser: factor away LYAML_STR macro.

* parser.c (LYAML__STR, LYAML_STR): Remove. Adjust all callers.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
maint: move lyaml extension sources to ext/lyaml subdir.

* lua52compat.h, lyaml.c, parser.c: Move from here...
* ext/lyaml/lua52compat.h, ext/lyaml/lyaml.c, ext/lyaml/parser.c:
...to here.
* local.mk (lyaml_cpath, EXTRA_DIST, lib_LTLIBRARIES): Adjust.
(ext_lyaml_lyaml_la_SOURCES): Compile sources as individual subdir
objects.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
parser: interface cleanup.

* ext/lyaml/lyaml.c (parser_init): Declare this...
(loader_gc): ...instead of this.
(luaopen_lyaml): Move __gc metatable init from here...
* ext/lyaml/parser.c (parser_init): ...to here.
Also fix a typo in one metatable name reference.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
specs: rename parser spec file to reflect source path.

* specs/parser_spec.yaml: Move from here...
* specs/ext_lyaml_parser_spec.yaml: ...to here.
* specs/specs.mk (specl_SPECS): Adjust.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
parser: use valid symbols for Lua event types.

* ext/lyaml/parser.c: Use '_' instead of '-' so that the bare
event types are valid Lua symbols.
* specs/ext_lyaml_parser_spec.yaml: Adjust.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
parser: factor out function dispatch for simple events.

* ext/lyaml/parser.c (parse_STREAM_END, parse_SEQUENCE_END)
(parse_MAPPING_END): Delete.
(event_iter): Generate parser_push_exenttable calls with CPP
instead.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>