Package lepl :: Package regexp :: Module str :: Class StrAlphabet
[hide private]
[frames] | no frames]

Class StrAlphabet

source code


Support for alphabets.
Instance Methods [hide private]
 
__init__(self, min_, max_, escape='\\', escaped=ILLEGAL, illegal=ILLEGAL, range=None, parser_factory=make_str_parser)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
escape(self) source code
 
escaped(self) source code
 
illegal(self) source code
 
range(self) source code
 
_escape_char(self, char)
Escape a character if necessary.
source code
 
_no_parens(self, children)
Returns True of no parens are needed around this when fmtting.
source code
 
fmt_intervals(self, intervals)
Hide unicode chars because of some strange error that occurs with Python2.6 on the command line.
source code
 
fmt_sequence(self, children)
Generate a string representation of a sequence.
source code
 
fmt_repeat(self, children)
Generate a string representation of a repetition.
source code
 
fmt_choice(self, children)
Generate a string representation of a choice.
source code
 
fmt_option(self, children)
Generate a string representation of an option.
source code
 
fmt_label(self, label, child)
Generate a string representation of labelled options.
source code
 
join(self, chars)
Join characters together.
source code
 
from_char(self, char)
This must convert a single character.
source code
 
parse(self, regexp)
Generate a Sequence from the given text.
source code

Inherited from core.Alphabet: after, before, extension, invert, max, min

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, min_, max_, escape='\\', escaped=ILLEGAL, illegal=ILLEGAL, range=None, parser_factory=make_str_parser)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

escape(self)

source code 
Decorators:
  • @property

escaped(self)

source code 
Decorators:
  • @property

illegal(self)

source code 
Decorators:
  • @property

range(self)

source code 
Decorators:
  • @property

fmt_intervals(self, intervals)

source code 

Hide unicode chars because of some strange error that occurs with Python2.6 on the command line.

This is in StrAlphabet, but for ASCII makes no difference. Having it here helps LineAwareAlphabet work (the whole idea of subclassing alphabets etc is not so great).

Overrides: core.Alphabet.fmt_intervals

fmt_sequence(self, children)

source code 

Generate a string representation of a sequence.

This must fully describe the data in the children (it is used to hash the data).

Overrides: core.Alphabet.fmt_sequence

fmt_repeat(self, children)

source code 

Generate a string representation of a repetition.

This must fully describe the data in the children (it is used to hash the data).

Overrides: core.Alphabet.fmt_repeat

fmt_choice(self, children)

source code 

Generate a string representation of a choice.

This must fully describe the data in the children (it is used to hash the data).

Overrides: core.Alphabet.fmt_choice

fmt_option(self, children)

source code 

Generate a string representation of an option.

This must fully describe the data in the children (it is used to hash the data).

Overrides: core.Alphabet.fmt_option

fmt_label(self, label, child)

source code 

Generate a string representation of labelled options.

This must fully describe the data in the children (it is used to hash the data).

Overrides: core.Alphabet.fmt_label

join(self, chars)

source code 
Join characters together.
Overrides: core.Alphabet.join

parse(self, regexp)

source code 
Generate a Sequence from the given text.
Overrides: core.Alphabet.parse