def parse_array_or_map(self):
self.next()
if self.peek_is(token.COLON) or self.cur_is(token.COLON):
pairs = self.parse_expr_pairs(token.RSQUARE)
return ast.Map(self.cur_tok, pairs)
else:
return ast.Array(self.cur_tok, self.parse_expr_list(token.RSQUARE))
评论列表
文章目录