Author: pfg
Date: Tue Jul 31 22:46:38 2012
New Revision: 1367810

URL: http://svn.apache.org/viewvc?rev=1367810&view=rev
Log:
Python reindent.

Modified:
    incubator/ooo/trunk/main/l10ntools/scripts/tool/const.py
    incubator/ooo/trunk/main/l10ntools/scripts/tool/l10ntool.py
    incubator/ooo/trunk/main/l10ntools/scripts/tool/pseudo.py
    incubator/ooo/trunk/main/l10ntools/scripts/tool/sdf.py
    incubator/ooo/trunk/main/l10ntools/scripts/tool/xhtex.py
    incubator/ooo/trunk/main/l10ntools/scripts/tool/xtxex.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/expression.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/globals.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/macroparser.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/src2xml.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/srclexer.py
    incubator/ooo/trunk/main/toolkit/src2xml/source/srcparser.py

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/const.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/const.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/const.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/const.py Tue Jul 31 
22:46:38 2012
@@ -29,5 +29,3 @@ class _const:
 
 import sys
 sys.modules[__name__] = _const()
-
-

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/l10ntool.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/l10ntool.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/l10ntool.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/l10ntool.py Tue Jul 31 
22:46:38 2012
@@ -30,9 +30,9 @@ import shutil
 class AbstractL10nTool:
     _options            = {}
     _args               = ""
-    _resource_type      = "" 
+    _resource_type      = ""
     _source_language    = "en-US"
-   
+
     ##### Implement these abstract methods
 
     ##### Nameing scheme for the output files
@@ -58,9 +58,9 @@ class AbstractL10nTool:
     ################### Extract a single File 
######################################################
     def extract_file(self, inputfile):
         pass
-    
+
     
################################################################################################
-     
+
     def format_outputfile(self, filename, language):
         extension = filename[filename.rfind('.')+1:]
         file = filename[:filename.rfind('.')]
@@ -78,26 +78,26 @@ class AbstractL10nTool:
             return ""
         else:
             return 
self._options.outputfile[:self._options.outputfile.rfind('/')]
-            
+
     def merge(self,  sdfdata):
         langset,forcedset, foundset = PseudoSet(), PseudoSet() , PseudoSet()
 
-        if self._options.languages:       
-            langset = PseudoSet(self._options.languages)  
-        if self._options.forcedlanguages: 
-            forcedset = PseudoSet(self._options.forcedlanguages) 
-        if sdfdata.get_languages_found_in_sdf(): 
-            foundset = sdfdata.get_languages_found_in_sdf() 
-    
-        if self.has_multi_inputfiles(): 
+        if self._options.languages:
+            langset = PseudoSet(self._options.languages)
+        if self._options.forcedlanguages:
+            forcedset = PseudoSet(self._options.forcedlanguages)
+        if sdfdata.get_languages_found_in_sdf():
+            foundset = sdfdata.get_languages_found_in_sdf()
+
+        if self.has_multi_inputfiles():
             filelist = self.read_inputfile_list()
         else:
             filelist = self._options.inputfile
-            
+
         for inputfile in filelist:
             ref = self.parse_file(inputfile)
             # Don't write that files if there is no l10n present
-            if ((langset & foundset) - forcedset):  # all langs given and 
found in sdf without enforced 
+            if ((langset & foundset) - forcedset):  # all langs given and 
found in sdf without enforced
                 [self.merge_file(inputfile,self.format_outputfile(inputfile, 
lang), ref, lang, False, sdfdata) for lang in ((langset & foundset) - 
forcedset)]
             # Always write those files even if there is no l10n available
             if forcedset: # all enforced langs
@@ -105,15 +105,15 @@ class AbstractL10nTool:
             # In case a big file have to be written
             if ((langset & foundset) | forcedset): # all langs given ,found in 
sdf and enforced ones
                 self.merge_one_big_file(inputfile, 
self.format_outputfile(inputfile, lang), ref, ((langset & foundset) | 
forcedset), sdfdata)
-    
-    def has_multi_inputfiles(self): 
+
+    def has_multi_inputfiles(self):
         return self._options.inputfile[0] == '@'
 
     def copy_file(self, inputfilename, outputfilename):
-        try: 
+        try:
             os.remove(outputfilename)
         except:
-            pass    
+            pass
 
         try:
             os.remove(outputfilename)
@@ -125,7 +125,7 @@ class AbstractL10nTool:
         except IOError:
             print "ERROR: Can not copy file '" + inputfilename + "' to " + "'" 
