MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / set_indent

Method set_indent

extlibs/vili/src/parser/parser_state.cpp:27–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25 }
26
27 void state::set_indent(int64_t indent)
28 {
29 if (m_indent_current == -1 && indent > 0)
30 {
31 m_indent_base = indent;
32 }
33 if (indent % m_indent_base && m_stack.top().indent)
34 {
35 throw exceptions::inconsistent_indentation(
36 indent, m_indent_base, VILI_EXC_INFO);
37 }
38 indent /= m_indent_base; // Normalize indentation to "levels"
39 if (m_indent_current > indent)
40 {
41 for (auto decrease_indent = m_indent_current; decrease_indent > indent;
42 decrease_indent--)
43 {
44 this->close_block();
45 }
46 }
47 else if (m_indent_current == indent && indent < m_stack.top().indent)
48 {
49 this->close_block();
50 }
51 else if (m_indent_current < indent)
52 {
53 if (indent - m_indent_current > 1)
54 {
55 throw exceptions::too_much_indentation(indent, VILI_EXC_INFO);
56 }
57 }
58 m_indent_current = indent;
59 }
60
61 void state::use_indent()
62 {

Callers 2

applyMethod · 0.80
applyMethod · 0.80

Calls 4

close_blockMethod · 0.95
topMethod · 0.80

Tested by

no test coverage detected