org.python.antlr
Class PythonTree
- java.lang.Object
-
- org.python.core.PyObject
-
- org.python.antlr.AST
-
- org.python.antlr.PythonTree
-
- All Implemented Interfaces:
- java.io.Serializable, Traverseproc
- Direct Known Subclasses:
- Add, alias, And, arguments, AugLoad, AugStore, BitAnd, BitOr, BitXor, boolop, cmpop, comprehension, Del, Div, Eq, excepthandler, expr, expr_context, FloorDiv, Gt, GtE, In, Invert, Is, IsNot, keyword, Load, LShift, Lt, LtE, mod, Mod, Mult, Not, NotEq, NotIn, operator, Or, Param, Pow, PythonErrorNode, RShift, slice, stmt, Store, Sub, UAdd, unaryop, USub
public class PythonTree extends AST implements Traverseproc
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.python.core.PyObject
PyObject.ConversionException
-
-
Field Summary
Fields Modifier and Type Field and Description booleanfrom_future_checked-
Fields inherited from class org.python.core.PyObject
gcMonitorGlobal
-
-
Constructor Summary
Constructors Constructor and Description PythonTree()PythonTree(int ttype, org.antlr.runtime.Token t)PythonTree(PythonTree tree)PythonTree(PyType subType)PythonTree(org.antlr.runtime.Token t)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description <R> Raccept(VisitorIF<R> visitor)voidaddChild(PythonTree t)Add t as child of this node.voidaddChildren(java.util.List<PythonTree> kids)Add all elements of kids list as children of this nodejava.lang.ObjectdeleteChild(int i)static java.lang.StringdottedNameListToString(java.util.List<Name> names)Converts a list of Name to a dotted-name string.PythonTreedupNode()voidfreshenParentAndChildIndexes()Set the parent and child index values for all child of tvoidfreshenParentAndChildIndexes(int offset)intgetAntlrType()intgetCharStartIndex()intgetCharStopIndex()PythonTreegetChild(int i)intgetChildCount()intgetChildIndex()java.util.List<PythonTree>getChildren()Get the children internal List; note that if you directly mess with the list, do so at your own risk.intgetCol_offset()PythonTreegetFirstChildWithType(int type)intgetLineno()org.antlr.runtime.tree.CommonTreegetNode()PythonTreegetParent()java.lang.StringgetText()org.antlr.runtime.TokengetToken()intgetTokenStartIndex()intgetTokenStopIndex()booleanisNil()booleanrefersDirectlyTo(PyObject ob)Optional operation.voidreplaceChildren(int startChildIndex, int stopChildIndex, java.lang.Object t)Delete children from start to stop and replace with t even if t is a list (nil-root tree).voidsetCharStartIndex(int index)voidsetCharStopIndex(int index)voidsetChild(int i, PythonTree t)voidsetChildIndex(int index)voidsetParent(PythonTree t)voidsetTokenStartIndex(int index)voidsetTokenStopIndex(int index)java.lang.StringtoString()java.lang.StringtoStringTree()voidtraverse(VisitorIF<?> visitor)inttraverse(Visitproc visit, java.lang.Object arg)Traverses all directly containedPyObjects.-
Methods inherited from class org.python.antlr.AST
check, unexpectedCall
-
Methods inherited from class org.python.core.PyObject
__abs__, __add__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __cmp__, __coerce__, __coerce_ex__, __complex__, __contains__, __delattr__, __delattr__, __delete__, __delitem__, __delitem__, __delslice__, __delslice__, __dir__, __div__, __divmod__, __ensure_finalizer__, __eq__, __findattr__, __findattr__, __findattr_ex__, __finditem__, __finditem__, __finditem__, __float__, __floordiv__, __format__, __ge__, __get__, __getattr__, __getattr__, __getitem__, __getitem__, __getnewargs__, __getslice__, __getslice__, __gt__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __index__, __int__, __invert__, __ior__, __ipow__, __irshift__, __isub__, __iter__, __iternext__, __itruediv__, __ixor__, __le__, __len__, __long__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __not__, __oct__, __or__, __pos__, __pow__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __reduce__, __reduce_ex__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __set__, __setattr__, __setattr__, __setitem__, __setitem__, __setitem__, __setslice__, __setslice__, __str__, __sub__, __tojava__, __truediv__, __trunc__, __unicode__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _iadd, _iand, _idiv, _idivmod, _ifloordiv, _ilshift, _imod, _imul, _in, _ior, _ipow, _irshift, _is, _isnot, _isub, _itruediv, _ixor, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asDouble, asIndex, asIndex, asInt, asInt, asIterable, asLong, asLong, asName, asName, asString, asString, asStringOrNull, asStringOrNull, bit_length, conjugate, delDict, delType, dispatch__init__, equals, fastGetClass, fastGetDict, getDict, getType, hashCode, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isInteger, isMappingType, isNumberType, isSequenceType, noAttributeError, object___subclasshook__, readonlyAttributeError, setDict, setType
-
-
-
-
Constructor Detail
-
PythonTree
public PythonTree()
-
PythonTree
public PythonTree(PyType subType)
-
PythonTree
public PythonTree(org.antlr.runtime.Token t)
-
PythonTree
public PythonTree(int ttype, org.antlr.runtime.Token t)
-
PythonTree
public PythonTree(PythonTree tree)
-
-
Method Detail
-
getNode
public org.antlr.runtime.tree.CommonTree getNode()
-
getToken
public org.antlr.runtime.Token getToken()
-
dupNode
public PythonTree dupNode()
-
isNil
public boolean isNil()
-
getAntlrType
public int getAntlrType()
-
getText
public java.lang.String getText()
-
getLineno
public int getLineno()
-
getCol_offset
public int getCol_offset()
-
getTokenStartIndex
public int getTokenStartIndex()
-
setTokenStartIndex
public void setTokenStartIndex(int index)
-
getTokenStopIndex
public int getTokenStopIndex()
-
setTokenStopIndex
public void setTokenStopIndex(int index)
-
getCharStartIndex
public int getCharStartIndex()
-
setCharStartIndex
public void setCharStartIndex(int index)
-
getCharStopIndex
public int getCharStopIndex()
-
setCharStopIndex
public void setCharStopIndex(int index)
-
getChildIndex
public int getChildIndex()
-
getParent
public PythonTree getParent()
-
setParent
public void setParent(PythonTree t)
-
setChildIndex
public void setChildIndex(int index)
-
dottedNameListToString
public static java.lang.String dottedNameListToString(java.util.List<Name> names)
Converts a list of Name to a dotted-name string. Because leading dots are indexable identifiers (referring to parent directories in relative imports), a Name list may include leading dots, but not dots between names.
-
toStringTree
public java.lang.String toStringTree()
-
accept
public <R> R accept(VisitorIF<R> visitor) throws java.lang.Exception
- Throws:
java.lang.Exception
-
traverse
public void traverse(VisitorIF<?> visitor) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getChild
public PythonTree getChild(int i)
-
getChildren
public java.util.List<PythonTree> getChildren()
Get the children internal List; note that if you directly mess with the list, do so at your own risk.
-
getFirstChildWithType
public PythonTree getFirstChildWithType(int type)
-
getChildCount
public int getChildCount()
-
addChild
public void addChild(PythonTree t)
Add t as child of this node. Warning: if t has no children, but child does and child isNil then this routine moves children to t via t.children = child.children; i.e., without copying the array.
-
addChildren
public void addChildren(java.util.List<PythonTree> kids)
Add all elements of kids list as children of this node
-
setChild
public void setChild(int i, PythonTree t)
-
deleteChild
public java.lang.Object deleteChild(int i)
-
replaceChildren
public void replaceChildren(int startChildIndex, int stopChildIndex, java.lang.Object t)Delete children from start to stop and replace with t even if t is a list (nil-root tree). num of children can increase or decrease. For huge child lists, inserting children can force walking rest of children to set their childindex; could be slow.
-
freshenParentAndChildIndexes
public void freshenParentAndChildIndexes()
Set the parent and child index values for all child of t
-
freshenParentAndChildIndexes
public void freshenParentAndChildIndexes(int offset)
-
traverse
public int traverse(Visitproc visit, java.lang.Object arg)
Description copied from interface:TraverseprocTraverses all directly containedPyObjects. Like in CPython,argmust be passed unmodified tovisitas its second parameter. IfVisitproc.visit(PyObject, Object)returns nonzero, this return value must be returned immediately by traverse.Visitproc.visit(PyObject, Object)must not be called with anullPyObject-argument.- Specified by:
traversein interfaceTraverseproc
-
refersDirectlyTo
public boolean refersDirectlyTo(PyObject ob)
Description copied from interface:TraverseprocOptional operation. Should only be implemented if it is more efficient than callingTraverseproc.traverse(Visitproc, Object)with a visitproc that just watches out forob. Must returnfalseifobisnull.- Specified by:
refersDirectlyToin interfaceTraverseproc
-
-
DMelt 3.0 © DataMelt by jWork.ORG