class xr_kind

Enumeration class: describes the kind of a (non-keyword) token.

The range of kinds associated with C and C++ programs includes type, namespace, function, variable, and so on.

xr_kind Details

class cs.xr_kind

Enumeration class: describes the kind of a (non-keyword) token.

static from_integer(_inner)

Construct an instance from an integer representation.

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

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

>>> xrk = xr_kind.FUNC_STATIC.as_integer()
>>> xrk
3
>>> xr_kind.from_integer(xrk)
<cs.xr_kind static function>
__cmp__(other)

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

Parameters:other (xr_kind) – The xr_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
>>> xr_kind.TLV.__cmp__(xr_kind.TLT)
1
__eq__(b)

Equality operator for xr_kind .

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

Greater-than-or-equal operator for xr_kind .

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

Greater-than operator for xr_kind .

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

Hash function for xr_kind .

Return type:int
>>> hash(xr_kind.STRINGLIT)
14
__le__(b)

Less-than-or-equal operator for xr_kind .

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

Less-than operator for xr_kind .

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

Inequality operator for xr_kind .

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

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

Return type:str
Returns:The string representation.
>>> repr(xr_kind.FILE)
'<cs.xr_kind file>'
__str__()

Get a simple string representation of a xr_kind object.

Return type:str
Returns:The string representation.
>>> str(xr_kind.TLT)
'template type'
as_integer()

Get an integer representation of self.

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

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

>>> xrk = xr_kind.FUNC_STATIC.as_integer()
>>> xrk
3
>>> xr_kind.from_integer(xrk)
<cs.xr_kind static function>
name()

Get the name of a xr_kind object.

Return type:str
Returns:The name.
>>> xr_kind.ENUM.name()
'enum'
BUILTIN

[C++ / GNU C only] builtin: the name of a __builtin_*() function.

>>> xr_kind.BUILTIN
<cs.xr_kind builtin>
ENUM

enum: an individual enum symbol.

>>> xr_kind.ENUM
<cs.xr_kind enum>
FIELD

field: a field name in an aggregate.

>>> xr_kind.FIELD
<cs.xr_kind field>
FILE

file: a file name (including extension).

>>> xr_kind.FILE
<cs.xr_kind file>
FUNC

a (non-static) function name.

>>> xr_kind.FUNC
<cs.xr_kind function>
FUNC_STATIC

a static function name.

>>> xr_kind.FUNC_STATIC
<cs.xr_kind static function>
LABEL

label: an identifier used as a label.

>>> xr_kind.LABEL
<cs.xr_kind label>
MACRO

macro: a macro name.

>>> xr_kind.MACRO
<cs.xr_kind macro>
METHOD

a (non-static) method method name.

>>> xr_kind.METHOD
<cs.xr_kind method>
METHOD_STATIC

a static method name.

>>> xr_kind.METHOD_STATIC
<cs.xr_kind static method>
NAMESPACE

[C++ only] namespace: a namespace name.

>>> xr_kind.NAMESPACE
<cs.xr_kind namespace>
STRINGLIT

A string literal.

>>> xr_kind.STRINGLIT
<cs.xr_kind string literal>
TAG

tag: a type tag.

>>> xr_kind.TAG
<cs.xr_kind tag>
TLT

[C++ only] template type parameter: the name of a type parameter for a template.

>>> xr_kind.TLT
<cs.xr_kind template type>
TLV

[C++ only] template value parameter: the name of a value parameter for a template.

>>> xr_kind.TLV
<cs.xr_kind template value>
TYPE

type: a type name.

>>> xr_kind.TYPE
<cs.xr_kind type>
VAR_GLOBAL

a global variable name.

>>> xr_kind.VAR_GLOBAL
<cs.xr_kind global variable>
VAR_LOCAL

a local variable name.

>>> xr_kind.VAR_LOCAL
<cs.xr_kind local variable>
VAR_LOCAL_STATIC

a locally-scoped static variable name.

>>> xr_kind.VAR_LOCAL_STATIC
<cs.xr_kind local static variable>
VAR_PARAMETER

a parameter name.

>>> xr_kind.VAR_PARAMETER
<cs.xr_kind parameter>
VAR_STATIC

a static variable name.

>>> xr_kind.VAR_STATIC
<cs.xr_kind file static variable>