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

Function yaml_parser_roll_indent

scannerc.go:995–1024  ·  view source on GitHub ↗

Push the current indentation level to the stack and set the new level the current column is greater than the indentation level. In this case, append or insert the specified token into the token queue.

(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t)

Source from the content-addressed store, hash-verified

993// the current column is greater than the indentation level. In this case,
994// append or insert the specified token into the token queue.
995func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool {
996 // In the flow context, do nothing.
997 if parser.flow_level > 0 {
998 return true
999 }
1000
1001 if parser.indent < column {
1002 // Push the current indentation level to the stack and set the new
1003 // indentation level.
1004 parser.indents = append(parser.indents, parser.indent)
1005 parser.indent = column
1006 if len(parser.indents) > max_indents {
1007 return yaml_parser_set_scanner_error(parser,
1008 "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark,
1009 fmt.Sprintf("exceeded max depth of %d", max_indents))
1010 }
1011
1012 // Create a token and insert it into the queue.
1013 token := yaml_token_t{
1014 typ: typ,
1015 start_mark: mark,
1016 end_mark: mark,
1017 }
1018 if number > -1 {
1019 number -= parser.tokens_parsed
1020 }
1021 yaml_insert_token(parser, number, &token)
1022 }
1023 return true
1024}
1025
1026// Pop indentation levels from the indents stack until the current level
1027// becomes less or equal to the column. For each indentation level, append

Callers 3

yaml_parser_fetch_keyFunction · 0.85
yaml_parser_fetch_valueFunction · 0.85

Calls 2

yaml_insert_tokenFunction · 0.85

Tested by

no test coverage detected