def parse_func_def_stat(lexer): lexer.get_next_token_of_kind(TokenKind.KW_FUNCTION) fn_exp, has_colon = StatParser.parse_func_name(lexer) fd_exp = ExpParser.parse_func_def_exp(lexer) if has_colon: fd_exp.insert(0, 'self') return lua_stat.AssignStat(fd_exp.line, [fn_exp], [fd_exp])
def finish_local_func_def_stat(lexer): lexer.get_next_token_of_kind(TokenKind.KW_FUNCTION) _, name = lexer.get_next_identifier() fd_exp = ExpParser.parse_func_def_exp(lexer) return lua_stat.LocalFuncDefStat(name, fd_exp)