class point_syntax_kind

Enumeration class: the syntax kind associated with a program point ( point ), indicating the kind of source code statement from which the point was generated.

The “bodies” of code keywords do not have syntax kinds, only conditions, exprs, etc. In the code:

for (i = 0; i < 10; ++i)
    j = i;

The syntax kinds and elements are as follows.

point point_syntax_kind point_syntax_element
i = 0 point_syntax_kind.FOR point_syntax_element.INIT
i < 10 point_syntax_kind.FOR point_syntax_element.COND
++i point_syntax_kind.FOR point_syntax_element.INCR
j = 1 point_syntax_kind.NONE point_syntax_element.NONE

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

Not to be confused with syntax_kind , which is a property of a span within a source file instance.

point_syntax_kind Details

class cs.point_syntax_kind

Enumeration class: the syntax kind associated with a program point ( point ), indicating the kind of source code statement from which the 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_kind.as_integer().
Return type:point_syntax_kind
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a point_syntax_kind instance.

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

>>> psk = point_syntax_kind.WHILE.as_integer()
>>> psk
5
>>> point_syntax_kind.from_integer(psk)
<cs.point_syntax_kind while>
__cmp__(other)

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

Parameters:other (point_syntax_kind) – The point_syntax_kind 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_kind.SWITCH.__cmp__(point_syntax_kind.ASM)
-1
__eq__(b)

Equality operator for point_syntax_kind .

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

Greater-than-or-equal operator for point_syntax_kind .

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

Greater-than operator for point_syntax_kind .

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

Hash function for point_syntax_kind .

Return type:int
>>> hash(point_syntax_kind.IF)
1
__le__(b)

Less-than-or-equal operator for point_syntax_kind .

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

Less-than operator for point_syntax_kind .

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

Inequality operator for point_syntax_kind .

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

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

Return type:str
Returns:The string representation.
>>> repr(point_syntax_kind.THROW)
'<cs.point_syntax_kind throw>'
__str__()

Get a simple string representation of a point_syntax_kind object.

Return type:str
Returns:The string representation.
>>> str(point_syntax_kind.LABEL)
'label'
as_integer()

Get an integer representation of self.

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

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

>>> psk = point_syntax_kind.WHILE.as_integer()
>>> psk
5
>>> point_syntax_kind.from_integer(psk)
<cs.point_syntax_kind while>
name()

Get the name of a point_syntax_kind object.

Return type:str
Returns:The name.
>>> point_syntax_kind.ELSE.name()
'else'
ASM

An asm statement.

>>> point_syntax_kind.ASM
<cs.point_syntax_kind asm>
BREAK

A break statement.

>>> point_syntax_kind.BREAK
<cs.point_syntax_kind break>
CASE

A case label (in a switch statement).

>>> point_syntax_kind.CASE
<cs.point_syntax_kind case>
CATCH

The formal parameter of a catch clause.

>>> point_syntax_kind.CATCH
<cs.point_syntax_kind catch>
CONTINUE

A continue statement.

>>> point_syntax_kind.CONTINUE
<cs.point_syntax_kind continue>
DO

The controlling expression of a do-while statement.

>>> point_syntax_kind.DO
<cs.point_syntax_kind do>
ELSE

An else label.

>>> point_syntax_kind.ELSE
<cs.point_syntax_kind else>
FOR

An element of a for loop header: initialization clause, termination condition, or step clause.

>>> point_syntax_kind.FOR
<cs.point_syntax_kind for>
GOTO

A goto statement.

>>> point_syntax_kind.GOTO
<cs.point_syntax_kind goto>
IF

An if condition.

>>> point_syntax_kind.IF
<cs.point_syntax_kind if>
LABEL

A statement label.

>>> point_syntax_kind.LABEL
<cs.point_syntax_kind label>
NONE

All other program points.

>>> point_syntax_kind.NONE
<cs.point_syntax_kind none>
RETURN

A return statement or expression.

>>> point_syntax_kind.RETURN
<cs.point_syntax_kind return>
SWITCH

The controlling expression of a switch statement.

>>> point_syntax_kind.SWITCH
<cs.point_syntax_kind switch>
THROW

A throw expression.

>>> point_syntax_kind.THROW
<cs.point_syntax_kind throw>
TRY

A try block header.

>>> point_syntax_kind.TRY
<cs.point_syntax_kind try>
WHILE

The controlling expression of a while statement.

>>> point_syntax_kind.WHILE
<cs.point_syntax_kind while>