MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / yaml_parser_fetch_next_token

Function yaml_parser_fetch_next_token

external/libyaml/src/scanner.c:866–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864 */
865
866static int
867yaml_parser_fetch_next_token(yaml_parser_t *parser)
868{
869 /* Ensure that the buffer is initialized. */
870
871 if (!CACHE(parser, 1))
872 return 0;
873
874 /* Check if we just started scanning. Fetch STREAM-START then. */
875
876 if (!parser->stream_start_produced)
877 return yaml_parser_fetch_stream_start(parser);
878
879 /* Eat whitespaces and comments until we reach the next token. */
880
881 if (!yaml_parser_scan_to_next_token(parser))
882 return 0;
883
884 /* Remove obsolete potential simple keys. */
885
886 if (!yaml_parser_stale_simple_keys(parser))
887 return 0;
888
889 /* Check the indentation level against the current column. */
890
891 if (!yaml_parser_unroll_indent(parser, parser->mark.column))
892 return 0;
893
894 /*
895 * Ensure that the buffer contains at least 4 characters. 4 is the length
896 * of the longest indicators ('--- ' and '... ').
897 */
898
899 if (!CACHE(parser, 4))
900 return 0;
901
902 /* Is it the end of the stream? */
903
904 if (IS_Z(parser->buffer))
905 return yaml_parser_fetch_stream_end(parser);
906
907 /* Is it a directive? */
908
909 if (parser->mark.column == 0 && CHECK(parser->buffer, '%'))
910 return yaml_parser_fetch_directive(parser);
911
912 /* Is it the document start indicator? */
913
914 if (parser->mark.column == 0
915 && CHECK_AT(parser->buffer, '-', 0)
916 && CHECK_AT(parser->buffer, '-', 1)
917 && CHECK_AT(parser->buffer, '-', 2)
918 && IS_BLANKZ_AT(parser->buffer, 3))
919 return yaml_parser_fetch_document_indicator(parser,
920 YAML_DOCUMENT_START_TOKEN);
921
922 /* Is it the document end indicator? */
923

Callers 1

Tested by

no test coverage detected