Simplify some current_block matches

This commit is contained in:
David Tolnay 2022-07-30 02:42:02 -07:00
parent 91400c631f
commit 5548f3544e
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
4 changed files with 839 additions and 987 deletions

View file

@ -679,26 +679,23 @@ pub unsafe fn yaml_document_start_event_initialize(
} else { } else {
current_block = 16203760046146113240; current_block = 16203760046146113240;
} }
match current_block { if current_block != 14964981520188694172 {
14964981520188694172 => {} memset(
_ => { event as *mut libc::c_void,
memset( 0,
event as *mut libc::c_void, size_of::<yaml_event_t>() as libc::c_ulong,
0, );
size_of::<yaml_event_t>() as libc::c_ulong, (*event).type_ = YAML_DOCUMENT_START_EVENT;
); (*event).start_mark = mark;
(*event).type_ = YAML_DOCUMENT_START_EVENT; (*event).end_mark = mark;
(*event).start_mark = mark; let fresh164 = addr_of_mut!((*event).data.document_start.version_directive);
(*event).end_mark = mark; *fresh164 = version_directive_copy;
let fresh164 = addr_of_mut!((*event).data.document_start.version_directive); let fresh165 = addr_of_mut!((*event).data.document_start.tag_directives.start);
*fresh164 = version_directive_copy; *fresh165 = tag_directives_copy.start;
let fresh165 = addr_of_mut!((*event).data.document_start.tag_directives.start); let fresh166 = addr_of_mut!((*event).data.document_start.tag_directives.end);
*fresh165 = tag_directives_copy.start; *fresh166 = tag_directives_copy.top;
let fresh166 = addr_of_mut!((*event).data.document_start.tag_directives.end); (*event).data.document_start.implicit = implicit;
*fresh166 = tag_directives_copy.top; return OK;
(*event).data.document_start.implicit = implicit;
return OK;
}
} }
yaml_free(version_directive_copy as *mut libc::c_void); yaml_free(version_directive_copy as *mut libc::c_void);
while !STACK_EMPTY!(tag_directives_copy) { while !STACK_EMPTY!(tag_directives_copy) {
@ -812,60 +809,54 @@ pub unsafe fn yaml_scalar_event_initialize(
} else { } else {
current_block = 8515828400728868193; current_block = 8515828400728868193;
} }
match current_block { if current_block == 8515828400728868193 {
8515828400728868193 => { if !tag.is_null() {
if !tag.is_null() { if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail { current_block = 16285396129609901221;
} else {
tag_copy = yaml_strdup(tag);
if tag_copy.is_null() {
current_block = 16285396129609901221; current_block = 16285396129609901221;
} else { } else {
tag_copy = yaml_strdup(tag); current_block = 12800627514080957624;
if tag_copy.is_null() {
current_block = 16285396129609901221;
} else {
current_block = 12800627514080957624;
}
} }
} else {
current_block = 12800627514080957624;
} }
match current_block { } else {
16285396129609901221 => {} current_block = 12800627514080957624;
_ => { }
if length < 0 { if current_block != 16285396129609901221 {
length = strlen(value as *mut libc::c_char) as libc::c_int; if length < 0 {
} length = strlen(value as *mut libc::c_char) as libc::c_int;
if yaml_check_utf8(value, length as size_t).ok { }
value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t; if yaml_check_utf8(value, length as size_t).ok {
memcpy( value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t;
value_copy as *mut libc::c_void, memcpy(
value as *const libc::c_void, value_copy as *mut libc::c_void,
length as libc::c_ulong, value as *const libc::c_void,
); length as libc::c_ulong,
*value_copy.wrapping_offset(length as isize) = b'\0'; );
memset( *value_copy.wrapping_offset(length as isize) = b'\0';
event as *mut libc::c_void, memset(
0, event as *mut libc::c_void,
size_of::<yaml_event_t>() as libc::c_ulong, 0,
); size_of::<yaml_event_t>() as libc::c_ulong,
(*event).type_ = YAML_SCALAR_EVENT; );
(*event).start_mark = mark; (*event).type_ = YAML_SCALAR_EVENT;
(*event).end_mark = mark; (*event).start_mark = mark;
let fresh168 = addr_of_mut!((*event).data.scalar.anchor); (*event).end_mark = mark;
*fresh168 = anchor_copy; let fresh168 = addr_of_mut!((*event).data.scalar.anchor);
let fresh169 = addr_of_mut!((*event).data.scalar.tag); *fresh168 = anchor_copy;
*fresh169 = tag_copy; let fresh169 = addr_of_mut!((*event).data.scalar.tag);
let fresh170 = addr_of_mut!((*event).data.scalar.value); *fresh169 = tag_copy;
*fresh170 = value_copy; let fresh170 = addr_of_mut!((*event).data.scalar.value);
(*event).data.scalar.length = length as size_t; *fresh170 = value_copy;
(*event).data.scalar.plain_implicit = plain_implicit; (*event).data.scalar.length = length as size_t;
(*event).data.scalar.quoted_implicit = quoted_implicit; (*event).data.scalar.plain_implicit = plain_implicit;
(*event).data.scalar.style = style; (*event).data.scalar.quoted_implicit = quoted_implicit;
return OK; (*event).data.scalar.style = style;
} return OK;
}
} }
} }
_ => {}
} }
yaml_free(anchor_copy as *mut libc::c_void); yaml_free(anchor_copy as *mut libc::c_void);
yaml_free(tag_copy as *mut libc::c_void); yaml_free(tag_copy as *mut libc::c_void);
@ -924,25 +915,22 @@ pub unsafe fn yaml_sequence_start_event_initialize(
} else { } else {
current_block = 7651349459974463963; current_block = 7651349459974463963;
} }
match current_block { if current_block != 8817775685815971442 {
8817775685815971442 => {} memset(
_ => { event as *mut libc::c_void,
memset( 0,
event as *mut libc::c_void, size_of::<yaml_event_t>() as libc::c_ulong,
0, );
size_of::<yaml_event_t>() as libc::c_ulong, (*event).type_ = YAML_SEQUENCE_START_EVENT;
); (*event).start_mark = mark;
(*event).type_ = YAML_SEQUENCE_START_EVENT; (*event).end_mark = mark;
(*event).start_mark = mark; let fresh171 = addr_of_mut!((*event).data.sequence_start.anchor);
(*event).end_mark = mark; *fresh171 = anchor_copy;
let fresh171 = addr_of_mut!((*event).data.sequence_start.anchor); let fresh172 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh171 = anchor_copy; *fresh172 = tag_copy;
let fresh172 = addr_of_mut!((*event).data.sequence_start.tag); (*event).data.sequence_start.implicit = implicit;
*fresh172 = tag_copy; (*event).data.sequence_start.style = style;
(*event).data.sequence_start.implicit = implicit; return OK;
(*event).data.sequence_start.style = style;
return OK;
}
} }
} }
_ => {} _ => {}
@ -1006,44 +994,38 @@ pub unsafe fn yaml_mapping_start_event_initialize(
} else { } else {
current_block = 11006700562992250127; current_block = 11006700562992250127;
} }
match current_block { if current_block == 11006700562992250127 {
11006700562992250127 => { if !tag.is_null() {
if !tag.is_null() { if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail { current_block = 14748279734549812740;
} else {
tag_copy = yaml_strdup(tag);
if tag_copy.is_null() {
current_block = 14748279734549812740; current_block = 14748279734549812740;
} else { } else {
tag_copy = yaml_strdup(tag); current_block = 7651349459974463963;
if tag_copy.is_null() {
current_block = 14748279734549812740;
} else {
current_block = 7651349459974463963;
}
}
} else {
current_block = 7651349459974463963;
}
match current_block {
14748279734549812740 => {}
_ => {
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = mark;
(*event).end_mark = mark;
let fresh173 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh173 = anchor_copy;
let fresh174 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh174 = tag_copy;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = style;
return OK;
} }
} }
} else {
current_block = 7651349459974463963;
}
if current_block != 14748279734549812740 {
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = mark;
(*event).end_mark = mark;
let fresh173 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh173 = anchor_copy;
let fresh174 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh174 = tag_copy;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = style;
return OK;
} }
_ => {}
} }
yaml_free(anchor_copy as *mut libc::c_void); yaml_free(anchor_copy as *mut libc::c_void);
yaml_free(tag_copy as *mut libc::c_void); yaml_free(tag_copy as *mut libc::c_void);
@ -1205,32 +1187,29 @@ pub unsafe fn yaml_document_initialize(
} else { } else {
current_block = 14818589718467733107; current_block = 14818589718467733107;
} }
match current_block { if current_block != 8142820162064489797 {
8142820162064489797 => {} memset(
_ => { document as *mut libc::c_void,
memset( 0,
document as *mut libc::c_void, size_of::<yaml_document_t>() as libc::c_ulong,
0, );
size_of::<yaml_document_t>() as libc::c_ulong, let fresh176 = addr_of_mut!((*document).nodes.start);
); *fresh176 = nodes.start;
let fresh176 = addr_of_mut!((*document).nodes.start); let fresh177 = addr_of_mut!((*document).nodes.end);
*fresh176 = nodes.start; *fresh177 = nodes.end;
let fresh177 = addr_of_mut!((*document).nodes.end); let fresh178 = addr_of_mut!((*document).nodes.top);
*fresh177 = nodes.end; *fresh178 = nodes.start;
let fresh178 = addr_of_mut!((*document).nodes.top); let fresh179 = addr_of_mut!((*document).version_directive);
*fresh178 = nodes.start; *fresh179 = version_directive_copy;
let fresh179 = addr_of_mut!((*document).version_directive); let fresh180 = addr_of_mut!((*document).tag_directives.start);
*fresh179 = version_directive_copy; *fresh180 = tag_directives_copy.start;
let fresh180 = addr_of_mut!((*document).tag_directives.start); let fresh181 = addr_of_mut!((*document).tag_directives.end);
*fresh180 = tag_directives_copy.start; *fresh181 = tag_directives_copy.top;
let fresh181 = addr_of_mut!((*document).tag_directives.end); (*document).start_implicit = start_implicit;
*fresh181 = tag_directives_copy.top; (*document).end_implicit = end_implicit;
(*document).start_implicit = start_implicit; (*document).start_mark = mark;
(*document).end_implicit = end_implicit; (*document).end_mark = mark;
(*document).start_mark = mark; return OK;
(*document).end_mark = mark;
return OK;
}
} }
STACK_DEL!(nodes); STACK_DEL!(nodes);
yaml_free(version_directive_copy as *mut libc::c_void); yaml_free(version_directive_copy as *mut libc::c_void);

