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

Function yaml_emitter_write_block_scalar_hints

emitterc.go:1848–1888  ·  view source on GitHub ↗
(emitter *yaml_emitter_t, value []byte)

Source from the content-addressed store, hash-verified

1846}
1847
1848func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool {
1849 if is_space(value, 0) || is_break(value, 0) {
1850 indent_hint := []byte{'0' + byte(emitter.best_indent)}
1851 if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) {
1852 return false
1853 }
1854 }
1855
1856 emitter.open_ended = false
1857
1858 var chomp_hint [1]byte
1859 if len(value) == 0 {
1860 chomp_hint[0] = '-'
1861 } else {
1862 i := len(value) - 1
1863 for value[i]&0xC0 == 0x80 {
1864 i--
1865 }
1866 if !is_break(value, i) {
1867 chomp_hint[0] = '-'
1868 } else if i == 0 {
1869 chomp_hint[0] = '+'
1870 emitter.open_ended = true
1871 } else {
1872 i--
1873 for value[i]&0xC0 == 0x80 {
1874 i--
1875 }
1876 if is_break(value, i) {
1877 chomp_hint[0] = '+'
1878 emitter.open_ended = true
1879 }
1880 }
1881 }
1882 if chomp_hint[0] != 0 {
1883 if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) {
1884 return false
1885 }
1886 }
1887 return true
1888}
1889
1890func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool {
1891 if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) {

Calls 3

is_spaceFunction · 0.85
is_breakFunction · 0.85

Tested by

no test coverage detected