diff --git a/src/api.rs b/src/api.rs index cdc4f38..fcc0dd5 100644 --- a/src/api.rs +++ b/src/api.rs @@ -679,26 +679,23 @@ pub unsafe fn yaml_document_start_event_initialize( } else { current_block = 16203760046146113240; } - match current_block { - 14964981520188694172 => {} - _ => { - memset( - event as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*event).type_ = YAML_DOCUMENT_START_EVENT; - (*event).start_mark = mark; - (*event).end_mark = mark; - let fresh164 = addr_of_mut!((*event).data.document_start.version_directive); - *fresh164 = version_directive_copy; - let fresh165 = addr_of_mut!((*event).data.document_start.tag_directives.start); - *fresh165 = tag_directives_copy.start; - let fresh166 = addr_of_mut!((*event).data.document_start.tag_directives.end); - *fresh166 = tag_directives_copy.top; - (*event).data.document_start.implicit = implicit; - return OK; - } + if current_block != 14964981520188694172 { + memset( + event as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*event).type_ = YAML_DOCUMENT_START_EVENT; + (*event).start_mark = mark; + (*event).end_mark = mark; + let fresh164 = addr_of_mut!((*event).data.document_start.version_directive); + *fresh164 = version_directive_copy; + let fresh165 = addr_of_mut!((*event).data.document_start.tag_directives.start); + *fresh165 = tag_directives_copy.start; + let fresh166 = addr_of_mut!((*event).data.document_start.tag_directives.end); + *fresh166 = tag_directives_copy.top; + (*event).data.document_start.implicit = implicit; + return OK; } yaml_free(version_directive_copy as *mut libc::c_void); while !STACK_EMPTY!(tag_directives_copy) { @@ -812,60 +809,54 @@ pub unsafe fn yaml_scalar_event_initialize( } else { current_block = 8515828400728868193; } - match current_block { - 8515828400728868193 => { - if !tag.is_null() { - if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail { + if current_block == 8515828400728868193 { + if !tag.is_null() { + 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; } else { - tag_copy = yaml_strdup(tag); - if tag_copy.is_null() { - current_block = 16285396129609901221; - } else { - current_block = 12800627514080957624; - } + current_block = 12800627514080957624; } - } else { - current_block = 12800627514080957624; } - match current_block { - 16285396129609901221 => {} - _ => { - 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; - memcpy( - value_copy as *mut libc::c_void, - value as *const libc::c_void, - length as libc::c_ulong, - ); - *value_copy.wrapping_offset(length as isize) = b'\0'; - memset( - event as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*event).type_ = YAML_SCALAR_EVENT; - (*event).start_mark = mark; - (*event).end_mark = mark; - let fresh168 = addr_of_mut!((*event).data.scalar.anchor); - *fresh168 = anchor_copy; - let fresh169 = addr_of_mut!((*event).data.scalar.tag); - *fresh169 = tag_copy; - let fresh170 = addr_of_mut!((*event).data.scalar.value); - *fresh170 = value_copy; - (*event).data.scalar.length = length as size_t; - (*event).data.scalar.plain_implicit = plain_implicit; - (*event).data.scalar.quoted_implicit = quoted_implicit; - (*event).data.scalar.style = style; - return OK; - } - } + } else { + current_block = 12800627514080957624; + } + if current_block != 16285396129609901221 { + 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; + memcpy( + value_copy as *mut libc::c_void, + value as *const libc::c_void, + length as libc::c_ulong, + ); + *value_copy.wrapping_offset(length as isize) = b'\0'; + memset( + event as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*event).type_ = YAML_SCALAR_EVENT; + (*event).start_mark = mark; + (*event).end_mark = mark; + let fresh168 = addr_of_mut!((*event).data.scalar.anchor); + *fresh168 = anchor_copy; + let fresh169 = addr_of_mut!((*event).data.scalar.tag); + *fresh169 = tag_copy; + let fresh170 = addr_of_mut!((*event).data.scalar.value); + *fresh170 = value_copy; + (*event).data.scalar.length = length as size_t; + (*event).data.scalar.plain_implicit = plain_implicit; + (*event).data.scalar.quoted_implicit = quoted_implicit; + (*event).data.scalar.style = style; + return OK; } } - _ => {} } yaml_free(anchor_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 { current_block = 7651349459974463963; } - match current_block { - 8817775685815971442 => {} - _ => { - memset( - event as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*event).type_ = YAML_SEQUENCE_START_EVENT; - (*event).start_mark = mark; - (*event).end_mark = mark; - let fresh171 = addr_of_mut!((*event).data.sequence_start.anchor); - *fresh171 = anchor_copy; - let fresh172 = addr_of_mut!((*event).data.sequence_start.tag); - *fresh172 = tag_copy; - (*event).data.sequence_start.implicit = implicit; - (*event).data.sequence_start.style = style; - return OK; - } + if current_block != 8817775685815971442 { + memset( + event as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*event).type_ = YAML_SEQUENCE_START_EVENT; + (*event).start_mark = mark; + (*event).end_mark = mark; + let fresh171 = addr_of_mut!((*event).data.sequence_start.anchor); + *fresh171 = anchor_copy; + let fresh172 = addr_of_mut!((*event).data.sequence_start.tag); + *fresh172 = tag_copy; + (*event).data.sequence_start.implicit = implicit; + (*event).data.sequence_start.style = style; + return OK; } } _ => {} @@ -1006,44 +994,38 @@ pub unsafe fn yaml_mapping_start_event_initialize( } else { current_block = 11006700562992250127; } - match current_block { - 11006700562992250127 => { - if !tag.is_null() { - if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).fail { + if current_block == 11006700562992250127 { + if !tag.is_null() { + 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; } else { - tag_copy = yaml_strdup(tag); - 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::() 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; + current_block = 7651349459974463963; } } + } else { + current_block = 7651349459974463963; + } + if current_block != 14748279734549812740 { + memset( + event as *mut libc::c_void, + 0, + size_of::() 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(tag_copy as *mut libc::c_void); @@ -1205,32 +1187,29 @@ pub unsafe fn yaml_document_initialize( } else { current_block = 14818589718467733107; } - match current_block { - 8142820162064489797 => {} - _ => { - memset( - document as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - let fresh176 = addr_of_mut!((*document).nodes.start); - *fresh176 = nodes.start; - let fresh177 = addr_of_mut!((*document).nodes.end); - *fresh177 = nodes.end; - let fresh178 = addr_of_mut!((*document).nodes.top); - *fresh178 = nodes.start; - let fresh179 = addr_of_mut!((*document).version_directive); - *fresh179 = version_directive_copy; - let fresh180 = addr_of_mut!((*document).tag_directives.start); - *fresh180 = tag_directives_copy.start; - let fresh181 = addr_of_mut!((*document).tag_directives.end); - *fresh181 = tag_directives_copy.top; - (*document).start_implicit = start_implicit; - (*document).end_implicit = end_implicit; - (*document).start_mark = mark; - (*document).end_mark = mark; - return OK; - } + if current_block != 8142820162064489797 { + memset( + document as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + let fresh176 = addr_of_mut!((*document).nodes.start); + *fresh176 = nodes.start; + let fresh177 = addr_of_mut!((*document).nodes.end); + *fresh177 = nodes.end; + let fresh178 = addr_of_mut!((*document).nodes.top); + *fresh178 = nodes.start; + let fresh179 = addr_of_mut!((*document).version_directive); + *fresh179 = version_directive_copy; + let fresh180 = addr_of_mut!((*document).tag_directives.start); + *fresh180 = tag_directives_copy.start; + let fresh181 = addr_of_mut!((*document).tag_directives.end); + *fresh181 = tag_directives_copy.top; + (*document).start_implicit = start_implicit; + (*document).end_implicit = end_implicit; + (*document).start_mark = mark; + (*document).end_mark = mark; + return OK; } STACK_DEL!(nodes); yaml_free(version_directive_copy as *mut libc::c_void); diff --git a/src/loader.rs b/src/loader.rs index 39a12a3..e3659a4 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -59,25 +59,22 @@ pub unsafe fn yaml_parser_load( } else { current_block = 7815301370352969686; } - match current_block { - 6234624449317607669 => {} - _ => { - if (*parser).stream_end_produced { + if current_block != 6234624449317607669 { + if (*parser).stream_end_produced { + return OK; + } + if yaml_parser_parse(parser, event).ok { + if (*event).type_ == YAML_STREAM_END_EVENT { return OK; } - if yaml_parser_parse(parser, event).ok { - if (*event).type_ == YAML_STREAM_END_EVENT { - return OK; - } - STACK_INIT!((*parser).aliases, yaml_alias_data_t); - let fresh6 = addr_of_mut!((*parser).document); - *fresh6 = document; - if yaml_parser_load_document(parser, event).ok { - yaml_parser_delete_aliases(parser); - let fresh7 = addr_of_mut!((*parser).document); - *fresh7 = ptr::null_mut::(); - return OK; - } + STACK_INIT!((*parser).aliases, yaml_alias_data_t); + let fresh6 = addr_of_mut!((*parser).document); + *fresh6 = document; + if yaml_parser_load_document(parser, event).ok { + yaml_parser_delete_aliases(parser); + let fresh7 = addr_of_mut!((*parser).document); + *fresh7 = ptr::null_mut::(); + return OK; } } } @@ -353,32 +350,29 @@ unsafe fn yaml_parser_load_scalar( } else { current_block = 11006700562992250127; } - match current_block { - 10579931339944277179 => {} - _ => { - memset( - node as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*node).type_ = YAML_SCALAR_NODE; - (*node).tag = tag; - (*node).start_mark = (*event).start_mark; - (*node).end_mark = (*event).end_mark; - (*node).data.scalar.value = (*event).data.scalar.value; - (*node).data.scalar.length = (*event).data.scalar.length; - (*node).data.scalar.style = (*event).data.scalar.style; - PUSH!((*(*parser).document).nodes, *node); - index = (*(*parser).document) - .nodes - .top - .c_offset_from((*(*parser).document).nodes.start) - as libc::c_int; - if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor).fail { - return FAIL; - } - return yaml_parser_load_node_add(parser, ctx, index); + if current_block != 10579931339944277179 { + memset( + node as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*node).type_ = YAML_SCALAR_NODE; + (*node).tag = tag; + (*node).start_mark = (*event).start_mark; + (*node).end_mark = (*event).end_mark; + (*node).data.scalar.value = (*event).data.scalar.value; + (*node).data.scalar.length = (*event).data.scalar.length; + (*node).data.scalar.style = (*event).data.scalar.style; + PUSH!((*(*parser).document).nodes, *node); + index = (*(*parser).document) + .nodes + .top + .c_offset_from((*(*parser).document).nodes.start) + as libc::c_int; + if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor).fail { + return FAIL; } + return yaml_parser_load_node_add(parser, ctx, index); } } yaml_free(tag as *mut libc::c_void); @@ -426,43 +420,39 @@ unsafe fn yaml_parser_load_sequence( } else { current_block = 6937071982253665452; } - match current_block { - 13474536459355229096 => {} - _ => { - STACK_INIT!(items, yaml_node_item_t); - memset( - node as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*node).type_ = YAML_SEQUENCE_NODE; - (*node).tag = tag; - (*node).start_mark = (*event).start_mark; - (*node).end_mark = (*event).end_mark; - (*node).data.sequence.items.start = items.start; - (*node).data.sequence.items.end = items.end; - (*node).data.sequence.items.top = items.start; - (*node).data.sequence.style = (*event).data.sequence_start.style; - PUSH!((*(*parser).document).nodes, *node); - index = (*(*parser).document) - .nodes - .top - .c_offset_from((*(*parser).document).nodes.start) - as libc::c_int; - if yaml_parser_register_anchor(parser, index, (*event).data.sequence_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 current_block != 13474536459355229096 { + STACK_INIT!(items, yaml_node_item_t); + memset( + node as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*node).type_ = YAML_SEQUENCE_NODE; + (*node).tag = tag; + (*node).start_mark = (*event).start_mark; + (*node).end_mark = (*event).end_mark; + (*node).data.sequence.items.start = items.start; + (*node).data.sequence.items.end = items.end; + (*node).data.sequence.items.top = items.start; + (*node).data.sequence.style = (*event).data.sequence_start.style; + PUSH!((*(*parser).document).nodes, *node); + index = (*(*parser).document) + .nodes + .top + .c_offset_from((*(*parser).document).nodes.start) + as libc::c_int; + if yaml_parser_register_anchor(parser, index, (*event).data.sequence_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; } } yaml_free(tag as *mut libc::c_void); @@ -529,43 +519,38 @@ unsafe fn yaml_parser_load_mapping( } else { current_block = 6937071982253665452; } - match current_block { - 13635467803606088781 => {} - _ => { - STACK_INIT!(pairs, yaml_node_pair_t); - memset( - node as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*node).type_ = YAML_MAPPING_NODE; - (*node).tag = tag; - (*node).start_mark = (*event).start_mark; - (*node).end_mark = (*event).end_mark; - (*node).data.mapping.pairs.start = pairs.start; - (*node).data.mapping.pairs.end = pairs.end; - (*node).data.mapping.pairs.top = pairs.start; - (*node).data.mapping.style = (*event).data.mapping_start.style; - PUSH!((*(*parser).document).nodes, *node); - index = (*(*parser).document) - .nodes - .top - .c_offset_from((*(*parser).document).nodes.start) - as libc::c_int; - 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 current_block != 13635467803606088781 { + STACK_INIT!(pairs, yaml_node_pair_t); + memset( + node as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*node).type_ = YAML_MAPPING_NODE; + (*node).tag = tag; + (*node).start_mark = (*event).start_mark; + (*node).end_mark = (*event).end_mark; + (*node).data.mapping.pairs.start = pairs.start; + (*node).data.mapping.pairs.end = pairs.end; + (*node).data.mapping.pairs.top = pairs.start; + (*node).data.mapping.style = (*event).data.mapping_start.style; + PUSH!((*(*parser).document).nodes, *node); + index = (*(*parser).document) + .nodes + .top + .c_offset_from((*(*parser).document).nodes.start) + as libc::c_int; + 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; } } yaml_free(tag as *mut libc::c_void); diff --git a/src/parser.rs b/src/parser.rs index 9a634f5..0f9f80d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -481,254 +481,238 @@ unsafe fn yaml_parser_parse_node( } else { current_block = 11743904203796629665; } - match current_block { - 11743904203796629665 => { - if !tag_handle.is_null() { - if *tag_handle == 0 { - tag = tag_suffix; - yaml_free(tag_handle as *mut libc::c_void); - tag_suffix = ptr::null_mut::(); - tag_handle = tag_suffix; - current_block = 9437013279121998969; - } else { - let mut tag_directive: *mut yaml_tag_directive_t; - tag_directive = (*parser).tag_directives.start; - loop { - if !(tag_directive != (*parser).tag_directives.top) { - current_block = 17728966195399430138; - 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::(); - tag_handle = tag_suffix; - current_block = 17728966195399430138; - break; - } else { - tag_directive = tag_directive.wrapping_offset(1); - } + if current_block == 11743904203796629665 { + if !tag_handle.is_null() { + if *tag_handle == 0 { + tag = tag_suffix; + yaml_free(tag_handle as *mut libc::c_void); + tag_suffix = ptr::null_mut::(); + tag_handle = tag_suffix; + current_block = 9437013279121998969; + } else { + let mut tag_directive: *mut yaml_tag_directive_t; + tag_directive = (*parser).tag_directives.start; + loop { + if !(tag_directive != (*parser).tag_directives.top) { + current_block = 17728966195399430138; + break; } - match current_block { - 17786380918591080555 => {} - _ => { - if tag.is_null() { - yaml_parser_set_parser_error_context( - parser, - b"while parsing a node\0" as *const u8 - as *const libc::c_char, - start_mark, - b"found undefined tag handle\0" as *const u8 - as *const libc::c_char, - tag_mark, - ); - current_block = 17786380918591080555; - } else { - current_block = 9437013279121998969; - } - } + 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::(); + tag_handle = tag_suffix; + current_block = 17728966195399430138; + break; + } else { + tag_directive = tag_directive.wrapping_offset(1); } } - } else { - current_block = 9437013279121998969; - } - 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::() 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::() 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::() 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::() 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::() 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::() 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::() 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 { + if current_block != 17786380918591080555 { + if tag.is_null() { 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 - }, + b"while parsing a 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, + b"found undefined tag handle\0" as *const u8 as *const libc::c_char, + tag_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::() 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::() 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::() 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::() 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::() 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::() 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::() 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(tag_handle as *mut libc::c_void); @@ -1283,52 +1267,46 @@ unsafe fn yaml_parser_process_directives( break; } } - match current_block { - 17143798186130252483 => {} - _ => { - default_tag_directive = default_tag_directives.as_mut_ptr(); - loop { - if (*default_tag_directive).handle.is_null() { - 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); + if current_block != 17143798186130252483 { + default_tag_directive = default_tag_directives.as_mut_ptr(); + loop { + if (*default_tag_directive).handle.is_null() { + current_block = 18377268871191777778; + break; } - match 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::(); - *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; - } + 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); + } + 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::(); + *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; } } } diff --git a/src/scanner.rs b/src/scanner.rs index d059367..1378515 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -1018,72 +1018,58 @@ unsafe fn yaml_parser_scan_directive( ); current_block = 11397968426844348457; } - match current_block { - 11397968426844348457 => {} - _ => { - if CACHE(parser, 1_u64).ok { - loop { - if !IS_BLANK!((*parser).buffer) { - current_block = 11584701595673473500; - break; - } - SKIP(parser); - if CACHE(parser, 1_u64).fail { - current_block = 11397968426844348457; - break; - } + if current_block != 11397968426844348457 { + if CACHE(parser, 1_u64).ok { + loop { + if !IS_BLANK!((*parser).buffer) { + current_block = 11584701595673473500; + break; } - match current_block { - 11397968426844348457 => {} - _ => { - if CHECK!((*parser).buffer, b'#') { - loop { - if IS_BREAKZ!((*parser).buffer) { - current_block = 6669252993407410313; - break; - } - SKIP(parser); - if CACHE(parser, 1_u64).fail { - current_block = 11397968426844348457; - break; - } + SKIP(parser); + if CACHE(parser, 1_u64).fail { + current_block = 11397968426844348457; + break; + } + } + if current_block != 11397968426844348457 { + if CHECK!((*parser).buffer, b'#') { + loop { + if IS_BREAKZ!((*parser).buffer) { + current_block = 6669252993407410313; + 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 { - current_block = 6669252993407410313; + current_block = 652864300344834934; } - match 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 { - current_block = 652864300344834934; - } - match current_block { - 11397968426844348457 => {} - _ => { - yaml_free(name as *mut libc::c_void); - return OK; - } - } - } - } + if 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; } } - match current_block { - 8318012024179131575 => {} - _ => { - if string.start == string.pointer { - yaml_parser_set_scanner_error( - parser, - b"while scanning a directive\0" as *const u8 as *const libc::c_char, - start_mark, - b"could not find expected directive name\0" as *const u8 - as *const libc::c_char, - ); - } else if !IS_BLANKZ!((*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"found unexpected non-alphabetical character\0" as *const u8 - as *const libc::c_char, - ); - } else { - *name = string.start; - return OK; - } + if current_block != 8318012024179131575 { + if string.start == string.pointer { + yaml_parser_set_scanner_error( + parser, + b"while scanning a directive\0" as *const u8 as *const libc::c_char, + start_mark, + b"could not find expected directive name\0" as *const u8 as *const libc::c_char, + ); + } else if !IS_BLANKZ!((*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"found unexpected non-alphabetical character\0" as *const u8 + as *const libc::c_char, + ); + } else { + *name = string.start; + return OK; } } } @@ -1347,58 +1329,55 @@ unsafe fn yaml_parser_scan_anchor( } length += 1; } - match current_block { - 5883759901342942623 => {} - _ => { - end_mark = (*parser).mark; - if length == 0 - || !(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'`')) - { - 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 current_block != 5883759901342942623 { + end_mark = (*parser).mark; + if length == 0 + || !(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'`')) + { + yaml_parser_set_scanner_error( + parser, if type_ == YAML_ANCHOR_TOKEN { - memset( - token as *mut libc::c_void, - 0, - size_of::() 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; + b"while scanning an anchor\0" as *const u8 as *const libc::c_char } else { - memset( - token as *mut libc::c_void, - 0, - size_of::() 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; + 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 { + memset( + token as *mut libc::c_void, + 0, + size_of::() 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::() 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; } - match current_block { - 17708497480799081542 => {} - _ => { - if CACHE(parser, 1_u64).ok { - if !IS_BLANKZ!((*parser).buffer) { - if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') { - yaml_parser_set_scanner_error( - parser, - b"while scanning a tag\0" as *const u8 as *const libc::c_char, - start_mark, - b"did not find expected whitespace or line break\0" as *const u8 - as *const libc::c_char, - ); - current_block = 17708497480799081542; - } else { - current_block = 7333393191927787629; - } + if current_block != 17708497480799081542 { + if CACHE(parser, 1_u64).ok { + if !IS_BLANKZ!((*parser).buffer) { + if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') { + yaml_parser_set_scanner_error( + parser, + b"while scanning a tag\0" as *const u8 as *const libc::c_char, + start_mark, + b"did not find expected whitespace or line break\0" as *const u8 + as *const libc::c_char, + ); + current_block = 17708497480799081542; } else { current_block = 7333393191927787629; } - match current_block { - 17708497480799081542 => {} - _ => { - end_mark = (*parser).mark; - memset( - token as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*token).type_ = YAML_TAG_TOKEN; - (*token).start_mark = start_mark; - (*token).end_mark = end_mark; - let fresh234 = addr_of_mut!((*token).data.tag.handle); - *fresh234 = handle; - let fresh235 = addr_of_mut!((*token).data.tag.suffix); - *fresh235 = suffix; - return OK; - } - } + } else { + current_block = 7333393191927787629; + } + if current_block != 17708497480799081542 { + end_mark = (*parser).mark; + memset( + token as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*token).type_ = YAML_TAG_TOKEN; + (*token).start_mark = start_mark; + (*token).end_mark = end_mark; + let fresh234 = addr_of_mut!((*token).data.tag.handle); + *fresh234 = handle; + let fresh235 = addr_of_mut!((*token).data.tag.suffix); + *fresh235 = suffix; + return OK; } } } @@ -1573,34 +1546,27 @@ unsafe fn yaml_parser_scan_tag_handle( break; } } - match current_block { - 1771849829115608806 => {} - _ => { - if CHECK!((*parser).buffer, b'!') { - READ!(parser, string); - current_block = 5689001924483802034; - } else if directive - && !(*string.start == b'!' - && *string.start.wrapping_offset(1_isize) == b'\0') - { - yaml_parser_set_scanner_error( - parser, - b"while parsing a tag directive\0" as *const u8 - as *const libc::c_char, - start_mark, - b"did not find expected '!'\0" as *const u8 as *const libc::c_char, - ); - current_block = 1771849829115608806; - } else { - current_block = 5689001924483802034; - } - match current_block { - 1771849829115608806 => {} - _ => { - *handle = string.start; - return OK; - } - } + if current_block != 1771849829115608806 { + if CHECK!((*parser).buffer, b'!') { + READ!(parser, string); + current_block = 5689001924483802034; + } else if directive + && !(*string.start == b'!' + && *string.start.wrapping_offset(1_isize) == b'\0') + { + yaml_parser_set_scanner_error( + parser, + b"while parsing a tag directive\0" as *const u8 as *const libc::c_char, + start_mark, + b"did not find expected '!'\0" as *const u8 as *const libc::c_char, + ); + current_block = 1771849829115608806; + } else { + current_block = 5689001924483802034; + } + if current_block != 1771849829115608806 { + *handle = string.start; + return OK; } } } @@ -1886,214 +1852,164 @@ unsafe fn yaml_parser_scan_block_scalar( } else { current_block = 11913429853522160501; } - match current_block { - 14984465786483313892 => {} - _ => { - if CACHE(parser, 1_u64).ok { - loop { - if !IS_BLANK!((*parser).buffer) { - current_block = 4090602189656566074; - break; - } - SKIP(parser); - if CACHE(parser, 1_u64).fail { - current_block = 14984465786483313892; - break; - } + if current_block != 14984465786483313892 { + if CACHE(parser, 1_u64).ok { + loop { + if !IS_BLANK!((*parser).buffer) { + current_block = 4090602189656566074; + break; } - match current_block { - 14984465786483313892 => {} - _ => { - if CHECK!((*parser).buffer, b'#') { - loop { - if IS_BREAKZ!((*parser).buffer) { - current_block = 12997042908615822766; - break; - } - SKIP(parser); - if CACHE(parser, 1_u64).fail { - current_block = 14984465786483313892; - break; - } + SKIP(parser); + if CACHE(parser, 1_u64).fail { + current_block = 14984465786483313892; + break; + } + } + if current_block != 14984465786483313892 { + if CHECK!((*parser).buffer, b'#') { + loop { + if IS_BREAKZ!((*parser).buffer) { + current_block = 12997042908615822766; + 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 { - current_block = 12997042908615822766; + current_block = 13619784596304402172; } - match 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, - ); + if current_block != 14984465786483313892 { + end_mark = (*parser).mark; + if increment != 0 { + indent = if (*parser).indent >= 0 { + (*parser).indent + increment } 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 { current_block = 14984465786483313892; - } else { - SKIP_LINE(parser); - current_block = 13619784596304402172; + 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; } - } else { - current_block = 13619784596304402172; } - match current_block { - 14984465786483313892 => {} - _ => { - end_mark = (*parser).mark; - if increment != 0 { - indent = if (*parser).indent >= 0 { - (*parser).indent + increment - } else { - 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 { - 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::() 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; - } - } - } - } - } + if current_block != 14984465786483313892 { + if chomping != -1 { + JOIN!(string, leading_break); + current_block = 17787701279558130514; + } else { + current_block = 17787701279558130514; + } + if current_block != 14984465786483313892 { + if chomping == 1 { + JOIN!(string, trailing_breaks); } + memset( + token as *mut libc::c_void, + 0, + size_of::() 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 { - 8114179180390253173 => {} - _ => { - SKIP(parser); - end_mark = (*parser).mark; - memset( - token as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*token).type_ = YAML_SCALAR_TOKEN; - (*token).start_mark = start_mark; - (*token).end_mark = end_mark; - let fresh716 = addr_of_mut!((*token).data.scalar.value); - *fresh716 = 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 single { - YAML_SINGLE_QUOTED_SCALAR_STYLE - } else { - YAML_DOUBLE_QUOTED_SCALAR_STYLE - }; - STRING_DEL!(leading_break); - STRING_DEL!(trailing_breaks); - STRING_DEL!(whitespaces); - return OK; - } + if current_block != 8114179180390253173 { + SKIP(parser); + end_mark = (*parser).mark; + memset( + token as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*token).type_ = YAML_SCALAR_TOKEN; + (*token).start_mark = start_mark; + (*token).end_mark = end_mark; + let fresh716 = addr_of_mut!((*token).data.scalar.value); + *fresh716 = 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 single { + YAML_SINGLE_QUOTED_SCALAR_STYLE + } else { + YAML_DOUBLE_QUOTED_SCALAR_STYLE + }; + STRING_DEL!(leading_break); + STRING_DEL!(trailing_breaks); + STRING_DEL!(whitespaces); + return OK; } STRING_DEL!(string); STRING_DEL!(leading_break); @@ -2724,30 +2637,27 @@ unsafe fn yaml_parser_scan_plain_scalar( break; } } - match current_block { - 16642808987012640029 => {} - _ => { - memset( - token as *mut libc::c_void, - 0, - size_of::() as libc::c_ulong, - ); - (*token).type_ = YAML_SCALAR_TOKEN; - (*token).start_mark = start_mark; - (*token).end_mark = end_mark; - let fresh842 = addr_of_mut!((*token).data.scalar.value); - *fresh842 = string.start; - (*token).data.scalar.length = - string.pointer.c_offset_from(string.start) as libc::c_long as size_t; - (*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE; - if leading_blanks != 0 { - (*parser).simple_key_allowed = true; - } - STRING_DEL!(leading_break); - STRING_DEL!(trailing_breaks); - STRING_DEL!(whitespaces); - return OK; + if current_block != 16642808987012640029 { + memset( + token as *mut libc::c_void, + 0, + size_of::() as libc::c_ulong, + ); + (*token).type_ = YAML_SCALAR_TOKEN; + (*token).start_mark = start_mark; + (*token).end_mark = end_mark; + let fresh842 = addr_of_mut!((*token).data.scalar.value); + *fresh842 = string.start; + (*token).data.scalar.length = + string.pointer.c_offset_from(string.start) as libc::c_long as size_t; + (*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE; + if leading_blanks != 0 { + (*parser).simple_key_allowed = true; } + STRING_DEL!(leading_break); + STRING_DEL!(trailing_breaks); + STRING_DEL!(whitespaces); + return OK; } STRING_DEL!(string); STRING_DEL!(leading_break);