Back to index

enigmail  1.4.3
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
pymake.data.Expansion Class Reference

List of all members.

Public Member Functions

def __init__
def clone
def appendstr
def appendfunc
def concat
def isempty
def lstrip
def rstrip
def finish
def resolve
def resolvestr
def resolvesplit
def __repr__

Static Public Member Functions

def fromstring

Public Attributes

 loc
 hasfunc

Static Public Attributes

 simple = False

Static Private Attributes

tuple __slots__ = ('loc', 'hasfunc')

Detailed Description

A representation of expanded data, such as that for a recursively-expanded variable, a command, etc.

Definition at line 107 of file data.py.


Constructor & Destructor Documentation

def pymake.data.Expansion.__init__ (   self,
  loc = None 
)

Definition at line 115 of file data.py.

00115 
00116     def __init__(self, loc=None):
00117         # A list of (element, isfunc) tuples
00118         # element is either a string or a function
00119         self.loc = loc
00120         self.hasfunc = False


Member Function Documentation

Definition at line 215 of file data.py.

00215 
00216     def __repr__(self):
00217         return "<Expansion with elements: %r>" % ([e for e, isfunc in self],)

def pymake.data.Expansion.appendfunc (   self,
  func 
)

Definition at line 137 of file data.py.

00137 
00138     def appendfunc(self, func):
00139         assert isinstance(func, functions.Function)
00140         self.append((func, True))
00141         self.hasfunc = True

Here is the call graph for this function:

def pymake.data.Expansion.appendstr (   self,
  s 
)

Definition at line 130 of file data.py.

00130 
00131     def appendstr(self, s):
00132         assert isinstance(s, str)
00133         if s == '':
00134             return
00135 
00136         self.append((s, False))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 125 of file data.py.

00125 
00126     def clone(self):
00127         e = Expansion()
00128         e.extend(self)
00129         return e

def pymake.data.Expansion.concat (   self,
  o 
)
Concatenate the other expansion on to this one.

Definition at line 142 of file data.py.

00142 
00143     def concat(self, o):
00144         """Concatenate the other expansion on to this one."""
00145         if o.simple:
00146             self.appendstr(o.s)
00147         else:
00148             self.extend(o)
00149             self.hasfunc = self.hasfunc or o.hasfunc

Here is the call graph for this function:

Definition at line 181 of file data.py.

00181 
00182     def finish(self):
00183         if self.hasfunc:
00184             return self
00185 
00186         return StringExpansion(''.join([i for i, isfunc in self]), self.loc)

def pymake.data.Expansion.fromstring (   s,
  path 
) [static]

Definition at line 122 of file data.py.

00122 
00123     def fromstring(s, path):
00124         return StringExpansion(s, parserdata.Location(path, 1, 0))

Definition at line 150 of file data.py.

00150 
00151     def isempty(self):
00152         return (not len(self)) or self[0] == ('', False)

Strip leading literal whitespace from this expansion.

Definition at line 153 of file data.py.

00153 
00154     def lstrip(self):
00155         """Strip leading literal whitespace from this expansion."""
00156         while True:
00157             i, isfunc = self[0]
00158             if isfunc:
00159                 return
00160 
00161             i = i.lstrip()
00162             if i != '':
00163                 self[0] = i, False
00164                 return
00165 
00166             del self[0]

def pymake.data.Expansion.resolve (   self,
  makefile,
  variables,
  fd,
  setting = [] 
)
Resolve this variable into a value, by interpolating the value
of other variables.

@param setting (Variable instance) the variable currently
       being set, if any. Setting variables must avoid self-referential
       loops.

Definition at line 187 of file data.py.

00187 
00188     def resolve(self, makefile, variables, fd, setting=[]):
00189         """
00190         Resolve this variable into a value, by interpolating the value
00191         of other variables.
00192 
00193         @param setting (Variable instance) the variable currently
00194                being set, if any. Setting variables must avoid self-referential
00195                loops.
00196         """
00197         assert isinstance(makefile, Makefile)
00198         assert isinstance(variables, Variables)
00199         assert isinstance(setting, list)
00200 
00201         for e, isfunc in self:
00202             if isfunc:
00203                 e.resolve(makefile, variables, fd, setting)
00204             else:
00205                 assert isinstance(e, str)
00206                 fd.write(e)
                    

Here is the caller graph for this function:

def pymake.data.Expansion.resolvesplit (   self,
  makefile,
  variables,
  setting = [] 
)

Definition at line 212 of file data.py.

00212 
00213     def resolvesplit(self, makefile, variables, setting=[]):
00214         return self.resolvestr(makefile, variables, setting).split()

Here is the call graph for this function:

def pymake.data.Expansion.resolvestr (   self,
  makefile,
  variables,
  setting = [] 
)

Definition at line 207 of file data.py.

00207 
00208     def resolvestr(self, makefile, variables, setting=[]):
00209         fd = StringIO()
00210         self.resolve(makefile, variables, fd, setting)
00211         return fd.getvalue()

Here is the call graph for this function:

Here is the caller graph for this function:

Strip trailing literal whitespace from this expansion.

Definition at line 167 of file data.py.

00167 
00168     def rstrip(self):
00169         """Strip trailing literal whitespace from this expansion."""
00170         while True:
00171             i, isfunc = self[-1]
00172             if isfunc:
00173                 return
00174 
00175             i = i.rstrip()
00176             if i != '':
00177                 self[-1] = i, False
00178                 return
00179 
00180             del self[-1]


Member Data Documentation

tuple pymake.data.Expansion.__slots__ = ('loc', 'hasfunc') [static, private]

Definition at line 112 of file data.py.

Definition at line 119 of file data.py.

Definition at line 118 of file data.py.

Definition at line 113 of file data.py.


The documentation for this class was generated from the following file: