MCPcopy
hub / github.com/go-yaml/yaml / yaml_insert_token

Function yaml_insert_token

apic.go:29–46  ·  view source on GitHub ↗
(parser *yaml_parser_t, pos int, token *yaml_token_t)

Source from the content-addressed store, hash-verified

27)
28
29func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) {
30 //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens))
31
32 // Check if we can move the queue at the beginning of the buffer.
33 if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) {
34 if parser.tokens_head != len(parser.tokens) {
35 copy(parser.tokens, parser.tokens[parser.tokens_head:])
36 }
37 parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head]
38 parser.tokens_head = 0
39 }
40 parser.tokens = append(parser.tokens, *token)
41 if pos < 0 {
42 return
43 }
44 copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:])
45 parser.tokens[parser.tokens_head+pos] = *token
46}
47
48// Create a new parser object.
49func yaml_parser_initialize(parser *yaml_parser_t) bool {

Calls

no outgoing calls

Tested by

no test coverage detected