View file

@ -59,25 +59,22 @@ pub unsafe fn yaml_parser_load(
} else { } else {
current_block = 7815301370352969686; current_block = 7815301370352969686;
} }
match current_block { if current_block != 6234624449317607669 {
6234624449317607669 => {} if (*parser).stream_end_produced {
_ => { return OK;
if (*parser).stream_end_produced { }
if yaml_parser_parse(parser, event).ok {
if (*event).type_ == YAML_STREAM_END_EVENT {
return OK; return OK;
} }
if yaml_parser_parse(parser, event).ok { STACK_INIT!((*parser).aliases, yaml_alias_data_t);
if (*event).type_ == YAML_STREAM_END_EVENT { let fresh6 = addr_of_mut!((*parser).document);
return OK; *fresh6 = document;
} if yaml_parser_load_document(parser, event).ok {
STACK_INIT!((*parser).aliases, yaml_alias_data_t); yaml_parser_delete_aliases(parser);
let fresh6 = addr_of_mut!((*parser).document); let fresh7 = addr_of_mut!((*parser).document);
*fresh6 = document; *fresh7 = ptr::null_mut::<yaml_document_t>();
if yaml_parser_load_document(parser, event).ok { return OK;
yaml_parser_delete_aliases(parser);
let fresh7 = addr_of_mut!((*parser).document);
*fresh7 = ptr::null_mut::<yaml_document_t>();
return OK;
}
} }
} }
} }
@ -353,32 +350,29 @@ unsafe fn yaml_parser_load_scalar(
} else { } else {
current_block = 11006700562992250127; current_block = 11006700562992250127;
} }
match current_block { if current_block != 10579931339944277179 {
10579931339944277179 => {} memset(
_ => { node as *mut libc::c_void,
memset( 0,
node as *mut libc::c_void, size_of::<yaml_node_t>() as libc::c_ulong,
0, );
size_of::<yaml_node_t>() as libc::c_ulong, (*node).type_ = YAML_SCALAR_NODE;
); (*node).tag = tag;
(*node).type_ = YAML_SCALAR_NODE; (*node).start_mark = (*event).start_mark;
(*node).tag = tag; (*node).end_mark = (*event).end_mark;
(*node).start_mark = (*event).start_mark; (*node).data.scalar.value = (*event).data.scalar.value;
(*node).end_mark = (*event).end_mark; (*node).data.scalar.length = (*event).data.scalar.length;
(*node).data.scalar.value = (*event).data.scalar.value; (*node).data.scalar.style = (*event).data.scalar.style;
(*node).data.scalar.length = (*event).data.scalar.length; PUSH!((*(*parser).document).nodes, *node);
(*node).data.scalar.style = (*event).data.scalar.style; index = (*(*parser).document)
PUSH!((*(*parser).document).nodes, *node); .nodes
index = (*(*parser).document) .top
.nodes .c_offset_from((*(*parser).document).nodes.start)
.top as libc::c_int;
.c_offset_from((*(*parser).document).nodes.start) if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor).fail {
as libc::c_int; return FAIL;
if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor).fail {
return FAIL;
}
return yaml_parser_load_node_add(parser, ctx, index);
} }
return yaml_parser_load_node_add(parser, ctx, index);
} }
} }
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
@ -426,43 +420,39 @@ unsafe fn yaml_parser_load_sequence(
} else { } else {
current_block = 6937071982253665452; current_block = 6937071982253665452;
} }
match current_block { if current_block != 13474536459355229096 {
13474536459355229096 => {} STACK_INIT!(items, yaml_node_item_t);
_ => { memset(
STACK_INIT!(items, yaml_node_item_t); node as *mut libc::c_void,
memset( 0,
node as *mut libc::c_void, size_of::<yaml_node_t>() as libc::c_ulong,
0, );
size_of::<yaml_node_t>() as libc::c_ulong, (*node).type_ = YAML_SEQUENCE_NODE;
); (*node).tag = tag;
(*node).type_ = YAML_SEQUENCE_NODE; (*node).start_mark = (*event).start_mark;
(*node).tag = tag; (*node).end_mark = (*event).end_mark;
(*node).start_mark = (*event).start_mark; (*node).data.sequence.items.start = items.start;
(*node).end_mark = (*event).end_mark; (*node).data.sequence.items.end = items.end;
(*node).data.sequence.items.start = items.start; (*node).data.sequence.items.top = items.start;
(*node).data.sequence.items.end = items.end; (*node).data.sequence.style = (*event).data.sequence_start.style;
(*node).data.sequence.items.top = items.start; PUSH!((*(*parser).document).nodes, *node);
(*node).data.sequence.style = (*event).data.sequence_start.style; index = (*(*parser).document)
PUSH!((*(*parser).document).nodes, *node); .nodes
index = (*(*parser).document) .top
.nodes .c_offset_from((*(*parser).document).nodes.start)
.top as libc::c_int;
.c_offset_from((*(*parser).document).nodes.start) if yaml_parser_register_anchor(parser, index, (*event).data.sequence_start.anchor).fail
as libc::c_int; {
if yaml_parser_register_anchor(parser, index, (*event).data.sequence_start.anchor) return FAIL;
.fail
{
return FAIL;
}
if yaml_parser_load_node_add(parser, ctx, index).fail {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(*ctx, index);
return OK;
} }
if yaml_parser_load_node_add(parser, ctx, index).fail {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(*ctx, index);
return OK;
} }
} }
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
@ -529,43 +519,38 @@ unsafe fn yaml_parser_load_mapping(
} else { } else {
current_block = 6937071982253665452; current_block = 6937071982253665452;
} }
match current_block { if current_block != 13635467803606088781 {
13635467803606088781 => {} STACK_INIT!(pairs, yaml_node_pair_t);
_ => { memset(
STACK_INIT!(pairs, yaml_node_pair_t); node as *mut libc::c_void,
memset( 0,
node as *mut libc::c_void, size_of::<yaml_node_t>() as libc::c_ulong,
0, );
size_of::<yaml_node_t>() as libc::c_ulong, (*node).type_ = YAML_MAPPING_NODE;
); (*node).tag = tag;
(*node).type_ = YAML_MAPPING_NODE; (*node).start_mark = (*event).start_mark;
(*node).tag = tag; (*node).end_mark = (*event).end_mark;
(*node).start_mark = (*event).start_mark; (*node).data.mapping.pairs.start = pairs.start;
(*node).end_mark = (*event).end_mark; (*node).data.mapping.pairs.end = pairs.end;
(*node).data.mapping.pairs.start = pairs.start; (*node).data.mapping.pairs.top = pairs.start;
(*node).data.mapping.pairs.end = pairs.end; (*node).data.mapping.style = (*event).data.mapping_start.style;
(*node).data.mapping.pairs.top = pairs.start; PUSH!((*(*parser).document).nodes, *node);
(*node).data.mapping.style = (*event).data.mapping_start.style; index = (*(*parser).document)
PUSH!((*(*parser).document).nodes, *node); .nodes
index = (*(*parser).document) .top
.nodes .c_offset_from((*(*parser).document).nodes.start)
.top as libc::c_int;
.c_offset_from((*(*parser).document).nodes.start) if yaml_parser_register_anchor(parser, index, (*event).data.mapping_start.anchor).fail {
as libc::c_int; return FAIL;
if yaml_parser_register_anchor(parser, index, (*event).data.mapping_start.anchor)
.fail
{
return FAIL;
}
if yaml_parser_load_node_add(parser, ctx, index).fail {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(*ctx, index);
return OK;
} }
if yaml_parser_load_node_add(parser, ctx, index).fail {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(*ctx, index);
return OK;
} }
} }
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);

