Don't have keywords in the lexer and parser.

Instead of recognizing "function" as a keyword, simply match it as a
context-sensitive keyword in the parser outside functions.
This commit is contained in:
Jakob Stoklund Olesen
2016-09-20 12:57:29 -07:00
parent fab16941c8
commit 64490a3587
3 changed files with 13 additions and 23 deletions

View File

@@ -454,7 +454,7 @@ impl<'a> Parser<'a> {
// function-spec ::= * "function" name signature
//
fn parse_function_spec(&mut self) -> Result<(Location, FunctionName, Signature)> {
try!(self.match_token(Token::Function, "expected 'function' keyword"));
try!(self.match_identifier("function", "expected 'function'"));
let location = self.loc;
// function-spec ::= "function" * name signature