Add FuncRef and SigRef entity references.

These refer to external functions and function signatures declared in
the preamble. Since we're already using the type names 'Signature' and
'Function', these entity references don't folow the usual EntityData /
Entity naming convention.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-12 14:15:29 -07:00
parent b42d85ae24
commit 7cf25a073b
7 changed files with 94 additions and 24 deletions

View File

@@ -34,6 +34,8 @@ pub enum Token<'a> {
Ebb(Ebb), // ebb3
StackSlot(u32), // ss3
JumpTable(u32), // jt2
FuncRef(u32), // fn2
SigRef(u32), // sig2
Identifier(&'a str), // Unrecognized identifier (opcode, enumerator, ...)
}
@@ -285,6 +287,8 @@ impl<'a> Lexer<'a> {
"ebb" => Ebb::with_number(number).map(|ebb| Token::Ebb(ebb)),
"ss" => Some(Token::StackSlot(number)),
"jt" => Some(Token::JumpTable(number)),
"fn" => Some(Token::FuncRef(number)),
"sig" => Some(Token::SigRef(number)),
_ => None,
}
}