Token Class

Inheritance diagram of Token

class Token

Token class.

Methods

count(...)
index((value, [start, ...) Raises ValueError if the value is not present.
test(expr) Test a token against a token expression.
test_any(*iterable) Test against multiple token expressions.

Attributes

lineno itemgetter(item, ...) –> itemgetter object
type itemgetter(item, ...) –> itemgetter object
value itemgetter(item, ...) –> itemgetter object

Descriptions

class Token

Method details

test(expr)

Test a token against a token expression. This can either be a token type or 'token_type:token_value'. This can only test against string values and types.

test_any(*iterable)

Test against multiple token expressions.

Attribute details

lineno

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

type

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

value

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After, f=itemgetter(2), the call f(r) returns r[2]. After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])

Inherited member details

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

Table Of Contents

Previous topic

Lexer Class

Next topic

TokenStream Class