class ast_family¶
Enumeration class for AST family.
Each language dependent AST module will define its own AST families.
ast_family Members¶
| Constructors | none |
| Static Method | from_integer() |
| Methods | __cmp__(), __eq__(), __ge__(), __gt__(), __hash__(), __le__(), __lt__(), __ne__(), __repr__(), __str__(), as_integer(), name() |
| Attributes | C_NORMALIZED, C_UNNORMALIZED, DEFAULT, |
ast_family Details¶
-
class
cs.ast_family¶ Enumeration class for AST family.
-
static
from_integer(_inner)¶ Construct an instance from an integer representation.
Parameters: _inner (int) – The integer representation, as returned by ast_family.as_integer().Return type: ast_familyRaises: result.ERROR_INVALID_ARGUMENTif_inneris not a valid integer representation for aast_familyinstance.Invariant: For
ast_familyx, ast_family.from_integer(x.as_integer()) == x>>> f = ast_family.C_UNNORMALIZED.as_integer() >>> f 1 >>> ast_family.from_integer(f) <cs.ast_family unnormalized>
-
__cmp__(other)¶ Comparison function for
ast_family, with respect to a stable overall ordering.Parameters: other ( ast_family) – Theast_familyobject to compare against.Return type: int Returns: An integer N such that: - N==0 if the two objects compare equal
- N<0 if
self< other - N>0 if
self> other
>>> ast_family.C_NORMALIZED.__cmp__(ast_family.C_UNNORMALIZED) -1
-
__eq__(b)¶ Equality operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Trueifselfandbcompare equal,Falseotherwise.>>> ast_family.C_NORMALIZED == ast_family.C_NORMALIZED True
-
__ge__(b)¶ Greater-than-or-equal operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Trueifself>=b,Falseotherwise.>>> ast_family.C_UNNORMALIZED >= ast_family.C_NORMALIZED True
-
__gt__(b)¶ Greater-than operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Trueifself>b,Falseotherwise.>>> ast_family.C_UNNORMALIZED > ast_family.C_NORMALIZED True
-
__hash__()¶ Hash function for
ast_family.Return type: int >>> hash(ast_family.C_UNNORMALIZED) 1
-
__le__(b)¶ Less-than-or-equal operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Trueifself<=b,Falseotherwise.>>> ast_family.C_NORMALIZED <= ast_family.C_UNNORMALIZED True
-
__lt__(b)¶ Less-than operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Trueifself<b,Falseotherwise.>>> ast_family.C_NORMALIZED < ast_family.C_UNNORMALIZED True
-
__ne__(b)¶ Inequality operator for
ast_family.Parameters: b ( ast_family) – Theast_familyobject to compare against.Return type: bool Returns: Falseifselfandbcompare equal,Trueotherwise.>>> ast_family.C_NORMALIZED != ast_family.C_UNNORMALIZED True
-
__repr__()¶ Get a representation of a
ast_familyobject that includes information useful for debugging.Return type: str Returns: The string representation. >>> repr(ast_family.C_NORMALIZED) '<cs.ast_family normalized>'
-
__str__()¶ Get a simple string representation of a
ast_familyobject.Return type: str Returns: The string representation. >>> str(ast_family.C_UNNORMALIZED) 'unnormalized'
-
as_integer()¶ Get an integer representation of
self.Return type: int Returns: An integer suitable for use with ast_family.from_integer().Invariant: For
ast_familyx, ast_family.from_integer(x.as_integer()) == x>>> f = ast_family.C_UNNORMALIZED.as_integer() >>> f 1 >>> ast_family.from_integer(f) <cs.ast_family unnormalized>
-
name()¶ Get the name of a
ast_familyobject.Return type: str Returns: The name. >>> ast_family.C_NORMALIZED.name() 'normalized'
-
C_NORMALIZED¶ Normalized C/C++ AST.
>>> ast_family.C_NORMALIZED <cs.ast_family normalized>
-
C_UNNORMALIZED¶ Unnormalized C/C++ AST.
>>> ast_family.C_UNNORMALIZED <cs.ast_family unnormalized>
-
DEFAULT¶ Represents the first AST family, whatever it might be.
Used as a default in the API if the user does not specify a particular family.
>>> ast_family.DEFAULT # there is a one-to-many relationship between ast_family slots and names <cs.ast_family normalized>
-
static