X-Git-Url: http://andersk.mit.edu/gitweb/libyaml.git/blobdiff_plain/2a02dfd2625480af0f2b48664c46dab20ea799da..677348a9619dfec1b64c3ef17f746b6811c195ee:/tests/example-deconstructor.c diff --git a/tests/example-deconstructor.c b/tests/example-deconstructor.c index d41b5ae..fec7d59 100644 --- a/tests/example-deconstructor.c +++ b/tests/example-deconstructor.c @@ -336,67 +336,67 @@ main(int argc, char *argv[]) tag != input_event.data.document_start.tag_directives.end; tag ++) { - /* Write '{'. */ - - if (!yaml_mapping_start_event_initialize(&output_event, - NULL, "tag:yaml.org,2002:map", 1, - YAML_FLOW_MAPPING_STYLE)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - - /* Write 'handle'. */ - - if (!yaml_scalar_event_initialize(&output_event, - NULL, "tag:yaml.org,2002:str", "handle", -1, - 1, 1, YAML_PLAIN_SCALAR_STYLE)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - - /* Write the tag directive handle. */ - - if (!yaml_scalar_event_initialize(&output_event, - NULL, "tag:yaml.org,2002:str", - tag->handle, -1, - 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - - /* Write 'prefix'. */ - - if (!yaml_scalar_event_initialize(&output_event, - NULL, "tag:yaml.org,2002:str", "prefix", -1, - 1, 1, YAML_PLAIN_SCALAR_STYLE)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - - /* Write the tag directive prefix. */ - - if (!yaml_scalar_event_initialize(&output_event, - NULL, "tag:yaml.org,2002:str", - tag->prefix, -1, - 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - - /* Write '}'. */ - - if (!yaml_mapping_end_event_initialize(&output_event)) - goto event_error; - if (!yaml_emitter_emit(&emitter, &output_event)) - goto emitter_error; - } - - /* End a block sequence. */ - - if (!yaml_sequence_end_event_initialize(&output_event)) + /* Write '{'. */ + + if (!yaml_mapping_start_event_initialize(&output_event, + NULL, "tag:yaml.org,2002:map", 1, + YAML_FLOW_MAPPING_STYLE)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; + + /* Write 'handle'. */ + + if (!yaml_scalar_event_initialize(&output_event, + NULL, "tag:yaml.org,2002:str", "handle", -1, + 1, 1, YAML_PLAIN_SCALAR_STYLE)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; + + /* Write the tag directive handle. */ + + if (!yaml_scalar_event_initialize(&output_event, + NULL, "tag:yaml.org,2002:str", + tag->handle, -1, + 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; + + /* Write 'prefix'. */ + + if (!yaml_scalar_event_initialize(&output_event, + NULL, "tag:yaml.org,2002:str", "prefix", -1, + 1, 1, YAML_PLAIN_SCALAR_STYLE)) goto event_error; if (!yaml_emitter_emit(&emitter, &output_event)) goto emitter_error; + + /* Write the tag directive prefix. */ + + if (!yaml_scalar_event_initialize(&output_event, + NULL, "tag:yaml.org,2002:str", + tag->prefix, -1, + 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; + + /* Write '}'. */ + + if (!yaml_mapping_end_event_initialize(&output_event)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; + } + + /* End a block sequence. */ + + if (!yaml_sequence_end_event_initialize(&output_event)) + goto event_error; + if (!yaml_emitter_emit(&emitter, &output_event)) + goto emitter_error; } /* Write 'implicit'. */ @@ -1046,14 +1046,14 @@ parser_error: if (parser.context) { fprintf(stderr, "Scanner error: %s at line %d, column %d\n" "%s at line %d, column %d\n", parser.context, - parser.context_mark.line, parser.context_mark.column, - parser.problem, parser.problem_mark.line, - parser.problem_mark.column); + parser.context_mark.line+1, parser.context_mark.column+1, + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); } else { fprintf(stderr, "Scanner error: %s at line %d, column %d\n", - parser.problem, parser.problem_mark.line, - parser.problem_mark.column); + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); } break; @@ -1061,14 +1061,14 @@ parser_error: if (parser.context) { fprintf(stderr, "Parser error: %s at line %d, column %d\n" "%s at line %d, column %d\n", parser.context, - parser.context_mark.line, parser.context_mark.column, - parser.problem, parser.problem_mark.line, - parser.problem_mark.column); + parser.context_mark.line+1, parser.context_mark.column+1, + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); } else { fprintf(stderr, "Parser error: %s at line %d, column %d\n", - parser.problem, parser.problem_mark.line, - parser.problem_mark.column); + parser.problem, parser.problem_mark.line+1, + parser.problem_mark.column+1); } break;