class point_syntax_element

Enumeration class: the element of source code statement from which a point was generated.

Get a point’s syntax kind with point.get_syntax_kind().

See class point_syntax_kind for a short example.

point_syntax_element Details

class cs.point_syntax_element

Enumeration class: the element of source code statement from which a point was generated.

static from_integer(_inner)

Construct an instance from an integer representation.

Parameters:_inner (int) – The integer representation, as returned by point_syntax_element.as_integer().
Return type:point_syntax_element
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a point_syntax_element instance.

Invariant: For point_syntax_element x, point_syntax_element.from_integer(x.as_integer()) == x

>>> pse = point_syntax_element.COND.as_integer()
>>> pse
2
>>> point_syntax_element.from_integer(pse)
<cs.point_syntax_element cond>
__cmp__(other)

Comparison function for point_syntax_element , with respect to a stable overall ordering.

Parameters:other (point_syntax_element) – The point_syntax_element object 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
>>> point_syntax_element.INCR.__cmp__(point_syntax_element.COND)
1
__eq__(b)

Equality operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:True if self and b compare equal, False otherwise.
>>> point_syntax_element.INIT == point_syntax_element.EXPR
False
__ge__(b)

Greater-than-or-equal operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:True if self >= b , False otherwise.
>>> point_syntax_element.INIT >= point_syntax_element.EXPR
False
__gt__(b)

Greater-than operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:True if self > b , False otherwise.
>>> point_syntax_element.INCR > point_syntax_element.COND
True
__hash__()

Hash function for point_syntax_element .

Return type:int
>>> hash(point_syntax_element.NONE)
0
__le__(b)

Less-than-or-equal operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:True if self <= b , False otherwise.
>>> point_syntax_element.INCR <= point_syntax_element.COND
False
__lt__(b)

Less-than operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:True if self < b , False otherwise.
>>> point_syntax_element.EXPR < point_syntax_element.INIT
False
__ne__(b)

Inequality operator for point_syntax_element .

Parameters:b (point_syntax_element) – The point_syntax_element object to compare against.
Return type:bool
Returns:False if self and b compare equal, True otherwise.
>>> point_syntax_element.NONE != point_syntax_element.INCR
True
__repr__()

Get a representation of a point_syntax_element object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> repr(point_syntax_element.EXPR)
'<cs.point_syntax_element expr>'
__str__()

Get a simple string representation of a point_syntax_element object.

Return type:str
Returns:The string representation.
>>> str(point_syntax_element.COND)
'cond'
as_integer()

Get an integer representation of self.

Return type:int
Returns:An integer suitable for use with point_syntax_element.from_integer().

Invariant: For point_syntax_element x, point_syntax_element.from_integer(x.as_integer()) == x

>>> pse = point_syntax_element.COND.as_integer()
>>> pse
2
>>> point_syntax_element.from_integer(pse)
<cs.point_syntax_element cond>
name()

Get the name of a point_syntax_element object.

Return type:str
Returns:The name.
>>> point_syntax_element.NONE.name()
'none'
COND

A condition: for loop termination condition (kind point_syntax_kind.FOR), if condition (kind point_syntax_kind.IF), controlling expression of a while or do-while statement (kind point_syntax_kind.WHILE, point_syntax_kind.DO, respectively).

>>> point_syntax_element.COND
<cs.point_syntax_element cond>
EXPR

return expression (kind point_syntax_kind.RETURN), controlling expression of a switch statement (kind point_syntax_kind.SWITCH), case label (kind point_syntax_kind.CASE), throw expression (kind point_syntax_kind.THROW).

>>> point_syntax_element.EXPR
<cs.point_syntax_element expr>
INCR

for loop step clause (kind point_syntax_kind.FOR).

>>> point_syntax_element.INCR
<cs.point_syntax_element incr>
INIT

A for loop initialization clause (kind point_syntax_kind.FOR) or catch clause formal parameter (kind point_syntax_kind.CATCH).

>>> point_syntax_element.INIT
<cs.point_syntax_element init>
NONE

All other program points.

>>> point_syntax_element.NONE
<cs.point_syntax_element none>