summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-22 04:25:09 (GMT)
committerGitHub <noreply@github.com>2023-05-22 04:25:09 (GMT)
commita5f244d627a6815cf2d8ccec836b9b52eb3e8de2 (patch)
tree55b68f8a6f9366132742fb45bd93199065f9e720 /Parser
parentef5d00a59207a63c6d5ae0d5d44054847d1bf3b5 (diff)
downloadcpython-a5f244d627a6815cf2d8ccec836b9b52eb3e8de2.zip
cpython-a5f244d627a6815cf2d8ccec836b9b52eb3e8de2.tar.gz
cpython-a5f244d627a6815cf2d8ccec836b9b52eb3e8de2.tar.bz2
gh-104656: Rename typeparams AST node to type_params (#104657)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/Python.asdl16
-rw-r--r--Parser/action_helpers.c6
-rw-r--r--Parser/parser.c30
3 files changed, 26 insertions, 26 deletions
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index cfc41ef..dc2eb802 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -8,15 +8,15 @@ module Python
| Expression(expr body)
| FunctionType(expr* argtypes, expr returns)
- stmt = FunctionDef(identifier name, typeparam* typeparams, arguments args,
+ stmt = FunctionDef(identifier name, type_param* type_params, arguments args,
stmt* body, expr* decorator_list, expr? returns,
string? type_comment)
- | AsyncFunctionDef(identifier name, typeparam* typeparams, arguments args,
+ | AsyncFunctionDef(identifier name, type_param* type_params, arguments args,
stmt* body, expr* decorator_list, expr? returns,
string? type_comment)
| ClassDef(identifier name,
- typeparam* typeparams,
+ type_param* type_params,
expr* bases,
keyword* keywords,
stmt* body,
@@ -25,7 +25,7 @@ module Python
| Delete(expr* targets)
| Assign(expr* targets, expr value, string? type_comment)
- | TypeAlias(expr name, typeparam* typeparams, expr value)
+ | TypeAlias(expr name, type_param* type_params, expr value)
| AugAssign(expr target, operator op, expr value)
-- 'simple' indicates that we annotate simple name without parens
| AnnAssign(expr target, expr annotation, expr? value, int simple)
@@ -145,8 +145,8 @@ module Python
type_ignore = TypeIgnore(int lineno, string tag)
- typeparam = TypeVar(identifier name, expr? bound)
- | ParamSpec(identifier name)
- | TypeVarTuple(identifier name)
- attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
+ type_param = TypeVar(identifier name, expr? bound)
+ | ParamSpec(identifier name)
+ | TypeVarTuple(identifier name)
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
}
diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c
index 0134e6f..06d77b6 100644
--- a/Parser/action_helpers.c
+++ b/Parser/action_helpers.c
@@ -752,7 +752,7 @@ _PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty f
assert(function_def != NULL);
if (function_def->kind == AsyncFunctionDef_kind) {
return _PyAST_AsyncFunctionDef(
- function_def->v.FunctionDef.name, function_def->v.FunctionDef.typeparams,
+ function_def->v.FunctionDef.name, function_def->v.FunctionDef.type_params,
function_def->v.FunctionDef.args,
function_def->v.FunctionDef.body, decorators, function_def->v.FunctionDef.returns,
function_def->v.FunctionDef.type_comment, function_def->lineno,
@@ -761,7 +761,7 @@ _PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty f
}
return _PyAST_FunctionDef(
- function_def->v.FunctionDef.name, function_def->v.FunctionDef.typeparams,
+ function_def->v.FunctionDef.name, function_def->v.FunctionDef.type_params,
function_def->v.FunctionDef.args,
function_def->v.FunctionDef.body, decorators,
function_def->v.FunctionDef.returns,
@@ -776,7 +776,7 @@ _PyPegen_class_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty clas
{
assert(class_def != NULL);
return _PyAST_ClassDef(
- class_def->v.ClassDef.name, class_def->v.ClassDef.typeparams,
+ class_def->v.ClassDef.name, class_def->v.ClassDef.type_params,
class_def->v.ClassDef.bases, class_def->v.ClassDef.keywords,
class_def->v.ClassDef.body, decorators,
class_def->lineno, class_def->col_offset, class_def->end_lineno,
diff --git a/Parser/parser.c b/Parser/parser.c
index 8948467..fc5466f 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -696,9 +696,9 @@ static asdl_pattern_seq* positional_patterns_rule(Parser *p);
static asdl_seq* keyword_patterns_rule(Parser *p);
static KeyPatternPair* keyword_pattern_rule(Parser *p);
static stmt_ty type_alias_rule(Parser *p);
-static asdl_typeparam_seq* type_params_rule(Parser *p);
-static asdl_typeparam_seq* type_param_seq_rule(Parser *p);
-static typeparam_ty type_param_rule(Parser *p);
+static asdl_type_param_seq* type_params_rule(Parser *p);
+static asdl_type_param_seq* type_param_seq_rule(Parser *p);
+static type_param_ty type_param_rule(Parser *p);
static expr_ty type_param_bound_rule(Parser *p);
static expr_ty expressions_rule(Parser *p);
static expr_ty expression_rule(Parser *p);
@@ -10653,7 +10653,7 @@ type_alias_rule(Parser *p)
}
// type_params: '[' type_param_seq ']'
-static asdl_typeparam_seq*
+static asdl_type_param_seq*
type_params_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
@@ -10664,7 +10664,7 @@ type_params_rule(Parser *p)
p->level--;
return NULL;
}
- asdl_typeparam_seq* _res = NULL;
+ asdl_type_param_seq* _res = NULL;
int _mark = p->mark;
{ // '[' type_param_seq ']'
if (p->error_indicator) {
@@ -10674,7 +10674,7 @@ type_params_rule(Parser *p)
D(fprintf(stderr, "%*c> type_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
Token * _literal;
Token * _literal_1;
- asdl_typeparam_seq* t;
+ asdl_type_param_seq* t;
if (
(_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
@@ -10684,7 +10684,7 @@ type_params_rule(Parser *p)
)
{
D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
- _res = CHECK_VERSION ( asdl_typeparam_seq* , 12 , "Type parameter lists are" , t );
+ _res = CHECK_VERSION ( asdl_type_param_seq* , 12 , "Type parameter lists are" , t );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
p->level--;
@@ -10703,7 +10703,7 @@ type_params_rule(Parser *p)
}
// type_param_seq: ','.type_param+ ','?
-static asdl_typeparam_seq*
+static asdl_type_param_seq*
type_param_seq_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
@@ -10714,7 +10714,7 @@ type_param_seq_rule(Parser *p)
p->level--;
return NULL;
}
- asdl_typeparam_seq* _res = NULL;
+ asdl_type_param_seq* _res = NULL;
int _mark = p->mark;
{ // ','.type_param+ ','?
if (p->error_indicator) {
@@ -10724,9 +10724,9 @@ type_param_seq_rule(Parser *p)
D(fprintf(stderr, "%*c> type_param_seq[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
void *_opt_var;
UNUSED(_opt_var); // Silence compiler warnings
- asdl_typeparam_seq* a;
+ asdl_type_param_seq* a;
if (
- (a = (asdl_typeparam_seq*)_gather_81_rule(p)) // ','.type_param+
+ (a = (asdl_type_param_seq*)_gather_81_rule(p)) // ','.type_param+
&&
(_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','?
)
@@ -10756,7 +10756,7 @@ type_param_seq_rule(Parser *p)
// | '*' NAME
// | '**' NAME ":" expression
// | '**' NAME
-static typeparam_ty
+static type_param_ty
type_param_rule(Parser *p)
{
if (p->level++ == MAXSTACK) {
@@ -10767,7 +10767,7 @@ type_param_rule(Parser *p)
p->level--;
return NULL;
}
- typeparam_ty _res = NULL;
+ type_param_ty _res = NULL;
if (_PyPegen_is_memoized(p, type_param_type, &_res)) {
p->level--;
return _res;
@@ -30199,7 +30199,7 @@ _loop0_82_rule(Parser *p)
}
D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' type_param"));
Token * _literal;
- typeparam_ty elem;
+ type_param_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
@@ -30266,7 +30266,7 @@ _gather_81_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> _gather_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "type_param _loop0_82"));
- typeparam_ty elem;
+ type_param_ty elem;
asdl_seq * seq;
if (
(elem = type_param_rule(p)) // type_param