// File: night-shift[P]Srl/src/lib/Node.cpp
// Function: Srl::Node::read_source(int)
void Node::read_source(int scope_depth)
{
    auto& parser = *this->env->parser;
    auto& source = this->env->in;

    while(true) {

        MemBlock seg_name; Value val;
        tie(seg_name, val) = parser.read(source);

        if(val.type() == Type::Scope_End) {
            this->parsed = true;
            break;
        }

        auto field_name = String(seg_name, Encoding::UTF8);

        if(!TpTools::is_scope(val.type())) {
            this->env->store_value(*this, val, field_name);

        } else {

            if(scope_depth + 1 > MAX_SAFE_NESTED_SCOPE_DEPTH) {
                throw Exception("Abort parsing data MAX_SAFE_NESTED_SCOPE_DEPTH [" + to_string(MAX_SAFE_NESTED_SCOPE_DEPTH) + "] exceeded");
            }

            auto* link = this->env->store_node(*this, Node(this->env->tree, val.type()), field_name);

            link->field.read_source(scope_depth + 1);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
movq (%rax), %rcx
movq 0x250(%rcx), %rcx
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
addq $0x260, %rax            # imm = 0x260
movq %rax, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x374c0
leaq -0x48(%rbp), %rdi
movl $0xb, %esi
callq 0x33ff0
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq (%rsi), %rax
leaq -0x70(%rbp), %rdi
callq *0x10(%rax)
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x37cb0
leaq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x35650
leaq -0x48(%rbp), %rdi
callq 0x35b80
cmpb $0x10, %al
jne 0x4653c
movq -0x178(%rbp), %rax
movb $0x1, 0x51(%rax)
jmp 0x467ab
movq -0x30(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
leaq -0x90(%rbp), %rdi
movl $0x1, %ecx
callq 0x38280
leaq -0x48(%rbp), %rdi
callq 0x35b80
movzbl %al, %edi
callq 0x35db0
testb $0x1, %al
jne 0x465a5
movq -0x178(%rbp), %rsi
movq (%rsi), %rdi
leaq -0x48(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x387c0
jmp 0x467a6
movl -0xc(%rbp), %eax
addl $0x1, %eax
cmpl 0x3f8cf(%rip), %eax     # 0x85e80
jle 0x466e4
movb $0x1, -0x10d(%rbp)
movl $0x28, %edi
callq 0x34160
movq %rax, -0x180(%rbp)
movl 0x3f8ab(%rip), %esi     # 0x85e80
leaq -0x100(%rbp), %rdi
callq 0x36a10
jmp 0x465e3
leaq 0x22f16(%rip), %rsi     # 0x69500
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x37e60
jmp 0x465ff
leaq 0x22f2b(%rip), %rdx     # 0x69531
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x336d0
jmp 0x4661b
movq -0x180(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x33910
jmp 0x46630
movq -0x180(%rbp), %rdi
movb $0x0, -0x10d(%rbp)
movq 0x3c9a3(%rip), %rsi     # 0x82fe8
movq 0x3c8ec(%rip), %rdx     # 0x82f38
callq 0x37fc0
jmp 0x467c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x466c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x466bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x466b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x38ce0
leaq -0xe0(%rbp), %rdi
callq 0x38ce0
leaq -0x100(%rbp), %rdi
callq 0x38ce0
testb $0x1, -0x10d(%rbp)
jne 0x466d3
jmp 0x466df
movq -0x180(%rbp), %rdi
callq 0x34ce0
jmp 0x467b4
movq -0x178(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x35b80
movq -0x1a0(%rbp), %rsi
movzbl %al, %edx
leaq -0x170(%rbp), %rdi
movq %rdi, -0x190(%rbp)
movl $0x1, %ecx
callq 0x33fb0
movq -0x198(%rbp), %rdi
movq -0x178(%rbp), %rsi
movq -0x190(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x344c0
movq %rax, -0x188(%rbp)
jmp 0x46754
leaq -0x170(%rbp), %rdi
callq 0x38bf0
movq -0x188(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
addq $0x8, %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x361e0
jmp 0x467a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x38bf0
jmp 0x467b4
jmp 0x464d8
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x108(%rbp), %rdi
callq 0x38210