+ outputfilename + "'"
             sys.exit(-1)
-    
+
     def extract(self):
         try:
             f = open(self._options.outputfile, "w+")
@@ -134,7 +134,7 @@ class AbstractL10nTool:
             print "ERROR: Can not write file " + self._options.outputfile
         else:
             f.close()
-            
+
     # Parse the common options
     def parse_options(self):
         parser = OptionParser()
@@ -147,19 +147,19 @@ class AbstractL10nTool:
         parser.add_option("-r", "--projectroot",     dest="project_root",    
metavar="PATH", help=""                              )
         parser.add_option("-f", "--forcedlanguages", dest="forcedlanguages", 
metavar="ISOCODE[,ISOCODE]", help="Always merge those langs even if no l10n is 
available for those langs" )
         parser.add_option("-l", "--languages",       dest="languages",       
metavar="ISOCODE[,ISOCODE]", help="Merge those langs if l10n is found for each")
-        parser.add_option("-s", "--pattern",         dest="pattern",         
metavar="", help=""                                  )        
+        parser.add_option("-s", "--pattern",         dest="pattern",         
metavar="", help=""                                  )
         parser.add_option("-q", "--quiet",           action="store_true",    
dest="quietmode", help="",default=False)
         (self._options, self.args) = parser.parse_args()
-        
+
         # -l "de,pr,pt-BR" => [ "de" , "pt" , "pt-BR" ]
         parse_complex_arg = lambda arg: arg.split(",")
-        
-        if self._options.forcedlanguages: 
-            self._options.forcedlanguages = 
parse_complex_arg(self._options.forcedlanguages) 
-        if self._options.languages:       
-            self._options.languages = 
parse_complex_arg(self._options.languages) 
+
+        if self._options.forcedlanguages:
+            self._options.forcedlanguages = 
parse_complex_arg(self._options.forcedlanguages)
+        if self._options.languages:
+            self._options.languages = 
parse_complex_arg(self._options.languages)
         self.test_options()
-        
+
     def __init__(self):
         self.parse_options()
         if self._options.input_sdf_file != None and 
len(self._options.input_sdf_file):
@@ -183,7 +183,7 @@ class AbstractL10nTool:
             except IOError:
                 print "Error: Can not create dir " + dir
                 sys.exit(-1)
-            
+
     def test_options(self):
         opt = self._options
         is_valid = lambda x: x != None and len(x) > 0
@@ -193,7 +193,7 @@ class AbstractL10nTool:
                 ( is_valid(opt.inputfile) and is_valid(opt.outputFile)) ))))
         print "Strange options ..."
         sys.exit( -1 )
-                     
+
     def read_inputfile_list(self):
         if self.has_multi_inputfiles():
             lines = []
@@ -206,9 +206,8 @@ class AbstractL10nTool:
             else:
                 f.close()
             return lines
-        
+
     def get_filename_string(self, inputfile):
         absfile = os.path.realpath(os.path.abspath(inputfile))
-        absroot = 
os.path.realpath(os.path.abspath(self._options.project_root)) 
+        absroot = os.path.realpath(os.path.abspath(self._options.project_root))
         return absfile[len(absroot)+1:].replace('/','\\')
-    

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/pseudo.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/pseudo.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/pseudo.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/pseudo.py Tue Jul 31 
22:46:38 2012
@@ -19,12 +19,12 @@
 #  
 #**************************************************************
 
-# to support macosx baseline machines from Cretaceous period 
+# to support macosx baseline machines from Cretaceous period
 
 # incomplete set() class implementation of Python 2.4
 class PseudoSet:
     _list = []
-   
+
     def __str__(self):
         return str(self._list)
 
@@ -56,10 +56,10 @@ class PseudoSet:
             return PseudoSet(tmplist)
         else:
             print "__and__(None)"
-                    
+
     def __iter__(self):
         return self._list.__iter__()
-    
+
     def __items__(self):
         return self._list.items()
 
@@ -67,16 +67,16 @@ class PseudoSet:
         return keys(self._list)
 
     def _remove_dupes(self, list):
-        tmpdict = {} 
+        tmpdict = {}
         for key in list:
             tmpdict[key] = 1
         return tmpdict.keys()
 
-# incomplete OrderedDict() class implementation 
+# incomplete OrderedDict() class implementation
 class PseudoOrderedDict(dict):
     _keylist        = []
     _valuelist      = []
-    
+
     def __init__(self, defaults={}):
         dict.__init__(self)
         for n,v in defaults.items():
@@ -86,7 +86,7 @@ class PseudoOrderedDict(dict):
         self._keylist.append(key)
         self._valuelist.append(value)
         return dict.__setitem__(self, key, value)
-        
+
     def __delattr__(self, key):
         self._keylist.__delattr__(key)
         self._valuelist.__delattr__(dict[key])
@@ -96,17 +96,17 @@ class PseudoOrderedDict(dict):
         self._keylist.__delitem__(key)
         self._valuelist.__delitem__(dict[key])
         return dict.__delitem__(self, key)
-        
+
     def __iter__(self):
         raise NotImplementedError("__iter__")
-    
+
     def __iterkeys__(self):
         return self._keylist
-    
+
     def iteritems(self):
         #return self._valuelist
         return zip(self._keylist, self._valuelist)
-   
+
     def items(self):
         return zip(self._keylist,self._valuelist)
 
@@ -118,15 +118,15 @@ class PseudoOrderedDict(dict):
 
     def __keysattr__(self):
         return self._keylist
-    
+
     def pop(self, key):
         self._keylist.pop(key)
         self._valuelist.pop(key)
         return dict.__pop__(self, key)
-    
+
     def popitem(self):
         raise NotImplementedError("popitem")
-    
+
 def _testdriver_set():
     list, list1 = [] ,[]
     list.append("a")

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/sdf.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/sdf.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/sdf.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/sdf.py Tue Jul 31 22:46:38 
2012
@@ -26,35 +26,35 @@ class SdfData:
     _filename        = "";
     _dict            = PseudoOrderedDict()
     _languages_found = [];
-    
+
     def __init__ (self, filename=""):
         self._filename = filename
-    
+
     def __getitem__(self, key):
         if self._dict.has_key(key):
             return self._dict[key]
         else:
             return None
-    
+
     def has_key(self, key):
         return self._dict.has_key(key)
-    
+
     def __setitem__(self, key, value):
         self._dict[key] = value
-    
+
     def get_languages_found_in_sdf(self):
         return PseudoSet(self._languages_found)
 
     def read(self):
         try:
             f = open(self._filename, "r")
-            lines = [line.rstrip('\n') for line in f.readlines()] 
+            lines = [line.rstrip('\n') for line in f.readlines()]
         except IOError:
             print "ERROR: Trying to read "+ self._filename
             raise
         else:
             f.close()
-        for line in lines:        
+        for line in lines:
             entity = SdfEntity()
             entity.set_properties(line)
             self._dict[entity.get_id()] = entity
@@ -62,7 +62,7 @@ class SdfData:
 
     def write(self, filename):
         try:
-            f = open(filename, "w+") 
+            f = open(filename, "w+")
             for value in self._dict.itervalues():
                 #f.write( repr(value)+"\n" )
                 f.write(value + "\n")
@@ -73,7 +73,7 @@ class SdfData:
             f.close()
 
 import sys
-class SdfEntity: 
+class SdfEntity:
     # Sdf format columns
     project         = ""
     source_file     = ""
@@ -90,7 +90,7 @@ class SdfEntity: 
     quickhelptext   = ""
     title           = ""
     date            = ""
-    
+
     import const
     const._PROJECT_POS         = 0
     const._SOURCE_FILE_POS     = 1
@@ -107,8 +107,8 @@ class SdfEntity: 
     const._QUICKHELPTEXT_POS   = 12
     const._TITLE_POS           = 13
     const._DATE_POS            = 14
