Node types#

Every node type string the parser produces, with its class. A renderer registers handlers and rules under these strings. The Nodes page explains what each node represents.

type

Class

Attributes

calc_line

CalcLine

assigns, expression_tree, comment, pars_nesting

expr_line

ExprLine

expression_tree, comment, return_expr, pars_nesting

comment_line

CommentLine

content

heading

Heading

content, heading_level

comment_command

CommentCommand

commands

import

Import

import_from, names, import_from_module, import_from_level

params_block

ParamsBlock

lines, with_comments

comments_block

CommentsBlock

lines

calcs_block

CalcsBlock

lines

for_block

ForBlock

lines, assigns, iterator

if_block

IfBlock

lines, test, orelse, is_true

else_block

ElseBlock

lines

elif_block

ElifBlock

lines

name

Name

identifier, value

constant

Constant

value

attribute

Attribute

namespace, identifier, value

list

List

elems

tuple

Tuple

elems

set

Set

elems

dictionary

Dictionary

keys, values

subscript

Subscript

container, index, labels, value

slice

Slice

lower, upper, step

matrix

Matrix

rows

function_call

FunctionCall

namespace, function_name, args

keyword

Keyword

arg, value

compare

Compare

comparison

if_exp

IfExp

test, body, orelse, is_true

inline_comment

InlineComment

content

inline_command

InlineCommand

content, commands

comprehension

Comprehension

assigns, iterator, is_async

comprehension_chain

ComprehensionChain

comp_type, assign, key, value, comprehensions

pow_op

PowOp

left, right, symbol

div_op

DivOp

left, right, symbol

floor_op

FloorOp

left, right, symbol

modulo_op

ModuloOp

left, right, symbol

mult_op

MultOp

left, right, symbol

mat_mult_op

MatMultOp

left, right, symbol

add_op

AddOp

left, right, symbol

sub_op

SubOp

left, right, symbol

unary_op

HcUnaryOp

operand, symbol

eq_op

EqOp

symbol

neq_op

NeqOp

symbol

gt_op

GtOp

symbol

gte_op

GtEOp

symbol

lt_op

LtOp

symbol

lte_op

LtEOp

symbol

is_op

IsOp

symbol

is_not_op

IsNotOp

symbol

in_op

InOp

symbol

not_in_op

NotInOp

symbol

and_op

AndOp

values, symbol

or_op

OrOp

values, symbol

no_value

NoValue

(none)

not_implemented

HcNotImplemented

node_name

root

HcSequence

sequence, hc_globals, hc_locals

All line nodes also have level, pre and post; all block nodes have level, header_pre, header_post, body_pre and body_post; operators have pre and post.