/*1* yaml.c, LibYAML binding for Lua2* Written by Andrew Danforth, 20093*4* Copyright (C) 2014-2022 Gary V. Vaughan5* Copyright (C) 2009 Andrew Danforth6*7* Permission is hereby granted, free of charge, to any person obtaining a copy8* of this software and associated documentation files (the "Software"), to deal9* in the Software without restriction, including without limitation the rights10* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell11* copies of the Software, and to permit persons to whom the Software is12* furnished to do so, subject to the following conditions:13*14* The above copyright notice and this permission notice shall be included in15* all copies or substantial portions of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR18* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,19* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE20* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER21* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,22* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN23* THE SOFTWARE.24*25* Portions of this software were inspired by Perl's YAML::LibYAML module by26* Ingy d�t Net <[email protected]>27*28*/2930#include <string.h>31#include <stdlib.h>3233#include <lualib.h>3435#include "lyaml.h"3637#include "bootstrap.h"3839#define MYNAME "yaml"40#define MYVERSION MYNAME " library for " LUA_VERSION " / " VERSION4142#define LYAML__STR_1(_s) (#_s + 1)43#define LYAML_STR_1(_s) LYAML__STR_1(_s)4445static const luaL_Reg R[] =46{47#define MENTRY(_s) {LYAML_STR_1(_s), (_s)}48MENTRY( Pemitter ),49MENTRY( Pparser ),50MENTRY( Pscanner ),51#undef MENTRY52{NULL, NULL}53};5455LUALIB_API int56luaopen_yaml (lua_State *L)57{58parser_init (L);59scanner_init (L);6061luaL_register(L, "yaml", R);6263lua_pushliteral(L, MYVERSION);64lua_setfield(L, -2, "version");6566return 1;67}6869FLUA_MODULE(yaml);707172