Lines Matching refs:token

45  * Peek the next token in the token queue.
53 * Remove the next token from the queue (must be called after PEEK_TOKEN).
315 yaml_token_t *token;
317 token = PEEK_TOKEN(parser);
318 if (!token) return 0;
320 if (token->type != YAML_STREAM_START_TOKEN) {
322 "did not find expected <stream-start>", token->start_mark);
326 STREAM_START_EVENT_INIT(*event, token->data.stream_start.encoding,
327 token->start_mark, token->start_mark);
345 yaml_token_t *token;
352 token = PEEK_TOKEN(parser);
353 if (!token) return 0;
359 while (token->type == YAML_DOCUMENT_END_TOKEN) {
361 token = PEEK_TOKEN(parser);
362 if (!token) return 0;
368 if (implicit && token->type != YAML_VERSION_DIRECTIVE_TOKEN &&
369 token->type != YAML_TAG_DIRECTIVE_TOKEN &&
370 token->type != YAML_DOCUMENT_START_TOKEN &&
371 token->type != YAML_STREAM_END_TOKEN)
379 token->start_mark, token->start_mark);
385 else if (token->type != YAML_STREAM_END_TOKEN)
388 start_mark = token->start_mark;
392 token = PEEK_TOKEN(parser);
393 if (!token) goto error;
394 if (token->type != YAML_DOCUMENT_START_TOKEN) {
396 "did not find expected <document start>", token->start_mark);
402 end_mark = token->end_mark;
417 STREAM_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
442 yaml_token_t *token;
444 token = PEEK_TOKEN(parser);
445 if (!token) return 0;
447 if (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
448 token->type == YAML_TAG_DIRECTIVE_TOKEN ||
449 token->type == YAML_DOCUMENT_START_TOKEN ||
450 token->type == YAML_DOCUMENT_END_TOKEN ||
451 token->type == YAML_STREAM_END_TOKEN) {
454 token->start_mark);
472 yaml_token_t *token;
476 token = PEEK_TOKEN(parser);
477 if (!token) return 0;
479 start_mark = end_mark = token->start_mark;
481 if (token->type == YAML_DOCUMENT_END_TOKEN) {
482 end_mark = token->end_mark;
532 yaml_token_t *token;
540 token = PEEK_TOKEN(parser);
541 if (!token) return 0;
543 if (token->type == YAML_ALIAS_TOKEN)
546 ALIAS_EVENT_INIT(*event, token->data.alias.value,
547 token->start_mark, token->end_mark);
554 start_mark = end_mark = token->start_mark;
556 if (token->type == YAML_ANCHOR_TOKEN)
558 anchor = token->data.anchor.value;
559 start_mark = token->start_mark;
560 end_mark = token->end_mark;
562 token = PEEK_TOKEN(parser);
563 if (!token) goto error;
564 if (token->type == YAML_TAG_TOKEN)
566 tag_handle = token->data.tag.handle;
567 tag_suffix = token->data.tag.suffix;
568 tag_mark = token->start_mark;
569 end_mark = token->end_mark;
571 token = PEEK_TOKEN(parser);
572 if (!token) goto error;
575 else if (token->type == YAML_TAG_TOKEN)
577 tag_handle = token->data.tag.handle;
578 tag_suffix = token->data.tag.suffix;
579 start_mark = tag_mark = token->start_mark;
580 end_mark = token->end_mark;
582 token = PEEK_TOKEN(parser);
583 if (!token) goto error;
584 if (token->type == YAML_ANCHOR_TOKEN)
586 anchor = token->data.anchor.value;
587 end_mark = token->end_mark;
589 token = PEEK_TOKEN(parser);
590 if (!token) goto error;
632 if (indentless_sequence && token->type == YAML_BLOCK_ENTRY_TOKEN) {
633 end_mark = token->end_mark;
640 if (token->type == YAML_SCALAR_TOKEN) {
643 end_mark = token->end_mark;
644 if ((token->data.scalar.style == YAML_PLAIN_SCALAR_STYLE && !tag)
653 token->data.scalar.value, token->data.scalar.length,
655 token->data.scalar.style, start_mark, end_mark);
659 else if (token->type == YAML_FLOW_SEQUENCE_START_TOKEN) {
660 end_mark = token->end_mark;
666 else if (token->type == YAML_FLOW_MAPPING_START_TOKEN) {
667 end_mark = token->end_mark;
673 else if (block && token->type == YAML_BLOCK_SEQUENCE_START_TOKEN) {
674 end_mark = token->end_mark;
680 else if (block && token->type == YAML_BLOCK_MAPPING_START_TOKEN) {
681 end_mark = token->end_mark;
704 "did not find expected node content", token->start_mark);
729 yaml_token_t *token;
732 token = PEEK_TOKEN(parser);
733 if (!PUSH(parser, parser->marks, token->start_mark))
738 token = PEEK_TOKEN(parser);
739 if (!token) return 0;
741 if (token->type == YAML_BLOCK_ENTRY_TOKEN)
743 yaml_mark_t mark = token->end_mark;
745 token = PEEK_TOKEN(parser);
746 if (!token) return 0;
747 if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
748 token->type != YAML_BLOCK_END_TOKEN) {
760 else if (token->type == YAML_BLOCK_END_TOKEN)
765 SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
774 "did not find expected '-' indicator", token->start_mark);
788 yaml_token_t *token;
790 token = PEEK_TOKEN(parser);
791 if (!token) return 0;
793 if (token->type == YAML_BLOCK_ENTRY_TOKEN)
795 yaml_mark_t mark = token->end_mark;
797 token = PEEK_TOKEN(parser);
798 if (!token) return 0;
799 if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
800 token->type != YAML_KEY_TOKEN &&
801 token->type != YAML_VALUE_TOKEN &&
802 token->type != YAML_BLOCK_END_TOKEN) {
817 SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
838 yaml_token_t *token;
841 token = PEEK_TOKEN(parser);
842 if (!PUSH(parser, parser->marks, token->start_mark))
847 token = PEEK_TOKEN(parser);
848 if (!token) return 0;
850 if (token->type == YAML_KEY_TOKEN)
852 yaml_mark_t mark = token->end_mark;
854 token = PEEK_TOKEN(parser);
855 if (!token) return 0;
856 if (token->type != YAML_KEY_TOKEN &&
857 token->type != YAML_VALUE_TOKEN &&
858 token->type != YAML_BLOCK_END_TOKEN) {
870 else if (token->type == YAML_BLOCK_END_TOKEN)
875 MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
884 "did not find expected key", token->start_mark);
904 yaml_token_t *token;
906 token = PEEK_TOKEN(parser);
907 if (!token) return 0;
909 if (token->type == YAML_VALUE_TOKEN)
911 yaml_mark_t mark = token->end_mark;
913 token = PEEK_TOKEN(parser);
914 if (!token) return 0;
915 if (token->type != YAML_KEY_TOKEN &&
916 token->type != YAML_VALUE_TOKEN &&
917 token->type != YAML_BLOCK_END_TOKEN) {
932 return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
954 yaml_token_t *token;
958 token = PEEK_TOKEN(parser);
959 if (!PUSH(parser, parser->marks, token->start_mark))
964 token = PEEK_TOKEN(parser);
965 if (!token) return 0;
967 if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
970 if (token->type == YAML_FLOW_ENTRY_TOKEN) {
972 token = PEEK_TOKEN(parser);
973 if (!token) return 0;
978 "did not find expected ',' or ']'", token->start_mark);
982 if (token->type == YAML_KEY_TOKEN) {
986 token->start_mark, token->end_mark);
991 else if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
1001 SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
1016 yaml_token_t *token;
1018 token = PEEK_TOKEN(parser);
1019 if (!token) return 0;
1021 if (token->type != YAML_VALUE_TOKEN && token->type != YAML_FLOW_ENTRY_TOKEN
1022 && token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
1029 yaml_mark_t mark = token->end_mark;
1046 yaml_token_t *token;
1048 token = PEEK_TOKEN(parser);
1049 if (!token) return 0;
1051 if (token->type == YAML_VALUE_TOKEN) {
1053 token = PEEK_TOKEN(parser);
1054 if (!token) return 0;
1055 if (token->type != YAML_FLOW_ENTRY_TOKEN
1056 && token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
1064 return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
1077 yaml_token_t *token;
1079 token = PEEK_TOKEN(parser);
1080 if (!token) return 0;
1084 MAPPING_END_EVENT_INIT(*event, token->start_mark, token->start_mark);
1106 yaml_token_t *token;
1110 token = PEEK_TOKEN(parser);
1111 if (!PUSH(parser, parser->marks, token->start_mark))
1116 token = PEEK_TOKEN(parser);
1117 if (!token) return 0;
1119 if (token->type != YAML_FLOW_MAPPING_END_TOKEN)
1122 if (token->type == YAML_FLOW_ENTRY_TOKEN) {
1124 token = PEEK_TOKEN(parser);
1125 if (!token) return 0;
1130 "did not find expected ',' or '}'", token->start_mark);
1134 if (token->type == YAML_KEY_TOKEN) {
1136 token = PEEK_TOKEN(parser);
1137 if (!token) return 0;
1138 if (token->type != YAML_VALUE_TOKEN
1139 && token->type != YAML_FLOW_ENTRY_TOKEN
1140 && token->type != YAML_FLOW_MAPPING_END_TOKEN) {
1149 token->start_mark);
1152 else if (token->type != YAML_FLOW_MAPPING_END_TOKEN) {
1162 MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
1177 yaml_token_t *token;
1179 token = PEEK_TOKEN(parser);
1180 if (!token) return 0;
1185 token->start_mark);
1188 if (token->type == YAML_VALUE_TOKEN) {
1190 token = PEEK_TOKEN(parser);
1191 if (!token) return 0;
1192 if (token->type != YAML_FLOW_ENTRY_TOKEN
1193 && token->type != YAML_FLOW_MAPPING_END_TOKEN) {
1202 return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
1250 yaml_token_t *token;
1255 token = PEEK_TOKEN(parser);
1256 if (!token) goto error;
1258 while (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
1259 token->type == YAML_TAG_DIRECTIVE_TOKEN)
1261 if (token->type == YAML_VERSION_DIRECTIVE_TOKEN) {
1264 "found duplicate %YAML directive", token->start_mark);
1267 if (token->data.version_directive.major != 1
1268 || token->data.version_directive.minor != 1) {
1270 "found incompatible YAML document", token->start_mark);
1278 version_directive->major = token->data.version_directive.major;
1279 version_directive->minor = token->data.version_directive.minor;
1282 else if (token->type == YAML_TAG_DIRECTIVE_TOKEN) {
1284 value.handle = token->data.tag_directive.handle;
1285 value.prefix = token->data.tag_directive.prefix;
1288 token->start_mark))
1295 token = PEEK_TOKEN(parser);
1296 if (!token) goto error;
1302 token->start_mark))