ext/psych/yaml/parser.c File Reference

#include "yaml_private.h"

Go to the source code of this file.

Defines

#define PEEK_TOKEN(parser)
#define SKIP_TOKEN(parser)

Functions

 yaml_parser_parse (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_set_parser_error (yaml_parser_t *parser, const char *problem, yaml_mark_t problem_mark)
static int yaml_parser_set_parser_error_context (yaml_parser_t *parser, const char *context, yaml_mark_t context_mark, const char *problem, yaml_mark_t problem_mark)
static int yaml_parser_state_machine (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_stream_start (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_document_start (yaml_parser_t *parser, yaml_event_t *event, int implicit)
static int yaml_parser_parse_document_content (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_document_end (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_node (yaml_parser_t *parser, yaml_event_t *event, int block, int indentless_sequence)
static int yaml_parser_parse_block_sequence_entry (yaml_parser_t *parser, yaml_event_t *event, int first)
static int yaml_parser_parse_indentless_sequence_entry (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_block_mapping_key (yaml_parser_t *parser, yaml_event_t *event, int first)
static int yaml_parser_parse_block_mapping_value (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_flow_sequence_entry (yaml_parser_t *parser, yaml_event_t *event, int first)
static int yaml_parser_parse_flow_sequence_entry_mapping_key (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_flow_sequence_entry_mapping_value (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_flow_sequence_entry_mapping_end (yaml_parser_t *parser, yaml_event_t *event)
static int yaml_parser_parse_flow_mapping_key (yaml_parser_t *parser, yaml_event_t *event, int first)
static int yaml_parser_parse_flow_mapping_value (yaml_parser_t *parser, yaml_event_t *event, int empty)
static int yaml_parser_process_empty_scalar (yaml_parser_t *parser, yaml_event_t *event, yaml_mark_t mark)
static int yaml_parser_process_directives (yaml_parser_t *parser, yaml_version_directive_t **version_directive_ref, yaml_tag_directive_t **tag_directives_start_ref, yaml_tag_directive_t **tag_directives_end_ref)
static int yaml_parser_append_tag_directive (yaml_parser_t *parser, yaml_tag_directive_t value, int allow_duplicates, yaml_mark_t mark)


Define Documentation

#define PEEK_TOKEN ( parser   ) 

Value:

((parser->token_available || yaml_parser_fetch_more_tokens(parser)) ?       \
        parser->tokens.head : NULL)

Definition at line 48 of file parser.c.

Referenced by yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_mapping_value(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_document_content(), yaml_parser_parse_document_end(), yaml_parser_parse_document_start(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_mapping_value(), yaml_parser_parse_flow_sequence_entry(), yaml_parser_parse_flow_sequence_entry_mapping_end(), yaml_parser_parse_flow_sequence_entry_mapping_key(), yaml_parser_parse_flow_sequence_entry_mapping_value(), yaml_parser_parse_indentless_sequence_entry(), yaml_parser_parse_node(), yaml_parser_parse_stream_start(), and yaml_parser_process_directives().

#define SKIP_TOKEN ( parser   ) 

Value:

(parser->token_available = 0,                                               \
     parser->tokens_parsed ++,                                                  \
     parser->stream_end_produced =                                              \
        (parser->tokens.head->type == YAML_STREAM_END_TOKEN),                   \
     parser->tokens.head ++)

Definition at line 56 of file parser.c.

Referenced by yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_mapping_value(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_document_end(), yaml_parser_parse_document_start(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_mapping_value(), yaml_parser_parse_flow_sequence_entry(), yaml_parser_parse_flow_sequence_entry_mapping_key(), yaml_parser_parse_flow_sequence_entry_mapping_value(), yaml_parser_parse_indentless_sequence_entry(), yaml_parser_parse_node(), yaml_parser_parse_stream_start(), and yaml_parser_process_directives().


Function Documentation

static int yaml_parser_append_tag_directive ( yaml_parser_t parser,
yaml_tag_directive_t  value,
int  allow_duplicates,
yaml_mark_t  mark 
) [static]

Definition at line 1337 of file parser.c.

References yaml_parser_s::error, yaml_tag_directive_s::handle, mark(), NULL, yaml_tag_directive_s::prefix, PUSH, yaml_parser_s::start, yaml_parser_s::tag_directives, yaml_parser_s::top, yaml_free(), YAML_MEMORY_ERROR, yaml_parser_set_parser_error(), and yaml_strdup().

Referenced by yaml_parser_process_directives().

yaml_parser_parse ( yaml_parser_t parser,
yaml_event_t event 
)

Definition at line 170 of file parser.c.

References assert, YAML_PARSE_END_STATE, and yaml_parser_state_machine().

Referenced by parse(), yaml_parser_load(), yaml_parser_load_document(), yaml_parser_load_mapping(), and yaml_parser_load_sequence().

static int yaml_parser_parse_block_mapping_key ( yaml_parser_t parser,
yaml_event_t event,
int  first 
) [static]

Definition at line 834 of file parser.c.

References MAPPING_END_EVENT_INIT, mark(), yaml_parser_s::marks, PEEK_TOKEN, POP, PUSH, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_BLOCK_END_TOKEN, YAML_KEY_TOKEN, YAML_PARSE_BLOCK_MAPPING_VALUE_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), yaml_parser_set_parser_error_context(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_block_mapping_value ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 899 of file parser.c.

References mark(), PEEK_TOKEN, PUSH, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_BLOCK_END_TOKEN, YAML_KEY_TOKEN, YAML_PARSE_BLOCK_MAPPING_KEY_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_block_sequence_entry ( yaml_parser_t parser,
yaml_event_t event,
int  first 
) [static]

Definition at line 726 of file parser.c.

References mark(), yaml_parser_s::marks, PEEK_TOKEN, POP, PUSH, SEQUENCE_END_EVENT_INIT, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_BLOCK_END_TOKEN, YAML_BLOCK_ENTRY_TOKEN, YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and yaml_parser_set_parser_error_context().

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_document_content ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 440 of file parser.c.

References PEEK_TOKEN, POP, yaml_parser_s::state, yaml_parser_s::states, token, YAML_DOCUMENT_END_TOKEN, YAML_DOCUMENT_START_TOKEN, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), YAML_STREAM_END_TOKEN, YAML_TAG_DIRECTIVE_TOKEN, and YAML_VERSION_DIRECTIVE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_document_end ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 470 of file parser.c.

References DOCUMENT_END_EVENT_INIT, yaml_tag_directive_s::handle, PEEK_TOKEN, POP, yaml_tag_directive_s::prefix, SKIP_TOKEN, STACK_EMPTY, yaml_parser_s::state, yaml_parser_s::tag_directives, token, YAML_DOCUMENT_END_TOKEN, yaml_free(), and YAML_PARSE_DOCUMENT_START_STATE.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_document_start ( yaml_parser_t parser,
yaml_event_t event,
int  implicit 
) [static]

Definition at line 342 of file parser.c.

References DOCUMENT_START_EVENT_INIT, NULL, PEEK_TOKEN, PUSH, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, STREAM_END_EVENT_INIT, token, YAML_DOCUMENT_END_TOKEN, YAML_DOCUMENT_START_TOKEN, yaml_free(), YAML_PARSE_BLOCK_NODE_STATE, YAML_PARSE_DOCUMENT_CONTENT_STATE, YAML_PARSE_DOCUMENT_END_STATE, YAML_PARSE_END_STATE, yaml_parser_process_directives(), yaml_parser_set_parser_error(), YAML_STREAM_END_TOKEN, YAML_TAG_DIRECTIVE_TOKEN, and YAML_VERSION_DIRECTIVE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_mapping_key ( yaml_parser_t parser,
yaml_event_t event,
int  first 
) [static]

Definition at line 1100 of file parser.c.

References MAPPING_END_EVENT_INIT, yaml_parser_s::marks, PEEK_TOKEN, POP, PUSH, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_FLOW_ENTRY_TOKEN, YAML_FLOW_MAPPING_END_TOKEN, YAML_KEY_TOKEN, YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE, YAML_PARSE_FLOW_MAPPING_VALUE_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), yaml_parser_set_parser_error_context(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_mapping_value ( yaml_parser_t parser,
yaml_event_t event,
int  empty 
) [static]

Definition at line 1170 of file parser.c.

References PEEK_TOKEN, PUSH, SKIP_TOKEN, yaml_parser_s::state, token, YAML_FLOW_ENTRY_TOKEN, YAML_FLOW_MAPPING_END_TOKEN, YAML_PARSE_FLOW_MAPPING_KEY_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_sequence_entry ( yaml_parser_t parser,
yaml_event_t event,
int  first 
) [static]

Definition at line 949 of file parser.c.

References MAPPING_START_EVENT_INIT, yaml_parser_s::marks, NULL, PEEK_TOKEN, POP, PUSH, SEQUENCE_END_EVENT_INIT, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_FLOW_ENTRY_TOKEN, YAML_FLOW_MAPPING_STYLE, YAML_FLOW_SEQUENCE_END_TOKEN, YAML_KEY_TOKEN, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE, YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE, yaml_parser_parse_node(), and yaml_parser_set_parser_error_context().

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_sequence_entry_mapping_end ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 1071 of file parser.c.

References MAPPING_END_EVENT_INIT, PEEK_TOKEN, yaml_parser_s::state, token, and YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_sequence_entry_mapping_key ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 1010 of file parser.c.

References mark(), PEEK_TOKEN, PUSH, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_FLOW_ENTRY_TOKEN, YAML_FLOW_SEQUENCE_END_TOKEN, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_flow_sequence_entry_mapping_value ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 1040 of file parser.c.

References PEEK_TOKEN, PUSH, SKIP_TOKEN, yaml_parser_s::state, token, YAML_FLOW_ENTRY_TOKEN, YAML_FLOW_SEQUENCE_END_TOKEN, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_indentless_sequence_entry ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 784 of file parser.c.

References mark(), PEEK_TOKEN, POP, PUSH, SEQUENCE_END_EVENT_INIT, SKIP_TOKEN, yaml_parser_s::state, yaml_parser_s::states, token, YAML_BLOCK_END_TOKEN, YAML_BLOCK_ENTRY_TOKEN, YAML_KEY_TOKEN, YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE, yaml_parser_parse_node(), yaml_parser_process_empty_scalar(), and YAML_VALUE_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_parse_node ( yaml_parser_t parser,
yaml_event_t event,
int  block,
int  indentless_sequence 
) [static]

Definition at line 529 of file parser.c.

References ALIAS_EVENT_INIT, yaml_parser_s::error, yaml_tag_directive_s::handle, MAPPING_START_EVENT_INIT, NULL, PEEK_TOKEN, POP, yaml_tag_directive_s::prefix, SCALAR_EVENT_INIT, SEQUENCE_START_EVENT_INIT, SKIP_TOKEN, yaml_parser_s::start, yaml_parser_s::state, yaml_parser_s::states, strlen(), yaml_parser_s::tag_directives, token, yaml_parser_s::top, YAML_ALIAS_TOKEN, YAML_ANCHOR_TOKEN, YAML_BLOCK_ENTRY_TOKEN, YAML_BLOCK_MAPPING_START_TOKEN, YAML_BLOCK_MAPPING_STYLE, YAML_BLOCK_SEQUENCE_START_TOKEN, YAML_BLOCK_SEQUENCE_STYLE, YAML_FLOW_MAPPING_START_TOKEN, YAML_FLOW_MAPPING_STYLE, YAML_FLOW_SEQUENCE_START_TOKEN, YAML_FLOW_SEQUENCE_STYLE, yaml_free(), yaml_malloc(), YAML_MEMORY_ERROR, YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE, YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE, YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE, YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE, YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE, yaml_parser_set_parser_error_context(), YAML_PLAIN_SCALAR_STYLE, YAML_SCALAR_TOKEN, and YAML_TAG_TOKEN.

Referenced by yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_mapping_value(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_document_content(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_mapping_value(), yaml_parser_parse_flow_sequence_entry(), yaml_parser_parse_flow_sequence_entry_mapping_key(), yaml_parser_parse_flow_sequence_entry_mapping_value(), yaml_parser_parse_indentless_sequence_entry(), and yaml_parser_state_machine().

static int yaml_parser_parse_stream_start ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 313 of file parser.c.

References PEEK_TOKEN, SKIP_TOKEN, yaml_parser_s::state, STREAM_START_EVENT_INIT, token, YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE, yaml_parser_set_parser_error(), and YAML_STREAM_START_TOKEN.

Referenced by yaml_parser_state_machine().

static int yaml_parser_process_directives ( yaml_parser_t parser,
yaml_version_directive_t **  version_directive_ref,
yaml_tag_directive_t **  tag_directives_start_ref,
yaml_tag_directive_t **  tag_directives_end_ref 
) [static]

Definition at line 1229 of file parser.c.

References yaml_parser_s::error, yaml_tag_directive_s::handle, INITIAL_STACK_SIZE, NULL, PEEK_TOKEN, POP, yaml_tag_directive_s::prefix, PUSH, SKIP_TOKEN, STACK_DEL, STACK_EMPTY, STACK_INIT, token, top, yaml_free(), yaml_malloc(), YAML_MEMORY_ERROR, yaml_parser_append_tag_directive(), yaml_parser_set_parser_error(), YAML_TAG_DIRECTIVE_TOKEN, and YAML_VERSION_DIRECTIVE_TOKEN.

Referenced by yaml_parser_parse_document_start().

static int yaml_parser_process_empty_scalar ( yaml_parser_t parser,
yaml_event_t event,
yaml_mark_t  mark 
) [static]

Definition at line 1206 of file parser.c.

References yaml_parser_s::error, mark(), NULL, SCALAR_EVENT_INIT, yaml_malloc(), YAML_MEMORY_ERROR, and YAML_PLAIN_SCALAR_STYLE.

Referenced by yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_mapping_value(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_document_content(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_mapping_value(), yaml_parser_parse_flow_sequence_entry_mapping_key(), yaml_parser_parse_flow_sequence_entry_mapping_value(), and yaml_parser_parse_indentless_sequence_entry().

static int yaml_parser_set_parser_error ( yaml_parser_t parser,
const char *  problem,
yaml_mark_t  problem_mark 
) [static]

Definition at line 196 of file parser.c.

References yaml_parser_s::error, yaml_parser_s::problem, yaml_parser_s::problem_mark, and YAML_PARSER_ERROR.

Referenced by yaml_parser_append_tag_directive(), yaml_parser_parse_document_start(), yaml_parser_parse_stream_start(), and yaml_parser_process_directives().

static int yaml_parser_set_parser_error_context ( yaml_parser_t parser,
const char *  context,
yaml_mark_t  context_mark,
const char *  problem,
yaml_mark_t  problem_mark 
) [static]

Definition at line 207 of file parser.c.

References yaml_parser_s::context, yaml_parser_s::context_mark, yaml_parser_s::error, yaml_parser_s::problem, yaml_parser_s::problem_mark, and YAML_PARSER_ERROR.

Referenced by yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_sequence_entry(), and yaml_parser_parse_node().

static int yaml_parser_state_machine ( yaml_parser_t parser,
yaml_event_t event 
) [static]

Definition at line 226 of file parser.c.

References assert, yaml_parser_s::state, YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE, YAML_PARSE_BLOCK_MAPPING_KEY_STATE, YAML_PARSE_BLOCK_MAPPING_VALUE_STATE, YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE, YAML_PARSE_BLOCK_NODE_STATE, YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE, YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE, YAML_PARSE_DOCUMENT_CONTENT_STATE, YAML_PARSE_DOCUMENT_END_STATE, YAML_PARSE_DOCUMENT_START_STATE, YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE, YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE, YAML_PARSE_FLOW_MAPPING_KEY_STATE, YAML_PARSE_FLOW_MAPPING_VALUE_STATE, YAML_PARSE_FLOW_NODE_STATE, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE, YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE, YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE, YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE, YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE, YAML_PARSE_STREAM_START_STATE, yaml_parser_parse_block_mapping_key(), yaml_parser_parse_block_mapping_value(), yaml_parser_parse_block_sequence_entry(), yaml_parser_parse_document_content(), yaml_parser_parse_document_end(), yaml_parser_parse_document_start(), yaml_parser_parse_flow_mapping_key(), yaml_parser_parse_flow_mapping_value(), yaml_parser_parse_flow_sequence_entry(), yaml_parser_parse_flow_sequence_entry_mapping_end(), yaml_parser_parse_flow_sequence_entry_mapping_key(), yaml_parser_parse_flow_sequence_entry_mapping_value(), yaml_parser_parse_indentless_sequence_entry(), yaml_parser_parse_node(), and yaml_parser_parse_stream_start().

Referenced by yaml_parser_parse().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7