// File: ryuichiueda[P]GlueLang/src/ArgExtCom.cc
// Function: ArgExtCom::parse()
bool ArgExtCom::parse(void)
{
	m_feeder->getPos(&m_start_line, &m_start_char);

	//If the name of a command starts from a small capital letter,
	//it should be parsed as a full-path command.
	// (this rule should be relaxed since a command can start from
	// a non small captal letter)
	
	// fullpath command
	if( ! m_feeder->fileNameSegment(&m_prefix)){
		m_feeder->getPos(&m_end_line, &m_end_char);
		bool res = m_feeder->path(&m_text);

		if(res)
			m_evaled_text = m_text;

		return res;
	}

	// chech whether m_prefix is a prefix or a command name
 	if(!m_feeder->str(".")){
		// if m_prefix is not a prefix, it is a name of a command or a procedure
		m_text = m_prefix;
		m_prefix = "";
		return parsePrefixedCom();
	}

	//When the path is not found, "." is regarded as a part of the command's name
 	if(! m_env->isImportPath(&m_prefix)){
		m_text = m_prefix + ".";
		m_prefix = "";

		string tmp;
		while(m_feeder->fileNameSegment(&tmp)){
			m_text = m_text + tmp;
 			if(!m_feeder->str("."))
				break;

			m_text += ".";
		}
		return parsePrefixedCom();
	}

	//hereafter, a command name with a prefix
	if(!m_feeder->path(&m_text)){
		m_error_msg = "Invalid command name";
		m_exit_status = 2;
		m_feeder->getPos(&m_end_line, &m_end_char);
		throw this;
	}

	return parsePrefixedCom();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdx
movq %rdx, -0xe0(%rbp)
movq 0x8(%rdx), %rdi
movq %rdx, %rsi
addq $0x30, %rsi
addq $0x34, %rdx
callq 0x17610
movq -0xe0(%rbp), %rsi
movq 0x8(%rsi), %rdi
addq $0xc8, %rsi
callq 0x16600
testb $0x1, %al
jne 0x72b0
movq -0xe0(%rbp), %rdx
movq 0x8(%rdx), %rdi
movq %rdx, %rsi
addq $0x38, %rsi
addq $0x3c, %rdx
callq 0x17610
movq -0xe0(%rbp), %rsi
movq 0x8(%rsi), %rdi
addq $0x88, %rsi
callq 0x16220
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x72a3
movq -0xe0(%rbp), %rdi
movq %rdi, %rsi
addq $0x88, %rsi
addq $0xa8, %rdi
callq 0x6070
movb -0x11(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7674
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xf0(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x6710
movq -0xe8(%rbp), %rdx
leaq 0x15db6(%rip), %rsi     # 0x1d096
leaq -0x38(%rbp), %rdi
callq 0x7940
jmp 0x72eb
movq -0xf0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x17750
movb %al, -0xf1(%rbp)
jmp 0x7303
movb -0xf1(%rbp), %al
xorb $-0x1, %al
movb %al, -0xf2(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6280
leaq -0x39(%rbp), %rdi
callq 0x6480
movb -0xf2(%rbp), %al
testb $0x1, %al
jne 0x732f
jmp 0x73ad
movq -0xe0(%rbp), %rdi
movq %rdi, %rsi
addq $0xc8, %rsi
addq $0x88, %rdi
callq 0x6070
movq -0xe0(%rbp), %rdi
addq $0xc8, %rdi
leaq 0x1648a(%rip), %rsi     # 0x1d7eb
callq 0x6580
movq -0xe0(%rbp), %rdi
callq 0x7690
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7674
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x739f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6280
leaq -0x39(%rbp), %rdi
callq 0x6480
jmp 0x7682
movq -0xe0(%rbp), %rsi
movq 0x10(%rsi), %rdi
addq $0xc8, %rsi
callq 0xe950
testb $0x1, %al
jne 0x75e5
movq -0xe0(%rbp), %rsi
addq $0xc8, %rsi
leaq -0x70(%rbp), %rdi
leaq 0x15cb1(%rip), %rdx     # 0x1d096
callq 0x79f0
movq -0xe0(%rbp), %rdi
addq $0x88, %rdi
leaq -0x70(%rbp), %rsi
callq 0x6520
leaq -0x70(%rbp), %rdi
callq 0x6280
movq -0xe0(%rbp), %rdi
addq $0xc8, %rdi
leaq 0x163cc(%rip), %rsi     # 0x1d7eb
callq 0x6580
leaq -0x90(%rbp), %rdi
callq 0x65a0
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x90(%rbp), %rsi
callq 0x16600
movb %al, -0xf3(%rbp)
jmp 0x744f
movb -0xf3(%rbp), %al
testb $0x1, %al
jne 0x745e
jmp 0x75a4
movq -0xe0(%rbp), %rsi
addq $0x88, %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x7a70
jmp 0x7481
movq -0xe0(%rbp), %rdi
addq $0x88, %rdi
leaq -0xb0(%rbp), %rsi
movq %rsi, -0x110(%rbp)
callq 0x6520
movq -0x110(%rbp), %rdi
callq 0x6280
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x108(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x6710
movq -0x100(%rbp), %rdx
leaq 0x15bb5(%rip), %rsi     # 0x1d096
leaq -0xd0(%rbp), %rdi
callq 0x7940
jmp 0x74ef
movq -0x108(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x17750
movb %al, -0x111(%rbp)
jmp 0x750a
movb -0x111(%rbp), %al
xorb $-0x1, %al
movb %al, -0x112(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x6280
leaq -0xd1(%rbp), %rdi
callq 0x6480
movb -0x112(%rbp), %al
testb $0x1, %al
jne 0x753c
jmp 0x7583
jmp 0x75a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x75d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x7575
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x6280
leaq -0xd1(%rbp), %rdi
callq 0x6480
jmp 0x75d4
movq -0xe0(%rbp), %rdi
addq $0x88, %rdi
leaq 0x15afe(%rip), %rsi     # 0x1d096
callq 0x63f0
jmp 0x759f
jmp 0x7430
movq -0xe0(%rbp), %rdi
callq 0x7690
movb %al, -0x113(%rbp)
jmp 0x75b8
movb -0x113(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x6280
jmp 0x7674
leaq -0x90(%rbp), %rdi
callq 0x6280
jmp 0x7682
movq -0xe0(%rbp), %rsi
movq 0x8(%rsi), %rdi
addq $0x88, %rsi
callq 0x16220
testb $0x1, %al
jne 0x7663
movq -0xe0(%rbp), %rdi
addq $0x60, %rdi
leaq 0x159f7(%rip), %rsi     # 0x1d009
callq 0x6580
movq -0xe0(%rbp), %rdx
movl $0x2, 0x80(%rdx)
movq 0x8(%rdx), %rdi
movq %rdx, %rsi
addq $0x38, %rsi
addq $0x3c, %rdx
callq 0x17610
movl $0x8, %edi
callq 0x6200
movq %rax, %rdi
movq -0xe0(%rbp), %rax
movq %rax, (%rdi)
leaq 0x209b6(%rip), %rsi     # 0x28010
xorl %eax, %eax
movl %eax, %edx
callq 0x66d0
movq -0xe0(%rbp), %rdi
callq 0x7690
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x6700
nopl (%rax,%rax)