示例#1
0
文件: api.c 项目: Dar13/lightship
yaml_stream_start_event_initialize(yaml_event_t *event,
        yaml_encoding_t encoding)
{
    yaml_mark_t mark = { 0, 0, 0 };

    assert(event);  /* Non-NULL event object is expected. */

    STREAM_START_EVENT_INIT(*event, encoding, mark, mark);

    return 1;
}
示例#2
0
yaml_emitter_open (yaml_emitter_t* emitter) {
  yaml_event_t event;
  yaml_mark_t mark = { 0, 0, 0 };

  assert (emitter);           /* Non-NULL emitter object is required. */
  assert (!emitter->opened);  /* Emitter should not be opened yet. */

  STREAM_START_EVENT_INIT (event, YAML_ANY_ENCODING, mark, mark);

  if (!yaml_emitter_emit (emitter, &event)) {
    return 0;
    }

  emitter->opened = 1;

  return 1;
  }
示例#3
0
文件: parser.c 项目: 274914765/C
static int yaml_parser_parse_stream_start (yaml_parser_t * parser, yaml_event_t * event)
{
    yaml_token_t *token;

    token = PEEK_TOKEN (parser);
    if (!token)
	return 0;

    if (token->type != YAML_STREAM_START_TOKEN)
	{
	    return yaml_parser_set_parser_error (parser, "did not find expected <stream-start>", token->start_mark);
	}

    parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
    STREAM_START_EVENT_INIT (*event, token->data.stream_start.encoding, token->start_mark, token->start_mark);
    SKIP_TOKEN (parser);

    return 1;
}
示例#4
0
static int
_ympars_parsestream_start(ym_pars_t *parser, ym_event_t *event)
{
    ym_token_t *token;

    token = PEEK_TOKEN(parser);
    if (!token) return 0;

    if (token->type != YAML_STREAM_START_TOKEN) {
        return _ympars_setparsererr(parser,
                "did not find expected <stream-start>", token->soevent);
    }

    parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
    STREAM_START_EVENT_INIT(*event, token->data.stream_start.encoding,
            token->soevent, token->soevent);
    SKIP_TOKEN(parser);

    return 1;
}