--- /home/docs/checkouts/readthedocs.org/user_builds/restrictedpython/checkouts/latest/docs/contributing/ast/python3_9.ast
+++ /home/docs/checkouts/readthedocs.org/user_builds/restrictedpython/checkouts/latest/docs/contributing/ast/python3_10.ast
@@ -1,8 +1,8 @@
--- Python 3.9 AST
+-- Python 3.10 AST
-- ASDL's 4 builtin types are:
-- identifier, int, string, constant
-module Python version "3.9"
+module Python version "3.10"
{
mod = Module(stmt* body, type_ignore* type_ignores)
| Interactive(stmt* body)
@@ -43,6 +43,8 @@
| With(withitem* items, stmt* body, string? type_comment)
| AsyncWith(withitem* items, stmt* body, string? type_comment)
+ | Match(expr subject, match_case* cases)
+
| Raise(expr? exc, expr? cause)
| Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
| Assert(expr test, expr? msg)
@@ -81,7 +83,7 @@
-- x < 4 < 3 and (x < 4) < 3
| Compare(expr left, cmpop* ops, expr* comparators)
| Call(expr func, expr* args, keyword* keywords)
- | FormattedValue(expr value, int? conversion, expr? format_spec)
+ | FormattedValue(expr value, int conversion, expr? format_spec)
| JoinedStr(expr* values)
| Constant(constant value, string? kind)
@@ -158,8 +160,25 @@
-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
withitem = (expr context_expr, expr? optional_vars)
+ match_case = (pattern pattern, expr? guard, stmt* body)
+
+ pattern = MatchValue(expr value)
+ | MatchSingleton(constant value)
+ | MatchSequence(pattern* patterns)
+ | MatchMapping(expr* keys, pattern* patterns, identifier? rest)
+ | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
+
+ | MatchStar(identifier? name)
+ -- The optional "rest" MatchMapping parameter handles capturing extra mapping keys
+
+ | MatchAs(pattern? pattern, identifier? name)
+ | MatchOr(pattern* patterns)
+
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
+
type_ignore = TypeIgnore(int lineno, string tag)
}