def p_matrix(p): """matrix : LBRACKET RBRACKET | LBRACKET concat_list RBRACKET | LBRACKET concat_list SEMI RBRACKET | LBRACKET expr_list RBRACKET | LBRACKET expr_list SEMI RBRACKET """ if len(p) == 3: p[0] = node.matrix() else: p[0] = node.matrix(p[2])