diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 22:49:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 22:49:05 (GMT) |
commit | 49c5da1d88f605248167f4d95b1dfe08c1f703c7 (patch) | |
tree | 7c7c6ee02daee4f5a2dd3a3fb7b22a5910ec15d2 /Doc/lib | |
parent | 3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0 (diff) | |
download | cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.zip cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.gz cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.bz2 |
Patch #1440601: Add col_offset attribute to AST nodes.
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libast.tex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/lib/libast.tex b/Doc/lib/libast.tex index ca798c9..b3c3148 100644 --- a/Doc/lib/libast.tex +++ b/Doc/lib/libast.tex @@ -34,7 +34,13 @@ names of all child nodes. Each instance of a concrete class has one attribute for each child node, of the type as defined in the grammar. For example, \code{_ast.BinOp} -instances have an attribute \code{left} of type \code{_ast.expr}. +instances have an attribute \code{left} of type \code{_ast.expr}. +Instances of \code{_ast.expr} and \code{_ast.stmt} subclasses also +have lineno and col_offset attributes. The lineno is the line number +of source text (1 indexed so the first line is line 1) and the +col_offset is the utf8 byte offset of the first token that generated +the node. The utf8 offset is recorded because the parser uses utf8 +internally. If these attributes are marked as optional in the grammar (using a question mark), the value might be \code{None}. If the attributes |