Package aterm :: Module factory :: Class Factory
[frames] | no frames]

Class Factory




This class is responsible for make new terms, either by parsing from strings or streams, or via one the of the "make" methods.

Nested Classes
  __metaclass__
Metaclass for the Singleton design pattern.
Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
makeInt(self, value)
Creates a new integer literal term
 
makeReal(self, value)
Creates a new real literal term
 
makeStr(self, value)
Creates a new string literal term
 
makeNil(self)
Creates a new empty list term
 
makeCons(self, head, tail)
Creates a new extended list term
 
makeList(self, seq)
Creates a new list from a sequence.
 
makeTuple(self, args=None, annotations=None)
Creates a new tuple term
 
makeAppl(self, name, args=None, annotations=None)
Creates a new application term
 
coerce(self, value, name=None)
Coerce an object to a term.
 
readFromTextFile(self, fp)
Creates a new term by parsing from a text stream.
 
parse(self, buf)
Creates a new term by parsing a string.
 
match(self, pattern, term)
Matches the term to a string pattern and a list of arguments.
 
make(self, pattern, *args, **kargs)
Creates a new term from a string pattern and a list of arguments.

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

Class Variables
  MAX_PARSE_CACHE_LEN = 512
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

coerce(self, value, name=None)

 
Coerce an object to a term. Value must be an int, a float, a string, a sequence of terms, or a term.

make(self, pattern, *args, **kargs)

 
Creates a new term from a string pattern and a list of arguments. First the string pattern is parsed, then the holes in the pattern are filled with the supplied arguments.