You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2012/08/07 03:50:40 UTC
svn commit: r1370098 [2/2] - in /incubator/ooo/symphony/trunk/main:
l10ntools/scripts/tool/ pyuno/ pyuno/demo/ pyuno/source/loader/
pyuno/source/module/ sc/workben/celltrans/ scripting/examples/python/
scripting/examples/python/pythonSamples/ scripting...
Modified: incubator/ooo/symphony/trunk/main/scripting/source/pyprov/pythonscript.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/scripting/source/pyprov/pythonscript.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/scripting/source/pyprov/pythonscript.py (original)
+++ incubator/ooo/symphony/trunk/main/scripting/source/pyprov/pythonscript.py Tue Aug 7 01:50:39 2012
@@ -152,7 +152,7 @@ class MyUriHelper:
else:
self.m_baseUri = expandUri( self.s_UriMap[location] )
self.m_scriptUriLocation = location
- log.isDebugLevel() and log.debug( "initialized urihelper with baseUri="+self.m_baseUri + ",m_scriptUriLocation="+self.m_scriptUriLocation )
+ log.debug( "initialized urihelper with baseUri="+self.m_baseUri + ",m_scriptUriLocation="+self.m_scriptUriLocation )
def getRootStorageURI( self ):
return self.m_baseUri
@@ -166,20 +166,20 @@ class MyUriHelper:
def storageURI2ScriptUri( self, storageURI ):
if not storageURI.startswith( self.m_baseUri ):
message = "pythonscript: storage uri '" + storageURI + "' not in base uri '" + self.m_baseUri + "'"
- log.isDebugLevel() and log.debug( message )
+ log.debug( message )
raise RuntimeException( message )
ret = "vnd.sun.star.script:" + \
storageURI[len(self.m_baseUri)+1:].replace("/","|") + \
"?language=" + LANGUAGENAME + "&location=" + self.m_scriptUriLocation
- log.isDebugLevel() and log.debug( "converting storageURI="+storageURI + " to scriptURI=" + ret )
+ log.debug( "converting storageURI="+storageURI + " to scriptURI=" + ret )
return ret
def scriptURI2StorageUri( self, scriptURI ):
try:
myUri = self.m_uriRefFac.parse(scriptURI)
ret = self.m_baseUri + "/" + myUri.getName().replace( "|", "/" )
- log.isDebugLevel() and log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + ret )
+ log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + ret )
return ret
except UnoException, e:
log.error( "error during converting scriptURI="+scriptURI + ": " + e.Message)
@@ -254,12 +254,12 @@ class ScriptContext(unohelper.Base):
# lastRead = sfa.getDateTimeModified( url )
# if entry:
# if hasChanged( entry.lastRead, lastRead ):
-# log.isDebugLevel() and log.debug("file " + url + " has changed, reloading")
+# log.debug("file " + url + " has changed, reloading")
# else:
# load = False
#
# if load:
-# log.isDebugLevel() and log.debug( "opening >" + url + "<" )
+# log.debug( "opening >" + url + "<" )
#
# code = readTextFromStream( sfa.openFileRead( url ) )
@@ -269,7 +269,7 @@ class ScriptContext(unohelper.Base):
# entry.module.__file__ = url
# exec code in entry.module.__dict__
# g_modules[ url ] = entry
-# log.isDebugLevel() and log.debug( "mapped " + url + " to " + str( entry.module ) )
+# log.debug( "mapped " + url + " to " + str( entry.module ) )
# return entry.module
class ProviderContext:
@@ -302,7 +302,7 @@ class ProviderContext:
def addPackageByUrl( self, url ):
packageName = self.getPackageNameFromUrl( url )
transientPart = self.getTransientPartFromUrl( url )
- log.isDebugLevel() and log.debug( "addPackageByUrl : " + packageName + ", " + transientPart + "("+url+")" + ", rootUrl="+self.rootUrl )
+ log.debug( "addPackageByUrl : " + packageName + ", " + transientPart + "("+url+")" + ", rootUrl="+self.rootUrl )
if self.mapPackageName2Path.has_key( packageName ):
package = self.mapPackageName2Path[ packageName ]
package.pathes = package.pathes + (url, )
@@ -329,7 +329,7 @@ class ProviderContext:
if self.rootUrl:
pos = len( self.rootUrl) +1
ret = url[0:pos]+url[url.find("/",pos)+1:len(url)]
- log.isDebugLevel() and log.debug( "getPersistentUrlFromStorageUrl " + url + " -> "+ ret)
+ log.debug( "getPersistentUrlFromStorageUrl " + url + " -> "+ ret)
return ret
def getStorageUrlFromPersistentUrl( self, url):
@@ -339,7 +339,7 @@ class ProviderContext:
packageName = url[pos:url.find("/",pos+1)]
package = self.mapPackageName2Path[ packageName ]
ret = url[0:pos]+ package.transientPathElement + "/" + url[pos:len(url)]
- log.isDebugLevel() and log.debug( "getStorageUrlFromPersistentUrl " + url + " -> "+ ret)
+ log.debug( "getStorageUrlFromPersistentUrl " + url + " -> "+ ret)
return ret
def getFuncsByUrl( self, url ):
@@ -374,12 +374,12 @@ class ProviderContext:
lastRead = self.sfa.getDateTimeModified( url )
if entry:
if hasChanged( entry.lastRead, lastRead ):
- log.isDebugLevel() and log.debug( "file " + url + " has changed, reloading" )
+ log.debug( "file " + url + " has changed, reloading" )
else:
load = False
if load:
- log.isDebugLevel() and log.debug( "opening >" + url + "<" )
+ log.debug( "opening >" + url + "<" )
src = readTextFromStream( self.sfa.openFileRead( url ) )
checkForPythonPathBesideScript( url[0:url.rfind('/')] )
@@ -397,7 +397,7 @@ class ProviderContext:
exec code in entry.module.__dict__
entry.module.__file__ = url
self.modules[ url ] = entry
- log.isDebugLevel() and log.debug( "mapped " + url + " to " + str( entry.module ) )
+ log.debug( "mapped " + url + " to " + str( entry.module ) )
return entry.module
#--------------------------------------------------
@@ -436,16 +436,16 @@ class ScriptBrowseNode( unohelper.Base,
elif name == "Editable" and ENABLE_EDIT_DIALOG:
ret = not self.provCtx.sfa.isReadOnly( self.uri )
- log.isDebugLevel() and log.debug( "ScriptBrowseNode.getPropertyValue called for " + name + ", returning " + str(ret) )
+ log.debug( "ScriptBrowseNode.getPropertyValue called for " + name + ", returning " + str(ret) )
except Exception,e:
log.error( "ScriptBrowseNode.getPropertyValue error " + lastException2String())
raise
return ret
def setPropertyValue( self, name, value ):
- log.isDebugLevel() and log.debug( "ScriptBrowseNode.setPropertyValue called " + name + "=" +str(value ) )
+ log.debug( "ScriptBrowseNode.setPropertyValue called " + name + "=" +str(value ) )
def getPropertySetInfo( self ):
- log.isDebugLevel() and log.debug( "ScriptBrowseNode.getPropertySetInfo called " )
+ log.debug( "ScriptBrowseNode.getPropertySetInfo called " )
return None
def getIntrospection( self ):
@@ -503,9 +503,9 @@ class ScriptBrowseNode( unohelper.Base,
out.writeBytes( toWrite )
out.close()
self.provCtx.sfa.kill( copyUrl )
-# log.isDebugLevel() and log.debug("Save is not implemented yet")
+# log.debug("Save is not implemented yet")
# text = self.editor.getControl("EditorTextField").getText()
-# log.isDebugLevel() and log.debug("Would save: " + text)
+# log.debug("Would save: " + text)
except Exception,e:
# TODO: add an error box here !
log.error( lastException2String() )
@@ -546,7 +546,7 @@ class FileBrowseNode( unohelper.Base, XB
ScriptBrowseNode(
self.provCtx, self.uri, self.name, i ))
ret = tuple( scriptNodeList )
- log.isDebugLevel() and log.debug( "returning " +str(len(ret)) + " ScriptChildNodes on " + self.uri )
+ log.debug( "returning " +str(len(ret)) + " ScriptChildNodes on " + self.uri )
except Exception, e:
text = lastException2String()
log.error( "Error while evaluating " + self.uri + ":" + text )
@@ -575,16 +575,16 @@ class DirBrowseNode( unohelper.Base, XBr
def getChildNodes( self ):
try:
- log.isDebugLevel() and log.debug( "DirBrowseNode.getChildNodes called for " + self.rootUrl )
+ log.debug( "DirBrowseNode.getChildNodes called for " + self.rootUrl )
contents = self.provCtx.sfa.getFolderContents( self.rootUrl, True )
browseNodeList = []
for i in contents:
if i.endswith( ".py" ):
- log.isDebugLevel() and log.debug( "adding filenode " + i )
+ log.debug( "adding filenode " + i )
browseNodeList.append(
FileBrowseNode( self.provCtx, i, i[i.rfind("/")+1:len(i)-3] ) )
elif self.provCtx.sfa.isFolder( i ) and not i.endswith("/pythonpath"):
- log.isDebugLevel() and log.debug( "adding DirBrowseNode " + i )
+ log.debug( "adding DirBrowseNode " + i )
browseNodeList.append( DirBrowseNode( self.provCtx, i[i.rfind("/")+1:len(i)],i))
return tuple( browseNodeList )
except Exception, e:
@@ -675,18 +675,18 @@ class DummyInteractionHandler( unohelper
def __init__( self ):
pass
def handle( self, event):
- log.isDebugLevel() and log.debug( "pythonscript: DummyInteractionHandler.handle " + str( event ) )
+ log.debug( "pythonscript: DummyInteractionHandler.handle " + str( event ) )
class DummyProgressHandler( unohelper.Base, XProgressHandler ):
def __init__( self ):
pass
def push( self,status ):
- log.isDebugLevel() and log.debug( "pythonscript: DummyProgressHandler.push " + str( status ) )
+ log.debug( "pythonscript: DummyProgressHandler.push " + str( status ) )
def update( self,status ):
- log.isDebugLevel() and log.debug( "pythonscript: DummyProgressHandler.update " + str( status ) )
+ log.debug( "pythonscript: DummyProgressHandler.update " + str( status ) )
def pop( self ):
- log.isDebugLevel() and log.debug( "pythonscript: DummyProgressHandler.push " + str( event ) )
+ log.debug( "pythonscript: DummyProgressHandler.push " + str( event ) )
class CommandEnvironment(unohelper.Base, XCommandEnvironment):
def __init__( self ):
@@ -702,9 +702,9 @@ class CommandEnvironment(unohelper.Base,
# def __init__( self ):
# pass
# def modified( self, event ):
-# log.isDebugLevel() and log.debug( "pythonscript: ModifyListener.modified " + str( event ) )
+# log.debug( "pythonscript: ModifyListener.modified " + str( event ) )
# def disposing( self, event ):
-# log.isDebugLevel() and log.debug( "pythonscript: ModifyListener.disposing " + str( event ) )
+# log.debug( "pythonscript: ModifyListener.disposing " + str( event ) )
def mapStorageType2PackageContext( storageType ):
ret = storageType
@@ -721,13 +721,13 @@ def getPackageName2PathMap( sfa, storage
packageManager = packageManagerFactory.getPackageManager(
mapStorageType2PackageContext(storageType))
# packageManager.addModifyListener( ModifyListener() )
- log.isDebugLevel() and log.debug( "pythonscript: getPackageName2PathMap start getDeployedPackages" )
+ log.debug( "pythonscript: getPackageName2PathMap start getDeployedPackages" )
packages = packageManager.getDeployedPackages(
packageManager.createAbortChannel(), CommandEnvironment( ) )
- log.isDebugLevel() and log.debug( "pythonscript: getPackageName2PathMap end getDeployedPackages (" + str(len(packages))+")" )
+ log.debug( "pythonscript: getPackageName2PathMap end getDeployedPackages (" + str(len(packages))+")" )
for i in packages:
- log.isDebugLevel() and log.debug( "inspecting package " + i.Name + "("+i.Identifier.Value+")" )
+ log.debug( "inspecting package " + i.Name + "("+i.Identifier.Value+")" )
transientPathElement = penultimateElement( i.URL )
j = expandUri( i.URL )
pathes = getPathesFromPackage( j, sfa )
@@ -785,7 +785,7 @@ class PythonScript( unohelper.Base, XScr
self.func = func
self.mod = mod
def invoke(self, args, out, outindex ):
- log.isDebugLevel() and log.debug( "PythonScript.invoke " + str( args ) )
+ log.debug( "PythonScript.invoke " + str( args ) )
try:
ret = self.func( *args )
except UnoException,e:
@@ -794,7 +794,7 @@ class PythonScript( unohelper.Base, XScr
complete = "Error during invoking function " + \
str(self.func.__name__) + " in module " + \
self.mod.__file__ + " (" + text + ")"
- log.isDebugLevel() and log.debug( complete )
+ log.debug( complete )
# some people may beat me up for modifying the exception text,
# but otherwise office just shows
# the type name and message text with no more information,
@@ -807,9 +807,9 @@ class PythonScript( unohelper.Base, XScr
complete = "Error during invoking function " + \
str(self.func.__name__) + " in module " + \
self.mod.__file__ + " (" + text + ")"
- log.isDebugLevel() and log.debug( complete )
+ log.debug( complete )
raise RuntimeException( complete , self )
- log.isDebugLevel() and log.debug( "PythonScript.invoke ret = " + str( ret ) )
+ log.debug( "PythonScript.invoke ret = " + str( ret ) )
return ret, (), ()
def expandUri( uri ):
@@ -843,10 +843,10 @@ class PythonScriptProvider( unohelper.Ba
# urlHelper = ctx.ServiceManager.createInstanceWithArgumentsAndContext(
# "com.sun.star.script.provider.ScriptURIHelper", (LANGUAGENAME, storageType), ctx)
urlHelper = MyUriHelper( ctx, storageType )
- log.isDebugLevel() and log.debug( "got urlHelper " + str( urlHelper ) )
+ log.debug( "got urlHelper " + str( urlHelper ) )
rootUrl = expandUri( urlHelper.getRootStorageURI() )
- log.isDebugLevel() and log.debug( storageType + " transformed to " + rootUrl )
+ log.debug( storageType + " transformed to " + rootUrl )
ucbService = "com.sun.star.ucb.SimpleFileAccess"
sfa = ctx.ServiceManager.createInstanceWithContext( ucbService, ctx )
@@ -887,20 +887,20 @@ class PythonScriptProvider( unohelper.Ba
def getScript( self, scriptUri ):
try:
- log.isDebugLevel() and log.debug( "getScript " + scriptUri + " invoked")
+ log.debug( "getScript " + scriptUri + " invoked")
storageUri = self.provCtx.getStorageUrlFromPersistentUrl(
self.provCtx.uriHelper.getStorageURI(scriptUri) );
- log.isDebugLevel() and log.debug( "getScript: storageUri = " + storageUri)
+ log.debug( "getScript: storageUri = " + storageUri)
fileUri = storageUri[0:storageUri.find( "$" )]
funcName = storageUri[storageUri.find( "$" )+1:len(storageUri)]
mod = self.provCtx.getModuleByUrl( fileUri )
- log.isDebugLevel() and log.debug( " got mod " + str(mod) )
+ log.debug( " got mod " + str(mod) )
func = mod.__dict__[ funcName ]
- log.isDebugLevel() and log.debug( "got func " + str( func ) )
+ log.debug( "got func " + str( func ) )
return PythonScript( func, mod )
except Exception, e:
text = lastException2String()
Modified: incubator/ooo/symphony/trunk/main/solenv/bin/pchdelta.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/solenv/bin/pchdelta.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/solenv/bin/pchdelta.py (original)
+++ incubator/ooo/symphony/trunk/main/solenv/bin/pchdelta.py Tue Aug 7 01:50:39 2012
@@ -1,10 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Hacky little delta debug tool to figure out the proper includes for a pch file
#
# Usage:
-#
+#
# pchdelta.py <pch_target> <dir1> [<dir2> <dir3> ...]
#
# <pch_target> File to perform delta debugging on. The section to test
@@ -61,7 +61,7 @@ def writePch(pchname, header, footer, ac
outputfile.write(MARKER)
outputfile.write(footer)
outputfile.close()
-
+
# ------------------------------------------------------------------------------
# Recursive tester routine. Test the segment given and if an error is
@@ -144,6 +144,3 @@ if not testSequenceBuild(dirlist):
print "Starting evaluation of " + str(len(lines)) + " lines"
acceptedlines = binaryTest(dirlist, lines, pchname, header, footer, [], "", 0)
writePch(pchname, header, footer, acceptedlines, [])
-
-
-
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/boxer.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/boxer.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/boxer.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/boxer.py Tue Aug 7 01:50:39 2012
@@ -17,11 +17,9 @@ class DlgLayoutBuilder(object):
def build (self):
root = Element('vbox')
- ys = self.rows.keys()
- ys.sort()
+ ys = sorted(self.rows.keys())
for y in ys:
- xs = self.rows[y].keys()
- xs.sort()
+ xs = sorted(self.rows[y].keys())
if len(xs) == 1:
root.appendChild(self.rows[y][xs[0]])
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/expression.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/expression.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/expression.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/expression.py Tue Aug 7 01:50:39 2012
@@ -105,7 +105,3 @@ class ExpParser(object):
def dumpTree (self):
self.jumpToRoot()
print toString(self.ptr)
-
-
-
-
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/globals.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/globals.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/globals.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/globals.py Tue Aug 7 01:50:39 2012
@@ -1,6 +1,6 @@
import sys
-class ParseError (Exception):
+class ParseError (Exception):
pass
def error (msg, exit=0):
@@ -80,7 +80,7 @@ class Element(Node):
chars += '>'
for child in self.getChildren():
chars += child.dump(level+1)
-
+
chars += "\n"+Element.INDENT*level
chars += "</%s>"%self.name
@@ -107,8 +107,7 @@ class Element(Node):
def __dumpAttrs (self):
text = ''
- keys = self.attrs.keys()
- keys.sort()
+ keys = sorted(self.attrs.keys())
for key in keys:
value = self.attrs[key]
text += ' %s="%s"'%(key, value)
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/macroparser.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/macroparser.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/macroparser.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/macroparser.py Tue Aug 7 01:50:39 2012
@@ -12,7 +12,7 @@ class MacroParser(object):
def parse (self):
"""
-A macro with arguments must have its open paren immediately following
+A macro with arguments must have its open paren immediately following
its name without any whitespace.
"""
if self.debug:
@@ -45,7 +45,7 @@ its name without any whitespace.
def parseArgs (self, buffer):
"""Parse arguments.
-The buffer is expected to be formatted like '(a, b, c)' where the first
+The buffer is expected to be formatted like '(a, b, c)' where the first
character is the open paren.
"""
scope = 0
@@ -105,7 +105,7 @@ character is the open paren.
self.macro.tokens = mclexer.getTokens()
if self.debug:
print self.macro.tokens
-
+
if not self.isValidMacro(self.macro):
self.macro = None
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/src2xml.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/src2xml.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/src2xml.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/src2xml.py Tue Aug 7 01:50:39 2012
@@ -25,7 +25,7 @@ Examples:
def format_examples (self):
return examples
-
+
if 'epilog' in p.__dict__:
p.formatter.format_epilog = format_examples
p.epilog = examples
@@ -222,6 +222,6 @@ def main ():
dry_one_file (f, options)
else:
do_one_file (f, options)
-
+
if __name__ == '__main__':
main ()
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srclexer.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srclexer.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srclexer.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srclexer.py Tue Aug 7 01:50:39 2012
@@ -34,7 +34,7 @@ def dumpTokens (tokens, toError=False):
indent = " "
line = ''
chars = ''
-
+
for token in tokens:
if token in '{<':
if len(line) > 0:
@@ -77,7 +77,7 @@ class HeaderData(object):
class SrcLexer(object):
"""Lexicographical analyzer for .src format.
-The role of a lexer is to parse the source file and break it into
+The role of a lexer is to parse the source file and break it into
appropriate tokens. Such tokens are later passed to a parser to
build the syntax tree.
"""
@@ -161,7 +161,7 @@ build the syntax tree.
if item != SrcLexer.VISIBLE:
return False
return True
-
+
def tokenize (self):
self.init()
@@ -202,8 +202,7 @@ build the syntax tree.
if not self.parentLexer and self.debug:
progress ("-"*68 + "\n")
progress ("All defines found in this translation unit:\n")
- keys = self.defines.keys()
- keys.sort()
+ keys = sorted(self.defines.keys())
for key in keys:
progress ("@ %s\n"%key)
@@ -343,7 +342,7 @@ build the syntax tree.
return eval(buf)
except:
return True
-
+
def handleMacroDefine (self, buf):
mparser = macroparser.MacroParser(buf)
@@ -378,7 +377,7 @@ build the syntax tree.
if not headerPath:
error("included header file " + headerSub + " not found\n", self.stopOnHeader)
return
-
+
if self.debug:
progress ("%s found\n"%headerPath)
Modified: incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srcparser.py
URL: http://svn.apache.org/viewvc/incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srcparser.py?rev=1370098&r1=1370097&r2=1370098&view=diff
==============================================================================
--- incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srcparser.py (original)
+++ incubator/ooo/symphony/trunk/main/toolkit/src2xml/source/srcparser.py Tue Aug 7 01:50:39 2012
@@ -3,7 +3,7 @@ from globals import *
import srclexer
# simple name translation map
-postTransMap = {"ok-button": "okbutton",
+postTransMap = {"ok-button": "okbutton",
"cancel-button": "cancelbutton",
"help-button": "helpbutton"}
@@ -118,11 +118,11 @@ class MacroExpander(object):
def parseValues (self):
"""Parse tokens to get macro function variable values.
-Be aware that there is an implicit quotes around the text between the open
-paren, the comma(s), and the close paren. For instance, if a macro is defined
-as FOO(a, b) and is used as FOO(one two three, and four), then the 'a' must be
-replaced with 'one two three', and the 'b' replaced with 'and four'. In other
-words, whitespace does not end a token.
+Be aware that there is an implicit quotes around the text between the open
+paren, the comma(s), and the close paren. For instance, if a macro is defined
+as FOO(a, b) and is used as FOO(one two three, and four), then the 'a' must be
+replaced with 'one two three', and the 'b' replaced with 'and four'. In other
+words, whitespace does not end a token.
"""
values = []
@@ -229,17 +229,17 @@ This is the main loop for the parser. T
# Token Handlers
"""
-Each token handler takes the current token position and returns the position
-of the last token processed. For the most part, the current token position
-and the last processed token are one and the same, in which case the handler
-can simply return the position value it receives without incrementing it.
-
-If you need to read ahead to process more tokens than just the current token,
-make sure that the new token position points to the last token that has been
-processed, not the next token that has not yet been processed. This is
-because the main loop increments the token position when it returns from the
+Each token handler takes the current token position and returns the position
+of the last token processed. For the most part, the current token position
+and the last processed token are one and the same, in which case the handler
+can simply return the position value it receives without incrementing it.
+
+If you need to read ahead to process more tokens than just the current token,
+make sure that the new token position points to the last token that has been
+processed, not the next token that has not yet been processed. This is
+because the main loop increments the token position when it returns from the
handler.
-"""
+"""
# assignment token '='
def assignment (self, i):
@@ -251,7 +251,7 @@ handler.
self.tokenBuf = []
return i
-
+
# open brace token '{'
def openBrace (self, i):
bufSize = len(self.tokenBuf)
@@ -305,11 +305,11 @@ handler.
if len(self.tokenBuf) == 0:
pass
elif scope == 0:
- # We are not supposed to have any statment in global scope.
+ # We are not supposed to have any statment in global scope.
# Just ignore this statement.
pass
else:
- # Statement within a scope. Import it as an attribute for the
+ # Statement within a scope. Import it as an attribute for the
# current element.
elem = self.elementStack[-1]
@@ -412,5 +412,3 @@ handler.
raise ParseError ('')
return eval(values[0]), eval(values[1])
-
-