Home | Trees | Index | Help |
|
---|
Package lemon :: Package external :: Package Cheetah :: Module Compiler :: Class GenUtils |
|
ClassCompiler
,
MethodCompiler
,
ModuleCompiler
An abstract baseclass for the Compiler classes that provides methods that perform generic utility functions or generate pieces of output code from information passed in by the Parser baseclass. These methods don't do any parsing themselves.
Method Summary | |
---|---|
Decipher a placeholder cachetoken... | |
genCacheInfoFromArgList(self,
argList)
| |
genCheetahVar(self,
nameChunks,
plain)
| |
Generate valid Python code for a Cheetah $var, using NameMapper (Unified Dotted Notation with the SearchList). | |
Generate Python code for a Cheetah $var without using NameMapper (Unified Dotted Notation with the SearchList). | |
genTimeInterval(self,
timeString)
| |
Unescape any escaped Cheetah \$vars in the string. | |
Unescape any escaped Cheetah \$vars in the string. |
Method Details |
---|
genCacheInfo(self, cacheToken)Decipher a placeholder cachetoken |
genNameMapperVar(self, nameChunks)Generate valid Python code for a Cheetah $var, using NameMapper (Unified Dotted Notation with the SearchList). nameChunks = list of var subcomponents represented as tuples [ (namemapperPart,autoCall,restOfName), ] where: namemapperPart = the dottedName base autocall = where NameMapper should use autocalling on namemapperPart restOfName = any arglist, index, or slice If restOfName contains a call arglist (e.g. '(1234)') then autocall is False, otherwise it defaults to True. It is overridden by the global setting 'useAutocalling' if this setting is False. EXAMPLE ------------------------------------------------------------------------ if the raw Cheetah Var is $a.b.c[1].d().x.y.z nameChunks is the list [ ('a.b.c',1,'[1]'), # A ('d',0,'()'), # B ('x.y.z',1,''), # C ] When this method is fed the list above it returns VFN(VFN(VFS(SL, 'a.b.c',1)[1], 'd',0)(), 'x.y.z',1) which can be represented as VFN(B` + [globals(), __builtin__], C[0], str(ACS and C[1]))C[2] where: ACS = self.setting('useAutocalling') = 1 in this example VFN = NameMapper.valueForName VFS = NameMapper.valueFromSearchList SL = self.searchList() A = ('a.b.c',1,'[1]') B = ('d',0,'()') C = ('x.y.z',1,'') B` = VFN(A`, B[0], str(ACS and B[1]))B[2] A` = VFS(SL + [globals(), __builtin__], A[0], str(ACS and A[1]))A[2] |
genPlainVar(self, nameChunks)Generate Python code for a Cheetah $var without using NameMapper (Unified Dotted Notation with the SearchList). |
unescapeCheetahVars(self, theString)Unescape any escaped Cheetah \$vars in the string. |
unescapeDirectives(self, theString)Unescape any escaped Cheetah \$vars in the string. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Mon Nov 10 15:07:53 2003 | http://epydoc.sf.net |