diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Parser/listnode.c | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Parser/listnode.c')
-rw-r--r-- | contrib/tools/python3/src/Parser/listnode.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/tools/python3/src/Parser/listnode.c b/contrib/tools/python3/src/Parser/listnode.c index 2479cec778..c806b98e48 100644 --- a/contrib/tools/python3/src/Parser/listnode.c +++ b/contrib/tools/python3/src/Parser/listnode.c @@ -1,9 +1,9 @@ /* List a node on a file */ -#include "Python.h" -#include "pycore_interp.h" // PyInterpreterState.parser -#include "pycore_pystate.h" // _PyInterpreterState_GET() +#include "Python.h" +#include "pycore_interp.h" // PyInterpreterState.parser +#include "pycore_pystate.h" // _PyInterpreterState_GET() #include "token.h" #include "node.h" @@ -20,18 +20,18 @@ PyNode_ListTree(node *n) static void listnode(FILE *fp, node *n) { - PyInterpreterState *interp = _PyInterpreterState_GET(); - - interp->parser.listnode.level = 0; - interp->parser.listnode.atbol = 1; + PyInterpreterState *interp = _PyInterpreterState_GET(); + + interp->parser.listnode.level = 0; + interp->parser.listnode.atbol = 1; list1node(fp, n); } static void list1node(FILE *fp, node *n) { - PyInterpreterState *interp; - + PyInterpreterState *interp; + if (n == NULL) return; if (ISNONTERMINAL(TYPE(n))) { @@ -40,26 +40,26 @@ list1node(FILE *fp, node *n) list1node(fp, CHILD(n, i)); } else if (ISTERMINAL(TYPE(n))) { - interp = _PyInterpreterState_GET(); + interp = _PyInterpreterState_GET(); switch (TYPE(n)) { case INDENT: - interp->parser.listnode.level++; + interp->parser.listnode.level++; break; case DEDENT: - interp->parser.listnode.level--; + interp->parser.listnode.level--; break; default: - if (interp->parser.listnode.atbol) { + if (interp->parser.listnode.atbol) { int i; - for (i = 0; i < interp->parser.listnode.level; ++i) + for (i = 0; i < interp->parser.listnode.level; ++i) fprintf(fp, "\t"); - interp->parser.listnode.atbol = 0; + interp->parser.listnode.atbol = 0; } if (TYPE(n) == NEWLINE) { if (STR(n) != NULL) fprintf(fp, "%s", STR(n)); fprintf(fp, "\n"); - interp->parser.listnode.atbol = 1; + interp->parser.listnode.atbol = 1; } else fprintf(fp, "%s ", STR(n)); |