-        
-    def __init__(self, project="", source_file="", dummy1="0", 
resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", 
langid="", 
+
+    def __init__(self, project="", source_file="", dummy1="0", 
resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="",
                        text="", helptext="", quickhelptext="", title="", 
date=""):
         self.project        = project;
         self.source_file    = source_file;
@@ -133,32 +133,32 @@ class SdfEntity: 
     def set_properties(self, line):
         splitted = line.split("\t")
         if len(splitted) == 15:
-            self.project        = splitted[ self.const._PROJECT_POS ]          
   
-            self.source_file    = splitted[ self.const._SOURCE_FILE_POS ]     
-            self.dummy1         = splitted[ self.const._DUMMY1_POS ]         
-            self.resource_type  = splitted[ self.const._RESOURCE_TYPE_POS ] 
-            self.gid            = splitted[ self.const._GID_POS ]             
-            self.lid            = splitted[ self.const._LID_POS ]             
-            self.helpid         = splitted[ self.const._HELPID_POS ]         
-            self.platform       = splitted[ self.const._PLATFORM_POS ]         
-            self.dummy2         = splitted[ self.const._DUMMY2_POS ]         
-            self.langid         = splitted[ self.const._LANGID_POS ]         
-            self.text           = splitted[ self.const._TEXT_POS ]             
-            self.helptext       = splitted[ self.const._HELPTEXT_POS ]         
-            self.quickhelptext  = splitted[ self.const._QUICKHELPTEXT_POS ] 
-            self.title          = splitted[ self.const._TITLE_POS ]         
-            self.date           = splitted[ self.const._DATE_POS ]            
+            self.project        = splitted[ self.const._PROJECT_POS ]
+            self.source_file    = splitted[ self.const._SOURCE_FILE_POS ]
+            self.dummy1         = splitted[ self.const._DUMMY1_POS ]
+            self.resource_type  = splitted[ self.const._RESOURCE_TYPE_POS ]
+            self.gid            = splitted[ self.const._GID_POS ]
+            self.lid            = splitted[ self.const._LID_POS ]
+            self.helpid         = splitted[ self.const._HELPID_POS ]
+            self.platform       = splitted[ self.const._PLATFORM_POS ]
+            self.dummy2         = splitted[ self.const._DUMMY2_POS ]
+            self.langid         = splitted[ self.const._LANGID_POS ]
+            self.text           = splitted[ self.const._TEXT_POS ]
+            self.helptext       = splitted[ self.const._HELPTEXT_POS ]
+            self.quickhelptext  = splitted[ self.const._QUICKHELPTEXT_POS ]
+            self.title          = splitted[ self.const._TITLE_POS ]
+            self.date           = splitted[ self.const._DATE_POS ]
 
     def get_file_id(self):
         return self.project + "\\" + self.source_file
-    
+
     def get_resource_path(self):
-            return self.source_file[0:self.source_file.rfind( "\\" )-1]
-    
+        return self.source_file[0:self.source_file.rfind( "\\" )-1]
+
     def __str__(self):
-        return ''.join([self.project, "\t", self.source_file, "\t", 
self.dummy1, "\t", self.resource_type, "\t" , 
-            self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, 
"\t", self.dummy2, "\t" , self.langid, 
+        return ''.join([self.project, "\t", self.source_file, "\t", 
self.dummy1, "\t", self.resource_type, "\t" ,
+            self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, 
"\t", self.dummy2, "\t" , self.langid,
             "\t", self.text, "\t", self.helptext, "\t", self.quickhelptext, 
"\t" , self.title, "\t", self.date ])
-    
+
     def get_id(self):
         return ''.join([self.project, self.gid, self.lid, self.source_file, 
self.resource_type, self.platform, self.helpid, self.langid])

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/xhtex.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/xhtex.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/xhtex.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/xhtex.py Tue Jul 31 
22:46:38 2012
@@ -25,25 +25,25 @@ import sys
 import xml.dom.minidom
 
 class Xhtex(AbstractL10nTool):
-    _resource_type = "xht" 
+    _resource_type = "xht"
     _sdfdata       = ()
     _lang          = ""
-   
+
     # Extract methods
     def extract_topic(self, list, inputfile):
         topics = []
-        for elem in list:                        
+        for elem in list:
             if elem.childNodes[0].nodeType == elem.TEXT_NODE and 
len(elem.childNodes[0].data.strip()):
-                
topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), 
text=elem.childNodes[0].data, inputfile=inputfile))            
+                
topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), 
text=elem.childNodes[0].data, inputfile=inputfile))
         return topics
-            
+
     def extract_title(self, list, inputfile):
         titles = []
         for elem in list:
             if len(elem.getAttribute("title").strip()):
                 
titles.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), 
text=elem.getAttribute("title").strip(), inputfile=inputfile))
         return titles
-    
+
     # Merge methods
     def merge_topic(self, list, sdfdata, lang, inputfilename, dom):
         for elem in list:
@@ -52,17 +52,17 @@ class Xhtex(AbstractL10nTool):
                 if sdfdata[obj.get_id()]:
                     elem.childNodes[0].data = 
unicode(str(sdfdata[obj.get_id()].text),"utf8")
 
-                
+
     def merge_title(self, list, sdfdata, lang, inputfilename):
         for elem in list:
             obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, 
id=elem.getAttribute("id").strip())
-            if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]: 
+            if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
                 elem.setAttribute("title", 
unicode(str(sdfdata[obj.get_id()].text),"utf8"))
 
-    # L10N tool       
+    # L10N tool
     def __init__(self):
         AbstractL10nTool.__init__(self)
