Add YAML module with typed DOM, built-in YAML 1.2.2 parser and serializer
This commit is contained in:
+5710
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* @PROJECT AerScript Interpreter
|
||||||
|
* @COPYRIGHT See COPYING in the top level directory
|
||||||
|
* @FILE modules/yaml/yaml.h
|
||||||
|
* @DESCRIPTION Typed YAML DOM module for AerScript Interpreter
|
||||||
|
* @DEVELOPERS Symisc Systems <devel@symisc.net>
|
||||||
|
* Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||||
|
*/
|
||||||
|
#ifndef __YAML_H__
|
||||||
|
#define __YAML_H__
|
||||||
|
|
||||||
|
#include "ph7.h"
|
||||||
|
#include "ph7int.h"
|
||||||
|
|
||||||
|
#define MODULE_DESC "YAML Module"
|
||||||
|
#define MODULE_VER 1.0
|
||||||
|
|
||||||
|
/* YamlNodeType constants. NULL is a language keyword, so the null node kind
|
||||||
|
* is published as NULL_NODE (the contract's documented fallback). */
|
||||||
|
#define YAML_NODE_MAPPING 1
|
||||||
|
#define YAML_NODE_SEQUENCE 2
|
||||||
|
#define YAML_NODE_STRING 3
|
||||||
|
#define YAML_NODE_INT 4
|
||||||
|
#define YAML_NODE_FLOAT 5
|
||||||
|
#define YAML_NODE_BOOLEAN 6
|
||||||
|
#define YAML_NODE_NULL_NODE 7
|
||||||
|
|
||||||
|
/* YamlException error codes. KEY_NOT_FOUND is reserved for a future lookup
|
||||||
|
* API but is published with a stable value now. */
|
||||||
|
#define YAML_ERROR_NONE 0
|
||||||
|
#define YAML_ERROR_DEPTH 1
|
||||||
|
#define YAML_ERROR_SYNTAX 2
|
||||||
|
#define YAML_ERROR_ENCODING 3
|
||||||
|
#define YAML_ERROR_TYPE_MISMATCH 4
|
||||||
|
#define YAML_ERROR_KEY_NOT_FOUND 5
|
||||||
|
#define YAML_ERROR_INDEX_OUT_OF_RANGE 6
|
||||||
|
#define YAML_ERROR_DUPLICATE_KEY 7
|
||||||
|
#define YAML_ERROR_INVALID_OPERATION 8
|
||||||
|
#define YAML_ERROR_INVALID_OPTION 9
|
||||||
|
#define YAML_ERROR_READONLY_OPTION 10
|
||||||
|
#define YAML_ERROR_UNDEFINED_ALIAS 11
|
||||||
|
#define YAML_ERROR_ALIAS_LIMIT 12
|
||||||
|
#define YAML_ERROR_UNKNOWN_TAG 13
|
||||||
|
#define YAML_ERROR_UNSUPPORTED 14
|
||||||
|
#define YAML_ERROR_ALIAS_NOT_ALLOWED 15
|
||||||
|
|
||||||
|
/* YamlOptions duplicate-key policies. Values follow JsonOptions numbering:
|
||||||
|
* KEEP_LAST=0, KEEP_FIRST=1, REJECT=2 (explicit default). */
|
||||||
|
#define YAML_DUP_KEEP_LAST 0
|
||||||
|
#define YAML_DUP_KEEP_FIRST 1
|
||||||
|
#define YAML_DUP_REJECT 2
|
||||||
|
|
||||||
|
/* Unknown-tag policy. */
|
||||||
|
#define YAML_UNKNOWN_TAG_REJECT 0
|
||||||
|
#define YAML_UNKNOWN_TAG_KEEP 1
|
||||||
|
|
||||||
|
/* Resolver schema. */
|
||||||
|
#define YAML_SCHEMA_CORE 0
|
||||||
|
#define YAML_SCHEMA_JSON 1
|
||||||
|
#define YAML_SCHEMA_FAILSAFE 2
|
||||||
|
|
||||||
|
/* Serializer style: block collections (default) or one flow document. */
|
||||||
|
#define YAML_STYLE_BLOCK 0
|
||||||
|
#define YAML_STYLE_FLOW 1
|
||||||
|
|
||||||
|
PH7_PRIVATE sxi32 initializeModule(ph7_vm *pVm, ph7_real *ver, SyString *desc);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user