Package rxpy :: Package alphabet :: Module ascii :: Class Ascii
[hide private]
[frames] | no frames]

Class Ascii

source code


Define character sets etc for ASCII strings. We could maybe extend or subclass this for Locale-dependent logic.

See base class for full documentation.

Instance Methods [hide private]
 
__init__(self)
min and max define the range of values that char_to_code will map characters to (inclusive).
source code
 
code_to_char(self, code)
Convert a code - an integer value between min and max, that maps the alphabet to a contiguous set of integers - to a character in the alphabet.
source code
 
char_to_code(self, char)
Convert a character in the alphabet to a code - an integer value between min and max, that maps the alphabet to a contiguous set of integers.
source code
 
coerce(self, char)
Force a character in str, unicode, or the alphabet itself, to be a member of the alphabet.
source code
 
join(self, *strings)
Construct a word in the alphabet, given a list of words and/or characters.
source code
 
to_str(self, char)
Display the character.
source code
 
digit(self, char)
Test whether the character is a digit or not.
source code
 
space(self, char)
Test whether the character is a whitespace or not.
source code
 
word(self, char)
Test whether the character is a word character or not.
source code
 
unpack(self, char, flags)
Return either (True, (lo, hi)) or (False, char)
source code
 
unescape(self, code)
By default, assume escape codes map to character codes.
source code

Inherited from base.BaseAlphabet: after, before

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
min and max define the range of values that char_to_code will map characters to (inclusive).
Overrides: object.__init__
(inherited documentation)

code_to_char(self, code)

source code 
Convert a code - an integer value between min and max, that maps the alphabet to a contiguous set of integers - to a character in the alphabet.
Overrides: base.BaseAlphabet.code_to_char
(inherited documentation)

char_to_code(self, char)

source code 
Convert a character in the alphabet to a code - an integer value between min and max, that maps the alphabet to a contiguous set of integers.
Overrides: base.BaseAlphabet.char_to_code
(inherited documentation)

coerce(self, char)

source code 
Force a character in str, unicode, or the alphabet itself, to be a member of the alphabet.
Overrides: base.BaseAlphabet.coerce
(inherited documentation)

join(self, *strings)

source code 
Construct a word in the alphabet, given a list of words and/or characters.
Overrides: base.BaseAlphabet.join
(inherited documentation)

to_str(self, char)

source code 

Display the character.

Note - this is the basis of hash and equality for intervals, so must be unique, repeatable, etc.

Overrides: base.BaseAlphabet.to_str

digit(self, char)

source code 
Test whether the character is a digit or not.
Overrides: base.BaseAlphabet.digit
(inherited documentation)

space(self, char)

source code 
Test whether the character is a whitespace or not.
Overrides: base.BaseAlphabet.space
(inherited documentation)

word(self, char)

source code 
Test whether the character is a word character or not.
Overrides: base.BaseAlphabet.word
(inherited documentation)

unpack(self, char, flags)

source code 
Return either (True, (lo, hi)) or (False, char)
Overrides: base.BaseAlphabet.unpack

unescape(self, code)

source code 
By default, assume escape codes map to character codes.
Overrides: base.BaseAlphabet.unescape
(inherited documentation)