View file

@ -481,254 +481,238 @@ unsafe fn yaml_parser_parse_node(
} else { } else {
current_block = 11743904203796629665; current_block = 11743904203796629665;
} }
match current_block { if current_block == 11743904203796629665 {
11743904203796629665 => { if !tag_handle.is_null() {
if !tag_handle.is_null() { if *tag_handle == 0 {
if *tag_handle == 0 { tag = tag_suffix;
tag = tag_suffix; yaml_free(tag_handle as *mut libc::c_void);
yaml_free(tag_handle as *mut libc::c_void); tag_suffix = ptr::null_mut::<yaml_char_t>();
tag_suffix = ptr::null_mut::<yaml_char_t>(); tag_handle = tag_suffix;
tag_handle = tag_suffix; current_block = 9437013279121998969;
current_block = 9437013279121998969; } else {
} else { let mut tag_directive: *mut yaml_tag_directive_t;
let mut tag_directive: *mut yaml_tag_directive_t; tag_directive = (*parser).tag_directives.start;
tag_directive = (*parser).tag_directives.start; loop {
loop { if !(tag_directive != (*parser).tag_directives.top) {
if !(tag_directive != (*parser).tag_directives.top) { current_block = 17728966195399430138;
current_block = 17728966195399430138; break;
break;
}
if strcmp(
(*tag_directive).handle as *mut libc::c_char,
tag_handle as *mut libc::c_char,
) == 0
{
let prefix_len: size_t =
strlen((*tag_directive).prefix as *mut libc::c_char);
let suffix_len: size_t = strlen(tag_suffix as *mut libc::c_char);
tag = yaml_malloc(
prefix_len.wrapping_add(suffix_len).wrapping_add(1_u64),
) as *mut yaml_char_t;
memcpy(
tag as *mut libc::c_void,
(*tag_directive).prefix as *const libc::c_void,
prefix_len,
);
memcpy(
tag.wrapping_offset(prefix_len as isize) as *mut libc::c_void,
tag_suffix as *const libc::c_void,
suffix_len,
);
*tag.wrapping_offset(
prefix_len.wrapping_add(suffix_len) as isize
) = b'\0';
yaml_free(tag_handle as *mut libc::c_void);
yaml_free(tag_suffix as *mut libc::c_void);
tag_suffix = ptr::null_mut::<yaml_char_t>();
tag_handle = tag_suffix;
current_block = 17728966195399430138;
break;
} else {
tag_directive = tag_directive.wrapping_offset(1);
}
} }
match current_block { if strcmp(
17786380918591080555 => {} (*tag_directive).handle as *mut libc::c_char,
_ => { tag_handle as *mut libc::c_char,
if tag.is_null() { ) == 0
yaml_parser_set_parser_error_context( {
parser, let prefix_len: size_t =
b"while parsing a node\0" as *const u8 strlen((*tag_directive).prefix as *mut libc::c_char);
as *const libc::c_char, let suffix_len: size_t = strlen(tag_suffix as *mut libc::c_char);
start_mark, tag = yaml_malloc(
b"found undefined tag handle\0" as *const u8 prefix_len.wrapping_add(suffix_len).wrapping_add(1_u64),
as *const libc::c_char, ) as *mut yaml_char_t;
tag_mark, memcpy(
); tag as *mut libc::c_void,
current_block = 17786380918591080555; (*tag_directive).prefix as *const libc::c_void,
} else { prefix_len,
current_block = 9437013279121998969; );
} memcpy(
} tag.wrapping_offset(prefix_len as isize) as *mut libc::c_void,
tag_suffix as *const libc::c_void,
suffix_len,
);
*tag.wrapping_offset(prefix_len.wrapping_add(suffix_len) as isize) =
b'\0';
yaml_free(tag_handle as *mut libc::c_void);
yaml_free(tag_suffix as *mut libc::c_void);
tag_suffix = ptr::null_mut::<yaml_char_t>();
tag_handle = tag_suffix;
current_block = 17728966195399430138;
break;
} else {
tag_directive = tag_directive.wrapping_offset(1);
} }
} }
} else { if current_block != 17786380918591080555 {
current_block = 9437013279121998969; if tag.is_null() {
}
match current_block {
17786380918591080555 => {}
_ => {
implicit = tag.is_null() || *tag == 0;
if indentless_sequence && (*token).type_ == YAML_BLOCK_ENTRY_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh37 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh37 = anchor;
let fresh38 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh38 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return OK;
} else if (*token).type_ == YAML_SCALAR_TOKEN {
let mut plain_implicit = false;
let mut quoted_implicit = false;
end_mark = (*token).end_mark;
if (*token).data.scalar.style == YAML_PLAIN_SCALAR_STYLE
&& tag.is_null()
|| !tag.is_null()
&& strcmp(
tag as *mut libc::c_char,
b"!\0" as *const u8 as *const libc::c_char,
) == 0
{
plain_implicit = true;
} else if tag.is_null() {
quoted_implicit = true;
}
(*parser).state = POP!((*parser).states);
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SCALAR_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh40 = addr_of_mut!((*event).data.scalar.anchor);
*fresh40 = anchor;
let fresh41 = addr_of_mut!((*event).data.scalar.tag);
*fresh41 = tag;
let fresh42 = addr_of_mut!((*event).data.scalar.value);
*fresh42 = (*token).data.scalar.value;
(*event).data.scalar.length = (*token).data.scalar.length;
(*event).data.scalar.plain_implicit = plain_implicit;
(*event).data.scalar.quoted_implicit = quoted_implicit;
(*event).data.scalar.style = (*token).data.scalar.style;
SKIP_TOKEN(parser);
return OK;
} else if (*token).type_ == YAML_FLOW_SEQUENCE_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh45 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh45 = anchor;
let fresh46 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh46 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_FLOW_SEQUENCE_STYLE;
return OK;
} else if (*token).type_ == YAML_FLOW_MAPPING_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh47 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh47 = anchor;
let fresh48 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh48 = tag;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = YAML_FLOW_MAPPING_STYLE;
return OK;
} else if block && (*token).type_ == YAML_BLOCK_SEQUENCE_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh49 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh49 = anchor;
let fresh50 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh50 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return OK;
} else if block && (*token).type_ == YAML_BLOCK_MAPPING_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh51 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh51 = anchor;
let fresh52 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh52 = tag;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = YAML_BLOCK_MAPPING_STYLE;
return OK;
} else if !anchor.is_null() || !tag.is_null() {
let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t;
*value = b'\0';
(*parser).state = POP!((*parser).states);
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SCALAR_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh54 = addr_of_mut!((*event).data.scalar.anchor);
*fresh54 = anchor;
let fresh55 = addr_of_mut!((*event).data.scalar.tag);
*fresh55 = tag;
let fresh56 = addr_of_mut!((*event).data.scalar.value);
*fresh56 = value;
(*event).data.scalar.length = 0_u64;
(*event).data.scalar.plain_implicit = implicit;
(*event).data.scalar.quoted_implicit = false;
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
return OK;
} else {
yaml_parser_set_parser_error_context( yaml_parser_set_parser_error_context(
parser, parser,
if block { b"while parsing a node\0" as *const u8 as *const libc::c_char,
b"while parsing a block node\0" as *const u8
as *const libc::c_char
} else {
b"while parsing a flow node\0" as *const u8
as *const libc::c_char
},
start_mark, start_mark,
b"did not find expected node content\0" as *const u8 b"found undefined tag handle\0" as *const u8 as *const libc::c_char,
as *const libc::c_char, tag_mark,
(*token).start_mark,
); );
current_block = 17786380918591080555;
} else {
current_block = 9437013279121998969;
} }
} }
} }
} else {
current_block = 9437013279121998969;
}
if current_block != 17786380918591080555 {
implicit = tag.is_null() || *tag == 0;
if indentless_sequence && (*token).type_ == YAML_BLOCK_ENTRY_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh37 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh37 = anchor;
let fresh38 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh38 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return OK;
} else if (*token).type_ == YAML_SCALAR_TOKEN {
let mut plain_implicit = false;
let mut quoted_implicit = false;
end_mark = (*token).end_mark;
if (*token).data.scalar.style == YAML_PLAIN_SCALAR_STYLE && tag.is_null()
|| !tag.is_null()
&& strcmp(
tag as *mut libc::c_char,
b"!\0" as *const u8 as *const libc::c_char,
) == 0
{
plain_implicit = true;
} else if tag.is_null() {
quoted_implicit = true;
}
(*parser).state = POP!((*parser).states);
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SCALAR_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh40 = addr_of_mut!((*event).data.scalar.anchor);
*fresh40 = anchor;
let fresh41 = addr_of_mut!((*event).data.scalar.tag);
*fresh41 = tag;
let fresh42 = addr_of_mut!((*event).data.scalar.value);
*fresh42 = (*token).data.scalar.value;
(*event).data.scalar.length = (*token).data.scalar.length;
(*event).data.scalar.plain_implicit = plain_implicit;
(*event).data.scalar.quoted_implicit = quoted_implicit;
(*event).data.scalar.style = (*token).data.scalar.style;
SKIP_TOKEN(parser);
return OK;
} else if (*token).type_ == YAML_FLOW_SEQUENCE_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh45 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh45 = anchor;
let fresh46 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh46 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_FLOW_SEQUENCE_STYLE;
return OK;
} else if (*token).type_ == YAML_FLOW_MAPPING_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh47 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh47 = anchor;
let fresh48 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh48 = tag;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = YAML_FLOW_MAPPING_STYLE;
return OK;
} else if block && (*token).type_ == YAML_BLOCK_SEQUENCE_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SEQUENCE_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh49 = addr_of_mut!((*event).data.sequence_start.anchor);
*fresh49 = anchor;
let fresh50 = addr_of_mut!((*event).data.sequence_start.tag);
*fresh50 = tag;
(*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return OK;
} else if block && (*token).type_ == YAML_BLOCK_MAPPING_START_TOKEN {
end_mark = (*token).end_mark;
(*parser).state = YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_MAPPING_START_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh51 = addr_of_mut!((*event).data.mapping_start.anchor);
*fresh51 = anchor;
let fresh52 = addr_of_mut!((*event).data.mapping_start.tag);
*fresh52 = tag;
(*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = YAML_BLOCK_MAPPING_STYLE;
return OK;
} else if !anchor.is_null() || !tag.is_null() {
let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t;
*value = b'\0';
(*parser).state = POP!((*parser).states);
memset(
event as *mut libc::c_void,
0,
size_of::<yaml_event_t>() as libc::c_ulong,
);
(*event).type_ = YAML_SCALAR_EVENT;
(*event).start_mark = start_mark;
(*event).end_mark = end_mark;
let fresh54 = addr_of_mut!((*event).data.scalar.anchor);
*fresh54 = anchor;
let fresh55 = addr_of_mut!((*event).data.scalar.tag);
*fresh55 = tag;
let fresh56 = addr_of_mut!((*event).data.scalar.value);
*fresh56 = value;
(*event).data.scalar.length = 0_u64;
(*event).data.scalar.plain_implicit = implicit;
(*event).data.scalar.quoted_implicit = false;
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
return OK;
} else {
yaml_parser_set_parser_error_context(
parser,
if block {
b"while parsing a block node\0" as *const u8 as *const libc::c_char
} else {
b"while parsing a flow node\0" as *const u8 as *const libc::c_char
},
start_mark,
b"did not find expected node content\0" as *const u8 as *const libc::c_char,
(*token).start_mark,
);
}
} }
_ => {}
} }
yaml_free(anchor as *mut libc::c_void); yaml_free(anchor as *mut libc::c_void);
yaml_free(tag_handle as *mut libc::c_void); yaml_free(tag_handle as *mut libc::c_void);
@ -1283,52 +1267,46 @@ unsafe fn yaml_parser_process_directives(
break; break;
} }
} }
match current_block { if current_block != 17143798186130252483 {
17143798186130252483 => {} default_tag_directive = default_tag_directives.as_mut_ptr();
_ => { loop {
default_tag_directive = default_tag_directives.as_mut_ptr(); if (*default_tag_directive).handle.is_null() {
loop { current_block = 18377268871191777778;
if (*default_tag_directive).handle.is_null() { break;
current_block = 18377268871191777778;
break;
}
if yaml_parser_append_tag_directive(
parser,
*default_tag_directive,
true,
(*token).start_mark,
)
.fail
{
current_block = 17143798186130252483;
break;
}
default_tag_directive = default_tag_directive.wrapping_offset(1);
} }
match current_block { if yaml_parser_append_tag_directive(
17143798186130252483 => {} parser,
_ => { *default_tag_directive,
if !version_directive_ref.is_null() { true,
*version_directive_ref = version_directive; (*token).start_mark,
} )
if !tag_directives_start_ref.is_null() { .fail
if STACK_EMPTY!(tag_directives) { {
*tag_directives_end_ref = ptr::null_mut::<yaml_tag_directive_t>(); current_block = 17143798186130252483;
*tag_directives_start_ref = *tag_directives_end_ref; break;
STACK_DEL!(tag_directives);
} else {
*tag_directives_start_ref = tag_directives.start;
*tag_directives_end_ref = tag_directives.top;
}
} else {
STACK_DEL!(tag_directives);
}
if version_directive_ref.is_null() {
yaml_free(version_directive as *mut libc::c_void);
}
return OK;
}
} }
default_tag_directive = default_tag_directive.wrapping_offset(1);
}
if current_block != 17143798186130252483 {
if !version_directive_ref.is_null() {
*version_directive_ref = version_directive;
}
if !tag_directives_start_ref.is_null() {
if STACK_EMPTY!(tag_directives) {
*tag_directives_end_ref = ptr::null_mut::<yaml_tag_directive_t>();
*tag_directives_start_ref = *tag_directives_end_ref;
STACK_DEL!(tag_directives);
} else {
*tag_directives_start_ref = tag_directives.start;
*tag_directives_end_ref = tag_directives.top;
}
} else {
STACK_DEL!(tag_directives);
}
if version_directive_ref.is_null() {
yaml_free(version_directive as *mut libc::c_void);
}
return OK;
} }
} }
} }