-        
+
     def parse_file(self, filename):
         document = ""
         try:
@@ -75,16 +75,16 @@ class Xhtex(AbstractL10nTool):
             f.close()
         return xml.dom.minidom.parseString(document)
 
-        
+
     def merge_file(self, inputfilename, outputfilename, parsed_file_ref, 
lang,is_forced_lang, sdfdata):
-        if lang == "en-US":             
-            mod_outputfilename = outputfilename.replace("_en-US",'')           
 
+        if lang == "en-US":
+            mod_outputfilename = outputfilename.replace("_en-US",'')
             self.make_dirs(mod_outputfilename)
             self.copy_file(inputfilename, mod_outputfilename)
             return
         dom = parsed_file_ref.cloneNode(True)
         #dom = self.parse_file(inputfilename)    # in case cloneNode is buggy 
just parse it always
-                
+
         self.merge_topic(dom.getElementsByTagName("topic"), sdfdata, lang, 
inputfilename, dom)
         self.merge_title(dom.getElementsByTagName("node"), sdfdata, lang, 
inputfilename)
         self.merge_title(dom.getElementsByTagName("help_section"), sdfdata, 
lang, inputfilename)
@@ -98,7 +98,7 @@ class Xhtex(AbstractL10nTool):
             sys.exit(-1)
         else:
             f.close()
-    
+
     ##### Helper for parse-once-use-often like parsing a xml file is needed 
implement it here
     def parse_file(self, filename):
         document = ""
@@ -108,23 +108,22 @@ class Xhtex(AbstractL10nTool):
         except IOError:
             print "ERROR: Can not read file " + filename
         else:
-            f.close()        
+            f.close()
         return xml.dom.minidom.parseString(document)
-    
+
     ##### Extract a single File
     def extract_file(self, inputfile):
         sdf_data = []
-        dom = self.parse_file(inputfile)        
+        dom = self.parse_file(inputfile)
         sdf_data.extend(self.extract_topic(dom.getElementsByTagName("topic"), 
inputfile))
         
sdf_data.extend(self.extract_title(dom.getElementsByTagName("help_section"), 
inputfile))
-        sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), 
inputfile))        
-        return ''.join([str(line)+"\n" for line in sdf_data])                  
    
+        sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), 
inputfile))
+        return ''.join([str(line)+"\n" for line in sdf_data])
 
     def prepare_sdf_line(self, inputfile="", lang="" , id="" , text=""):
         if lang == "":
             lang = self._source_language
         return SdfEntity(project=self._options.project_name, 
source_file=self.get_filename_string(inputfile),
                          resource_type=self._resource_type, gid=id, lid="", 
langid=lang,text=text)
-        
+
 run = Xhtex()
- 

Modified: incubator/ooo/trunk/main/l10ntools/scripts/tool/xtxex.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/scripts/tool/xtxex.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/scripts/tool/xtxex.py (original)
+++ incubator/ooo/trunk/main/l10ntools/scripts/tool/xtxex.py Tue Jul 31 
22:46:38 2012
@@ -22,21 +22,21 @@
 from l10ntool import AbstractL10nTool
 from sdf import SdfEntity
 import sys
-import shutil 
+import shutil
 
 class Xtxex(AbstractL10nTool):
-    _resource_type       = "xtx" 
-       
+    _resource_type       = "xtx"
+
     def __init__(self):
         AbstractL10nTool.__init__(self)
-        
-    def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, 
is_forced_lang, sdfdata): 
+
+    def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, 
is_forced_lang, sdfdata):
         # Special handling for en-US files
-        if lang == "en-US":             
+        if lang == "en-US":
             mod_outputfilename = outputfilename
             # mod here if needed
             self.copy_file(inputfilename, mod_outputfilename)
-            return      
+            return
         # merge usual lang
         sdfline = self.prepare_sdf_line(inputfilename,lang)
         if sdfdata.has_key(sdfline.get_id()):
@@ -50,11 +50,11 @@ class Xtxex(AbstractL10nTool):
                 sys.exit(-1)
             else:
                 f.close()
-            return        
+            return
         # no sdf data found then copy en-US source file
         if is_forced_lang:
             self.copy_file(inputfilename, outputfilename)
-               
+
     ##### Extract a single File
     def extract_file(self, inputfile):
         lines = []
@@ -67,7 +67,7 @@ class Xtxex(AbstractL10nTool):
         else:
             f.close()
         # remove legal header
