Skip to content

Commit

Permalink
Update AST actions helper location in the PEG parser (python#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal authored Nov 21, 2021
1 parent ed2af43 commit f3ecfb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ when they succeed. Constructing these objects can be quite cumbersome (see
the :ref:`AST compiler section <compiler-ast-trees>` for more information
on how these objects are constructed and how they are used by the compiler) so
special helper functions are used. These functions are declared in the
:file:`Parser/pegen.h` header file and defined in the :file:`Parser/pegen.c`
:file:`Parser/pegen.h` header file and defined in the :file:`Parser/action_helpers.c`
file. These functions allow you to join AST sequences, get specific elements
from them or to do extra processing on the generated tree.

Expand All @@ -822,7 +822,7 @@ from them or to do extra processing on the generated tree.

As a general rule, if an action spawns multiple lines or requires something more
complicated than a single expression of C code, is normally better to create a
custom helper in :file:`Parser/pegen.c` and expose it in the
custom helper in :file:`Parser/action_helpers.c` and expose it in the
:file:`Parser/pegen.h` header file so it can be used from the grammar.

If the parsing succeeds, the parser **must** return a **valid** AST object.
Expand Down

0 comments on commit f3ecfb8

Please sign in to comment.