summaryrefslogtreecommitdiffstats
path: root/Doc/library/ast.rst
Commit message (Collapse)AuthorAgeFilesLines
* Update URLs in comments and metadata to use HTTPS (GH-27458) (GH-27478)Miss Islington (bot)2021-07-301-1/+1
| | | | | (cherry picked from commit be42c06bb01206209430f3ac08b72643dc7cad1c) Co-authored-by: Noah Kantrowitz <noah@coderanger.net>
* Fix typo in ast.rst (GH-27449) (GH-27454)Miss Islington (bot)2021-07-291-1/+1
| | | | | | Co-authored-by: HaeckelK <haeckelk.github@gmail.com> (cherry picked from commit 6b61d74a3bab43a44fa47b1facd1bec3d74e12b1) Co-authored-by: HaeckelK <51128712+HaeckelK@users.noreply.github.com>
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-291-36/+282
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* Fix some minor errors in the docs (GH-24834)Zackery Spytz2021-03-141-1/+1
|
* Fix error in documentation for ast.match_case (GH-24807)Adrian Freund2021-03-101-1/+1
|
* Add an attribution to the Green Tree Snakes in the AST docs (GH-24727)Pablo Galindo2021-03-031-0/+5
|
* bpo-42128: Add documentation for the new match-based AST nodes (GH-24673)Pablo Galindo2021-03-011-0/+122
| | | | | | | | | | | * bpo-42128: Add documentation for the new match-based AST nodes * Update Doc/library/ast.rst Co-authored-by: Carol Willing <carolcode@willingconsulting.com> * Fix trailing whitespace Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* bpo-39159: Declare error that might be raised from literal_eval (GH-19899)Batuhan Taskaya2020-12-221-1/+5
|
* Fix incorrect links in ast docs (GH-23017)Matthew Suozzo2020-11-031-6/+7
|
* bpo-42086: Document AST operator nodes acts as a singleton (GH-22896)Batuhan Taskaya2020-10-221-0/+7
| | | Automerge-Triggered-By: GH:gvanrossum
* bpo-40484: Document compiler flags under AST module (GH-19885)Batuhan Taskaya2020-10-191-0/+28
| | | | Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
* bpo-41887: omit leading spaces/tabs on ast.literal_eval (#22469)Batuhan Taskaya2020-10-041-1/+4
| | | Also document that eval() does this (the same way).
* Add links to asttokens, leoAst, LibCST and parso to ast docs (GH-21773)Edward K. Ream2020-08-111-2/+21
|
* bpo-38870: Extend subject of ast.unparse warnings (GH-21053)Batuhan Taskaya2020-06-281-1/+6
| | | | | | | - Mention that some compiler optimizations might not roundtrip exactly (such as constant tuples and frozensets). - Add a warning about it might raise RecursionError on very complex expressions due to recursive unparsing aspect of ast.unparse
* bpo-40517: Implement syntax highlighting support for ASDL (GH-19967)Batuhan Taskaya2020-05-071-1/+1
|
* Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" ↵Raymond Hettinger2020-05-061-1/+1
| | | | | (#19950) This reverts commit d60040ba226bd2e3b6f58d074015aa2499dc1cb8.
* bpo-40517: Implement syntax highlighting support for ASDL (#19928)Batuhan Taskaya2020-05-061-1/+1
|
* Fix syntax error in an example in the ast documentation and sync docstrings ↵Pablo Galindo2020-03-121-1/+1
| | | | (GH-18946)
* bpo-34822: Simplify AST for subscription. (GH-9605)Serhiy Storchaka2020-03-101-37/+31
| | | | | | | | | * Remove the slice type. * Make Slice a kind of the expr type instead of the slice type. * Replace ExtSlice(slices) with Tuple(slices, Load()). * Replace Index(value) with a value itself. All non-terminal nodes in AST for expressions are now of the expr type.
* bpo-36287: Make ast.dump() not output optional fields and attributes with ↵Serhiy Storchaka2020-03-091-99/+75
| | | | | | | default values. (GH-18843) The default values for optional fields and attributes of AST nodes are now set as class attributes (e.g. Constant.kind is set to None).
* bpo-39199: Use 'eval' mode for the examples with expression nodes (GH-18828)Pablo Galindo2020-03-071-292/+211
| | | Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39199: Add descriptions of non-deprecated nodes to the AST module ↵Pablo Galindo2020-03-021-6/+1497
| | | | | | | | | documentation (GH-17812) Adapted from https://greentreesnakes.readthedocs.io Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* bpo-32892: Update the documentation for handling constants in AST. (GH-18514)Serhiy Storchaka2020-02-171-3/+7
|
* bpo-3530: Add advice on when to correctly use fix_missing_locations in the ↵Batuhan Taşkaya2020-01-121-1/+9
| | | | | | AST docs (GH-17172) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39158: ast.literal_eval() doesn't support empty sets (GH-17742)Raymond Hettinger2020-01-031-0/+3
|
* bpo-39136: Fixed typos (GH-17720)Gurupad Hegde2019-12-281-1/+1
| | | | | funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape,
* bpo-38348: Extend command line options of ast parsing tool (GH-16540)Batuhan Taşkaya2019-12-161-0/+9
| | | | Add -i and --indent (indentation level), and --no-type-comments (type comments) command line options to ast parsing tool.
* bpo-38870: Expose a function to unparse an ast object in the ast module ↵Pablo Galindo2019-11-241-0/+13
| | | | | | | (GH-17302) Add ast.unparse() as a function in the ast module that can be used to unparse an ast.AST object and produce a string with code that would produce an equivalent ast.AST object when parsed.
* bpo-38049: Add command-line interface for the ast module. (GH-15724)Serhiy Storchaka2019-09-091-0/+36
|
* bpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)Serhiy Storchaka2019-09-091-1/+12
|
* bpo-37950: Fix ast.dump() when call with incompletely initialized node. ↵Serhiy Storchaka2019-08-291-4/+5
| | | | (GH-15510)
* bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). ↵Serhiy Storchaka2019-08-261-0/+7
| | | | | | | (GH-15490) It emits a deprecation warning and calls corresponding method visit_Num(), visit_Str(), etc.
* bpo-35766: Change format for feature_version to (major, minor) (GH-13992)Guido van Rossum2019-06-121-6/+7
| | | | | | | (A single int is still allowed, but undocumented.) https://bugs.python.org/issue35766
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-2/+8
| | | | | | | This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.) https://bugs.python.org/issue35975
* bpo-35766: Merge typed_ast back into CPython (GH-11645)Guido van Rossum2019-01-311-1/+18
|
* bpo-33416: Add end positions to Python AST (GH-11605)Ivan Levkivskyi2019-01-221-9/+31
| | | | | | | | | | | | | | | | | | The majority of this PR is tediously passing `end_lineno` and `end_col_offset` everywhere. Here are non-trivial points: * It is not possible to reconstruct end positions in AST "on the fly", some information is lost after an AST node is constructed, so we need two more attributes for every AST node `end_lineno` and `end_col_offset`. * I add end position information to both CST and AST. Although it may be technically possible to avoid adding end positions to CST, the code becomes more cumbersome and less efficient. * Since the end position is not known for non-leaf CST nodes while the next token is added, this requires a bit of extra care (see `_PyNode_FinalizeEndPos`). Unless I made some mistake, the algorithm should be linear. * For statements, I "trim" the end position of suites to not include the terminal newlines and dedent (this seems to be what people would expect), for example in ```python class C: pass pass ``` the end line and end column for the class definition is (2, 8). * For `end_col_offset` I use the common Python convention for indexing, for example for `pass` the `end_col_offset` is 4 (not 3), so that `[0:4]` gives one the source code that corresponds to the node. * I added a helper function `ast.get_source_segment()`, to get source text segment corresponding to a given AST node. It is also useful for testing. An (inevitable) downside of this PR is that AST now takes almost 25% more memory. I think however it is probably justified by the benefits.
* bpo-35054: Add yet more index entries for symbols. (GH-10121)Serhiy Storchaka2018-10-281-0/+3
|
* bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)Serhiy Storchaka2018-09-271-4/+11
|
* bpo-32911: Revert bpo-29463. (GH-7121) (GH-7197)Serhiy Storchaka2018-05-291-4/+0
| | | | | | Remove the docstring attribute of AST types and restore docstring expression as a first stmt in their body. Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the ↵Brett Cannon2018-03-091-0/+10
| | | | interpreter (GH-5960)
* bpo-25910: Link redirections in docs (#1933)Sanyam Khurana2018-01-201-1/+1
| | | Fixes some redirection links in docs.
* bpo-29463: Add docstring field to some AST nodes. (#46)INADA Naoki2017-02-221-3/+11
| | | | | | | | | | | * bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
* Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.Martin Panter2016-07-261-0/+1
| | | | Patch by Julien Palard.
* Issue16544 - Add a link to an external documentation resource in ast module ↵Senthil Kumaran2016-01-071-0/+5
| | | | docs.
* Fix a few grammar problems in the documentation and commentsMartin Panter2015-11-141-1/+1
|
* Closes #22525: clarify documentation for ast.literal_eval().Georg Brandl2014-11-051-7/+9
|
* Issue #19795: Improved markup of True/False constants.Serhiy Storchaka2013-11-291-1/+1
|
* remove ast.__version__ (closes #12273)Benjamin Peterson2011-07-161-3/+0
|
* convert ast versioning to mercurialBenjamin Peterson2011-03-131-2/+2
|
* Issue #11000 ast.parse parses source, not just expressions.Terry Reedy2011-01-241-2/+2
|