class xr_role

Enumeration class: describes the role that a token is playing at a particular occurrence of that token.

xr_role Details

class cs.xr_role

Enumeration class: describes the role that a token is playing at a particular occurrence of that token.

static from_integer(_inner)

Construct an instance from an integer representation.

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

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

>>> xrr = xr_role.CALL.as_integer()
>>> xrr
1
>>> xr_role.from_integer(xrr)
<cs.xr_role call>
__cmp__(other)

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

Parameters:other (xr_role) – The xr_role 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_role.OTHER.__cmp__(xr_role.INCLUDE)
1
__eq__(b)

Equality operator for xr_role .

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

Greater-than-or-equal operator for xr_role .

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

Greater-than operator for xr_role .

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

Hash function for xr_role .

Return type:int
>>> hash(xr_role.REDEF)
24
__le__(b)

Less-than-or-equal operator for xr_role .

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

Less-than operator for xr_role .

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

Inequality operator for xr_role .

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

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

Return type:str
Returns:The string representation.
>>> repr(xr_role.LOCAL)
'<cs.xr_role local>'
__str__()

Get a simple string representation of a xr_role object.

Return type:str
Returns:The string representation.
>>> str(xr_role.TEMPL_ARG)
'template argument'
as_integer()

Get an integer representation of self.

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

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

>>> xrr = xr_role.CALL.as_integer()
>>> xrr
1
>>> xr_role.from_integer(xrr)
<cs.xr_role call>
name()

Get the name of a xr_role object.

Return type:str
Returns:The name.
>>> xr_role.FRIEND.name()
'friend'
AGGREGATE_MEMBER

…as the type of a data member in an aggregate structure.

>>> xr_role.AGGREGATE_MEMBER
<cs.xr_role member>
CALL

…when the function is called.

>>> xr_role.CALL
<cs.xr_role call>
CAST

…as the target type of a cast operation.

>>> xr_role.CAST
<cs.xr_role cast>
CATCH_PARAM

…[C++ only] as the parameter type in a catch() expression.

>>> xr_role.CATCH_PARAM
<cs.xr_role catch parameter>
CONSTANT

…[C++ only] as the type of a parameter or variable declared as const.

>>> xr_role.CONSTANT
<cs.xr_role constant>
CONSTRUCTOR_INITIALIZATION

…[C++ only] in an initialization list.

>>> xr_role.CONSTRUCTOR_INITIALIZATION
<cs.xr_role constructor initialization>
DECLARATION

…when declared.

>>> xr_role.DECLARATION
<cs.xr_role declaration>
DEFINITION

…when defined.

>>> xr_role.DEFINITION
<cs.xr_role definition>
EXT

[C++ only] The role a namespace name takes at any subsequent extension of the namespace.

>>> xr_role.EXT
<cs.xr_role extension>
FILE_STATIC

…as the type of a file static variable.

>>> xr_role.FILE_STATIC
<cs.xr_role file static>
FORMAL

…as the type of a formal parameter in a function definition or declaration.

>>> xr_role.FORMAL
<cs.xr_role formal>
FRIEND

…[C++ only] when declared as a friend.

>>> xr_role.FRIEND
<cs.xr_role friend>
GLOBAL

…as the type of a global variable.

>>> xr_role.GLOBAL
<cs.xr_role global>
GOTO

…as the operand in a goto expression.

>>> xr_role.GOTO
<cs.xr_role goto>
INCLUDE

…as the subject of an #include statement.

>>> xr_role.INCLUDE
<cs.xr_role include>
INVOCATION

…as the subject of a macro invocation or function pointer invocation.

>>> xr_role.INVOCATION
<cs.xr_role invocation>
LOCAL

…as the type of a local variable.

>>> xr_role.LOCAL
<cs.xr_role local>
LOCAL_STATIC

…as the type of a local static variable.

>>> xr_role.LOCAL_STATIC
<cs.xr_role local static>
METHOD_INVOCATION

…[C++ only] when one of its methods is invoked (for aggregates).

>>> xr_role.METHOD_INVOCATION
<cs.xr_role method invocation>
NEW

…[C++ only] in the type of a new expression.

>>> xr_role.NEW
<cs.xr_role new>
OCCURRENCE

Any occurrence of an enum symbol other than its definition.

>>> xr_role.OCCURRENCE
<cs.xr_role occurrence>
OTHER

For certain token kinds, indicates an occurrence for which no other applicable role was appropriate.

>>> xr_role.OTHER
<cs.xr_role other>
QUALIFIER

…[C++ only] as the first operand in a name qualifier expression A::B.

>>> xr_role.QUALIFIER
<cs.xr_role qualifier>
READ

…when its value is read.

>>> xr_role.READ
<cs.xr_role read>
REDEF

when #define'd twice or more with no intervening #undef.

>>> xr_role.REDEF
<cs.xr_role redefinition>
RETURN_TYPE

…as the return type in a function definition or declaration.

>>> xr_role.RETURN_TYPE
<cs.xr_role return type>
SIZEOF

…as the argument to sizeof().

>>> xr_role.SIZEOF
<cs.xr_role sizeof>
SUBCLASS

…[C++ only] as the superclass in a subclass declaration.

>>> xr_role.SUBCLASS
<cs.xr_role subclass>
TAG

…when defined using the same name as a tag.

>>> xr_role.TAG
<cs.xr_role tag>
TAKE_ADDRESS

…as the operand of an addressing expression &A.

>>> xr_role.TAKE_ADDRESS
<cs.xr_role take address>
TEMPLATE_PARAMETER

…[C++ only] as the type of a template value parameter.

>>> xr_role.TEMPLATE_PARAMETER
<cs.xr_role template parameter>
TEMPL_ARG

…[C++ only] as an argument for template instantiation.

>>> xr_role.TEMPL_ARG
<cs.xr_role template argument>
THROW_EXCEPTION_SPEC

…[C++ only] as the parameter type in a throw() expression.

>>> xr_role.THROW_EXCEPTION_SPEC
<cs.xr_role throw exception specifier>
TYPEDEF

…in the first operand of a typedef statement.

>>> xr_role.TYPEDEF
<cs.xr_role typedef>
UNDEF

…when undefined with #undef.

>>> xr_role.UNDEF
<cs.xr_role undefinition>
USING

…[C++ only] as the operand in a using namespace expression.

>>> xr_role.USING
<cs.xr_role using>
WRITE

…when written to.

>>> xr_role.WRITE
<cs.xr_role write>
WRITE_THROUGH

…when dereferenced and its target written to.

>>> xr_role.WRITE_THROUGH
<cs.xr_role write through>