-        lines = [line for line in lines if len(line) > 0 and not line[0] == 
'#']        
+        lines = [line for line in lines if len(line) > 0 and not line[0] == 
'#']
         # escape all returns
         lines = [line.replace('\n', "\\n") for line in lines]
         line = ''.join(lines)
@@ -84,5 +84,5 @@ class Xtxex(AbstractL10nTool):
             lang = self._source_language
         return SdfEntity(project=self._options.project_name, 
source_file=self.get_filename_string(inputfile),
                           resource_type=self._resource_type, gid="none", 
lid="none", langid=lang,text="")
-         
+
 run = Xtxex()

Modified: incubator/ooo/trunk/main/toolkit/src2xml/source/expression.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/expression.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/expression.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/expression.py Tue Jul 31 
22:46:38 2012
@@ -126,7 +126,3 @@ class ExpParser(object):
     def dumpTree (self):
         self.jumpToRoot()
         print toString(self.ptr)
-
-
-
-

Modified: incubator/ooo/trunk/main/toolkit/src2xml/source/globals.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/globals.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/globals.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/globals.py Tue Jul 31 
22:46:38 2012
@@ -21,7 +21,7 @@
 
 import sys
 
-class ParseError (Exception): 
+class ParseError (Exception):
     pass
 
 def error (msg, exit=0):
@@ -101,7 +101,7 @@ class Element(Node):
             chars += '>'
             for child in self.getChildren():
                 chars += child.dump(level+1)
-    
+
             chars += "\n"+Element.INDENT*level
             chars += "</%s>"%self.name
 

Modified: incubator/ooo/trunk/main/toolkit/src2xml/source/macroparser.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/macroparser.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/macroparser.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/macroparser.py Tue Jul 31 
22:46:38 2012
@@ -33,7 +33,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:
@@ -66,7 +66,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
@@ -126,7 +126,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/trunk/main/toolkit/src2xml/source/src2xml.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/src2xml.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/src2xml.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/src2xml.py Tue Jul 31 
22:46:38 2012
@@ -46,7 +46,7 @@ Examples:
 
     def format_examples (self):
         return examples
-    
+
     if 'epilog' in  p.__dict__:
         p.formatter.format_epilog = format_examples
         p.epilog = examples
@@ -243,6 +243,6 @@ def main ():
             dry_one_file (f, options)
         else:
             do_one_file (f, options)
-        
+
 if __name__ == '__main__':
     main ()

Modified: incubator/ooo/trunk/main/toolkit/src2xml/source/srclexer.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/srclexer.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/srclexer.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/srclexer.py Tue Jul 31 
22:46:38 2012
@@ -55,7 +55,7 @@ def dumpTokens (tokens, toError=False):
     indent = "    "
     line = ''
     chars = ''
-    
+
     for token in tokens:
         if token in '{<':
             if len(line) > 0:
@@ -98,7 +98,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.
 """
@@ -182,7 +182,7 @@ build the syntax tree.
             if item != SrcLexer.VISIBLE:
                 return False
         return True
-        
+
     def tokenize (self):
         self.init()
 
@@ -364,7 +364,7 @@ build the syntax tree.
             return eval(buf)
         except:
             return True
-        
+
     def handleMacroDefine (self, buf):
 
         mparser = macroparser.MacroParser(buf)
@@ -399,7 +399,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/trunk/main/toolkit/src2xml/source/srcparser.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/toolkit/src2xml/source/srcparser.py?rev=1367810&r1=1367809&r2=1367810&view=diff
==============================================================================
--- incubator/ooo/trunk/main/toolkit/src2xml/source/srcparser.py (original)
+++ incubator/ooo/trunk/main/toolkit/src2xml/source/srcparser.py Tue Jul 31 
22:46:38 2012
@@ -24,7 +24,7 @@ from globals import *
 import srclexer
 
 # simple name translation map
-postTransMap = {"ok-button": "okbutton", 
+postTransMap = {"ok-button": "okbutton",
                 "cancel-button": "cancelbutton",
                 "help-button": "helpbutton"}
 
@@ -139,11 +139,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 = []
@@ -250,17 +250,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):
@@ -272,7 +272,7 @@ handler.
 
         self.tokenBuf = []
         return i
-    
+
     # open brace token '{'
     def openBrace (self, i):
         bufSize = len(self.tokenBuf)
@@ -326,11 +326,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]
 
@@ -433,5 +433,3 @@ handler.
             raise ParseError ('')
 
         return eval(values[0]), eval(values[1])
-
-


Reply via email to