Ticket #152: patch
| File patch, 2.6 KB (added by spitzak@…, 2 years ago) |
|---|
-
src/scanner.c
2335 2335 2336 2336 if (!CACHE(parser, 1)) goto error; 2337 2337 2338 while (IS_ALPHA(parser->buffer)) { 2338 while (!IS_BLANKZ(parser->buffer) && !CHECK(parser->buffer, ',') 2339 && !CHECK(parser->buffer, '[') && !CHECK(parser->buffer, ']') 2340 && !CHECK(parser->buffer, '{') && !CHECK(parser->buffer, '}')) { 2339 2341 if (!READ(parser, string)) goto error; 2340 2342 if (!CACHE(parser, 1)) goto error; 2341 2343 length ++; … … 2343 2345 2344 2346 end_mark = parser->mark; 2345 2347 2346 /* 2347 * Check if length of the anchor is greater than 0 and it is followed by 2348 * a whitespace character or one of the indicators: 2349 * 2350 * '?', ':', ',', ']', '}', '%', '@', '`'. 2351 */ 2352 2353 if (!length || !(IS_BLANKZ(parser->buffer) || CHECK(parser->buffer, '?') 2354 || CHECK(parser->buffer, ':') || CHECK(parser->buffer, ',') 2355 || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '}') 2356 || CHECK(parser->buffer, '%') || CHECK(parser->buffer, '@') 2357 || CHECK(parser->buffer, '`'))) { 2348 if (!length) { 2358 2349 yaml_parser_set_scanner_error(parser, type == YAML_ANCHOR_TOKEN ? 2359 2350 "while scanning an anchor" : "while scanning an alias", start_mark, 2360 2351 "did not find expected alphabetic or numeric character"); -
src/emitter.c
1154 1154 break; 1155 1155 1156 1156 case YAML_MAPPING_START_EVENT: 1157 if (!yaml_emitter_check_empty_ sequence(emitter))1157 if (!yaml_emitter_check_empty_mapping(emitter)) 1158 1158 return 0; 1159 1159 length += emitter->anchor_data.anchor_length 1160 1160 + emitter->tag_data.handle_length … … 1413 1413 } 1414 1414 1415 1415 while (string.pointer != string.end) { 1416 if (!IS_ALPHA(string)) { 1416 if (IS_BLANKZ(string) || CHECK(string, ',') 1417 || CHECK(string, '[') || CHECK(string, ']') 1418 || CHECK(string, '{') || CHECK(string, '}')) { 1417 1419 return yaml_emitter_set_emitter_error(emitter, alias ? 1418 " alias value must contain alphanumerical characters only" :1419 " anchor value must contain alphanumerical characters only");1420 "character not allowed in alias value" : 1421 "character not allowed in anchor value"); 1420 1422 } 1421 1423 MOVE(string); 1422 1424 }
