Add entity references as a new operand kind.

Define known entities in the cretonne.entities module.
This commit is contained in:
Jakob Stoklund Olesen
2016-05-18 15:30:16 -07:00
parent 1dcac579fb
commit d85fda0346
7 changed files with 96 additions and 41 deletions

View File

@@ -300,19 +300,19 @@ impl<'a> Parser<'a> {
// Parse a whole function definition.
//
// function ::= * function-spec "{" preample function-body "}"
// function ::= * function-spec "{" preamble function-body "}"
//
fn parse_function(&mut self) -> Result<Function> {
let (name, sig) = try!(self.parse_function_spec());
let mut ctx = Context::new(Function::with_name_signature(name, sig));
// function ::= function-spec * "{" preample function-body "}"
// function ::= function-spec * "{" preamble function-body "}"
try!(self.match_token(Token::LBrace, "expected '{' before function body"));
// function ::= function-spec "{" * preample function-body "}"
// function ::= function-spec "{" * preamble function-body "}"
try!(self.parse_preamble(&mut ctx));
// function ::= function-spec "{" preample * function-body "}"
// function ::= function-spec "{" preamble * function-body "}"
try!(self.parse_function_body(&mut ctx));
// function ::= function-spec "{" preample function-body * "}"
// function ::= function-spec "{" preamble function-body * "}"
try!(self.match_token(Token::RBrace, "expected '}' after function body"));
Ok(ctx.function)