View file

@ -1018,72 +1018,58 @@ unsafe fn yaml_parser_scan_directive(
); );
current_block = 11397968426844348457; current_block = 11397968426844348457;
} }
match current_block { if current_block != 11397968426844348457 {
11397968426844348457 => {} if CACHE(parser, 1_u64).ok {
_ => { loop {
if CACHE(parser, 1_u64).ok { if !IS_BLANK!((*parser).buffer) {
loop { current_block = 11584701595673473500;
if !IS_BLANK!((*parser).buffer) { break;
current_block = 11584701595673473500;
break;
}
SKIP(parser);
if CACHE(parser, 1_u64).fail {
current_block = 11397968426844348457;
break;
}
} }
match current_block { SKIP(parser);
11397968426844348457 => {} if CACHE(parser, 1_u64).fail {
_ => { current_block = 11397968426844348457;
if CHECK!((*parser).buffer, b'#') { break;
loop { }
if IS_BREAKZ!((*parser).buffer) { }
current_block = 6669252993407410313; if current_block != 11397968426844348457 {
break; if CHECK!((*parser).buffer, b'#') {
} loop {
SKIP(parser); if IS_BREAKZ!((*parser).buffer) {
if CACHE(parser, 1_u64).fail { current_block = 6669252993407410313;
current_block = 11397968426844348457; break;
break; }
} SKIP(parser);
if CACHE(parser, 1_u64).fail {
current_block = 11397968426844348457;
break;
}
}
} else {
current_block = 6669252993407410313;
}
if current_block != 11397968426844348457 {
if !IS_BREAKZ!((*parser).buffer) {
yaml_parser_set_scanner_error(
parser,
b"while scanning a directive\0" as *const u8 as *const libc::c_char,
start_mark,
b"did not find expected comment or line break\0" as *const u8
as *const libc::c_char,
);
} else {
if IS_BREAK!((*parser).buffer) {
if CACHE(parser, 2_u64).fail {
current_block = 11397968426844348457;
} else {
SKIP_LINE(parser);
current_block = 652864300344834934;
} }
} else { } else {
current_block = 6669252993407410313; current_block = 652864300344834934;
} }
match current_block { if current_block != 11397968426844348457 {
11397968426844348457 => {} yaml_free(name as *mut libc::c_void);
_ => { return OK;
if !IS_BREAKZ!((*parser).buffer) {
yaml_parser_set_scanner_error(
parser,
b"while scanning a directive\0" as *const u8
as *const libc::c_char,
start_mark,
b"did not find expected comment or line break\0"
as *const u8
as *const libc::c_char,
);
} else {
if IS_BREAK!((*parser).buffer) {
if CACHE(parser, 2_u64).fail {
current_block = 11397968426844348457;
} else {
SKIP_LINE(parser);
current_block = 652864300344834934;
}
} else {
current_block = 652864300344834934;
}
match current_block {
11397968426844348457 => {}
_ => {
yaml_free(name as *mut libc::c_void);
return OK;
}
}
}
}
} }
} }
} }
@ -1117,29 +1103,25 @@ unsafe fn yaml_parser_scan_directive_name(
break; break;
} }
} }
match current_block { if current_block != 8318012024179131575 {
8318012024179131575 => {} if string.start == string.pointer {
_ => { yaml_parser_set_scanner_error(
if string.start == string.pointer { parser,
yaml_parser_set_scanner_error( b"while scanning a directive\0" as *const u8 as *const libc::c_char,
parser, start_mark,
b"while scanning a directive\0" as *const u8 as *const libc::c_char, b"could not find expected directive name\0" as *const u8 as *const libc::c_char,
start_mark, );
b"could not find expected directive name\0" as *const u8 } else if !IS_BLANKZ!((*parser).buffer) {
as *const libc::c_char, yaml_parser_set_scanner_error(
); parser,
} else if !IS_BLANKZ!((*parser).buffer) { b"while scanning a directive\0" as *const u8 as *const libc::c_char,
yaml_parser_set_scanner_error( start_mark,
parser, b"found unexpected non-alphabetical character\0" as *const u8
b"while scanning a directive\0" as *const u8 as *const libc::c_char, as *const libc::c_char,
start_mark, );
b"found unexpected non-alphabetical character\0" as *const u8 } else {
as *const libc::c_char, *name = string.start;
); return OK;
} else {
*name = string.start;
return OK;
}
} }
} }
} }
@ -1347,58 +1329,55 @@ unsafe fn yaml_parser_scan_anchor(
} }
length += 1; length += 1;
} }
match current_block { if current_block != 5883759901342942623 {
5883759901342942623 => {} end_mark = (*parser).mark;
_ => { if length == 0
end_mark = (*parser).mark; || !(IS_BLANKZ!((*parser).buffer)
if length == 0 || CHECK!((*parser).buffer, b'?')
|| !(IS_BLANKZ!((*parser).buffer) || CHECK!((*parser).buffer, b':')
|| CHECK!((*parser).buffer, b'?') || CHECK!((*parser).buffer, b',')
|| CHECK!((*parser).buffer, b':') || CHECK!((*parser).buffer, b']')
|| CHECK!((*parser).buffer, b',') || CHECK!((*parser).buffer, b'}')
|| CHECK!((*parser).buffer, b']') || CHECK!((*parser).buffer, b'%')
|| CHECK!((*parser).buffer, b'}') || CHECK!((*parser).buffer, b'@')
|| CHECK!((*parser).buffer, b'%') || CHECK!((*parser).buffer, b'`'))
|| CHECK!((*parser).buffer, b'@') {
|| CHECK!((*parser).buffer, b'`')) yaml_parser_set_scanner_error(
{ parser,
yaml_parser_set_scanner_error(
parser,
if type_ == YAML_ANCHOR_TOKEN {
b"while scanning an anchor\0" as *const u8 as *const libc::c_char
} else {
b"while scanning an alias\0" as *const u8 as *const libc::c_char
},
start_mark,
b"did not find expected alphabetic or numeric character\0" as *const u8
as *const libc::c_char,
);
} else {
if type_ == YAML_ANCHOR_TOKEN { if type_ == YAML_ANCHOR_TOKEN {
memset( b"while scanning an anchor\0" as *const u8 as *const libc::c_char
token as *mut libc::c_void,
0,
size_of::<yaml_token_t>() as libc::c_ulong,
);
(*token).type_ = YAML_ANCHOR_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
let fresh220 = addr_of_mut!((*token).data.anchor.value);
*fresh220 = string.start;
} else { } else {
memset( b"while scanning an alias\0" as *const u8 as *const libc::c_char
token as *mut libc::c_void, },
0, start_mark,
size_of::<yaml_token_t>() as libc::c_ulong, b"did not find expected alphabetic or numeric character\0" as *const u8
); as *const libc::c_char,
(*token).type_ = YAML_ALIAS_TOKEN; );
(*token).start_mark = start_mark; } else {
(*token).end_mark = end_mark; if type_ == YAML_ANCHOR_TOKEN {
let fresh221 = addr_of_mut!((*token).data.alias.value); memset(
*fresh221 = string.start; token as *mut libc::c_void,
} 0,
return OK; size_of::<yaml_token_t>() as libc::c_ulong,
);
(*token).type_ = YAML_ANCHOR_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
let fresh220 = addr_of_mut!((*token).data.anchor.value);
*fresh220 = string.start;
} else {
memset(
token as *mut libc::c_void,
0,
size_of::<yaml_token_t>() as libc::c_ulong,
);
(*token).type_ = YAML_ALIAS_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
let fresh221 = addr_of_mut!((*token).data.alias.value);
*fresh221 = string.start;
} }
return OK;
} }
} }
} }
@ -1490,45 +1469,39 @@ unsafe fn yaml_parser_scan_tag(
} }
current_block = 4488286894823169796; current_block = 4488286894823169796;
} }
match current_block { if current_block != 17708497480799081542 {
17708497480799081542 => {} if CACHE(parser, 1_u64).ok {
_ => { if !IS_BLANKZ!((*parser).buffer) {
if CACHE(parser, 1_u64).ok { if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') {
if !IS_BLANKZ!((*parser).buffer) { yaml_parser_set_scanner_error(
if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') { parser,
yaml_parser_set_scanner_error( b"while scanning a tag\0" as *const u8 as *const libc::c_char,
parser, start_mark,
b"while scanning a tag\0" as *const u8 as *const libc::c_char, b"did not find expected whitespace or line break\0" as *const u8
start_mark, as *const libc::c_char,
b"did not find expected whitespace or line break\0" as *const u8 );
as *const libc::c_char, current_block = 17708497480799081542;
);
current_block = 17708497480799081542;
} else {
current_block = 7333393191927787629;
}
} else { } else {
current_block = 7333393191927787629; current_block = 7333393191927787629;
} }
match current_block { } else {
17708497480799081542 => {} current_block = 7333393191927787629;
_ => { }
end_mark = (*parser).mark; if current_block != 17708497480799081542 {
memset( end_mark = (*parser).mark;
token as *mut libc::c_void, memset(
0, token as *mut libc::c_void,
size_of::<yaml_token_t>() as libc::c_ulong, 0,
); size_of::<yaml_token_t>() as libc::c_ulong,
(*token).type_ = YAML_TAG_TOKEN; );
(*token).start_mark = start_mark; (*token).type_ = YAML_TAG_TOKEN;
(*token).end_mark = end_mark; (*token).start_mark = start_mark;
let fresh234 = addr_of_mut!((*token).data.tag.handle); (*token).end_mark = end_mark;
*fresh234 = handle; let fresh234 = addr_of_mut!((*token).data.tag.handle);
let fresh235 = addr_of_mut!((*token).data.tag.suffix); *fresh234 = handle;
*fresh235 = suffix; let fresh235 = addr_of_mut!((*token).data.tag.suffix);
return OK; *fresh235 = suffix;
} return OK;
}
} }
} }
} }
@ -1573,34 +1546,27 @@ unsafe fn yaml_parser_scan_tag_handle(
break; break;
} }
} }
match current_block { if current_block != 1771849829115608806 {
1771849829115608806 => {} if CHECK!((*parser).buffer, b'!') {
_ => { READ!(parser, string);
if CHECK!((*parser).buffer, b'!') { current_block = 5689001924483802034;
READ!(parser, string); } else if directive
current_block = 5689001924483802034; && !(*string.start == b'!'
} else if directive && *string.start.wrapping_offset(1_isize) == b'\0')
&& !(*string.start == b'!' {
&& *string.start.wrapping_offset(1_isize) == b'\0') yaml_parser_set_scanner_error(
{ parser,
yaml_parser_set_scanner_error( b"while parsing a tag directive\0" as *const u8 as *const libc::c_char,
parser, start_mark,
b"while parsing a tag directive\0" as *const u8 b"did not find expected '!'\0" as *const u8 as *const libc::c_char,
as *const libc::c_char, );
start_mark, current_block = 1771849829115608806;
b"did not find expected '!'\0" as *const u8 as *const libc::c_char, } else {
); current_block = 5689001924483802034;
current_block = 1771849829115608806; }
} else { if current_block != 1771849829115608806 {
current_block = 5689001924483802034; *handle = string.start;
} return OK;
match current_block {
1771849829115608806 => {}
_ => {
*handle = string.start;
return OK;
}
}
} }
} }
} }
@ -1886,214 +1852,164 @@ unsafe fn yaml_parser_scan_block_scalar(
} else { } else {
current_block = 11913429853522160501; current_block = 11913429853522160501;
} }
match current_block { if current_block != 14984465786483313892 {
14984465786483313892 => {} if CACHE(parser, 1_u64).ok {
_ => { loop {
if CACHE(parser, 1_u64).ok { if !IS_BLANK!((*parser).buffer) {
loop { current_block = 4090602189656566074;
if !IS_BLANK!((*parser).buffer) { break;
current_block = 4090602189656566074;
break;
}
SKIP(parser);
if CACHE(parser, 1_u64).fail {
current_block = 14984465786483313892;
break;
}
} }
match current_block { SKIP(parser);
14984465786483313892 => {} if CACHE(parser, 1_u64).fail {
_ => { current_block = 14984465786483313892;
if CHECK!((*parser).buffer, b'#') { break;
loop { }
if IS_BREAKZ!((*parser).buffer) { }
current_block = 12997042908615822766; if current_block != 14984465786483313892 {
break; if CHECK!((*parser).buffer, b'#') {
} loop {
SKIP(parser); if IS_BREAKZ!((*parser).buffer) {
if CACHE(parser, 1_u64).fail { current_block = 12997042908615822766;
current_block = 14984465786483313892; break;
break; }
} SKIP(parser);
if CACHE(parser, 1_u64).fail {
current_block = 14984465786483313892;
break;
}
}
} else {
current_block = 12997042908615822766;
}
if current_block != 14984465786483313892 {
if !IS_BREAKZ!((*parser).buffer) {
yaml_parser_set_scanner_error(
parser,
b"while scanning a block scalar\0" as *const u8
as *const libc::c_char,
start_mark,
b"did not find expected comment or line break\0" as *const u8
as *const libc::c_char,
);
} else {
if IS_BREAK!((*parser).buffer) {
if CACHE(parser, 2_u64).fail {
current_block = 14984465786483313892;
} else {
SKIP_LINE(parser);
current_block = 13619784596304402172;
} }
} else { } else {
current_block = 12997042908615822766; current_block = 13619784596304402172;
} }
match current_block { if current_block != 14984465786483313892 {
14984465786483313892 => {} end_mark = (*parser).mark;
_ => { if increment != 0 {
if !IS_BREAKZ!((*parser).buffer) { indent = if (*parser).indent >= 0 {
yaml_parser_set_scanner_error( (*parser).indent + increment
parser,
b"while scanning a block scalar\0" as *const u8
as *const libc::c_char,
start_mark,
b"did not find expected comment or line break\0"
as *const u8
as *const libc::c_char,
);
} else { } else {
if IS_BREAK!((*parser).buffer) { increment
};
}
if yaml_parser_scan_block_scalar_breaks(
parser,
addr_of_mut!(indent),
addr_of_mut!(trailing_breaks),
start_mark,
addr_of_mut!(end_mark),
)
.ok
{
if CACHE(parser, 1_u64).ok {
's_281: loop {
if !((*parser).mark.column as libc::c_int == indent
&& !IS_Z!((*parser).buffer))
{
current_block = 5793491756164225964;
break;
}
trailing_blank =
IS_BLANK!((*parser).buffer) as libc::c_int;
if !literal
&& *leading_break.start == b'\n'
&& leading_blank == 0
&& trailing_blank == 0
{
if *trailing_breaks.start == b'\0' {
STRING_EXTEND!(string);
let fresh418 = string.pointer;
string.pointer =
string.pointer.wrapping_offset(1);
*fresh418 = b' ';
}
CLEAR!(leading_break);
} else {
JOIN!(string, leading_break);
CLEAR!(leading_break);
}
JOIN!(string, trailing_breaks);
CLEAR!(trailing_breaks);
leading_blank =
IS_BLANK!((*parser).buffer) as libc::c_int;
while !IS_BREAKZ!((*parser).buffer) {
READ!(parser, string);
if CACHE(parser, 1_u64).fail {
current_block = 14984465786483313892;
break 's_281;
}
}
if CACHE(parser, 2_u64).fail { if CACHE(parser, 2_u64).fail {
current_block = 14984465786483313892; current_block = 14984465786483313892;
} else { break;
SKIP_LINE(parser); }
current_block = 13619784596304402172; READ_LINE!(parser, leading_break);
if yaml_parser_scan_block_scalar_breaks(
parser,
addr_of_mut!(indent),
addr_of_mut!(trailing_breaks),
start_mark,
addr_of_mut!(end_mark),
)
.fail
{
current_block = 14984465786483313892;
break;
} }
} else {
current_block = 13619784596304402172;
} }
match current_block { if current_block != 14984465786483313892 {
14984465786483313892 => {} if chomping != -1 {
_ => { JOIN!(string, leading_break);
end_mark = (*parser).mark; current_block = 17787701279558130514;
if increment != 0 { } else {
indent = if (*parser).indent >= 0 { current_block = 17787701279558130514;
(*parser).indent + increment }
} else { if current_block != 14984465786483313892 {
increment if chomping == 1 {
}; JOIN!(string, trailing_breaks);
}
if yaml_parser_scan_block_scalar_breaks(
parser,
addr_of_mut!(indent),
addr_of_mut!(trailing_breaks),
start_mark,
addr_of_mut!(end_mark),
)
.ok
{
if CACHE(parser, 1_u64).ok {
's_281: loop {
if !((*parser).mark.column
as libc::c_int
== indent
&& !IS_Z!((*parser).buffer))
{
current_block = 5793491756164225964;
break;
}
trailing_blank =
IS_BLANK!((*parser).buffer)
as libc::c_int;
if !literal
&& *leading_break.start == b'\n'
&& leading_blank == 0
&& trailing_blank == 0
{
if *trailing_breaks.start == b'\0' {
STRING_EXTEND!(string);
let fresh418 = string.pointer;
string.pointer = string
.pointer
.wrapping_offset(1);
*fresh418 = b' ';
}
CLEAR!(leading_break);
} else {
JOIN!(string, leading_break);
CLEAR!(leading_break);
}
JOIN!(string, trailing_breaks);
CLEAR!(trailing_breaks);
leading_blank =
IS_BLANK!((*parser).buffer)
as libc::c_int;
while !IS_BREAKZ!((*parser).buffer) {
READ!(parser, string);
if CACHE(parser, 1_u64).fail {
current_block =
14984465786483313892;
break 's_281;
}
}
if CACHE(parser, 2_u64).fail {
current_block =
14984465786483313892;
break;
}
READ_LINE!(parser, leading_break);
if yaml_parser_scan_block_scalar_breaks(
parser,
addr_of_mut!(indent),
addr_of_mut!(trailing_breaks),
start_mark,
addr_of_mut!(end_mark),
)
.fail
{
current_block =
14984465786483313892;
break;
}
}
match current_block {
14984465786483313892 => {}
_ => {
if chomping != -1 {
JOIN!(string, leading_break);
current_block =
17787701279558130514;
} else {
current_block =
17787701279558130514;
}
match current_block {
14984465786483313892 => {}
_ => {
if chomping == 1 {
JOIN!(
string,
trailing_breaks
);
}
memset(
token as *mut libc::c_void,
0,
size_of::<yaml_token_t>() as libc::c_ulong,
);
(*token).type_ =
YAML_SCALAR_TOKEN;
(*token).start_mark =
start_mark;
(*token).end_mark =
end_mark;
let fresh479 = addr_of_mut!(
(*token)
.data
.scalar
.value
);
*fresh479 = string.start;
(*token)
.data
.scalar
.length = string
.pointer
.c_offset_from(
string.start,
)
as libc::c_long
as size_t;
(*token)
.data
.scalar
.style = if literal {
YAML_LITERAL_SCALAR_STYLE
} else {
YAML_FOLDED_SCALAR_STYLE
};
STRING_DEL!(leading_break);
STRING_DEL!(
trailing_breaks
);
return OK;
}
}
}
}
}
} }
memset(
token as *mut libc::c_void,
0,
size_of::<yaml_token_t>() as libc::c_ulong,
);
(*token).type_ = YAML_SCALAR_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
let fresh479 =
addr_of_mut!((*token).data.scalar.value);
*fresh479 = string.start;
(*token).data.scalar.length =
string.pointer.c_offset_from(string.start)
as libc::c_long
as size_t;
(*token).data.scalar.style = if literal {
YAML_LITERAL_SCALAR_STYLE
} else {
YAML_FOLDED_SCALAR_STYLE
};
STRING_DEL!(leading_break);
STRING_DEL!(trailing_breaks);
return OK;
} }
} }
} }
@ -2537,33 +2453,30 @@ unsafe fn yaml_parser_scan_flow_scalar(
} }
} }
} }
match current_block { if current_block != 8114179180390253173 {
8114179180390253173 => {} SKIP(parser);
_ => { end_mark = (*parser).mark;
SKIP(parser); memset(
end_mark = (*parser).mark; token as *mut libc::c_void,
memset( 0,
token as *mut libc::c_void, size_of::<yaml_token_t>() as libc::c_ulong,
0, );
size_of::<yaml_token_t>() as libc::c_ulong, (*token).type_ = YAML_SCALAR_TOKEN;
); (*token).start_mark = start_mark;
(*token).type_ = YAML_SCALAR_TOKEN; (*token).end_mark = end_mark;
(*token).start_mark = start_mark; let fresh716 = addr_of_mut!((*token).data.scalar.value);
(*token).end_mark = end_mark; *fresh716 = string.start;
let fresh716 = addr_of_mut!((*token).data.scalar.value); (*token).data.scalar.length =
*fresh716 = string.start; string.pointer.c_offset_from(string.start) as libc::c_long as size_t;
(*token).data.scalar.length = (*token).data.scalar.style = if single {
string.pointer.c_offset_from(string.start) as libc::c_long as size_t; YAML_SINGLE_QUOTED_SCALAR_STYLE
(*token).data.scalar.style = if single { } else {
YAML_SINGLE_QUOTED_SCALAR_STYLE YAML_DOUBLE_QUOTED_SCALAR_STYLE
} else { };
YAML_DOUBLE_QUOTED_SCALAR_STYLE STRING_DEL!(leading_break);
}; STRING_DEL!(trailing_breaks);
STRING_DEL!(leading_break); STRING_DEL!(whitespaces);
STRING_DEL!(trailing_breaks); return OK;
STRING_DEL!(whitespaces);
return OK;
}
} }
STRING_DEL!(string); STRING_DEL!(string);
STRING_DEL!(leading_break); STRING_DEL!(leading_break);
@ -2724,30 +2637,27 @@ unsafe fn yaml_parser_scan_plain_scalar(
break; break;
} }
} }
match current_block { if current_block != 16642808987012640029 {
16642808987012640029 => {} memset(
_ => { token as *mut libc::c_void,
memset( 0,
token as *mut libc::c_void, size_of::<yaml_token_t>() as libc::c_ulong,
0, );
size_of::<yaml_token_t>() as libc::c_ulong, (*token).type_ = YAML_SCALAR_TOKEN;
); (*token).start_mark = start_mark;
(*token).type_ = YAML_SCALAR_TOKEN; (*token).end_mark = end_mark;
(*token).start_mark = start_mark; let fresh842 = addr_of_mut!((*token).data.scalar.value);
(*token).end_mark = end_mark; *fresh842 = string.start;
let fresh842 = addr_of_mut!((*token).data.scalar.value); (*token).data.scalar.length =
*fresh842 = string.start; string.pointer.c_offset_from(string.start) as libc::c_long as size_t;
(*token).data.scalar.length = (*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
string.pointer.c_offset_from(string.start) as libc::c_long as size_t; if leading_blanks != 0 {
(*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE; (*parser).simple_key_allowed = true;
if leading_blanks != 0 {
(*parser).simple_key_allowed = true;
}
STRING_DEL!(leading_break);
STRING_DEL!(trailing_breaks);
STRING_DEL!(whitespaces);
return OK;
} }
STRING_DEL!(leading_break);
STRING_DEL!(trailing_breaks);
STRING_DEL!(whitespaces);
return OK;
} }
STRING_DEL!(string); STRING_DEL!(string);
STRING_DEL!(leading_break); STRING_DEL!(leading_break);