Bug 1368216 - Python files under browser/ folder updated to match PEP8 style guide. draft
authorEmin Mastizada <emin@mastizada.com>
Sat, 27 May 2017 05:22:51 +0300
changeset 585667 5d5678b9d4c0665e4480e63be686cfbad41d0a81
parent 585328 bce03a8eac301bcd9408b22333b1a67c3eaed057
child 630775 3eca7b6bdacd30b3157699d3a16f17a8aec5de4a
push id61169
push userbmo:emin@mastizada.com
push dateSat, 27 May 2017 21:10:08 +0000
bugs1368216
milestone55.0a1
Bug 1368216 - Python files under browser/ folder updated to match PEP8 style guide. MozReview-Commit-ID: Jc1y2KHD9ap
browser/app/macversion.py
browser/components/migration/tests/marionette/test_refresh_firefox.py
browser/extensions/mortar/ppapi/generators/generator.py
browser/extensions/mortar/ppapi/generators/idl_ast.py
browser/extensions/mortar/ppapi/generators/idl_diff.py
browser/extensions/mortar/ppapi/generators/idl_generator.py
browser/extensions/mortar/ppapi/generators/idl_namespace.py
browser/extensions/mortar/ppapi/generators/idl_node.py
browser/extensions/mortar/ppapi/generators/idl_option.py
browser/extensions/mortar/ppapi/generators/idl_outfile.py
browser/extensions/mortar/ppapi/generators/idl_parser.py
browser/extensions/mortar/ppapi/generators/idl_propertynode.py
browser/extensions/mortar/ppapi/generators/idl_release.py
browser/extensions/mortar/ppapi/generators/idl_tests.py
browser/extensions/mortar/ppapi/generators/idl_thunk.py
browser/extensions/mortar/ppapi/generators/idl_visitor.py
browser/locales/filter.py
browser/themes/preprocess-tab-svgs.py
--- a/browser/app/macversion.py
+++ b/browser/app/macversion.py
@@ -31,14 +31,14 @@ if not options.version:
 define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split()
 
 # extract only the major version (i.e. "14" from "14.0b1")
 majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1)
 # last two digits of the year
 twodigityear = buildid[2:4]
 month = buildid[4:6]
 if month[0] == '0':
-  month = month[1]
+    month = month[1]
 day = buildid[6:8]
 if day[0] == '0':
-  day = day[1]
+    day = day[1]
 
 print '%s.%s.%s' % (majorVersion + twodigityear, month, day)
--- a/browser/components/migration/tests/marionette/test_refresh_firefox.py
+++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py
@@ -1,14 +1,14 @@
 import os
 import shutil
 import time
 
+from marionette_driver.errors import NoAlertPresentException
 from marionette_harness import MarionetteTestCase
-from marionette_driver.errors import NoAlertPresentException
 
 
 class TestFirefoxRefresh(MarionetteTestCase):
     _username = "marionette-test-login"
     _password = "marionette-test-password"
     _bookmarkURL = "about:mozilla"
     _bookmarkText = "Some bookmark from Marionette"
 
@@ -92,17 +92,17 @@ class TestFirefoxRefresh(MarionetteTestC
             handleCompletion() {
               if (!finished) {
                 marionetteScriptFinished(false);
               }
             }
           });
         """, script_args=[self._formHistoryFieldName, self._formHistoryValue])
         if error:
-          print error
+            print error
 
     def createCookie(self):
         self.runCode("""
           // Expire in 15 minutes:
           let expireTime = Math.floor(Date.now() / 1000) + 15 * 60;
           Services.cookies.add(arguments[0], arguments[1], arguments[2], arguments[3],
                                true, false, false, expireTime);
         """, script_args=[self._cookieHost, self._cookiePath, self._cookieName, self._cookieValue])
@@ -176,17 +176,17 @@ class TestFirefoxRefresh(MarionetteTestC
               marionetteScriptFinished("No visits found");
             } else {
               marionetteScriptFinished(pageInfo);
             }
           }).catch(e => {
             marionetteScriptFinished("Unexpected error in fetching page: " + e);
           });
         """, script_args=[self._historyURL])
-        if type(historyResult) == str:
+        if isinstance(historyResult, str):
             self.fail(historyResult)
             return
 
         self.assertEqual(historyResult['title'], self._historyTitle)
 
     def checkFormHistory(self):
         formFieldResults = self.runAsyncCode("""
           let results = [];
@@ -197,22 +197,23 @@ class TestFirefoxRefresh(MarionetteTestC
             handleResult(result) {
               results.push(result);
             },
             handleCompletion() {
               marionetteScriptFinished(results);
             },
           });
         """, script_args=[self._formHistoryFieldName])
-        if type(formFieldResults) == str:
+        if isinstance(formFieldResults, str):
             self.fail(formFieldResults)
             return
 
         formFieldResultCount = len(formFieldResults)
-        self.assertEqual(formFieldResultCount, 1, "Should have exactly 1 entry for this field, got %d" % formFieldResultCount)
+        self.assertEqual(formFieldResultCount, 1,
+                         "Should have exactly 1 entry for this field, got %d" % formFieldResultCount)
         if formFieldResultCount == 1:
             self.assertEqual(formFieldResults[0]['value'], self._formHistoryValue)
 
         formHistoryCount = self.runAsyncCode("""
           let count;
           let callbacks = {
             handleResult: rv => count = rv,
             handleCompletion() {
@@ -255,20 +256,20 @@ class TestFirefoxRefresh(MarionetteTestC
         tabURIs = self.runCode("""
           return [... gBrowser.browsers].map(b => b.currentURI && b.currentURI.spec)
         """)
         self.assertSequenceEqual(tabURIs, ["about:welcomeback"])
 
         # Dismiss modal dialog if any. This is mainly to dismiss the check for
         # default browser dialog if it shows up.
         try:
-          alert = self.marionette.switch_to_alert()
-          alert.dismiss()
+            alert = self.marionette.switch_to_alert()
+            alert.dismiss()
         except NoAlertPresentException:
-          pass
+            pass
 
         tabURIs = self.runAsyncCode("""
           let mm = gBrowser.selectedBrowser.messageManager;
 
           let {TabStateFlusher} = Cu.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
           window.addEventListener("SSWindowStateReady", function testSSPostReset() {
             window.removeEventListener("SSWindowStateReady", testSSPostReset, false);
             Promise.all(gBrowser.browsers.map(b => TabStateFlusher.flush(b))).then(function() {
@@ -337,21 +338,23 @@ class TestFirefoxRefresh(MarionetteTestC
         # blank slate for the next person.
         self.marionette.restart(clean=True, in_app=False)
         self.setUpScriptData()
 
         # Super
         MarionetteTestCase.tearDown(self)
 
         # Some helpers to deal with removing a load of files
-        import errno, stat
+        import errno
+        import stat
+
         def handleRemoveReadonly(func, path, exc):
             excvalue = exc[1]
             if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES:
-                os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777
+                os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)  # 0777
                 func(path)
             else:
                 raise
 
         if self.desktop_backup_path:
             shutil.rmtree(self.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly)
 
         if self.reset_profile_path:
@@ -411,21 +414,22 @@ class TestFirefoxRefresh(MarionetteTestC
           } catch (ex) {
             container = Services.dirsvc.get("Home", Ci.nsIFile);
           }
           let bundle = Services.strings.createBundle("chrome://mozapps/locale/profile/profileSelection.properties");
           let dirName = bundle.formatStringFromName("resetBackupDirectory", [Services.appinfo.name], 1);
           container.append(dirName);
           container.append(arguments[0]);
           return container.path;
-        """, script_args = [profileLeafName])
+        """, script_args=[profileLeafName])
 
         self.assertTrue(os.path.isdir(self.reset_profile_path), "Reset profile path should be present")
         self.assertTrue(os.path.isdir(self.desktop_backup_path), "Backup profile path should be present")
-        self.assertTrue(self.profileNameToRemove in self.reset_profile_path, "Reset profile path should contain profile name to remove")
+        self.assertTrue(self.profileNameToRemove in self.reset_profile_path,
+                        "Reset profile path should contain profile name to remove")
 
     def testReset(self):
         self.checkProfile()
 
         self.doReset()
 
         # Now check that we're doing OK...
         self.checkProfile(hasMigrated=True)
--- a/browser/extensions/mortar/ppapi/generators/generator.py
+++ b/browser/extensions/mortar/ppapi/generators/generator.py
@@ -5,53 +5,49 @@
 
 import os
 import sys
 import traceback
 
 # Note: some of these files are imported to register cmdline options.
 from idl_generator import Generator
 from idl_option import ParseOptions
-from idl_outfile import IDLOutFile
 from idl_parser import ParseFiles
-from idl_c_header import HGen
-from idl_thunk import TGen
-from idl_gen_pnacl import PnaclGen
 
 
 def Main(args):
-  # If no arguments are provided, assume we are trying to rebuild the
-  # C headers with warnings off.
-  try:
-    if not args:
-      args = [
-          '--wnone', '--cgen', '--range=start,end',
-          '--pnacl', '--pnaclshim',
-          '../native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c',
-          '--tgen',
-      ]
-      current_dir = os.path.abspath(os.getcwd())
-      script_dir = os.path.abspath(os.path.dirname(__file__))
-      if current_dir != script_dir:
-        print '\nIncorrect CWD, default run skipped.'
-        print 'When running with no arguments set CWD to the scripts directory:'
-        print '\t' + script_dir + '\n'
-        print 'This ensures correct default paths and behavior.\n'
-        return 1
+    # If no arguments are provided, assume we are trying to rebuild the
+    # C headers with warnings off.
+    try:
+        if not args:
+            args = [
+                '--wnone', '--cgen', '--range=start,end',
+                '--pnacl', '--pnaclshim',
+                '../native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c',
+                '--tgen',
+            ]
+            current_dir = os.path.abspath(os.getcwd())
+            script_dir = os.path.abspath(os.path.dirname(__file__))
+            if current_dir != script_dir:
+                print '\nIncorrect CWD, default run skipped.'
+                print 'When running with no arguments set CWD to the scripts directory:'
+                print '\t' + script_dir + '\n'
+                print 'This ensures correct default paths and behavior.\n'
+                return 1
 
-    filenames = ParseOptions(args)
-    ast = ParseFiles(filenames)
-    if ast.errors:
-      print 'Found %d errors.  Aborting build.\n' % ast.errors
-      return 1
-    return Generator.Run(ast)
-  except SystemExit, ec:
-    print 'Exiting with %d' % ec.code
-    sys.exit(ec.code)
+        filenames = ParseOptions(args)
+        ast = ParseFiles(filenames)
+        if ast.errors:
+            print 'Found %d errors.  Aborting build.\n' % ast.errors
+            return 1
+        return Generator.Run(ast)
+    except SystemExit as ec:
+        print 'Exiting with %d' % ec.code
+        sys.exit(ec.code)
 
-  except:
-    typeinfo, value, tb = sys.exc_info()
-    traceback.print_exception(typeinfo, value, tb)
-    print 'Called with: ' + ' '.join(sys.argv)
+    except:
+        typeinfo, value, tb = sys.exc_info()
+        traceback.print_exception(typeinfo, value, tb)
+        print 'Called with: ' + ' '.join(sys.argv)
 
 
 if __name__ == '__main__':
     sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_ast.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_ast.py
@@ -5,178 +5,179 @@
 """Nodes for PPAPI IDL AST."""
 
 from idl_namespace import IDLNamespace
 from idl_node import IDLNode
 from idl_option import GetOption
 from idl_visitor import IDLVisitor
 from idl_release import IDLReleaseMap
 
+
 #
 # IDLLabelResolver
 #
 # A specialized visitor which traverses the AST, building a mapping of
 # Release names to Versions numbers and calculating a min version.
 # The mapping is applied to the File nodes within the AST.
 #
 class IDLLabelResolver(IDLVisitor):
-  def Depart(self, node, ignore, childdata):
-    # Build list of Release=Version
-    if node.IsA('LabelItem'):
-      channel = node.GetProperty('channel')
-      if not channel:
-        channel = 'stable'
-      return (node.GetName(), node.GetProperty('VALUE'), channel)
+    def Depart(self, node, ignore, childdata):
+        # Build list of Release=Version
+        if node.IsA('LabelItem'):
+            channel = node.GetProperty('channel')
+            if not channel:
+                channel = 'stable'
+            return node.GetName(), node.GetProperty('VALUE'), channel
 
-    # On completion of the Label, apply to the parent File if the
-    # name of the label matches the generation label.
-    if node.IsA('Label') and node.GetName() == GetOption('label'):
-      try:
-        node.parent.release_map = IDLReleaseMap(childdata)
-      except Exception as err:
-        node.Error('Unable to build release map: %s' % str(err))
+        # On completion of the Label, apply to the parent File if the
+        # name of the label matches the generation label.
+        if node.IsA('Label') and node.GetName() == GetOption('label'):
+            try:
+                node.parent.release_map = IDLReleaseMap(childdata)
+            except Exception as err:
+                node.Error('Unable to build release map: %s' % str(err))
 
-    # For File objects, set the minimum version
-    if node.IsA('File'):
-      file_min, _ = node.release_map.GetReleaseRange()
-      node.SetMin(file_min)
+        # For File objects, set the minimum version
+        if node.IsA('File'):
+            file_min, _ = node.release_map.GetReleaseRange()
+            node.SetMin(file_min)
 
-    return None
+        return None
 
 
 #
 # IDLNamespaceVersionResolver
 #
 # A specialized visitor which traverses the AST, building a namespace tree
 # as it goes.  The namespace tree is mapping from a name to a version list.
 # Labels must already be resolved to use.
 #
 class IDLNamespaceVersionResolver(IDLVisitor):
-  NamespaceSet = set(['AST', 'Callspec', 'Interface', 'Member', 'Struct'])
-  #
-  # When we arrive at a node we must assign it a namespace and if the
-  # node is named, then place it in the appropriate namespace.
-  #
-  def Arrive(self, node, parent_namespace):
-    # If we are a File, grab the Min version and replease mapping
-    if node.IsA('File'):
-      self.rmin = node.GetMinMax()[0]
-      self.release_map = node.release_map
+    NamespaceSet = {'AST', 'Callspec', 'Interface', 'Member', 'Struct'}
 
-    # Set the min version on any non Label within the File
-    if not node.IsA('AST', 'File', 'Label', 'LabelItem'):
-      my_min, _ = node.GetMinMax()
-      if not my_min:
-        node.SetMin(self.rmin)
+    #
+    # When we arrive at a node we must assign it a namespace and if the
+    # node is named, then place it in the appropriate namespace.
+    #
+    def Arrive(self, node, parent_namespace):
+        # If we are a File, grab the Min version and replease mapping
+        if node.IsA('File'):
+            self.rmin = node.GetMinMax()[0]
+            self.release_map = node.release_map
+
+        # Set the min version on any non Label within the File
+        if not node.IsA('AST', 'File', 'Label', 'LabelItem'):
+            my_min, _ = node.GetMinMax()
+            if not my_min:
+                node.SetMin(self.rmin)
 
-    # If this object is not a namespace aware object, use the parent's one
-    if node.cls not in self.NamespaceSet:
-      node.namespace = parent_namespace
-    else:
-    # otherwise create one.
-      node.namespace = IDLNamespace(parent_namespace)
+        # If this object is not a namespace aware object, use the parent's one
+        if node.cls not in self.NamespaceSet:
+            node.namespace = parent_namespace
+        else:
+            # otherwise create one.
+            node.namespace = IDLNamespace(parent_namespace)
 
-    # If this node is named, place it in its parent's namespace
-    if parent_namespace and node.cls in IDLNode.NamedSet:
-      # Set version min and max based on properties
-      if self.release_map:
-        vmin = node.GetProperty('dev_version')
-        if vmin == None:
-          vmin = node.GetProperty('version')
-        vmax = node.GetProperty('deprecate')
-        # If no min is available, the use the parent File's min
-        if vmin == None:
-          rmin = self.rmin
-        else:
-          rmin = self.release_map.GetRelease(vmin)
-        rmax = self.release_map.GetRelease(vmax)
-        node.SetReleaseRange(rmin, rmax)
-      parent_namespace.AddNode(node)
+        # If this node is named, place it in its parent's namespace
+        if parent_namespace and node.cls in IDLNode.NamedSet:
+            # Set version min and max based on properties
+            if self.release_map:
+                vmin = node.GetProperty('dev_version')
+                if vmin is None:
+                    vmin = node.GetProperty('version')
+                vmax = node.GetProperty('deprecate')
+                # If no min is available, the use the parent File's min
+                if vmin is None:
+                    rmin = self.rmin
+                else:
+                    rmin = self.release_map.GetRelease(vmin)
+                rmax = self.release_map.GetRelease(vmax)
+                node.SetReleaseRange(rmin, rmax)
+            parent_namespace.AddNode(node)
 
-    # Pass this namespace to each child in case they inherit it
-    return node.namespace
+        # Pass this namespace to each child in case they inherit it
+        return node.namespace
 
 
 #
 # IDLFileTypeRessolver
 #
 # A specialized visitor which traverses the AST and sets a FILE property
 # on all file nodes.  In addition, searches the namespace resolving all
 # type references.  The namespace tree must already have been populated
 # before this visitor is used.
 #
 class IDLFileTypeResolver(IDLVisitor):
-  def VisitFilter(self, node, data):
-    return not node.IsA('Comment', 'Copyright')
+    def VisitFilter(self, node, data):
+        return not node.IsA('Comment', 'Copyright')
 
-  def Arrive(self, node, filenode):
-    # Track the file node to update errors
-    if node.IsA('File'):
-      node.SetProperty('FILE', node)
-      filenode = node
+    def Arrive(self, node, filenode):
+        # Track the file node to update errors
+        if node.IsA('File'):
+            node.SetProperty('FILE', node)
+            filenode = node
 
-    if not node.IsA('AST'):
-      file_min, _ = filenode.release_map.GetReleaseRange()
-      if not file_min:
-        print 'Resetting min on %s to %s' % (node, file_min)
-        node.SetMinRange(file_min)
+        if not node.IsA('AST'):
+            file_min, _ = filenode.release_map.GetReleaseRange()
+            if not file_min:
+                print 'Resetting min on %s to %s' % (node, file_min)
+                node.SetMinRange(file_min)
 
-    # If this node has a TYPEREF, resolve it to a version list
-    typeref = node.GetPropertyLocal('TYPEREF')
-    if typeref:
-      node.typelist = node.parent.namespace.FindList(typeref)
-      if not node.typelist:
-        node.Error('Could not resolve %s.' % typeref)
-    else:
-      node.typelist = None
-    return filenode
+        # If this node has a TYPEREF, resolve it to a version list
+        typeref = node.GetPropertyLocal('TYPEREF')
+        if typeref:
+            node.typelist = node.parent.namespace.FindList(typeref)
+            if not node.typelist:
+                node.Error('Could not resolve %s.' % typeref)
+        else:
+            node.typelist = None
+        return filenode
+
 
 #
 # IDLReleaseResolver
 #
 # A specialized visitor which will traverse the AST, and generate a mapping
 # from any release to the first release in which that version of the object
 # was generated.  Types must already be resolved to use.
 #
 class IDLReleaseResolver(IDLVisitor):
-  def Arrive(self, node, releases):
-    node.BuildReleaseMap(releases)
-    return releases
+    def Arrive(self, node, releases):
+        node.BuildReleaseMap(releases)
+        return releases
 
 
 #
 # IDLAst
 #
 # A specialized version of the IDLNode for containing the whole of the
 # AST.  Construction of the AST object will cause resolution of the
 # tree including versions, types, etc...  Errors counts will be collected
 # both per file, and on the AST itself.
 #
 class IDLAst(IDLNode):
-  def __init__(self, children):
-    IDLNode.__init__(self, 'AST', 'BuiltIn', 1, 0, children)
-    self.Resolve()
+    def __init__(self, children):
+        IDLNode.__init__(self, 'AST', 'BuiltIn', 1, 0, children)
+        self.Resolve()
 
-  def Resolve(self):
-    # Set the appropriate Release=Version mapping for each File
-    IDLLabelResolver().Visit(self, None)
+    def Resolve(self):
+        # Set the appropriate Release=Version mapping for each File
+        IDLLabelResolver().Visit(self, None)
 
-    # Generate the Namesapce Tree
-    self.namespace = IDLNamespace(None)
-    IDLNamespaceVersionResolver().Visit(self, self.namespace)
-
-    # Using the namespace, resolve type references
-    IDLFileTypeResolver().Visit(self, None)
+        # Generate the Namesapce Tree
+        self.namespace = IDLNamespace(None)
+        IDLNamespaceVersionResolver().Visit(self, self.namespace)
 
-    # Build an ordered list of all releases
-    releases = set()
-    for filenode in self.GetListOf('File'):
-      releases |= set(filenode.release_map.GetReleases())
+        # Using the namespace, resolve type references
+        IDLFileTypeResolver().Visit(self, None)
+
+        # Build an ordered list of all releases
+        releases = set()
+        for filenode in self.GetListOf('File'):
+            releases |= set(filenode.release_map.GetReleases())
 
-    # Generate a per node list of releases and release mapping
-    IDLReleaseResolver().Visit(self, sorted(releases))
+        # Generate a per node list of releases and release mapping
+        IDLReleaseResolver().Visit(self, sorted(releases))
 
-    for filenode in self.GetListOf('File'):
-      errors = filenode.GetProperty('ERRORS')
-      if errors:
-        self.errors += errors
-
-
+        for filenode in self.GetListOf('File'):
+            errors = filenode.GetProperty('ERRORS')
+            if errors:
+                self.errors += errors
--- a/browser/extensions/mortar/ppapi/generators/idl_diff.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_diff.py
@@ -4,351 +4,402 @@
 # found in the LICENSE file.
 
 import glob
 import os
 import subprocess
 import sys
 
 from idl_option import GetOption, Option, ParseOptions
-from idl_outfile import IDLOutFile
+
 #
 # IDLDiff
 #
 # IDLDiff is a tool for comparing sets of IDL generated header files
 # with the standard checked in headers.  It does this by capturing the
 # output of the standard diff tool, parsing it into separate changes, then
 # ignoring changes that are know to be safe, such as adding or removing
 # blank lines, etc...
 #
 
 Option('gen', 'IDL generated files', default='hdir')
 Option('src', 'Original ".h" files', default='../c')
 Option('halt', 'Stop if a difference is found')
 Option('diff', 'Directory holding acceptable diffs', default='diff')
 Option('ok', 'Write out the diff file.')
+
+
 # Change
 #
 # A Change object contains the previous lines, new news and change type.
 #
 class Change(object):
-  def __init__(self, mode, was, now):
-    self.mode = mode
-    self.was = was
-    self.now = now
+    def __init__(self, mode, was, now):
+        self.mode = mode
+        self.was = was
+        self.now = now
 
-  def Dump(self):
-    if not self.was:
-      print 'Adding %s' % self.mode
-    elif not self.now:
-      print 'Missing %s' % self.mode
-    else:
-      print 'Modifying %s' % self.mode
+    def Dump(self):
+        if not self.was:
+            print 'Adding %s' % self.mode
+        elif not self.now:
+            print 'Missing %s' % self.mode
+        else:
+            print 'Modifying %s' % self.mode
 
-    for line in self.was:
-      print 'src: >>%s<<' % line
-    for line in self.now:
-      print 'gen: >>%s<<' % line
-    print
+        for line in self.was:
+            print 'src: >>%s<<' % line
+        for line in self.now:
+            print 'gen: >>%s<<' % line
+        print
+
 
 #
 # IsCopyright
 #
 # Return True if this change is only a one line change in the copyright notice
 # such as non-matching years.
 #
 def IsCopyright(change):
-  if len(change.now) != 1 or len(change.was) != 1: return False
-  if 'Copyright (c)' not in change.now[0]: return False
-  if 'Copyright (c)' not in change.was[0]: return False
-  return True
+    if len(change.now) != 1 or len(change.was) != 1:
+        return False
+    if 'Copyright (c)' not in change.now[0]:
+        return False
+    if 'Copyright (c)' not in change.was[0]:
+        return False
+    return True
+
 
 #
 # IsBlankComment
 #
 # Return True if this change only removes a blank line from a comment
 #
 def IsBlankComment(change):
-  if change.now: return False
-  if len(change.was) != 1: return False
-  if change.was[0].strip() != '*': return False
-  return True
+    if change.now:
+        return False
+    if len(change.was) != 1:
+        return False
+    if change.was[0].strip() != '*':
+        return False
+    return True
+
 
 #
 # IsBlank
 #
 # Return True if this change only adds or removes blank lines
 #
 def IsBlank(change):
-  for line in change.now:
-    if line: return False
-  for line in change.was:
-    if line: return False
-  return True
+    for line in change.now:
+        if line:
+            return False
+    for line in change.was:
+        if line:
+            return False
+    return True
 
 
 #
 # IsCppComment
 #
 # Return True if this change only going from C++ to C style
 #
 def IsToCppComment(change):
-  if not len(change.now) or len(change.now) != len(change.was):
-    return False
-  for index in range(len(change.now)):
-    was = change.was[index].strip()
-    if was[:2] != '//':
-      return False
-    was = was[2:].strip()
-    now = change.now[index].strip()
-    if now[:2] != '/*':
-      return False
-    now = now[2:-2].strip()
-    if now != was:
-      return False
-  return True
+    if not len(change.now) or len(change.now) != len(change.was):
+        return False
+    for index in range(len(change.now)):
+        was = change.was[index].strip()
+        if was[:2] != '//':
+            return False
+        was = was[2:].strip()
+        now = change.now[index].strip()
+        if now[:2] != '/*':
+            return False
+        now = now[2:-2].strip()
+        if now != was:
+            return False
+    return True
+
+    return True
 
 
-  return True
+def IsMergeComment(change):
+    if len(change.was) != 1:
+        return False
+    if change.was[0].strip() != '*':
+        return False
+    for line in change.now:
+        stripped = line.strip()
+        if stripped != '*' and stripped[:2] != '/*' and stripped[-2:] != '*/':
+            return False
+    return True
 
-def IsMergeComment(change):
-  if len(change.was) != 1: return False
-  if change.was[0].strip() != '*': return False
-  for line in change.now:
-    stripped = line.strip()
-    if stripped != '*' and stripped[:2] != '/*' and stripped[-2:] != '*/':
-      return False
-  return True
+
 #
 # IsSpacing
 #
 # Return True if this change is only different in the way 'words' are spaced
 # such as in an enum:
 #   ENUM_XXX   = 1,
 #   ENUM_XYY_Y = 2,
 # vs
 #   ENUM_XXX = 1,
 #   ENUM_XYY_Y = 2,
 #
 def IsSpacing(change):
-  if len(change.now) != len(change.was): return False
-  for i in range(len(change.now)):
-    # Also ignore right side comments
-    line = change.was[i]
-    offs = line.find('//')
-    if offs == -1:
-      offs = line.find('/*')
-    if offs >-1:
-      line = line[:offs-1]
+    if len(change.now) != len(change.was):
+        return False
+    for i in range(len(change.now)):
+        # Also ignore right side comments
+        line = change.was[i]
+        offs = line.find('//')
+        if offs == -1:
+            offs = line.find('/*')
+        if offs > -1:
+            line = line[:offs - 1]
 
-    words1 = change.now[i].split()
-    words2 = line.split()
-    if words1 != words2: return False
-  return True
+        words1 = change.now[i].split()
+        words2 = line.split()
+        if words1 != words2:
+            return False
+    return True
+
 
 #
 # IsInclude
 #
 # Return True if change has extra includes
 #
 def IsInclude(change):
-  for line in change.was:
-    if line.strip().find('struct'): return False
-  for line in change.now:
-    if line and '#include' not in line: return False
-  return True
+    for line in change.was:
+        if line.strip().find('struct'):
+            return False
+    for line in change.now:
+        if line and '#include' not in line:
+            return False
+    return True
+
 
 #
 # IsCppComment
 #
 # Return True if the change is only missing C++ comments
 #
 def IsCppComment(change):
-  if len(change.now): return False
-  for line in change.was:
-    line = line.strip()
-    if line[:2] != '//': return False
-  return True
+    if len(change.now):
+        return False
+    for line in change.was:
+        line = line.strip()
+        if line[:2] != '//':
+            return False
+    return True
+
+
 #
 # ValidChange
 #
 # Return True if none of the changes does not patch an above "bogus" change.
 #
 def ValidChange(change):
-  if IsToCppComment(change): return False
-  if IsCopyright(change): return False
-  if IsBlankComment(change): return False
-  if IsMergeComment(change): return False
-  if IsBlank(change): return False
-  if IsSpacing(change): return False
-  if IsInclude(change): return False
-  if IsCppComment(change): return False
-  return True
+    if IsToCppComment(change):
+        return False
+    if IsCopyright(change):
+        return False
+    if IsBlankComment(change):
+        return False
+    if IsMergeComment(change):
+        return False
+    if IsBlank(change):
+        return False
+    if IsSpacing(change):
+        return False
+    if IsInclude(change):
+        return False
+    if IsCppComment(change):
+        return False
+    return True
 
 
 #
 # Swapped
 #
 # Check if the combination of last + next change signals they are both
 # invalid such as swap of line around an invalid block.
 #
 def Swapped(last, next):
-  if not last.now and not next.was and len(last.was) == len(next.now):
-    cnt = len(last.was)
-    for i in range(cnt):
-      match = True
-      for j in range(cnt):
-        if last.was[j] != next.now[(i + j) % cnt]:
-          match = False
-          break;
-      if match: return True
-  if not last.was and not next.now and len(last.now) == len(next.was):
-    cnt = len(last.now)
-    for i in range(cnt):
-      match = True
-      for j in range(cnt):
-        if last.now[i] != next.was[(i + j) % cnt]:
-          match = False
-          break;
-      if match: return True
-  return False
+    if not last.now and not next.was and len(last.was) == len(next.now):
+        cnt = len(last.was)
+        for i in range(cnt):
+            match = True
+            for j in range(cnt):
+                if last.was[j] != next.now[(i + j) % cnt]:
+                    match = False
+                    break
+            if match:
+                return True
+    if not last.was and not next.now and len(last.now) == len(next.was):
+        cnt = len(last.now)
+        for i in range(cnt):
+            match = True
+            for j in range(cnt):
+                if last.now[i] != next.was[(i + j) % cnt]:
+                    match = False
+                    break
+            if match:
+                return True
+    return False
 
 
 def FilterLinesIn(output):
-  was = []
-  now = []
-  filter = []
-  for index in range(len(output)):
-    filter.append(False)
-    line = output[index]
-    if len(line) < 2: continue
-    if line[0] == '<':
-      if line[2:].strip() == '': continue
-      was.append((index, line[2:]))
-    elif line[0] == '>':
-      if line[2:].strip() == '': continue
-      now.append((index, line[2:]))
-  for windex, wline in was:
-    for nindex, nline in now:
-      if filter[nindex]: continue
-      if filter[windex]: continue
-      if wline == nline:
-        filter[nindex] = True
-        filter[windex] = True
-        if GetOption('verbose'):
-          print "Found %d, %d >>%s<<" % (windex + 1, nindex + 1, wline)
-  out = []
-  for index in range(len(output)):
-    if not filter[index]:
-      out.append(output[index])
+    was = []
+    now = []
+    filters = []
+    for index in range(len(output)):
+        filters.append(False)
+        line = output[index]
+        if len(line) < 2:
+            continue
+        if line[0] == '<':
+            if line[2:].strip() == '':
+                continue
+            was.append((index, line[2:]))
+        elif line[0] == '>':
+            if line[2:].strip() == '':
+                continue
+            now.append((index, line[2:]))
+    for windex, wline in was:
+        for nindex, nline in now:
+            if filters[nindex]:
+                continue
+            if filters[windex]:
+                continue
+            if wline == nline:
+                filters[nindex] = True
+                filters[windex] = True
+                if GetOption('verbose'):
+                    print "Found %d, %d >>%s<<" % (windex + 1, nindex + 1, wline)
+    out = []
+    for index in range(len(output)):
+        if not filters[index]:
+            out.append(output[index])
 
-  return out
+    return out
+
+
 #
 # GetChanges
 #
 # Parse the output into discrete change blocks.
 #
 def GetChanges(output):
-  # Split on lines, adding an END marker to simply add logic
-  lines = output.split('\n')
-  lines = FilterLinesIn(lines)
-  lines.append('END')
+    # Split on lines, adding an END marker to simply add logic
+    lines = output.split('\n')
+    lines = FilterLinesIn(lines)
+    lines.append('END')
 
-  changes = []
-  was = []
-  now = []
-  mode = ''
-  last = None
+    changes = []
+    was = []
+    now = []
 
-  for line in lines:
-#    print "LINE=%s" % line
-    if not line: continue
+    for line in lines:
+        #    print "LINE=%s" % line
+        if not line:
+            continue
 
-    elif line[0] == '<':
-      if line[2:].strip() == '': continue
-      # Ignore prototypes
-      if len(line) > 10:
-        words = line[2:].split()
-        if len(words) == 2 and words[1][-1] == ';':
-          if words[0] == 'struct' or words[0] == 'union':
+        elif line[0] == '<':
+            if line[2:].strip() == '':
+                continue
+            # Ignore prototypes
+            if len(line) > 10:
+                words = line[2:].split()
+                if len(words) == 2 and words[1][-1] == ';':
+                    if words[0] == 'struct' or words[0] == 'union':
+                        continue
+            was.append(line[2:])
+        elif line[0] == '>':
+            if line[2:].strip() == '':
+                continue
+            if line[2:10] == '#include':
+                continue
+            now.append(line[2:])
+        elif line[0] == '-':
             continue
-      was.append(line[2:])
-    elif line[0] == '>':
-      if line[2:].strip() == '': continue
-      if line[2:10] == '#include': continue
-      now.append(line[2:])
-    elif line[0] == '-':
-      continue
-    else:
-      change = Change(line, was, now)
-      was = []
-      now = []
-      if ValidChange(change):
-          changes.append(change)
-      if line == 'END':
-        break
+        else:
+            change = Change(line, was, now)
+            was = []
+            now = []
+            if ValidChange(change):
+                changes.append(change)
+            if line == 'END':
+                break
 
-  return FilterChanges(changes)
+    return FilterChanges(changes)
+
 
 def FilterChanges(changes):
-  if len(changes) < 2: return changes
-  out = []
-  filter = [False for change in changes]
-  for cur in range(len(changes)):
-    for cmp in range(cur+1, len(changes)):
-      if filter[cmp]:
-        continue
-      if Swapped(changes[cur], changes[cmp]):
-        filter[cur] = True
-        filter[cmp] = True
-  for cur in range(len(changes)):
-    if filter[cur]: continue
-    out.append(changes[cur])
-  return out
+    if len(changes) < 2:
+        return changes
+    out = []
+    filters = [False] * len(changes)
+    for cur in range(len(changes)):
+        for compare in range(cur + 1, len(changes)):
+            if filters[compare]:
+                continue
+            if Swapped(changes[cur], changes[compare]):
+                filters[cur] = True
+                filters[compare] = True
+    for cur in range(len(changes)):
+        if filters[cur]:
+            continue
+        out.append(changes[cur])
+    return out
+
 
 def Main(args):
-  filenames = ParseOptions(args)
-  if not filenames:
-    gendir = os.path.join(GetOption('gen'), '*.h')
-    filenames = sorted(glob.glob(gendir))
-    srcdir = os.path.join(GetOption('src'), '*.h')
-    srcs = sorted(glob.glob(srcdir))
-    for name in srcs:
-      name = os.path.split(name)[1]
-      name = os.path.join(GetOption('gen'), name)
-      if name not in filenames:
-        print 'Missing: %s' % name
+    filenames = ParseOptions(args)
+    if not filenames:
+        gendir = os.path.join(GetOption('gen'), '*.h')
+        filenames = sorted(glob.glob(gendir))
+        srcdir = os.path.join(GetOption('src'), '*.h')
+        srcs = sorted(glob.glob(srcdir))
+        for name in srcs:
+            name = os.path.split(name)[1]
+            name = os.path.join(GetOption('gen'), name)
+            if name not in filenames:
+                print 'Missing: %s' % name
 
-  for filename in filenames:
-    gen = filename
-    filename = filename[len(GetOption('gen')) + 1:]
-    src = os.path.join(GetOption('src'), filename)
-    diff = os.path.join(GetOption('diff'), filename)
-    p = subprocess.Popen(['diff', src, gen], stdout=subprocess.PIPE)
-    output, errors = p.communicate()
+    for filename in filenames:
+        gen = filename
+        filename = filename[len(GetOption('gen')) + 1:]
+        src = os.path.join(GetOption('src'), filename)
+        diff = os.path.join(GetOption('diff'), filename)
+        p = subprocess.Popen(['diff', src, gen], stdout=subprocess.PIPE)
+        output, errors = p.communicate()
 
-    try:
-      input = open(diff, 'rt').read()
-    except:
-      input = ''
+        try:
+            input = open(diff, 'rt').read()
+        except:
+            input = ''
 
-    if input != output:
-      changes = GetChanges(output)
-    else:
-      changes = []
+        if input != output:
+            changes = GetChanges(output)
+        else:
+            changes = []
 
-    if changes:
-      print "\n\nDelta between:\n  src=%s\n  gen=%s\n" % (src, gen)
-      for change in changes:
-        change.Dump()
-      print 'Done with %s\n\n' % src
-      if GetOption('ok'):
-        open(diff, 'wt').write(output)
-      if GetOption('halt'):
-        return 1
-    else:
-      print "\nSAME:\n  src=%s\n  gen=%s" % (src, gen)
-      if input: print '  ** Matched expected diff. **'
-      print '\n'
+        if changes:
+            print "\n\nDelta between:\n  src=%s\n  gen=%s\n" % (src, gen)
+            for change in changes:
+                change.Dump()
+            print 'Done with %s\n\n' % src
+            if GetOption('ok'):
+                open(diff, 'wt').write(output)
+            if GetOption('halt'):
+                return 1
+        else:
+            print "\nSAME:\n  src=%s\n  gen=%s" % (src, gen)
+            if input:
+                print '  ** Matched expected diff. **'
+            print '\n'
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_generator.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_generator.py
@@ -1,277 +1,282 @@
 #!/usr/bin/env python
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
+from idl_log import ErrOut, InfoOut
 from idl_option import GetOption, Option, ParseOptions
 from idl_parser import ParseFiles
 
 GeneratorList = []
 
 Option('out', 'List of output files', default='')
 Option('release', 'Which release to generate.', default='')
 Option('range', 'Which ranges in the form of MIN,MAX.', default='start,end')
 
+
 class Generator(object):
-  """Base class for generators.
+    """Base class for generators.
 
-  This class provides a mechanism for adding new generator objects to the IDL
-  driver.  To use this class override the GenerateRelease and GenerateRange
-  members, and instantiate one copy of the class in the same module which
-  defines it to register the generator.  After the AST is generated, call the
-  static Run member which will check every registered generator to see which
-  ones have been enabled through command-line options.  To enable a generator
-  use the switches:
-    --<sname> : To enable with defaults
-    --<sname>_opt=<XXX,YYY=y> : To enable with generator specific options.
+    This class provides a mechanism for adding new generator objects to the IDL
+    driver.  To use this class override the GenerateRelease and GenerateRange
+    members, and instantiate one copy of the class in the same module which
+    defines it to register the generator.  After the AST is generated, call the
+    static Run member which will check every registered generator to see which
+    ones have been enabled through command-line options.  To enable a generator
+    use the switches:
+        --<sname> : To enable with defaults
+        --<sname>_opt=<XXX,YYY=y> : To enable with generator specific options.
 
-  NOTE:  Generators still have access to global options
-  """
+    NOTE:  Generators still have access to global options
+    """
 
-  def __init__(self, name, sname, desc):
-    self.name = name
-    self.run_switch = Option(sname, desc)
-    self.opt_switch = Option(sname + '_opt', 'Options for %s.' % sname,
-                             default='')
-    GeneratorList.append(self)
-    self.errors = 0
-    self.skip_list = []
+    def __init__(self, name, sname, desc):
+        self.name = name
+        self.run_switch = Option(sname, desc)
+        self.opt_switch = Option(sname + '_opt', 'Options for %s.' % sname,
+                                 default='')
+        GeneratorList.append(self)
+        self.errors = 0
+        self.skip_list = []
 
-  def Error(self, msg):
-    ErrOut.Log('Error %s : %s' % (self.name, msg))
-    self.errors += 1
+    def Error(self, msg):
+        ErrOut.Log('Error %s : %s' % (self.name, msg))
+        self.errors += 1
 
-  def GetRunOptions(self):
-    options = {}
-    option_list = self.opt_switch.Get()
-    if option_list:
-      option_list = option_list.split(',')
-      for opt in option_list:
-        offs = opt.find('=')
-        if offs > 0:
-          options[opt[:offs]] = opt[offs+1:]
-        else:
-          options[opt] = True
-      return options
-    if self.run_switch.Get():
-      return options
-    return None
+    def GetRunOptions(self):
+        options = {}
+        option_list = self.opt_switch.Get()
+        if option_list:
+            option_list = option_list.split(',')
+            for opt in option_list:
+                offs = opt.find('=')
+                if offs > 0:
+                    options[opt[:offs]] = opt[offs + 1:]
+                else:
+                    options[opt] = True
+            return options
+        if self.run_switch.Get():
+            return options
+        return None
 
-  def Generate(self, ast, options):
-    self.errors = 0
+    def Generate(self, ast, options):
+        self.errors = 0
 
-    rangestr = GetOption('range')
-    releasestr = GetOption('release')
+        rangestr = GetOption('range')
+        releasestr = GetOption('release')
 
-    print "Found releases: %s" % ast.releases
+        print "Found releases: %s" % ast.releases
 
-    # Generate list of files to ignore due to errors
-    for filenode in ast.GetListOf('File'):
-      # If this file has errors, skip it
-      if filenode.GetProperty('ERRORS') > 0:
-        self.skip_list.append(filenode)
-        continue
+        # Generate list of files to ignore due to errors
+        for filenode in ast.GetListOf('File'):
+            # If this file has errors, skip it
+            if filenode.GetProperty('ERRORS') > 0:
+                self.skip_list.append(filenode)
+                continue
 
-    # Check for a range option which over-rides a release option
-    if not releasestr and rangestr:
-      range_list = rangestr.split(',')
-      if len(range_list) != 2:
-        self.Error('Failed to generate for %s, incorrect range: "%s"' %
-                   (self.name, rangestr))
-      else:
-        vmin = range_list[0]
-        vmax = range_list[1]
+        # Check for a range option which over-rides a release option
+        if not releasestr and rangestr:
+            range_list = rangestr.split(',')
+            if len(range_list) != 2:
+                self.Error('Failed to generate for %s, incorrect range: "%s"' %
+                           (self.name, rangestr))
+            else:
+                vmin = range_list[0]
+                vmax = range_list[1]
 
-        # Generate 'start' and 'end' represent first and last found.
-        if vmin == 'start':
-            vmin = ast.releases[0]
-        if vmax == 'end':
-            vmax = ast.releases[-1]
+                # Generate 'start' and 'end' represent first and last found.
+                if vmin == 'start':
+                    vmin = ast.releases[0]
+                if vmax == 'end':
+                    vmax = ast.releases[-1]
 
-        vmin = ast.releases.index(vmin)
-        vmax = ast.releases.index(vmax) + 1
-        releases = ast.releases[vmin:vmax]
-        InfoOut.Log('Generate range %s of %s.' % (rangestr, self.name))
-        ret = self.GenerateRange(ast, releases, options)
-        if ret < 0:
-          self.Error('Failed to generate range %s : %s.' %(vmin, vmax))
+                vmin = ast.releases.index(vmin)
+                vmax = ast.releases.index(vmax) + 1
+                releases = ast.releases[vmin:vmax]
+                InfoOut.Log('Generate range %s of %s.' % (rangestr, self.name))
+                ret = self.GenerateRange(ast, releases, options)
+                if ret < 0:
+                    self.Error('Failed to generate range %s : %s.' % (vmin, vmax))
+                else:
+                    InfoOut.Log('%s wrote %d files.' % (self.name, ret))
+        # Otherwise this should be a single release generation
         else:
-          InfoOut.Log('%s wrote %d files.' % (self.name, ret))
-    # Otherwise this should be a single release generation
-    else:
-      if releasestr == 'start':
-        releasestr = ast.releases[0]
-      if releasestr == 'end':
-        releasestr = ast.releases[-1]
+            if releasestr == 'start':
+                releasestr = ast.releases[0]
+            if releasestr == 'end':
+                releasestr = ast.releases[-1]
 
-      if releasestr > ast.releases[-1]:
-        InfoOut.Log('There is no unique release for %s, using last release.' %
-                    releasestr)
-        releasestr = ast.releases[-1]
+            if releasestr > ast.releases[-1]:
+                InfoOut.Log('There is no unique release for %s, using last release.' %
+                            releasestr)
+                releasestr = ast.releases[-1]
 
-      if releasestr not in ast.releases:
-        self.Error('Release %s not in [%s].' %
-                   (releasestr, ', '.join(ast.releases)))
+            if releasestr not in ast.releases:
+                self.Error('Release %s not in [%s].' %
+                           (releasestr, ', '.join(ast.releases)))
 
-      if releasestr:
-        InfoOut.Log('Generate release %s of %s.' % (releasestr, self.name))
-        ret = self.GenerateRelease(ast, releasestr, options)
-        if ret < 0:
-          self.Error('Failed to generate release %s.' % releasestr)
-        else:
-          InfoOut.Log('%s wrote %d files.' % (self.name, ret))
+            if releasestr:
+                InfoOut.Log('Generate release %s of %s.' % (releasestr, self.name))
+                ret = self.GenerateRelease(ast, releasestr, options)
+                if ret < 0:
+                    self.Error('Failed to generate release %s.' % releasestr)
+                else:
+                    InfoOut.Log('%s wrote %d files.' % (self.name, ret))
 
-      else:
-        self.Error('No range or release specified for %s.' % releasestr)
-    return self.errors
+            else:
+                self.Error('No range or release specified for %s.' % releasestr)
+        return self.errors
 
-  def GenerateRelease(self, ast, release, options):
-    __pychecker__ = 'unusednames=ast,release,options'
-    self.Error("Undefined release generator.")
-    return 0
+    def GenerateRelease(self, ast, release, options):
+        __pychecker__ = 'unusednames=ast,release,options'
+        self.Error("Undefined release generator.")
+        return 0
 
-  def GenerateRange(self, ast, releases, options):
-    __pychecker__ = 'unusednames=ast,releases,options'
-    self.Error("Undefined range generator.")
-    return 0
+    def GenerateRange(self, ast, releases, options):
+        __pychecker__ = 'unusednames=ast,releases,options'
+        self.Error("Undefined range generator.")
+        return 0
 
-  @staticmethod
-  def Run(ast):
-    fail_count = 0
+    @staticmethod
+    def Run(ast):
+        fail_count = 0
 
-    # Check all registered generators if they should run.
-    for gen in GeneratorList:
-      options = gen.GetRunOptions()
-      if options is not None:
-        if gen.Generate(ast, options):
-          fail_count += 1
-    return fail_count
+        # Check all registered generators if they should run.
+        for gen in GeneratorList:
+            options = gen.GetRunOptions()
+            if options is not None:
+                if gen.Generate(ast, options):
+                    fail_count += 1
+        return fail_count
 
 
 class GeneratorByFile(Generator):
-  """A simplified generator that generates one output file per IDL source file.
+    """A simplified generator that generates one output file per IDL source file.
 
-  A subclass of Generator for use of generators which have a one to one
-  mapping between IDL sources and output files.
+    A subclass of Generator for use of generators which have a one to one
+    mapping between IDL sources and output files.
 
-  Derived classes should define GenerateFile.
-  """
+    Derived classes should define GenerateFile.
+    """
 
-  def GenerateFile(self, filenode, releases, options):
-    """Generates an output file from the IDL source.
+    def GenerateFile(self, filenode, releases, options):
+        """Generates an output file from the IDL source.
 
-    Returns true if the generated file is different than the previously
-    generated file.
-    """
-    __pychecker__ = 'unusednames=filenode,releases,options'
-    self.Error("Undefined release generator.")
-    return 0
+        Returns true if the generated file is different than the previously
+        generated file.
+        """
+        __pychecker__ = 'unusednames=filenode,releases,options'
+        self.Error("Undefined release generator.")
+        return 0
 
-  def GenerateRelease(self, ast, release, options):
-    return self.GenerateRange(ast, [release], options)
+    def GenerateRelease(self, ast, release, options):
+        return self.GenerateRange(ast, [release], options)
 
-  def GenerateRange(self, ast, releases, options):
-    # Get list of out files
-    outlist = GetOption('out')
-    if outlist: outlist = outlist.split(',')
+    def GenerateRange(self, ast, releases, options):
+        # Get list of out files
+        outlist = GetOption('out')
+        if outlist:
+            outlist = outlist.split(',')
 
-    skipList = []
-    cnt = 0
-    for filenode in ast.GetListOf('File'):
-      # Ignore files with errors
-      if filenode in self.skip_list:
-        continue
+        skipList = []
+        cnt = 0
+        for filenode in ast.GetListOf('File'):
+            # Ignore files with errors
+            if filenode in self.skip_list:
+                continue
 
-      # Skip this file if not required
-      if outlist and filenode.GetName() not in outlist:
-        continue
+            # Skip this file if not required
+            if outlist and filenode.GetName() not in outlist:
+                continue
 
-      # Create the output file and increment out count if there was a delta
-      if self.GenerateFile(filenode, releases, options):
-        cnt = cnt + 1
+            # Create the output file and increment out count if there was a delta
+            if self.GenerateFile(filenode, releases, options):
+                cnt = cnt + 1
 
-    for filenode in skipList:
-      errcnt = filenode.GetProperty('ERRORS')
-      ErrOut.Log('%s : Skipped because of %d errors.' % (
-          filenode.GetName(), errcnt))
+        for filenode in skipList:
+            errcnt = filenode.GetProperty('ERRORS')
+            ErrOut.Log('%s : Skipped because of %d errors.' % (
+                filenode.GetName(), errcnt))
 
-    if skipList:
-      return -len(skipList)
+        if skipList:
+            return -len(skipList)
 
-    if GetOption('diff'):
-      return -cnt
-    return cnt
+        if GetOption('diff'):
+            return -cnt
+        return cnt
 
 
 check_release = 0
 check_range = 0
 
+
 class GeneratorReleaseTest(Generator):
-  def GenerateRelease(self, ast, release, options = {}):
-    __pychecker__ = 'unusednames=ast,release,options'
-    global check_release
-    check_map = {
-      'so_long': True,
-      'MyOpt': 'XYZ',
-      'goodbye': True
-    }
-    check_release = 1
-    for item in check_map:
-      check_item = check_map[item]
-      option_item = options.get(item, None)
-      if check_item != option_item:
-        print 'Option %s is %s, expecting %s' % (item, option_item, check_item)
-        check_release = 0
+    def GenerateRelease(self, ast, release, options={}):
+        __pychecker__ = 'unusednames=ast,release,options'
+        global check_release
+        check_map = {
+            'so_long': True,
+            'MyOpt': 'XYZ',
+            'goodbye': True
+        }
+        check_release = 1
+        for item in check_map:
+            check_item = check_map[item]
+            option_item = options.get(item, None)
+            if check_item != option_item:
+                print 'Option %s is %s, expecting %s' % (item, option_item, check_item)
+                check_release = 0
 
-    if release != 'M14':
-      check_release = 0
-    return check_release == 1
+        if release != 'M14':
+            check_release = 0
+        return check_release == 1
 
-  def GenerateRange(self, ast, releases, options):
-    __pychecker__ = 'unusednames=ast,releases,options'
-    global check_range
-    check_range = 1
-    return True
+    def GenerateRange(self, ast, releases, options):
+        __pychecker__ = 'unusednames=ast,releases,options'
+        global check_range
+        check_range = 1
+        return True
+
 
 def Test():
-  __pychecker__ = 'unusednames=args'
-  global check_release
-  global check_range
+    __pychecker__ = 'unusednames=args'
+    global check_release
+    global check_range
 
-  ParseOptions(['--testgen_opt=so_long,MyOpt=XYZ,goodbye'])
-  if Generator.Run('AST') != 0:
-    print 'Generate release: Failed.\n'
-    return -1
+    ParseOptions(['--testgen_opt=so_long,MyOpt=XYZ,goodbye'])
+    if Generator.Run('AST') != 0:
+        print 'Generate release: Failed.\n'
+        return -1
 
-  if check_release != 1 or check_range != 0:
-    print 'Gererate release: Failed to run.\n'
-    return -1
+    if check_release != 1 or check_range != 0:
+        print 'Gererate release: Failed to run.\n'
+        return -1
 
-  check_release = 0
-  ParseOptions(['--testgen_opt="HELLO"', '--range=M14,M16'])
-  if Generator.Run('AST') != 0:
-    print 'Generate range: Failed.\n'
-    return -1
+    check_release = 0
+    ParseOptions(['--testgen_opt="HELLO"', '--range=M14,M16'])
+    if Generator.Run('AST') != 0:
+        print 'Generate range: Failed.\n'
+        return -1
 
-  if check_release != 0 or check_range != 1:
-    print 'Gererate range: Failed to run.\n'
-    return -1
+    if check_release != 0 or check_range != 1:
+        print 'Gererate range: Failed to run.\n'
+        return -1
 
-  print 'Generator test: Pass'
-  return 0
+    print 'Generator test: Pass'
+    return 0
 
 
 def Main(args):
-  if not args: return Test()
-  filenames = ParseOptions(args)
-  ast = ParseFiles(filenames)
+    if not args:
+        return Test()
+    filenames = ParseOptions(args)
+    ast = ParseFiles(filenames)
 
-  return Generator.Run(ast)
+    return Generator.Run(ast)
 
 
 if __name__ == '__main__':
-  GeneratorReleaseTest('Test Gen', 'testgen', 'Generator Class Test.')
-  sys.exit(Main(sys.argv[1:]))
+    GeneratorReleaseTest('Test Gen', 'testgen', 'Generator Class Test.')
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_namespace.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_namespace.py
@@ -8,242 +8,252 @@ IDLNamespace for PPAPI
 
 This file defines the behavior of the AST namespace which allows for resolving
 a symbol as one or more AST nodes given a release or range of releases.
 """
 
 import sys
 
 from idl_option import GetOption, Option, ParseOptions
-from idl_log import ErrOut, InfoOut, WarnOut
+from idl_log import InfoOut
 from idl_release import IDLRelease, IDLReleaseList
 
 Option('label', 'Use the specifed label blocks.', default='Chrome')
 Option('namespace_debug', 'Use the specified release')
 
 
 #
 # IDLNamespace
 #
 # IDLNamespace provides a mapping between a symbol name and an IDLReleaseList
 # which contains IDLRelease objects.  It provides an interface for fetching
 # one or more IDLNodes based on a release or range of releases.
 #
 class IDLNamespace(object):
-  def __init__(self, parent):
-    self._name_to_releases = {}
-    self._parent = parent
+    def __init__(self, parent):
+        self._name_to_releases = {}
+        self._parent = parent
 
-  def Dump(self):
-    for name in self._name_to_releases:
-      InfoOut.Log('NAME=%s' % name)
-      for cver in self._name_to_releases[name].GetReleases():
-        InfoOut.Log('  %s' % cver)
-      InfoOut.Log('')
+    def Dump(self):
+        for name in self._name_to_releases:
+            InfoOut.Log('NAME=%s' % name)
+            for cver in self._name_to_releases[name].GetReleases():
+                InfoOut.Log('  %s' % cver)
+            InfoOut.Log('')
 
-  def FindRelease(self, name, release):
-    verlist = self._name_to_releases.get(name, None)
-    if verlist == None:
-      if self._parent:
-        return self._parent.FindRelease(name, release)
-      else:
-        return None
-    return verlist.FindRelease(release)
+    def FindRelease(self, name, release):
+        verlist = self._name_to_releases.get(name, None)
+        if verlist is None:
+            if self._parent:
+                return self._parent.FindRelease(name, release)
+            else:
+                return None
+        return verlist.FindRelease(release)
 
-  def FindRange(self, name, rmin, rmax):
-    verlist = self._name_to_releases.get(name, None)
-    if verlist == None:
-      if self._parent:
-        return self._parent.FindRange(name, rmin, rmax)
-      else:
-        return []
-    return verlist.FindRange(rmin, rmax)
+    def FindRange(self, name, rmin, rmax):
+        verlist = self._name_to_releases.get(name, None)
+        if verlist is None:
+            if self._parent:
+                return self._parent.FindRange(name, rmin, rmax)
+            else:
+                return []
+        return verlist.FindRange(rmin, rmax)
 
-  def FindList(self, name):
-    verlist = self._name_to_releases.get(name, None)
-    if verlist == None:
-      if self._parent:
-        return self._parent.FindList(name)
-    return verlist
+    def FindList(self, name):
+        verlist = self._name_to_releases.get(name, None)
+        if verlist is None:
+            if self._parent:
+                return self._parent.FindList(name)
+        return verlist
 
-  def AddNode(self, node):
-    name = node.GetName()
-    verlist = self._name_to_releases.setdefault(name,IDLReleaseList())
-    if GetOption('namespace_debug'):
-        print "Adding to namespace: %s" % node
-    return verlist.AddNode(node)
+    def AddNode(self, node):
+        name = node.GetName()
+        verlist = self._name_to_releases.setdefault(name, IDLReleaseList())
+        if GetOption('namespace_debug'):
+            print "Adding to namespace: %s" % node
+        return verlist.AddNode(node)
 
 
 #
 # Testing Code
 #
 
 #
 # MockNode
 #
 # Mocks the IDLNode to support error, warning handling, and string functions.
 #
 class MockNode(IDLRelease):
-  def __init__(self, name, rmin, rmax):
-    self.name = name
-    self.rmin = rmin
-    self.rmax = rmax
-    self.errors = []
-    self.warns = []
-    self.properties = {
-        'NAME': name,
-        'release': rmin,
-        'deprecate' : rmax
+    def __init__(self, name, rmin, rmax):
+        super(MockNode, self).__init__(rmin, rmax)
+        self.name = name
+        self.rmin = rmin
+        self.rmax = rmax
+        self.errors = []
+        self.warns = []
+        self.properties = {
+            'NAME': name,
+            'release': rmin,
+            'deprecate': rmax
         }
 
-  def __str__(self):
-    return '%s (%s : %s)' % (self.name, self.rmin, self.rmax)
+    def __str__(self):
+        return '%s (%s : %s)' % (self.name, self.rmin, self.rmax)
 
-  def GetName(self):
-    return self.name
+    def GetName(self):
+        return self.name
 
-  def Error(self, msg):
-    if GetOption('release_debug'): print 'Error: %s' % msg
-    self.errors.append(msg)
+    def Error(self, msg):
+        if GetOption('release_debug'):
+            print 'Error: %s' % msg
+        self.errors.append(msg)
 
-  def Warn(self, msg):
-    if GetOption('release_debug'): print 'Warn: %s' % msg
-    self.warns.append(msg)
+    def Warn(self, msg):
+        if GetOption('release_debug'):
+            print 'Warn: %s' % msg
+        self.warns.append(msg)
 
-  def GetProperty(self, name):
-    return self.properties.get(name, None)
+    def GetProperty(self, name):
+        return self.properties.get(name, None)
+
 
 errors = 0
+
+
 #
 # DumpFailure
 #
 # Dumps all the information relevant  to an add failure.
 def DumpFailure(namespace, node, msg):
-  global errors
-  print '\n******************************'
-  print 'Failure: %s %s' % (node, msg)
-  for warn in node.warns:
-    print '  WARN: %s' % warn
-  for err in node.errors:
-    print '  ERROR: %s' % err
-  print '\n'
-  namespace.Dump()
-  print '******************************\n'
-  errors += 1
+    global errors
+    print '\n******************************'
+    print 'Failure: %s %s' % (node, msg)
+    for warn in node.warns:
+        print '  WARN: %s' % warn
+    for err in node.errors:
+        print '  ERROR: %s' % err
+    print '\n'
+    namespace.Dump()
+    print '******************************\n'
+    errors += 1
+
 
 # Add expecting no errors or warnings
 def AddOkay(namespace, node):
-  okay = namespace.AddNode(node)
-  if not okay or node.errors or node.warns:
-    DumpFailure(namespace, node, 'Expected success')
+    okay = namespace.AddNode(node)
+    if not okay or node.errors or node.warns:
+        DumpFailure(namespace, node, 'Expected success')
+
 
 # Add expecting a specific warning
 def AddWarn(namespace, node, msg):
-  okay = namespace.AddNode(node)
-  if not okay or node.errors or not node.warns:
-    DumpFailure(namespace, node, 'Expected warnings')
-  if msg not in node.warns:
-    DumpFailure(namespace, node, 'Expected warning: %s' % msg)
+    okay = namespace.AddNode(node)
+    if not okay or node.errors or not node.warns:
+        DumpFailure(namespace, node, 'Expected warnings')
+    if msg not in node.warns:
+        DumpFailure(namespace, node, 'Expected warning: %s' % msg)
+
 
 # Add expecting a specific error any any number of warnings
 def AddError(namespace, node, msg):
-  okay = namespace.AddNode(node)
-  if okay or not node.errors:
-    DumpFailure(namespace, node, 'Expected errors')
-  if msg not in node.errors:
-    DumpFailure(namespace, node, 'Expected error: %s' % msg)
-    print ">>%s<<\n>>%s<<\n" % (node.errors[0], msg)
+    okay = namespace.AddNode(node)
+    if okay or not node.errors:
+        DumpFailure(namespace, node, 'Expected errors')
+    if msg not in node.errors:
+        DumpFailure(namespace, node, 'Expected error: %s' % msg)
+        print ">>%s<<\n>>%s<<\n" % (node.errors[0], msg)
+
 
 # Verify that a FindRelease call on the namespace returns the expected node.
 def VerifyFindOne(namespace, name, release, node):
-  global errors
-  if (namespace.FindRelease(name, release) != node):
-    print "Failed to find %s as release %f of %s" % (node, release, name)
-    namespace.Dump()
-    print "\n"
-    errors += 1
+    global errors
+    if (namespace.FindRelease(name, release) != node):
+        print "Failed to find %s as release %f of %s" % (node, release, name)
+        namespace.Dump()
+        print "\n"
+        errors += 1
+
 
 # Verify that a FindRage call on the namespace returns a set of expected nodes.
 def VerifyFindAll(namespace, name, rmin, rmax, nodes):
-  global errors
-  out = namespace.FindRange(name, rmin, rmax)
-  if (out != nodes):
-    print "Found [%s] instead of[%s] for releases %f to %f of %s" % (
-        ' '.join([str(x) for x in out]),
-        ' '.join([str(x) for x in nodes]),
-        rmin,
-        rmax,
-        name)
-    namespace.Dump()
-    print "\n"
-    errors += 1
-
-def Main(args):
-  global errors
-  ParseOptions(args)
-
-  InfoOut.SetConsole(True)
-
-  namespace = IDLNamespace(None)
-
-  FooXX = MockNode('foo', None, None)
-  Foo1X = MockNode('foo', 1.0, None)
-  Foo2X = MockNode('foo', 2.0, None)
-  Foo3X = MockNode('foo', 3.0, None)
-
-  # Verify we succeed with undeprecated adds
-  AddOkay(namespace, FooXX)
-  AddOkay(namespace, Foo1X)
-  AddOkay(namespace, Foo3X)
-  # Verify we fail to add a node between undeprecated releases
-  AddError(namespace, Foo2X,
-           'Overlap in releases: 3.0 vs 2.0 when adding foo (2.0 : None)')
-
-  BarXX = MockNode('bar', None, None)
-  Bar12 = MockNode('bar', 1.0, 2.0)
-  Bar23 = MockNode('bar', 2.0, 3.0)
-  Bar34 = MockNode('bar', 3.0, 4.0)
+    global errors
+    out = namespace.FindRange(name, rmin, rmax)
+    if out != nodes:
+        print "Found [%s] instead of[%s] for releases %f to %f of %s" % (
+            ' '.join([str(x) for x in out]),
+            ' '.join([str(x) for x in nodes]),
+            rmin,
+            rmax,
+            name)
+        namespace.Dump()
+        print "\n"
+        errors += 1
 
 
-  # Verify we succeed with fully qualified releases
-  namespace = IDLNamespace(namespace)
-  AddOkay(namespace, BarXX)
-  AddOkay(namespace, Bar12)
-  # Verify we warn when detecting a gap
-  AddWarn(namespace, Bar34, 'Gap in release numbers.')
-  # Verify we fail when inserting into this gap
-  # (NOTE: while this could be legal, it is sloppy so we disallow it)
-  AddError(namespace, Bar23, 'Declarations out of order.')
+def Main(args):
+    global errors
+    ParseOptions(args)
+
+    InfoOut.SetConsole(True)
+
+    namespace = IDLNamespace(None)
+
+    FooXX = MockNode('foo', None, None)
+    Foo1X = MockNode('foo', 1.0, None)
+    Foo2X = MockNode('foo', 2.0, None)
+    Foo3X = MockNode('foo', 3.0, None)
 
-  # Verify local namespace
-  VerifyFindOne(namespace, 'bar', 0.0, BarXX)
-  VerifyFindAll(namespace, 'bar', 0.5, 1.5, [BarXX, Bar12])
+    # Verify we succeed with undeprecated adds
+    AddOkay(namespace, FooXX)
+    AddOkay(namespace, Foo1X)
+    AddOkay(namespace, Foo3X)
+    # Verify we fail to add a node between undeprecated releases
+    AddError(namespace, Foo2X,
+             'Overlap in releases: 3.0 vs 2.0 when adding foo (2.0 : None)')
+
+    BarXX = MockNode('bar', None, None)
+    Bar12 = MockNode('bar', 1.0, 2.0)
+    Bar23 = MockNode('bar', 2.0, 3.0)
+    Bar34 = MockNode('bar', 3.0, 4.0)
 
-  # Verify the correct release of the object is found recursively
-  VerifyFindOne(namespace, 'foo', 0.0, FooXX)
-  VerifyFindOne(namespace, 'foo', 0.5, FooXX)
-  VerifyFindOne(namespace, 'foo', 1.0, Foo1X)
-  VerifyFindOne(namespace, 'foo', 1.5, Foo1X)
-  VerifyFindOne(namespace, 'foo', 3.0, Foo3X)
-  VerifyFindOne(namespace, 'foo', 100.0, Foo3X)
+    # Verify we succeed with fully qualified releases
+    namespace = IDLNamespace(namespace)
+    AddOkay(namespace, BarXX)
+    AddOkay(namespace, Bar12)
+    # Verify we warn when detecting a gap
+    AddWarn(namespace, Bar34, 'Gap in release numbers.')
+    # Verify we fail when inserting into this gap
+    # (NOTE: while this could be legal, it is sloppy so we disallow it)
+    AddError(namespace, Bar23, 'Declarations out of order.')
+
+    # Verify local namespace
+    VerifyFindOne(namespace, 'bar', 0.0, BarXX)
+    VerifyFindAll(namespace, 'bar', 0.5, 1.5, [BarXX, Bar12])
 
-  # Verify the correct range of objects is found
-  VerifyFindAll(namespace, 'foo', 0.0, 1.0, [FooXX])
-  VerifyFindAll(namespace, 'foo', 0.5, 1.0, [FooXX])
-  VerifyFindAll(namespace, 'foo', 1.0, 1.1, [Foo1X])
-  VerifyFindAll(namespace, 'foo', 0.5, 1.5, [FooXX, Foo1X])
-  VerifyFindAll(namespace, 'foo', 0.0, 3.0, [FooXX, Foo1X])
-  VerifyFindAll(namespace, 'foo', 3.0, 100.0, [Foo3X])
+    # Verify the correct release of the object is found recursively
+    VerifyFindOne(namespace, 'foo', 0.0, FooXX)
+    VerifyFindOne(namespace, 'foo', 0.5, FooXX)
+    VerifyFindOne(namespace, 'foo', 1.0, Foo1X)
+    VerifyFindOne(namespace, 'foo', 1.5, Foo1X)
+    VerifyFindOne(namespace, 'foo', 3.0, Foo3X)
+    VerifyFindOne(namespace, 'foo', 100.0, Foo3X)
 
-  FooBar = MockNode('foobar', 1.0, 2.0)
-  namespace = IDLNamespace(namespace)
-  AddOkay(namespace, FooBar)
+    # Verify the correct range of objects is found
+    VerifyFindAll(namespace, 'foo', 0.0, 1.0, [FooXX])
+    VerifyFindAll(namespace, 'foo', 0.5, 1.0, [FooXX])
+    VerifyFindAll(namespace, 'foo', 1.0, 1.1, [Foo1X])
+    VerifyFindAll(namespace, 'foo', 0.5, 1.5, [FooXX, Foo1X])
+    VerifyFindAll(namespace, 'foo', 0.0, 3.0, [FooXX, Foo1X])
+    VerifyFindAll(namespace, 'foo', 3.0, 100.0, [Foo3X])
 
-  if errors:
-    print 'Test failed with %d errors.' % errors
-  else:
-    print 'Passed.'
-  return errors
+    FooBar = MockNode('foobar', 1.0, 2.0)
+    namespace = IDLNamespace(namespace)
+    AddOkay(namespace, FooBar)
+
+    if errors:
+        print 'Test failed with %d errors.' % errors
+    else:
+        print 'Passed.'
+    return errors
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
-
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_node.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_node.py
@@ -24,424 +24,423 @@ from idl_release import IDLRelease, IDLR
 
 
 # IDLAttribute
 #
 # A temporary object used by the parsing process to hold an Extended Attribute
 # which will be passed as a child to a standard IDLNode.
 #
 class IDLAttribute(object):
-  def __init__(self, name, value):
-    self.cls = 'ExtAttribute'
-    self.name = name
-    self.value = value
+    def __init__(self, name, value):
+        self.cls = 'ExtAttribute'
+        self.name = name
+        self.value = value
 
-  def __str__(self):
-    return '%s=%s' % (self.name, self.value)
+    def __str__(self):
+        return '%s=%s' % (self.name, self.value)
+
 
 #
 # IDLNode
 #
 # This class implements the AST tree, providing the associations between
 # parents and children.  It also contains a namepsace and propertynode to
 # allow for look-ups.  IDLNode is derived from IDLRelease, so it is
 # version aware.
 #
 class IDLNode(IDLRelease):
+    # Set of object IDLNode types which have a name and belong in the namespace.
+    NamedSet = {'Enum', 'EnumItem', 'File', 'Function', 'Interface', 'Member', 'Param', 'Struct', 'Type', 'Typedef'}
 
-  # Set of object IDLNode types which have a name and belong in the namespace.
-  NamedSet = set(['Enum', 'EnumItem', 'File', 'Function', 'Interface',
-                  'Member', 'Param', 'Struct', 'Type', 'Typedef'])
-
-  def __init__(self, cls, filename, lineno, pos, children=None):
-    # Initialize with no starting or ending Version
-    IDLRelease.__init__(self, None, None)
+    def __init__(self, cls, filename, lineno, pos, children=None):
+        # Initialize with no starting or ending Version
+        IDLRelease.__init__(self, None, None)
 
-    self.cls = cls
-    self.lineno = lineno
-    self.pos = pos
-    self._filename = filename
-    self._deps = {}
-    self.errors = 0
-    self.namespace = None
-    self.typelist = None
-    self.parent = None
-    self._property_node = IDLPropertyNode()
-    self._unique_releases = None
+        self.cls = cls
+        self.lineno = lineno
+        self.pos = pos
+        self._filename = filename
+        self._deps = {}
+        self.errors = 0
+        self.namespace = None
+        self.typelist = None
+        self.parent = None
+        self._property_node = IDLPropertyNode()
+        self._unique_releases = None
 
-    # A list of unique releases for this node
-    self.releases = None
+        # A list of unique releases for this node
+        self.releases = None
 
-    # A map from any release, to the first unique release
-    self.first_release = None
+        # A map from any release, to the first unique release
+        self.first_release = None
 
-    # self._children is a list of children ordered as defined
-    self._children = []
-    # Process the passed in list of children, placing ExtAttributes into the
-    # property dictionary, and nodes into the local child list in order.  In
-    # addition, add nodes to the namespace if the class is in the NamedSet.
-    if children:
-      for child in children:
-        if child.cls == 'ExtAttribute':
-          self.SetProperty(child.name, child.value)
-        else:
-          self.AddChild(child)
+        # self._children is a list of children ordered as defined
+        self._children = []
+        # Process the passed in list of children, placing ExtAttributes into the
+        # property dictionary, and nodes into the local child list in order.  In
+        # addition, add nodes to the namespace if the class is in the NamedSet.
+        if children:
+            for child in children:
+                if child.cls == 'ExtAttribute':
+                    self.SetProperty(child.name, child.value)
+                else:
+                    self.AddChild(child)
 
-  def __str__(self):
-    name = self.GetName()
-    if name is None:
-      name = ''
-    return '%s(%s)' % (self.cls, name)
+    def __str__(self):
+        name = self.GetName()
+        if name is None:
+            name = ''
+        return '%s(%s)' % (self.cls, name)
 
-  def Location(self):
-    """Return a file and line number for where this node was defined."""
-    return '%s(%d)' % (self._filename, self.lineno)
+    def Location(self):
+        """Return a file and line number for where this node was defined."""
+        return '%s(%d)' % (self._filename, self.lineno)
 
-  def Error(self, msg):
-    """Log an error for this object."""
-    self.errors += 1
-    ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
-                   (str(self), msg))
-    filenode = self.GetProperty('FILE')
-    if filenode:
-      errcnt = filenode.GetProperty('ERRORS')
-      if not errcnt:
-        errcnt = 0
-      filenode.SetProperty('ERRORS', errcnt + 1)
+    def Error(self, msg):
+        """Log an error for this object."""
+        self.errors += 1
+        ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
+                       (str(self), msg))
+        filenode = self.GetProperty('FILE')
+        if filenode:
+            errcnt = filenode.GetProperty('ERRORS')
+            if not errcnt:
+                errcnt = 0
+            filenode.SetProperty('ERRORS', errcnt + 1)
 
-  def Warning(self, msg):
-    """Log a warning for this object."""
-    WarnOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
-                    (str(self), msg))
+    def Warning(self, msg):
+        """Log a warning for this object."""
+        WarnOut.LogLine(self._filename, self.lineno, 0, ' %s %s' %
+                        (str(self), msg))
 
-  def GetName(self):
-    return self.GetProperty('NAME')
+    def GetName(self):
+        return self.GetProperty('NAME')
 
-  def Dump(self, depth=0, comments=False, out=sys.stdout):
-    """Dump this object and its children"""
-    if self.cls in ['Comment', 'Copyright']:
-      is_comment = True
-    else:
-      is_comment = False
+    def Dump(self, depth=0, comments=False, out=sys.stdout):
+        """Dump this object and its children"""
+        if self.cls in ['Comment', 'Copyright']:
+            is_comment = True
+        else:
+            is_comment = False
 
-    # Skip this node if it's a comment, and we are not printing comments
-    if not comments and is_comment:
-      return
+        # Skip this node if it's a comment, and we are not printing comments
+        if not comments and is_comment:
+            return
 
-    tab = ''.rjust(depth * 2)
-    if is_comment:
-      out.write('%sComment\n' % tab)
-      for line in self.GetName().split('\n'):
-        out.write('%s  "%s"\n' % (tab, line))
-    else:
-      ver = IDLRelease.__str__(self)
-      if self.releases:
-        release_list = ': ' # + ' '.join(self.releases)
-      else:
-        release_list = ': undefined'
-      out.write('%s%s%s%s\n' % (tab, self, ver, release_list))
-    if self.typelist:
-      out.write('%s  Typelist: %s\n' % (tab, self.typelist.GetReleases()[0]))
-    properties = self._property_node.GetPropertyList()
-    if properties:
-      out.write('%s  Properties\n' % tab)
-      for p in properties:
-        if is_comment and p == 'NAME':
-          # Skip printing the name for comments, since we printed above already
-          continue
-        out.write('%s    %s : %s\n' % (tab, p, self.GetProperty(p)))
-    for child in self._children:
-      child.Dump(depth+1, comments=comments, out=out)
+        tab = ''.rjust(depth * 2)
+        if is_comment:
+            out.write('%sComment\n' % tab)
+            for line in self.GetName().split('\n'):
+                out.write('%s  "%s"\n' % (tab, line))
+        else:
+            ver = IDLRelease.__str__(self)
+            if self.releases:
+                release_list = ': '  # + ' '.join(self.releases)
+            else:
+                release_list = ': undefined'
+            out.write('%s%s%s%s\n' % (tab, self, ver, release_list))
+        if self.typelist:
+            out.write('%s  Typelist: %s\n' % (tab, self.typelist.GetReleases()[0]))
+        properties = self._property_node.GetPropertyList()
+        if properties:
+            out.write('%s  Properties\n' % tab)
+            for p in properties:
+                if is_comment and p == 'NAME':
+                    # Skip printing the name for comments, since we printed above already
+                    continue
+                out.write('%s    %s : %s\n' % (tab, p, self.GetProperty(p)))
+        for child in self._children:
+            child.Dump(depth + 1, comments=comments, out=out)
 
-  def IsA(self, *typelist):
-    """Check if node is of a given type."""
-    return self.cls in typelist
+    def IsA(self, *typelist):
+        """Check if node is of a given type."""
+        return self.cls in typelist
 
-  def GetListOf(self, *keys):
-    """Get a list of objects for the given key(s)."""
-    out = []
-    for child in self._children:
-      if child.cls in keys:
-        out.append(child)
-    return out
+    def GetListOf(self, *keys):
+        """Get a list of objects for the given key(s)."""
+        out = []
+        for child in self._children:
+            if child.cls in keys:
+                out.append(child)
+        return out
 
-  def GetOneOf(self, *keys):
-    """Get an object for the given key(s)."""
-    out = self.GetListOf(*keys)
-    if out:
-      return out[0]
-    return None
+    def GetOneOf(self, *keys):
+        """Get an object for the given key(s)."""
+        out = self.GetListOf(*keys)
+        if out:
+            return out[0]
+        return None
 
-  def SetParent(self, parent):
-    self._property_node.AddParent(parent)
-    self.parent = parent
+    def SetParent(self, parent):
+        self._property_node.AddParent(parent)
+        self.parent = parent
 
-  def AddChild(self, node):
-    node.SetParent(self)
-    self._children.append(node)
+    def AddChild(self, node):
+        node.SetParent(self)
+        self._children.append(node)
 
-  # Get a list of all children
-  def GetChildren(self):
-    return self._children
+    # Get a list of all children
+    def GetChildren(self):
+        return self._children
 
-  def GetType(self, release):
-    if not self.typelist:
-      return None
-    return self.typelist.FindRelease(release)
+    def GetType(self, release):
+        if not self.typelist:
+            return None
+        return self.typelist.FindRelease(release)
 
-  def GetDeps(self, release, visited=None):
-    visited = visited or set()
+    def GetDeps(self, release, visited=None):
+        visited = visited or set()
 
-    # If this release is not valid for this object, then done.
-    if not self.IsRelease(release) or self.IsA('Comment', 'Copyright'):
-      return set([])
+        # If this release is not valid for this object, then done.
+        if not self.IsRelease(release) or self.IsA('Comment', 'Copyright'):
+            return set([])
 
-    # If we have cached the info for this release, return the cached value
-    deps = self._deps.get(release, None)
-    if deps is not None:
-      return deps
+        # If we have cached the info for this release, return the cached value
+        deps = self._deps.get(release, None)
+        if deps is not None:
+            return deps
 
-    # If we are already visited, then return
-    if self in visited:
-      return set([self])
+        # If we are already visited, then return
+        if self in visited:
+            return {self}
 
-    # Otherwise, build the dependency list
-    visited |= set([self])
-    deps = set([self])
+        # Otherwise, build the dependency list
+        visited |= {self}
+        deps = {self}
 
-    # Get child deps
-    for child in self.GetChildren():
-      deps |= child.GetDeps(release, visited)
-      visited |= set(deps)
+        # Get child deps
+        for child in self.GetChildren():
+            deps |= child.GetDeps(release, visited)
+            visited |= set(deps)
 
-    # Get type deps
-    typeref = self.GetType(release)
-    if typeref:
-      deps |= typeref.GetDeps(release, visited)
+        # Get type deps
+        typeref = self.GetType(release)
+        if typeref:
+            deps |= typeref.GetDeps(release, visited)
 
-    self._deps[release] = deps
-    return deps
+        self._deps[release] = deps
+        return deps
 
-  def GetVersion(self, release):
-    filenode = self.GetProperty('FILE')
-    if not filenode:
-      return None
-    return filenode.release_map.GetVersion(release)
+    def GetVersion(self, release):
+        filenode = self.GetProperty('FILE')
+        if not filenode:
+            return None
+        return filenode.release_map.GetVersion(release)
 
-  def GetUniqueReleases(self, releases):
-    """Return the unique set of first releases corresponding to input
+    def GetUniqueReleases(self, releases):
+        """Return the unique set of first releases corresponding to input
 
     Since we are returning the corresponding 'first' version for a
     release, we may return a release version prior to the one in the list."""
-    my_min, my_max = self.GetMinMax(releases)
-    if my_min > releases[-1] or my_max < releases[0]:
-      return []
+        my_min, my_max = self.GetMinMax(releases)
+        if my_min > releases[-1] or my_max < releases[0]:
+            return []
+
+        out = set()
+        for rel in releases:
+            remapped = self.first_release[rel]
+            if not remapped:
+                continue
+            out |= {remapped}
+
+        # Cache the most recent set of unique_releases
+        self._unique_releases = sorted(out)
+        return self._unique_releases
 
-    out = set()
-    for rel in releases:
-      remapped = self.first_release[rel]
-      if not remapped:
-        continue
-      out |= set([remapped])
+    def LastRelease(self, release):
+        # Get the most recent release from the most recently generated set of
+        # cached unique releases.
+        if self._unique_releases and self._unique_releases[-1] > release:
+            return False
+        return True
 
-    # Cache the most recent set of unique_releases
-    self._unique_releases = sorted(out)
-    return self._unique_releases
+    def GetRelease(self, version):
+        filenode = self.GetProperty('FILE')
+        if not filenode:
+            return None
+        return filenode.release_map.GetRelease(version)
+
+    def _GetReleaseList(self, releases, visited=None):
+        visited = visited or set()
+        if not self.releases:
+            # If we are unversionable, then return first available release
+            if self.IsA('Comment', 'Copyright', 'Label'):
+                self.releases = []
+                return self.releases
+
+            # Generate the first and if deprecated within this subset, the
+            # last release for this node
+            my_min, my_max = self.GetMinMax(releases)
 
-  def LastRelease(self, release):
-    # Get the most recent release from the most recently generated set of
-    # cached unique releases.
-    if self._unique_releases and self._unique_releases[-1] > release:
-      return False
-    return True
+            if my_max != releases[-1]:
+                my_releases = {my_min, my_max}
+            else:
+                my_releases = {my_min}
+
+            r = self.GetRelease(self.GetProperty('version'))
+            if r not in my_releases:
+                my_releases |= {r}
+
+            # Break cycle if we reference ourselves
+            if self in visited:
+                return [my_min]
+
+            visited |= {self}
+
+            # Files inherit all their releases from items in the file
+            if self.IsA('AST', 'File'):
+                my_releases = set()
+
+            # Visit all children
+            child_releases = set()
 
-  def GetRelease(self, version):
-    filenode = self.GetProperty('FILE')
-    if not filenode:
-      return None
-    return filenode.release_map.GetRelease(version)
+            # Exclude sibling results from parent visited set
+            cur_visits = visited
+
+            for child in self._children:
+                child_releases |= set(child._GetReleaseList(releases, cur_visits))
+                visited |= set(child_releases)
 
-  def _GetReleaseList(self, releases, visited=None):
-    visited = visited or set()
-    if not self.releases:
-      # If we are unversionable, then return first available release
-      if self.IsA('Comment', 'Copyright', 'Label'):
-        self.releases = []
+            # Visit my type
+            type_releases = set()
+            if self.typelist:
+                type_list = self.typelist.GetReleases()
+                for typenode in type_list:
+                    type_releases |= set(typenode._GetReleaseList(releases, cur_visits))
+
+                type_release_list = sorted(type_releases)
+                if my_min < type_release_list[0]:
+                    type_node = type_list[0]
+                    self.Error('requires %s in %s which is undefined at %s.' % (
+                        type_node, type_node._filename, my_min))
+
+            for rel in child_releases | type_releases:
+                if my_min <= rel <= my_max:
+                    my_releases |= {rel}
+
+            self.releases = sorted(my_releases)
         return self.releases
 
-      # Generate the first and if deprecated within this subset, the
-      # last release for this node
-      my_min, my_max = self.GetMinMax(releases)
-
-      if my_max != releases[-1]:
-        my_releases = set([my_min, my_max])
-      else:
-        my_releases = set([my_min])
-
-      r = self.GetRelease(self.GetProperty('version'))
-      if not r in my_releases:
-        my_releases |= set([r])
-
-      # Break cycle if we reference ourselves
-      if self in visited:
-        return [my_min]
-
-      visited |= set([self])
+    def BuildReleaseMap(self, releases):
+        unique_list = self._GetReleaseList(releases)
+        _, my_max = self.GetMinMax(releases)
 
-      # Files inherit all their releases from items in the file
-      if self.IsA('AST', 'File'):
-        my_releases = set()
-
-      # Visit all children
-      child_releases = set()
-
-      # Exclude sibling results from parent visited set
-      cur_visits = visited
+        self.first_release = {}
+        last_rel = None
+        for rel in releases:
+            if rel in unique_list:
+                last_rel = rel
+            self.first_release[rel] = last_rel
+            if rel == my_max:
+                last_rel = None
 
-      for child in self._children:
-        child_releases |= set(child._GetReleaseList(releases, cur_visits))
-        visited |= set(child_releases)
-
-      # Visit my type
-      type_releases = set()
-      if self.typelist:
-        type_list = self.typelist.GetReleases()
-        for typenode in type_list:
-          type_releases |= set(typenode._GetReleaseList(releases, cur_visits))
+    def SetProperty(self, name, val):
+        self._property_node.SetProperty(name, val)
 
-        type_release_list = sorted(type_releases)
-        if my_min < type_release_list[0]:
-          type_node = type_list[0]
-          self.Error('requires %s in %s which is undefined at %s.' % (
-              type_node, type_node._filename, my_min))
+    def GetProperty(self, name):
+        return self._property_node.GetProperty(name)
 
-      for rel in child_releases | type_releases:
-        if rel >= my_min and rel <= my_max:
-          my_releases |= set([rel])
+    def GetPropertyLocal(self, name):
+        return self._property_node.GetPropertyLocal(name)
 
-      self.releases = sorted(my_releases)
-    return self.releases
-
-  def BuildReleaseMap(self, releases):
-    unique_list = self._GetReleaseList(releases)
-    _, my_max = self.GetMinMax(releases)
+    def NodeIsDevOnly(self):
+        """Returns true iff a node is only in dev channel."""
+        return self.GetProperty('dev_version') and not self.GetProperty('version')
 
-    self.first_release = {}
-    last_rel = None
-    for rel in releases:
-      if rel in unique_list:
-        last_rel = rel
-      self.first_release[rel] = last_rel
-      if rel == my_max:
-        last_rel = None
-
-  def SetProperty(self, name, val):
-    self._property_node.SetProperty(name, val)
-
-  def GetProperty(self, name):
-    return self._property_node.GetProperty(name)
-
-  def GetPropertyLocal(self, name):
-    return self._property_node.GetPropertyLocal(name)
-
-  def NodeIsDevOnly(self):
-    """Returns true iff a node is only in dev channel."""
-    return self.GetProperty('dev_version') and not self.GetProperty('version')
-
-  def DevInterfaceMatchesStable(self, release):
-    """Returns true if an interface has an equivalent stable version."""
-    assert(self.IsA('Interface'))
-    for child in self.GetListOf('Member'):
-      unique = child.GetUniqueReleases([release])
-      if not unique or not child.InReleases([release]):
-        continue
-      if child.NodeIsDevOnly():
-        return False
-    return True
+    def DevInterfaceMatchesStable(self, release):
+        """Returns true if an interface has an equivalent stable version."""
+        assert (self.IsA('Interface'))
+        for child in self.GetListOf('Member'):
+            unique = child.GetUniqueReleases([release])
+            if not unique or not child.InReleases([release]):
+                continue
+            if child.NodeIsDevOnly():
+                return False
+        return True
 
 
 #
 # IDLFile
 #
 # A specialized version of IDLNode which tracks errors and warnings.
 #
 class IDLFile(IDLNode):
-  def __init__(self, name, children, errors=0):
-    attrs = [IDLAttribute('NAME', name),
-             IDLAttribute('ERRORS', errors)]
-    if not children:
-      children = []
-    IDLNode.__init__(self, 'File', name, 1, 0, attrs + children)
-    # TODO(teravest): Why do we set release map like this here? This looks
-    # suspicious...
-    self.release_map = IDLReleaseMap([('M13', 1.0, 'stable')])
+    def __init__(self, name, children, errors=0):
+        attrs = [IDLAttribute('NAME', name),
+                 IDLAttribute('ERRORS', errors)]
+        if not children:
+            children = []
+        IDLNode.__init__(self, 'File', name, 1, 0, attrs + children)
+        # TODO(teravest): Why do we set release map like this here? This looks
+        # suspicious...
+        self.release_map = IDLReleaseMap([('M13', 1.0, 'stable')])
 
 
 #
 # Tests
 #
 def StringTest():
-  errors = 0
-  name_str = 'MyName'
-  text_str = 'MyNode(%s)' % name_str
-  name_node = IDLAttribute('NAME', name_str)
-  node = IDLNode('MyNode', 'no file', 1, 0, [name_node])
-  if node.GetName() != name_str:
-    ErrOut.Log('GetName returned >%s< not >%s<' % (node.GetName(), name_str))
-    errors += 1
-  if node.GetProperty('NAME') != name_str:
-    ErrOut.Log('Failed to get name property.')
-    errors += 1
-  if str(node) != text_str:
-    ErrOut.Log('str() returned >%s< not >%s<' % (str(node), text_str))
-    errors += 1
-  if not errors:
-    InfoOut.Log('Passed StringTest')
-  return errors
+    errors = 0
+    name_str = 'MyName'
+    text_str = 'MyNode(%s)' % name_str
+    name_node = IDLAttribute('NAME', name_str)
+    node = IDLNode('MyNode', 'no file', 1, 0, [name_node])
+    if node.GetName() != name_str:
+        ErrOut.Log('GetName returned >%s< not >%s<' % (node.GetName(), name_str))
+        errors += 1
+    if node.GetProperty('NAME') != name_str:
+        ErrOut.Log('Failed to get name property.')
+        errors += 1
+    if str(node) != text_str:
+        ErrOut.Log('str() returned >%s< not >%s<' % (str(node), text_str))
+        errors += 1
+    if not errors:
+        InfoOut.Log('Passed StringTest')
+    return errors
 
 
 def ChildTest():
-  errors = 0
-  child = IDLNode('child', 'no file', 1, 0)
-  parent = IDLNode('parent', 'no file', 1, 0, [child])
+    errors = 0
+    child = IDLNode('child', 'no file', 1, 0)
+    parent = IDLNode('parent', 'no file', 1, 0, [child])
 
-  if child.parent != parent:
-    ErrOut.Log('Failed to connect parent.')
-    errors += 1
+    if child.parent != parent:
+        ErrOut.Log('Failed to connect parent.')
+        errors += 1
 
-  if [child] != parent.GetChildren():
-    ErrOut.Log('Failed GetChildren.')
-    errors += 1
+    if [child] != parent.GetChildren():
+        ErrOut.Log('Failed GetChildren.')
+        errors += 1
 
-  if child != parent.GetOneOf('child'):
-    ErrOut.Log('Failed GetOneOf(child)')
-    errors += 1
+    if child != parent.GetOneOf('child'):
+        ErrOut.Log('Failed GetOneOf(child)')
+        errors += 1
 
-  if parent.GetOneOf('bogus'):
-    ErrOut.Log('Failed GetOneOf(bogus)')
-    errors += 1
+    if parent.GetOneOf('bogus'):
+        ErrOut.Log('Failed GetOneOf(bogus)')
+        errors += 1
 
-  if not parent.IsA('parent'):
-    ErrOut.Log('Expecting parent type')
-    errors += 1
+    if not parent.IsA('parent'):
+        ErrOut.Log('Expecting parent type')
+        errors += 1
 
-  parent = IDLNode('parent', 'no file', 1, 0, [child, child])
-  if [child, child] != parent.GetChildren():
-    ErrOut.Log('Failed GetChildren2.')
-    errors += 1
+    parent = IDLNode('parent', 'no file', 1, 0, [child, child])
+    if [child, child] != parent.GetChildren():
+        ErrOut.Log('Failed GetChildren2.')
+        errors += 1
 
-  if not errors:
-    InfoOut.Log('Passed ChildTest')
-  return errors
+    if not errors:
+        InfoOut.Log('Passed ChildTest')
+    return errors
 
 
 def Main():
-  errors = StringTest()
-  errors += ChildTest()
+    errors = StringTest()
+    errors += ChildTest()
 
-  if errors:
-    ErrOut.Log('IDLNode failed with %d errors.' % errors)
-    return  -1
-  return 0
+    if errors:
+        ErrOut.Log('IDLNode failed with %d errors.' % errors)
+        return -1
+    return 0
+
 
 if __name__ == '__main__':
-  sys.exit(Main())
-
+    sys.exit(Main())
--- a/browser/extensions/mortar/ppapi/generators/idl_option.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_option.py
@@ -1,108 +1,115 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 import getopt
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
+from idl_log import ErrOut, InfoOut
 
-OptionMap = { }
+OptionMap = {}
 
 
 def GetOption(name):
-  if name not in OptionMap:
-    raise RuntimeError('Could not find option "%s".' % name)
-  return OptionMap[name].Get()
+    if name not in OptionMap:
+        raise RuntimeError('Could not find option "%s".' % name)
+    return OptionMap[name].Get()
+
 
 class Option(object):
-  def __init__(self, name, desc, default = None, callfunc = None,
-               testfunc = None, cookie = None):
+    def __init__(self, name, desc, default=None, callfunc=None,
+                 testfunc=None, cookie=None):
 
-    # Verify this option is not a duplicate
-    if name in OptionMap:
-      raise RuntimeError('Option "%s" already exists.' % name)
-    self.name = name
-    self.desc = desc
-    self.default = default
-    self.value = default
-    self.callfunc = callfunc
-    self.testfunc = testfunc
-    self.cookie = cookie
-    OptionMap[name] = self
+        # Verify this option is not a duplicate
+        if name in OptionMap:
+            raise RuntimeError('Option "%s" already exists.' % name)
+        self.name = name
+        self.desc = desc
+        self.default = default
+        self.value = default
+        self.callfunc = callfunc
+        self.testfunc = testfunc
+        self.cookie = cookie
+        OptionMap[name] = self
 
-  def Set(self, value):
-    if self.testfunc:
-      if not self.testfunc(self, value): return False
-    # If this is a boolean option, set it to true
-    if self.default is None:
-      self.value = True
-    else:
-      self.value = value
-    if self.callfunc:
-      self.callfunc(self)
-    return True
+    def Set(self, value):
+        if self.testfunc:
+            if not self.testfunc(self, value):
+                return False
+        # If this is a boolean option, set it to true
+        if self.default is None:
+            self.value = True
+        else:
+            self.value = value
+        if self.callfunc:
+            self.callfunc(self)
+        return True
 
-  def Get(self):
-    return self.value
+    def Get(self):
+        return self.value
 
 
 def DumpOption(option):
-  if len(option.name) > 1:
-    out = '  --%-15.15s\t%s' % (option.name, option.desc)
-  else:
-    out = '   -%-15.15s\t%s' % (option.name, option.desc)
-  if option.default:
-    out = '%s\n\t\t\t(Default: %s)\n' % (out, option.default)
-  InfoOut.Log(out)
+    if len(option.name) > 1:
+        out = '  --%-15.15s\t%s' % (option.name, option.desc)
+    else:
+        out = '   -%-15.15s\t%s' % (option.name, option.desc)
+    if option.default:
+        out = '%s\n\t\t\t(Default: %s)\n' % (out, option.default)
+    InfoOut.Log(out)
+
 
 def DumpHelp(option=None):
-  InfoOut.Log('Usage:')
-  for opt in sorted(OptionMap.keys()):
-    DumpOption(OptionMap[opt])
-  sys.exit(0)
+    InfoOut.Log('Usage:')
+    for opt in sorted(OptionMap.keys()):
+        DumpOption(OptionMap[opt])
+    sys.exit(0)
+
 
 #
 # Default IDL options
 #
 # -h : Help, prints options
 # --verbose : use verbose output
 # --test : test this module
 #
 Option('h', 'Help', callfunc=DumpHelp)
 Option('help', 'Help', callfunc=DumpHelp)
 Option('verbose', 'Verbose')
 Option('test', 'Test the IDL scripts')
 
+
 def ParseOptions(args):
-  short_opts= ""
-  long_opts = []
+    short_opts = ""
+    long_opts = []
 
-  # Build short and long option lists
-  for name in sorted(OptionMap.keys()):
-    option = OptionMap[name]
-    if len(name) > 1:
-      if option.default is None:
-        long_opts.append('%s' % name)
-      else:
-        long_opts.append('%s=' % name)
-    else:
-      if option.default is None:
-        short_opts += name
-      else:
-        short_opts += '%s:' % name
+    # Build short and long option lists
+    for name in sorted(OptionMap.keys()):
+        option = OptionMap[name]
+        if len(name) > 1:
+            if option.default is None:
+                long_opts.append('%s' % name)
+            else:
+                long_opts.append('%s=' % name)
+        else:
+            if option.default is None:
+                short_opts += name
+            else:
+                short_opts += '%s:' % name
 
-  try:
-    opts, filenames = getopt.getopt(args, short_opts, long_opts)
+    try:
+        opts, filenames = getopt.getopt(args, short_opts, long_opts)
 
-    for opt, val in opts:
-      if len(opt) == 2: opt = opt[1:]
-      if opt[0:2] == '--': opt = opt[2:]
-      OptionMap[opt].Set(val)
+        for opt, val in opts:
+            if len(opt) == 2:
+                opt = opt[1:]
+            if opt[0:2] == '--':
+                opt = opt[2:]
+            OptionMap[opt].Set(val)
 
-  except getopt.error, e:
-    ErrOut.Log('Illegal option: %s\n' % str(e))
-    DumpHelp()
-    sys.exit(-1)
+    except getopt.error as e:
+        ErrOut.Log('Illegal option: %s\n' % str(e))
+        DumpHelp()
+        sys.exit(-1)
 
-  return filenames
+    return filenames
--- a/browser/extensions/mortar/ppapi/generators/idl_outfile.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_outfile.py
@@ -6,200 +6,204 @@
 """ Output file objects for generator. """
 
 import difflib
 import os
 import time
 import subprocess
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
-from idl_option import GetOption, Option, ParseOptions
+from idl_log import ErrOut, InfoOut
+from idl_option import GetOption, Option
 from stat import *
 
 Option('diff', 'Generate a DIFF when saving the file.')
 
 
 #
 # IDLOutFile
 #
 # IDLOutFile provides a temporary output file.  By default, the object will
 # not write the output if the file already exists, and matches what will be
 # written.  This prevents the timestamp from changing to optimize cases where
 # the output files are used by a timestamp dependent build system
 #
 class IDLOutFile(object):
-  def __init__(self, filename, always_write = False, create_dir = True):
-    self.filename = filename
-    self.always_write = always_write
-    self.create_dir = create_dir
-    self.outlist = []
-    self.open = True
+    def __init__(self, filename, always_write=False, create_dir=True):
+        self.filename = filename
+        self.always_write = always_write
+        self.create_dir = create_dir
+        self.outlist = []
+        self.open = True
 
-  # Compare the old text to the current list of output lines.
-  def IsEquivalent_(self, oldtext):
-    if not oldtext: return False
+    # Compare the old text to the current list of output lines.
+    def IsEquivalent_(self, oldtext):
+        if not oldtext:
+            return False
 
-    oldlines = oldtext.split('\n')
-    curlines = (''.join(self.outlist)).split('\n')
+        oldlines = oldtext.split('\n')
+        curlines = (''.join(self.outlist)).split('\n')
 
-    # If number of lines don't match, it's a mismatch
-    if len(oldlines) != len(curlines):
-      return False
+        # If number of lines don't match, it's a mismatch
+        if len(oldlines) != len(curlines):
+            return False
 
-    for index in range(len(oldlines)):
-      oldline = oldlines[index]
-      curline = curlines[index]
+        for index in range(len(oldlines)):
+            oldline = oldlines[index]
+            curline = curlines[index]
 
-      if oldline == curline: continue
+            if oldline == curline:
+                continue
 
-      curwords = curline.split()
-      oldwords = oldline.split()
+            curwords = curline.split()
+            oldwords = oldline.split()
 
-      # Unmatched lines must be the same length
-      if len(curwords) != len(oldwords):
-        return False
+            # Unmatched lines must be the same length
+            if len(curwords) != len(oldwords):
+                return False
 
-      # If it's not a comment then it's a mismatch
-      if curwords[0] not in ['*', '/*', '//']:
-        return False
+            # If it's not a comment then it's a mismatch
+            if curwords[0] not in ['*', '/*', '//']:
+                return False
 
-      # Ignore changes to the Copyright year which is autogenerated
-      # /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
-      if len(curwords) > 4 and curwords[1] == 'Copyright':
-        if curwords[4:] == oldwords[4:]: continue
+            # Ignore changes to the Copyright year which is autogenerated
+            # /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+            if len(curwords) > 4 and curwords[1] == 'Copyright':
+                if curwords[4:] == oldwords[4:]:
+                    continue
 
-      # Ignore changes to auto generation timestamp when line unwrapped
-      # // From FILENAME.idl modified DAY MON DATE TIME YEAR.
-      # /* From FILENAME.idl modified DAY MON DATE TIME YEAR. */
-      if len(curwords) > 8 and curwords[1] == 'From':
-        if curwords[0:4] == oldwords[0:4]: continue
+            # Ignore changes to auto generation timestamp when line unwrapped
+            # // From FILENAME.idl modified DAY MON DATE TIME YEAR.
+            # /* From FILENAME.idl modified DAY MON DATE TIME YEAR. */
+            if len(curwords) > 8 and curwords[1] == 'From':
+                if curwords[0:4] == oldwords[0:4]:
+                    continue
 
-      # Ignore changes to auto generation timestamp when line is wrapped
-      # * modified DAY MON DATE TIME YEAR.
-      if len(curwords) > 6 and curwords[1] == 'modified':
-        continue
+            # Ignore changes to auto generation timestamp when line is wrapped
+            # * modified DAY MON DATE TIME YEAR.
+            if len(curwords) > 6 and curwords[1] == 'modified':
+                continue
 
-      return False
-    return True
-
-  # Return the file name
-  def Filename(self):
-    return self.filename
+            return False
+        return True
 
-  # Append to the output if the file is still open
-  def Write(self, string):
-    if not self.open:
-      raise RuntimeError('Could not write to closed file %s.' % self.filename)
-    self.outlist.append(string)
+    # Return the file name
+    def Filename(self):
+        return self.filename
 
-  # Run clang-format on the buffered file contents.
-  def ClangFormat(self):
-    clang_format = subprocess.Popen(['clang-format', '-style=Chromium'],
-                                    stdin=subprocess.PIPE,
-                                    stdout=subprocess.PIPE)
-    new_output = clang_format.communicate("".join(self.outlist))[0]
-    self.outlist = [new_output]
+    # Append to the output if the file is still open
+    def Write(self, string):
+        if not self.open:
+            raise RuntimeError('Could not write to closed file %s.' % self.filename)
+        self.outlist.append(string)
 
-  # Close the file, flushing it to disk
-  def Close(self):
-    filename = os.path.realpath(self.filename)
-    self.open = False
-    outtext = ''.join(self.outlist)
-    oldtext = ''
+    # Run clang-format on the buffered file contents.
+    def ClangFormat(self):
+        clang_format = subprocess.Popen(['clang-format', '-style=Chromium'],
+                                        stdin=subprocess.PIPE,
+                                        stdout=subprocess.PIPE)
+        new_output = clang_format.communicate("".join(self.outlist))[0]
+        self.outlist = [new_output]
 
-    if not self.always_write:
-      if os.path.isfile(filename):
-        oldtext = open(filename, 'rb').read()
-        if self.IsEquivalent_(oldtext):
-          if GetOption('verbose'):
-            InfoOut.Log('Output %s unchanged.' % self.filename)
-          return False
+    # Close the file, flushing it to disk
+    def Close(self):
+        filename = os.path.realpath(self.filename)
+        self.open = False
+        outtext = ''.join(self.outlist)
+        oldtext = ''
 
-    if GetOption('diff'):
-      for line in difflib.unified_diff(oldtext.split('\n'), outtext.split('\n'),
-                                       'OLD ' + self.filename,
-                                       'NEW ' + self.filename,
-                                       n=1, lineterm=''):
-        ErrOut.Log(line)
+        if not self.always_write:
+            if os.path.isfile(filename):
+                oldtext = open(filename, 'rb').read()
+                if self.IsEquivalent_(oldtext):
+                    if GetOption('verbose'):
+                        InfoOut.Log('Output %s unchanged.' % self.filename)
+                    return False
 
-    try:
-      # If the directory does not exit, try to create it, if we fail, we
-      # still get the exception when the file is openned.
-      basepath, leafname = os.path.split(filename)
-      if basepath and not os.path.isdir(basepath) and self.create_dir:
-        InfoOut.Log('Creating directory: %s\n' % basepath)
-        os.makedirs(basepath)
+        if GetOption('diff'):
+            for line in difflib.unified_diff(oldtext.split('\n'), outtext.split('\n'),
+                                             'OLD ' + self.filename,
+                                             'NEW ' + self.filename,
+                                             n=1, lineterm=''):
+                ErrOut.Log(line)
 
-      if not GetOption('test'):
-        outfile = open(filename, 'wb')
-        outfile.write(outtext)
-        outfile.close();
-        InfoOut.Log('Output %s written.' % self.filename)
-      return True
+        try:
+            # If the directory does not exit, try to create it, if we fail, we
+            # still get the exception when the file is openned.
+            basepath, leafname = os.path.split(filename)
+            if basepath and not os.path.isdir(basepath) and self.create_dir:
+                InfoOut.Log('Creating directory: %s\n' % basepath)
+                os.makedirs(basepath)
 
-    except IOError as (errno, strerror):
-      ErrOut.Log("I/O error(%d): %s" % (errno, strerror))
-    except:
-      ErrOut.Log("Unexpected error: %s" % sys.exc_info()[0])
-      raise
+            if not GetOption('test'):
+                outfile = open(filename, 'wb')
+                outfile.write(outtext)
+                outfile.close()
+                InfoOut.Log('Output %s written.' % self.filename)
+            return True
 
-    return False
+        except IOError as (errno, strerror):
+            ErrOut.Log("I/O error(%d): %s" % (errno, strerror))
+        except:
+            ErrOut.Log("Unexpected error: %s" % sys.exc_info()[0])
+            raise
+
+        return False
 
 
 def TestFile(name, stringlist, force, update):
-  errors = 0
+    errors = 0
 
-  # Get the old timestamp
-  if os.path.exists(name):
-    old_time = os.stat(filename)[ST_MTIME]
-  else:
-    old_time = 'NONE'
+    # Get the old timestamp
+    if os.path.exists(name):
+        old_time = os.stat(filename)[ST_MTIME]
+    else:
+        old_time = 'NONE'
 
-  # Create the file and write to it
-  out = IDLOutFile(filename, force)
-  for item in stringlist:
-    out.Write(item)
+    # Create the file and write to it
+    out = IDLOutFile(filename, force)
+    for item in stringlist:
+        out.Write(item)
 
-  # We wait for flush to force the timestamp to change
-  time.sleep(2)
+    # We wait for flush to force the timestamp to change
+    time.sleep(2)
 
-  wrote = out.Close()
-  cur_time = os.stat(filename)[ST_MTIME]
-  if update:
-    if not wrote:
-      ErrOut.Log('Failed to write output %s.' % filename)
-      return 1
-    if cur_time == old_time:
-      ErrOut.Log('Failed to update timestamp for %s.' % filename)
-      return 1
-  else:
-    if wrote:
-      ErrOut.Log('Should not have writen output %s.' % filename)
-      return 1
-    if cur_time != old_time:
-      ErrOut.Log('Should not have modified timestamp for %s.' % filename)
-      return 1
-  return 0
+    wrote = out.Close()
+    cur_time = os.stat(filename)[ST_MTIME]
+    if update:
+        if not wrote:
+            ErrOut.Log('Failed to write output %s.' % filename)
+            return 1
+        if cur_time == old_time:
+            ErrOut.Log('Failed to update timestamp for %s.' % filename)
+            return 1
+    else:
+        if wrote:
+            ErrOut.Log('Should not have writen output %s.' % filename)
+            return 1
+        if cur_time != old_time:
+            ErrOut.Log('Should not have modified timestamp for %s.' % filename)
+            return 1
+    return 0
 
 
 def main():
-  errors = 0
-  stringlist = ['Test', 'Testing\n', 'Test']
-  filename = 'outtest.txt'
+    errors = 0
+    stringlist = ['Test', 'Testing\n', 'Test']
+    filename = 'outtest.txt'
 
-  # Test forcibly writing a file
-  errors += TestFile(filename, stringlist, force=True, update=True)
+    # Test forcibly writing a file
+    errors += TestFile(filename, stringlist, force=True, update=True)
 
-  # Test conditionally writing the file skipping
-  errors += TestFile(filename, stringlist, force=False, update=False)
+    # Test conditionally writing the file skipping
+    errors += TestFile(filename, stringlist, force=False, update=False)
 
-  # Test conditionally writing the file updating
-  errors += TestFile(filename, stringlist + ['X'], force=False, update=True)
+    # Test conditionally writing the file updating
+    errors += TestFile(filename, stringlist + ['X'], force=False, update=True)
 
-  # Clean up file
-  os.remove(filename)
-  if not errors: InfoOut.Log('All tests pass.')
-  return errors
+    # Clean up file
+    os.remove(filename)
+    if not errors: InfoOut.Log('All tests pass.')
+    return errors
 
 
 if __name__ == '__main__':
-  sys.exit(main())
+    sys.exit(main())
--- a/browser/extensions/mortar/ppapi/generators/idl_parser.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_parser.py
@@ -17,20 +17,18 @@
 #   http://www.dabeaz.com/ply/
 #
 # The parser generates a tree by recursively matching sets of items against
 # defined patterns.  When a match is made, that set of items is reduced
 # to a new item.   The new item can provide a match for parent patterns.
 # In this way an AST is built (reduced) depth first.
 
 
-import getopt
 import glob
 import os.path
-import re
 import sys
 import time
 
 from idl_ast import IDLAst
 from idl_log import ErrOut, InfoOut, WarnOut
 from idl_lexer import IDLLexer
 from idl_node import IDLAttribute, IDLFile, IDLNode
 from idl_option import GetOption, Option, ParseOptions
@@ -47,80 +45,86 @@ Option('srcroot', 'Working directory.', 
 Option('include_private', 'Include private IDL directory in default API paths.')
 
 #
 # ERROR_REMAP
 #
 # Maps the standard error formula into a more friendly error message.
 #
 ERROR_REMAP = {
-  'Unexpected ")" after "(".' : 'Empty argument list.',
-  'Unexpected ")" after ",".' : 'Missing argument.',
-  'Unexpected "}" after ",".' : 'Trailing comma in block.',
-  'Unexpected "}" after "{".' : 'Unexpected empty block.',
-  'Unexpected comment after "}".' : 'Unexpected trailing comment.',
-  'Unexpected "{" after keyword "enum".' : 'Enum missing name.',
-  'Unexpected "{" after keyword "struct".' : 'Struct missing name.',
-  'Unexpected "{" after keyword "interface".' : 'Interface missing name.',
+    'Unexpected ")" after "(".': 'Empty argument list.',
+    'Unexpected ")" after ",".': 'Missing argument.',
+    'Unexpected "}" after ",".': 'Trailing comma in block.',
+    'Unexpected "}" after "{".': 'Unexpected empty block.',
+    'Unexpected comment after "}".': 'Unexpected trailing comment.',
+    'Unexpected "{" after keyword "enum".': 'Enum missing name.',
+    'Unexpected "{" after keyword "struct".': 'Struct missing name.',
+    'Unexpected "{" after keyword "interface".': 'Interface missing name.',
 }
 
+
 # DumpReduction
 #
 # Prints out the set of items which matched a particular pattern and the
 # new item or set it was reduced to.
 def DumpReduction(cls, p):
-  if p[0] is None:
-    InfoOut.Log("OBJ: %s(%d) - None\n" % (cls, len(p)))
-    InfoOut.Log("  [%s]\n" % [str(x) for x in p[1:]])
-  else:
-    out = ""
-    for index in range(len(p) - 1):
-      out += " >%s< " % str(p[index + 1])
-    InfoOut.Log("OBJ: %s(%d) - %s : %s\n"  % (cls, len(p), str(p[0]), out))
+    if p[0] is None:
+        InfoOut.Log("OBJ: %s(%d) - None\n" % (cls, len(p)))
+        InfoOut.Log("  [%s]\n" % [str(x) for x in p[1:]])
+    else:
+        out = ""
+        for index in range(len(p) - 1):
+            out += " >%s< " % str(p[index + 1])
+        InfoOut.Log("OBJ: %s(%d) - %s : %s\n" % (cls, len(p), str(p[0]), out))
 
 
 # CopyToList
 #
 # Takes an input item, list, or None, and returns a new list of that set.
 def CopyToList(item):
-  # If the item is 'Empty' make it an empty list
-  if not item: item = []
+    # If the item is 'Empty' make it an empty list
+    if not item:
+        item = []
 
-  # If the item is not a list
-  if type(item) is not type([]): item = [item]
+    # If the item is not a list
+    if not isinstance(item, list):
+        item = [item]
 
-  # Make a copy we can modify
-  return list(item)
-
+    # Make a copy we can modify
+    return list(item)
 
 
 # ListFromConcat
 #
 # Generate a new List by joining of two sets of inputs which can be an
 # individual item, a list of items, or None.
 def ListFromConcat(*items):
-  itemsout = []
-  for item in items:
-    itemlist = CopyToList(item)
-    itemsout.extend(itemlist)
+    itemsout = []
+    for item in items:
+        itemlist = CopyToList(item)
+        itemsout.extend(itemlist)
 
-  return itemsout
+    return itemsout
 
 
 # TokenTypeName
 #
 # Generate a string which has the type and value of the token.
 def TokenTypeName(t):
-  if t.type == 'SYMBOL':  return 'symbol %s' % t.value
-  if t.type in ['HEX', 'INT', 'OCT', 'FLOAT']:
-    return 'value %s' % t.value
-  if t.type == 'STRING' : return 'string "%s"' % t.value
-  if t.type == 'COMMENT' : return 'comment'
-  if t.type == t.value: return '"%s"' % t.value
-  return 'keyword "%s"' % t.value
+    if t.type == 'SYMBOL':
+        return 'symbol %s' % t.value
+    if t.type in ['HEX', 'INT', 'OCT', 'FLOAT']:
+        return 'value %s' % t.value
+    if t.type == 'STRING':
+        return 'string "%s"' % t.value
+    if t.type == 'COMMENT':
+        return 'comment'
+    if t.type == t.value:
+        return '"%s"' % t.value
+    return 'keyword "%s"' % t.value
 
 
 #
 # IDL Parser
 #
 # The Parser inherits the from the Lexer to provide PLY with the tokenizing
 # definitions.  Parsing patterns are encoded as function where p_<name> is
 # is called any time a patern matching the function documentation is found.
@@ -167,1130 +171,1186 @@ def TokenTypeName(t):
 #       ',' <type>_list | (empty)
 #   The <type>_cont form is used to consume the ',' which only occurs when
 #   there is more than one object in the list.  The <type>_cont also provides
 #   the terminating (empty) definition.
 #
 
 
 class IDLParser(IDLLexer):
-# TOP
-#
-# This pattern defines the top of the parse tree.  The parse tree is in the
-# the form of:
-#
-# top
-#   *modifiers
-#     *comments
-#     *ext_attr_block
-#       ext_attr_list
-#          attr_arg_list
-#   *integer, value
-#   *param_list
-#   *typeref
-#
-#   top_list
-#     describe_block
-#       describe_list
-#     enum_block
-#       enum_item
-#     interface_block
-#       member
-#     label_block
-#       label_item
-#     struct_block
-#       member
-#     typedef_decl
-#       typedef_data
-#       typedef_func
-#
-# (* sub matches found at multiple levels and are not truly children of top)
-#
-# We force all input files to start with two comments.  The first comment is a
-# Copyright notice followed by a set of file wide Extended Attributes, followed
-# by the file comment and finally by file level patterns.
-#
-  # Find the Copyright, File comment, and optional file wide attributes.  We
-  # use a match with COMMENT instead of comments to force the token to be
-  # present.  The extended attributes and the top_list become siblings which
-  # in turn are children of the file object created from the results of top.
-  def p_top(self, p):
-    """top : COMMENT COMMENT ext_attr_block top_list"""
+    # TOP
+    #
+    # This pattern defines the top of the parse tree.  The parse tree is in the
+    # the form of:
+    #
+    # top
+    #   *modifiers
+    #     *comments
+    #     *ext_attr_block
+    #       ext_attr_list
+    #          attr_arg_list
+    #   *integer, value
+    #   *param_list
+    #   *typeref
+    #
+    #   top_list
+    #     describe_block
+    #       describe_list
+    #     enum_block
+    #       enum_item
+    #     interface_block
+    #       member
+    #     label_block
+    #       label_item
+    #     struct_block
+    #       member
+    #     typedef_decl
+    #       typedef_data
+    #       typedef_func
+    #
+    # (* sub matches found at multiple levels and are not truly children of top)
+    #
+    # We force all input files to start with two comments.  The first comment is a
+    # Copyright notice followed by a set of file wide Extended Attributes, followed
+    # by the file comment and finally by file level patterns.
+    #
+    # Find the Copyright, File comment, and optional file wide attributes.  We
+    # use a match with COMMENT instead of comments to force the token to be
+    # present.  The extended attributes and the top_list become siblings which
+    # in turn are children of the file object created from the results of top.
+    def p_top(self, p):
+        """top : COMMENT COMMENT ext_attr_block top_list"""
 
-    Copyright = self.BuildComment('Copyright', p, 1)
-    Filedoc = self.BuildComment('Comment', p, 2)
+        copyright = self.BuildComment('Copyright', p, 1)
+        filedoc = self.BuildComment('Comment', p, 2)
 
-    p[0] = ListFromConcat(Copyright, Filedoc, p[3], p[4])
-    if self.parse_debug: DumpReduction('top', p)
+        p[0] = ListFromConcat(copyright, filedoc, p[3], p[4])
+        if self.parse_debug:
+            DumpReduction('top', p)
 
-  def p_top_short(self, p):
-    """top : COMMENT ext_attr_block top_list"""
-    Copyright = self.BuildComment('Copyright', p, 1)
-    Filedoc = IDLNode('Comment', self.lexobj.filename, p.lineno(2)-1,
-        p.lexpos(2)-1, [self.BuildAttribute('NAME', ''),
-          self.BuildAttribute('FORM', 'cc')])
-    p[0] = ListFromConcat(Copyright, Filedoc, p[2], p[3])
-    if self.parse_debug: DumpReduction('top', p)
+    def p_top_short(self, p):
+        """top : COMMENT ext_attr_block top_list"""
+        copyright = self.BuildComment('Copyright', p, 1)
+        filedoc = IDLNode('Comment', self.lexobj.filename, p.lineno(2) - 1,
+                          p.lexpos(2) - 1, [self.BuildAttribute('NAME', ''),
+                                            self.BuildAttribute('FORM', 'cc')])
+        p[0] = ListFromConcat(copyright, filedoc, p[2], p[3])
+        if self.parse_debug:
+            DumpReduction('top', p)
 
-  # Build a list of top level items.
-  def p_top_list(self, p):
-    """top_list : callback_decl top_list
+    # Build a list of top level items.
+    def p_top_list(self, p):
+        """top_list : callback_decl top_list
                 | describe_block top_list
                 | dictionary_block top_list
                 | enum_block top_list
                 | inline top_list
                 | interface_block top_list
                 | label_block top_list
                 | namespace top_list
                 | struct_block top_list
                 | typedef_decl top_list
                 | bad_decl top_list
                 | """
-    if len(p) > 2:
-      p[0] = ListFromConcat(p[1], p[2])
-    if self.parse_debug: DumpReduction('top_list', p)
+        if len(p) > 2:
+            p[0] = ListFromConcat(p[1], p[2])
+        if self.parse_debug:
+            DumpReduction('top_list', p)
 
-  # Recover from error and continue parsing at the next top match.
-  def p_top_error(self, p):
-    """top_list : error top_list"""
-    p[0] = p[2]
+    # Recover from error and continue parsing at the next top match.
+    def p_top_error(self, p):
+        """top_list : error top_list"""
+        p[0] = p[2]
 
-  # Recover from error and continue parsing at the next top match.
-  def p_bad_decl(self, p):
-    """bad_decl : modifiers SYMBOL error '}' ';'"""
-    p[0] = []
+    # Recover from error and continue parsing at the next top match.
+    def p_bad_decl(self, p):
+        """bad_decl : modifiers SYMBOL error '}' ';'"""
+        p[0] = []
 
-#
-# Modifier List
-#
-#
-  def p_modifiers(self, p):
-    """modifiers : comments ext_attr_block"""
-    p[0] = ListFromConcat(p[1], p[2])
-    if self.parse_debug: DumpReduction('modifiers', p)
+    #
+    # Modifier List
+    #
+    #
+    def p_modifiers(self, p):
+        """modifiers : comments ext_attr_block"""
+        p[0] = ListFromConcat(p[1], p[2])
+        if self.parse_debug:
+            DumpReduction('modifiers', p)
 
-#
-# Scoped name is a name with an optional scope.
-#
-# Used for types and namespace names. eg. foo_bar.hello_world, or
-# foo_bar.hello_world.SomeType.
-#
-  def p_scoped_name(self, p):
-    """scoped_name : SYMBOL scoped_name_rest"""
-    p[0] = ''.join(p[1:])
-    if self.parse_debug: DumpReduction('scoped_name', p)
+    #
+    # Scoped name is a name with an optional scope.
+    #
+    # Used for types and namespace names. eg. foo_bar.hello_world, or
+    # foo_bar.hello_world.SomeType.
+    #
+    def p_scoped_name(self, p):
+        """scoped_name : SYMBOL scoped_name_rest"""
+        p[0] = ''.join(p[1:])
+        if self.parse_debug:
+            DumpReduction('scoped_name', p)
 
-  def p_scoped_name_rest(self, p):
-    """scoped_name_rest : '.' scoped_name
+    def p_scoped_name_rest(self, p):
+        """scoped_name_rest : '.' scoped_name
                         |"""
-    p[0] = ''.join(p[1:])
-    if self.parse_debug: DumpReduction('scoped_name_rest', p)
+        p[0] = ''.join(p[1:])
+        if self.parse_debug:
+            DumpReduction('scoped_name_rest', p)
 
-#
-# Type reference
-#
-#
-  def p_typeref(self, p):
-    """typeref : scoped_name"""
-    p[0] = p[1]
-    if self.parse_debug: DumpReduction('typeref', p)
-
+    #
+    # Type reference
+    #
+    #
+    def p_typeref(self, p):
+        """typeref : scoped_name"""
+        p[0] = p[1]
+        if self.parse_debug:
+            DumpReduction('typeref', p)
 
-#
-# Comments
-#
-# Comments are optional list of C style comment objects.  Comments are returned
-# as a list or None.
-#
-  def p_comments(self, p):
-    """comments : COMMENT comments
+    #
+    # Comments
+    #
+    # Comments are optional list of C style comment objects.  Comments are returned
+    # as a list or None.
+    #
+    def p_comments(self, p):
+        """comments : COMMENT comments
                 | """
-    if len(p) > 1:
-      child = self.BuildComment('Comment', p, 1)
-      p[0] = ListFromConcat(child, p[2])
-      if self.parse_debug: DumpReduction('comments', p)
-    else:
-      if self.parse_debug: DumpReduction('no comments', p)
-
+        if len(p) > 1:
+            child = self.BuildComment('Comment', p, 1)
+            p[0] = ListFromConcat(child, p[2])
+            if self.parse_debug:
+                DumpReduction('comments', p)
+        else:
+            if self.parse_debug:
+                DumpReduction('no comments', p)
 
-#
-# Namespace
-#
-# A namespace provides a named scope to an enclosed top_list.
-#
-  def p_namespace(self, p):
-    """namespace : modifiers NAMESPACE namespace_name '{' top_list '}' ';'"""
-    children = ListFromConcat(p[1], p[5])
-    p[0] = self.BuildNamed('Namespace', p, 3, children)
+            #
+            # Namespace
+            #
+            # A namespace provides a named scope to an enclosed top_list.
+            #
+
+    def p_namespace(self, p):
+        """namespace : modifiers NAMESPACE namespace_name '{' top_list '}' ';'"""
+        children = ListFromConcat(p[1], p[5])
+        p[0] = self.BuildNamed('Namespace', p, 3, children)
 
-  # We allow namespace names of the form foo.bar.baz.
-  def p_namespace_name(self, p):
-    """namespace_name : scoped_name"""
-    p[0] = p[1]
-
+    # We allow namespace names of the form foo.bar.baz.
+    def p_namespace_name(self, p):
+        """namespace_name : scoped_name"""
+        p[0] = p[1]
 
-#
-# Dictionary
-#
-# A dictionary is a named list of optional and required members.
-#
-  def p_dictionary_block(self, p):
-    """dictionary_block : modifiers DICTIONARY SYMBOL '{' struct_list '}' ';'"""
-    p[0] = self.BuildNamed('Dictionary', p, 3, ListFromConcat(p[1], p[5]))
+    #
+    # Dictionary
+    #
+    # A dictionary is a named list of optional and required members.
+    #
+    def p_dictionary_block(self, p):
+        """dictionary_block : modifiers DICTIONARY SYMBOL '{' struct_list '}' ';'"""
+        p[0] = self.BuildNamed('Dictionary', p, 3, ListFromConcat(p[1], p[5]))
 
-  def p_dictionary_errorA(self, p):
-    """dictionary_block : modifiers DICTIONARY error ';'"""
-    p[0] = []
+    def p_dictionary_errorA(self, p):
+        """dictionary_block : modifiers DICTIONARY error ';'"""
+        p[0] = []
 
-  def p_dictionary_errorB(self, p):
-    """dictionary_block : modifiers DICTIONARY error '{' struct_list '}' ';'"""
-    p[0] = []
+    def p_dictionary_errorB(self, p):
+        """dictionary_block : modifiers DICTIONARY error '{' struct_list '}' ';'"""
+        p[0] = []
 
-#
-# Callback
-#
-# A callback is essentially a single function declaration (outside of an
-# Interface).
-#
-  def p_callback_decl(self, p):
-    """callback_decl : modifiers CALLBACK SYMBOL '=' SYMBOL param_list ';'"""
-    children = ListFromConcat(p[1], p[6])
-    p[0] = self.BuildNamed('Callback', p, 3, children)
-
+    #
+    # Callback
+    #
+    # A callback is essentially a single function declaration (outside of an
+    # Interface).
+    #
+    def p_callback_decl(self, p):
+        """callback_decl : modifiers CALLBACK SYMBOL '=' SYMBOL param_list ';'"""
+        children = ListFromConcat(p[1], p[6])
+        p[0] = self.BuildNamed('Callback', p, 3, children)
 
-#
-# Inline
-#
-# Inline blocks define option code to be emitted based on language tag,
-# in the form of:
-# #inline <LANGUAGE>
-# <CODE>
-# #endinl
-#
-  def p_inline(self, p):
-    """inline : modifiers INLINE"""
-    words = p[2].split()
-    name = self.BuildAttribute('NAME', words[1])
-    lines = p[2].split('\n')
-    value = self.BuildAttribute('VALUE', '\n'.join(lines[1:-1]) + '\n')
-    children = ListFromConcat(name, value, p[1])
-    p[0] = self.BuildProduction('Inline', p, 2, children)
-    if self.parse_debug: DumpReduction('inline', p)
+    #
+    # Inline
+    #
+    # Inline blocks define option code to be emitted based on language tag,
+    # in the form of:
+    # #inline <LANGUAGE>
+    # <CODE>
+    # #endinl
+    #
+    def p_inline(self, p):
+        """inline : modifiers INLINE"""
+        words = p[2].split()
+        name = self.BuildAttribute('NAME', words[1])
+        lines = p[2].split('\n')
+        value = self.BuildAttribute('VALUE', '\n'.join(lines[1:-1]) + '\n')
+        children = ListFromConcat(name, value, p[1])
+        p[0] = self.BuildProduction('Inline', p, 2, children)
+        if self.parse_debug:
+            DumpReduction('inline', p)
 
-# Extended Attributes
-#
-# Extended Attributes denote properties which will be applied to a node in the
-# AST.  A list of extended attributes are denoted by a brackets '[' ... ']'
-# enclosing a comma separated list of extended attributes in the form of:
-#
-#  Name
-#  Name=HEX | INT | OCT | FLOAT
-#  Name="STRING"
-#  Name=Function(arg ...)
-#  TODO(noelallen) -Not currently supported:
-#  ** Name(arg ...) ...
-#  ** Name=Scope::Value
-#
-# Extended Attributes are returned as a list or None.
+    # Extended Attributes
+    #
+    # Extended Attributes denote properties which will be applied to a node in the
+    # AST.  A list of extended attributes are denoted by a brackets '[' ... ']'
+    # enclosing a comma separated list of extended attributes in the form of:
+    #
+    #  Name
+    #  Name=HEX | INT | OCT | FLOAT
+    #  Name="STRING"
+    #  Name=Function(arg ...)
+    #  TODO(noelallen) -Not currently supported:
+    #  ** Name(arg ...) ...
+    #  ** Name=Scope::Value
+    #
+    # Extended Attributes are returned as a list or None.
 
-  def p_ext_attr_block(self, p):
-    """ext_attr_block : '[' ext_attr_list ']'
+    def p_ext_attr_block(self, p):
+        """ext_attr_block : '[' ext_attr_list ']'
                   | """
-    if len(p) > 1:
-      p[0] = p[2]
-      if self.parse_debug: DumpReduction('ext_attr_block', p)
-    else:
-      if self.parse_debug: DumpReduction('no ext_attr_block', p)
+        if len(p) > 1:
+            p[0] = p[2]
+            if self.parse_debug:
+                DumpReduction('ext_attr_block', p)
+        else:
+            if self.parse_debug:
+                DumpReduction('no ext_attr_block', p)
 
-  def p_ext_attr_list(self, p):
-    """ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont
+    def p_ext_attr_list(self, p):
+        """ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont
                      | SYMBOL '=' value ext_attr_cont
                      | SYMBOL '=' SYMBOL param_list ext_attr_cont
                      | SYMBOL ext_attr_cont"""
-    # If there are 4 tokens plus a return slot, this must be in the form
-    # SYMBOL = SYMBOL|value ext_attr_cont
-    if len(p) == 5:
-      p[0] = ListFromConcat(self.BuildAttribute(p[1], p[3]), p[4])
-    # If there are 5 tokens plus a return slot, this must be in the form
-    # SYMBOL = SYMBOL (param_list) ext_attr_cont
-    elif len(p) == 6:
-      member = self.BuildNamed('Member', p, 3, [p[4]])
-      p[0] = ListFromConcat(self.BuildAttribute(p[1], member), p[5])
-    # Otherwise, this must be: SYMBOL ext_attr_cont
-    else:
-      p[0] = ListFromConcat(self.BuildAttribute(p[1], 'True'), p[2])
-    if self.parse_debug: DumpReduction('ext_attribute_list', p)
+        # If there are 4 tokens plus a return slot, this must be in the form
+        # SYMBOL = SYMBOL|value ext_attr_cont
+        if len(p) == 5:
+            p[0] = ListFromConcat(self.BuildAttribute(p[1], p[3]), p[4])
+        # If there are 5 tokens plus a return slot, this must be in the form
+        # SYMBOL = SYMBOL (param_list) ext_attr_cont
+        elif len(p) == 6:
+            member = self.BuildNamed('Member', p, 3, [p[4]])
+            p[0] = ListFromConcat(self.BuildAttribute(p[1], member), p[5])
+        # Otherwise, this must be: SYMBOL ext_attr_cont
+        else:
+            p[0] = ListFromConcat(self.BuildAttribute(p[1], 'True'), p[2])
+        if self.parse_debug:
+            DumpReduction('ext_attribute_list', p)
 
-  def p_ext_attr_list_values(self, p):
-    """ext_attr_list : SYMBOL '=' '(' values ')' ext_attr_cont
+    def p_ext_attr_list_values(self, p):
+        """ext_attr_list : SYMBOL '=' '(' values ')' ext_attr_cont
                      | SYMBOL '=' '(' symbols ')' ext_attr_cont"""
-    p[0] = ListFromConcat(self.BuildAttribute(p[1], p[4]), p[6])
+        p[0] = ListFromConcat(self.BuildAttribute(p[1], p[4]), p[6])
 
-  def p_values(self, p):
-    """values : value values_cont"""
-    p[0] = ListFromConcat(p[1], p[2])
+    def p_values(self, p):
+        """values : value values_cont"""
+        p[0] = ListFromConcat(p[1], p[2])
 
-  def p_symbols(self, p):
-    """symbols : SYMBOL symbols_cont"""
-    p[0] = ListFromConcat(p[1], p[2])
+    def p_symbols(self, p):
+        """symbols : SYMBOL symbols_cont"""
+        p[0] = ListFromConcat(p[1], p[2])
 
-  def p_symbols_cont(self, p):
-    """symbols_cont : ',' SYMBOL symbols_cont
+    def p_symbols_cont(self, p):
+        """symbols_cont : ',' SYMBOL symbols_cont
                     | """
-    if len(p) > 1: p[0] = ListFromConcat(p[2], p[3])
+        if len(p) > 1:
+            p[0] = ListFromConcat(p[2], p[3])
 
-  def p_values_cont(self, p):
-    """values_cont : ',' value values_cont
+    def p_values_cont(self, p):
+        """values_cont : ',' value values_cont
                    | """
-    if len(p) > 1: p[0] = ListFromConcat(p[2], p[3])
-
-  def p_ext_attr_cont(self, p):
-    """ext_attr_cont : ',' ext_attr_list
-                     |"""
-    if len(p) > 1: p[0] = p[2]
-    if self.parse_debug: DumpReduction('ext_attribute_cont', p)
+        if len(p) > 1:
+            p[0] = ListFromConcat(p[2], p[3])
 
-  def p_ext_attr_func(self, p):
-    """ext_attr_list : SYMBOL '(' attr_arg_list ')' ext_attr_cont"""
-    p[0] = ListFromConcat(self.BuildAttribute(p[1] + '()', p[3]), p[5])
-    if self.parse_debug: DumpReduction('attr_arg_func', p)
-
-  def p_ext_attr_arg_list(self, p):
-    """attr_arg_list : SYMBOL attr_arg_cont
-                     | value attr_arg_cont"""
-    p[0] = ListFromConcat(p[1], p[2])
+    def p_ext_attr_cont(self, p):
+        """ext_attr_cont : ',' ext_attr_list
+                     |"""
+        if len(p) > 1:
+            p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('ext_attribute_cont', p)
 
-  def p_attr_arg_cont(self, p):
-    """attr_arg_cont : ',' attr_arg_list
+    def p_ext_attr_func(self, p):
+        """ext_attr_list : SYMBOL '(' attr_arg_list ')' ext_attr_cont"""
+        p[0] = ListFromConcat(self.BuildAttribute(p[1] + '()', p[3]), p[5])
+        if self.parse_debug:
+            DumpReduction('attr_arg_func', p)
+
+    def p_ext_attr_arg_list(self, p):
+        """attr_arg_list : SYMBOL attr_arg_cont
+                     | value attr_arg_cont"""
+        p[0] = ListFromConcat(p[1], p[2])
+
+    def p_attr_arg_cont(self, p):
+        """attr_arg_cont : ',' attr_arg_list
                      | """
-    if self.parse_debug: DumpReduction('attr_arg_cont', p)
-    if len(p) > 1: p[0] = p[2]
-
-  def p_attr_arg_error(self, p):
-    """attr_arg_cont : error attr_arg_cont"""
-    p[0] = p[2]
-    if self.parse_debug: DumpReduction('attr_arg_error', p)
+        if self.parse_debug:
+            DumpReduction('attr_arg_cont', p)
+        if len(p) > 1:
+            p[0] = p[2]
 
+    def p_attr_arg_error(self, p):
+        """attr_arg_cont : error attr_arg_cont"""
+        p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('attr_arg_error', p)
 
-#
-# Describe
-#
-# A describe block is defined at the top level.  It provides a mechanism for
-# attributing a group of ext_attr to a describe_list.  Members of the
-# describe list are language specific 'Type' declarations
-#
-  def p_describe_block(self, p):
-    """describe_block : modifiers DESCRIBE '{' describe_list '}' ';'"""
-    children = ListFromConcat(p[1], p[4])
-    p[0] = self.BuildProduction('Describe', p, 2, children)
-    if self.parse_debug: DumpReduction('describe_block', p)
+    #
+    # Describe
+    #
+    # A describe block is defined at the top level.  It provides a mechanism for
+    # attributing a group of ext_attr to a describe_list.  Members of the
+    # describe list are language specific 'Type' declarations
+    #
+    def p_describe_block(self, p):
+        """describe_block : modifiers DESCRIBE '{' describe_list '}' ';'"""
+        children = ListFromConcat(p[1], p[4])
+        p[0] = self.BuildProduction('Describe', p, 2, children)
+        if self.parse_debug:
+            DumpReduction('describe_block', p)
 
-  # Recover from describe error and continue parsing at the next top match.
-  def p_describe_error(self, p):
-    """describe_list : error describe_list"""
-    p[0] = []
+    # Recover from describe error and continue parsing at the next top match.
+    def p_describe_error(self, p):
+        """describe_list : error describe_list"""
+        p[0] = []
 
-  def p_describe_list(self, p):
-    """describe_list : modifiers SYMBOL ';' describe_list
+    def p_describe_list(self, p):
+        """describe_list : modifiers SYMBOL ';' describe_list
                      | modifiers ENUM ';' describe_list
                      | modifiers STRUCT ';' describe_list
                      | modifiers TYPEDEF ';' describe_list
                      | """
-    if len(p) > 1:
-      Type = self.BuildNamed('Type', p, 2, p[1])
-      p[0] = ListFromConcat(Type, p[4])
+        if len(p) > 1:
+            Type = self.BuildNamed('Type', p, 2, p[1])
+            p[0] = ListFromConcat(Type, p[4])
 
-#
-# Constant Values (integer, value)
-#
-# Constant values can be found at various levels.  A Constant value is returns
-# as the string value after validated against a FLOAT, HEX, INT, OCT or
-# STRING pattern as appropriate.
-#
-  def p_value(self, p):
-    """value : FLOAT
+            #
+            # Constant Values (integer, value)
+            #
+            # Constant values can be found at various levels.  A Constant value is returns
+            # as the string value after validated against a FLOAT, HEX, INT, OCT or
+            # STRING pattern as appropriate.
+            #
+
+    def p_value(self, p):
+        """value : FLOAT
              | HEX
              | INT
              | OCT
              | STRING"""
-    p[0] = p[1]
-    if self.parse_debug: DumpReduction('value', p)
+        p[0] = p[1]
+        if self.parse_debug:
+            DumpReduction('value', p)
 
-  def p_value_lshift(self, p):
-    """value : integer LSHIFT INT"""
-    p[0] = "%s << %s" % (p[1], p[3])
-    if self.parse_debug: DumpReduction('value', p)
+    def p_value_lshift(self, p):
+        """value : integer LSHIFT INT"""
+        p[0] = "%s << %s" % (p[1], p[3])
+        if self.parse_debug:
+            DumpReduction('value', p)
 
-# Integers are numbers which may not be floats used in cases like array sizes.
-  def p_integer(self, p):
-    """integer : HEX
+    # Integers are numbers which may not be floats used in cases like array sizes.
+    def p_integer(self, p):
+        """integer : HEX
                | INT
                | OCT"""
-    p[0] = p[1]
-    if self.parse_debug: DumpReduction('integer', p)
+        p[0] = p[1]
+        if self.parse_debug:
+            DumpReduction('integer', p)
 
-#
-# Expression
-#
-# A simple arithmetic expression.
-#
-  precedence = (
-    ('left','|','&','^'),
-    ('left','LSHIFT','RSHIFT'),
-    ('left','+','-'),
-    ('left','*','/'),
-    ('right','UMINUS','~'),
+    #
+    # Expression
+    #
+    # A simple arithmetic expression.
+    #
+    precedence = (
+        ('left', '|', '&', '^'),
+        ('left', 'LSHIFT', 'RSHIFT'),
+        ('left', '+', '-'),
+        ('left', '*', '/'),
+        ('right', 'UMINUS', '~'),
     )
 
-  def p_expression_binop(self, p):
-    """expression : expression LSHIFT expression
+    def p_expression_binop(self, p):
+        """expression : expression LSHIFT expression
                   | expression RSHIFT expression
                   | expression '|' expression
                   | expression '&' expression
                   | expression '^' expression
                   | expression '+' expression
                   | expression '-' expression
                   | expression '*' expression
                   | expression '/' expression"""
-    p[0] = "%s %s %s" % (str(p[1]), str(p[2]), str(p[3]))
-    if self.parse_debug: DumpReduction('expression_binop', p)
+        p[0] = "%s %s %s" % (str(p[1]), str(p[2]), str(p[3]))
+        if self.parse_debug:
+            DumpReduction('expression_binop', p)
 
-  def p_expression_unop(self, p):
-    """expression : '-' expression %prec UMINUS
+    def p_expression_unop(self, p):
+        """expression : '-' expression %prec UMINUS
                   | '~' expression %prec '~'"""
-    p[0] = "%s%s" % (str(p[1]), str(p[2]))
-    if self.parse_debug: DumpReduction('expression_unop', p)
+        p[0] = "%s%s" % (str(p[1]), str(p[2]))
+        if self.parse_debug:
+            DumpReduction('expression_unop', p)
 
-  def p_expression_term(self, p):
-    """expression : '(' expression ')'"""
-    p[0] = "%s%s%s" % (str(p[1]), str(p[2]), str(p[3]))
-    if self.parse_debug: DumpReduction('expression_term', p)
+    def p_expression_term(self, p):
+        """expression : '(' expression ')'"""
+        p[0] = "%s%s%s" % (str(p[1]), str(p[2]), str(p[3]))
+        if self.parse_debug:
+            DumpReduction('expression_term', p)
 
-  def p_expression_symbol(self, p):
-    """expression : SYMBOL"""
-    p[0] = p[1]
-    if self.parse_debug: DumpReduction('expression_symbol', p)
+    def p_expression_symbol(self, p):
+        """expression : SYMBOL"""
+        p[0] = p[1]
+        if self.parse_debug:
+            DumpReduction('expression_symbol', p)
 
-  def p_expression_integer(self, p):
-    """expression : integer"""
-    p[0] = p[1]
-    if self.parse_debug: DumpReduction('expression_integer', p)
+    def p_expression_integer(self, p):
+        """expression : integer"""
+        p[0] = p[1]
+        if self.parse_debug:
+            DumpReduction('expression_integer', p)
 
-#
-# Array List
-#
-# Defined a list of array sizes (if any).
-#
-  def p_arrays(self, p):
-    """arrays : '[' ']' arrays
+    #
+    # Array List
+    #
+    # Defined a list of array sizes (if any).
+    #
+    def p_arrays(self, p):
+        """arrays : '[' ']' arrays
               | '[' integer ']' arrays
               | """
-    # If there are 3 tokens plus a return slot it is an unsized array
-    if len(p) == 4:
-      array = self.BuildProduction('Array', p, 1)
-      p[0] = ListFromConcat(array, p[3])
-    # If there are 4 tokens plus a return slot it is a fixed array
-    elif len(p) == 5:
-      count = self.BuildAttribute('FIXED', p[2])
-      array = self.BuildProduction('Array', p, 2, [count])
-      p[0] = ListFromConcat(array, p[4])
-    # If there is only a return slot, do not fill it for this terminator.
-    elif len(p) == 1: return
-    if self.parse_debug: DumpReduction('arrays', p)
+        # If there are 3 tokens plus a return slot it is an unsized array
+        if len(p) == 4:
+            array = self.BuildProduction('Array', p, 1)
+            p[0] = ListFromConcat(array, p[3])
+        # If there are 4 tokens plus a return slot it is a fixed array
+        elif len(p) == 5:
+            count = self.BuildAttribute('FIXED', p[2])
+            array = self.BuildProduction('Array', p, 2, [count])
+            p[0] = ListFromConcat(array, p[4])
+        # If there is only a return slot, do not fill it for this terminator.
+        elif len(p) == 1:
+            return
+        if self.parse_debug:
+            DumpReduction('arrays', p)
 
-
-# An identifier is a legal value for a parameter or attribute name. Lots of
-# existing IDL files use "callback" as a parameter/attribute name, so we allow
-# a SYMBOL or the CALLBACK keyword.
-  def p_identifier(self, p):
-    """identifier : SYMBOL
+    # An identifier is a legal value for a parameter or attribute name. Lots of
+    # existing IDL files use "callback" as a parameter/attribute name, so we allow
+    # a SYMBOL or the CALLBACK keyword.
+    def p_identifier(self, p):
+        """identifier : SYMBOL
                   | CALLBACK"""
-    p[0] = p[1]
-    # Save the line number of the underlying token (otherwise it gets
-    # discarded), since we use it in the productions with an identifier in
-    # them.
-    p.set_lineno(0, p.lineno(1))
+        p[0] = p[1]
+        # Save the line number of the underlying token (otherwise it gets
+        # discarded), since we use it in the productions with an identifier in
+        # them.
+        p.set_lineno(0, p.lineno(1))
 
+    #
+    # Union
+    #
+    # A union allows multiple choices of types for a parameter or member.
+    #
 
-#
-# Union
-#
-# A union allows multiple choices of types for a parameter or member.
-#
+    def p_union_option(self, p):
+        """union_option : modifiers SYMBOL arrays"""
+        typeref = self.BuildAttribute('TYPEREF', p[2])
+        children = ListFromConcat(p[1], typeref, p[3])
+        p[0] = self.BuildProduction('Option', p, 2, children)
 
-  def p_union_option(self, p):
-    """union_option : modifiers SYMBOL arrays"""
-    typeref = self.BuildAttribute('TYPEREF', p[2])
-    children = ListFromConcat(p[1], typeref, p[3])
-    p[0] = self.BuildProduction('Option', p, 2, children)
-
-  def p_union_list(self, p):
-    """union_list : union_option OR union_list
+    def p_union_list(self, p):
+        """union_list : union_option OR union_list
                   | union_option"""
-    if len(p) > 2:
-      p[0] = ListFromConcat(p[1], p[3])
-    else:
-      p[0] = p[1]
+        if len(p) > 2:
+            p[0] = ListFromConcat(p[1], p[3])
+        else:
+            p[0] = p[1]
+
+            #
+            # Parameter List
+            #
+            # A parameter list is a collection of arguments which are passed to a
+            # function.
+            #
 
-#
-# Parameter List
-#
-# A parameter list is a collection of arguments which are passed to a
-# function.
-#
-  def p_param_list(self, p):
-    """param_list : '(' param_item param_cont ')'
+    def p_param_list(self, p):
+        """param_list : '(' param_item param_cont ')'
                   | '(' ')' """
-    if len(p) > 3:
-      args = ListFromConcat(p[2], p[3])
-    else:
-      args = []
-    p[0] = self.BuildProduction('Callspec', p, 1, args)
-    if self.parse_debug: DumpReduction('param_list', p)
+        if len(p) > 3:
+            args = ListFromConcat(p[2], p[3])
+        else:
+            args = []
+        p[0] = self.BuildProduction('Callspec', p, 1, args)
+        if self.parse_debug:
+            DumpReduction('param_list', p)
+
+    def p_param_item(self, p):
+        """param_item : modifiers optional typeref arrays identifier"""
+        typeref = self.BuildAttribute('TYPEREF', p[3])
+        children = ListFromConcat(p[1], p[2], typeref, p[4])
+        p[0] = self.BuildNamed('Param', p, 5, children)
+        if self.parse_debug:
+            DumpReduction('param_item', p)
 
-  def p_param_item(self, p):
-    """param_item : modifiers optional typeref arrays identifier"""
-    typeref = self.BuildAttribute('TYPEREF', p[3])
-    children = ListFromConcat(p[1], p[2], typeref, p[4])
-    p[0] = self.BuildNamed('Param', p, 5, children)
-    if self.parse_debug: DumpReduction('param_item', p)
-
-  def p_param_item_union(self, p):
-    """param_item : modifiers optional '(' union_list ')' identifier"""
-    union = self.BuildAttribute('Union', True)
-    children = ListFromConcat(p[1], p[2], p[4], union)
-    p[0] = self.BuildNamed('Param', p, 6, children)
-    if self.parse_debug: DumpReduction('param_item', p)
+    def p_param_item_union(self, p):
+        """param_item : modifiers optional '(' union_list ')' identifier"""
+        union = self.BuildAttribute('Union', True)
+        children = ListFromConcat(p[1], p[2], p[4], union)
+        p[0] = self.BuildNamed('Param', p, 6, children)
+        if self.parse_debug:
+            DumpReduction('param_item', p)
 
-  def p_optional(self, p):
-    """optional : OPTIONAL
+    def p_optional(self, p):
+        """optional : OPTIONAL
                 | """
-    if len(p) == 2:
-      p[0] = self.BuildAttribute('OPTIONAL', True)
-
+        if len(p) == 2:
+            p[0] = self.BuildAttribute('OPTIONAL', True)
 
-  def p_param_cont(self, p):
-    """param_cont : ',' param_item param_cont
+    def p_param_cont(self, p):
+        """param_cont : ',' param_item param_cont
                   | """
-    if len(p) > 1:
-      p[0] = ListFromConcat(p[2], p[3])
-      if self.parse_debug: DumpReduction('param_cont', p)
+        if len(p) > 1:
+            p[0] = ListFromConcat(p[2], p[3])
+            if self.parse_debug:
+                DumpReduction('param_cont', p)
 
-  def p_param_error(self, p):
-    """param_cont : error param_cont"""
-    p[0] = p[2]
-
+    def p_param_error(self, p):
+        """param_cont : error param_cont"""
+        p[0] = p[2]
 
-#
-# Typedef
-#
-# A typedef creates a new referencable type.  The typedef can specify an array
-# definition as well as a function declaration.
-#
-  def p_typedef_data(self, p):
-    """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL ';' """
-    typeref = self.BuildAttribute('TYPEREF', p[3])
-    children = ListFromConcat(p[1], typeref)
-    p[0] = self.BuildNamed('Typedef', p, 4, children)
-    if self.parse_debug: DumpReduction('typedef_data', p)
+    #
+    # Typedef
+    #
+    # A typedef creates a new referencable type.  The typedef can specify an array
+    # definition as well as a function declaration.
+    #
+    def p_typedef_data(self, p):
+        """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL ';' """
+        typeref = self.BuildAttribute('TYPEREF', p[3])
+        children = ListFromConcat(p[1], typeref)
+        p[0] = self.BuildNamed('Typedef', p, 4, children)
+        if self.parse_debug:
+            DumpReduction('typedef_data', p)
+
+    def p_typedef_array(self, p):
+        """typedef_decl : modifiers TYPEDEF SYMBOL arrays SYMBOL ';' """
+        typeref = self.BuildAttribute('TYPEREF', p[3])
+        children = ListFromConcat(p[1], typeref, p[4])
+        p[0] = self.BuildNamed('Typedef', p, 5, children)
+        if self.parse_debug:
+            DumpReduction('typedef_array', p)
 
-  def p_typedef_array(self, p):
-    """typedef_decl : modifiers TYPEDEF SYMBOL arrays SYMBOL ';' """
-    typeref = self.BuildAttribute('TYPEREF', p[3])
-    children = ListFromConcat(p[1], typeref, p[4])
-    p[0] = self.BuildNamed('Typedef', p, 5, children)
-    if self.parse_debug: DumpReduction('typedef_array', p)
+    def p_typedef_func(self, p):
+        """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL param_list ';' """
+        typeref = self.BuildAttribute('TYPEREF', p[3])
+        children = ListFromConcat(p[1], typeref, p[5])
+        p[0] = self.BuildNamed('Typedef', p, 4, children)
+        if self.parse_debug:
+            DumpReduction('typedef_func', p)
 
-  def p_typedef_func(self, p):
-    """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL param_list ';' """
-    typeref = self.BuildAttribute('TYPEREF', p[3])
-    children = ListFromConcat(p[1], typeref, p[5])
-    p[0] = self.BuildNamed('Typedef', p, 4, children)
-    if self.parse_debug: DumpReduction('typedef_func', p)
+    #
+    # Enumeration
+    #
+    # An enumeration is a set of named integer constants.  An enumeration
+    # is valid type which can be referenced in other definitions.
+    #
+    def p_enum_block(self, p):
+        """enum_block : modifiers ENUM SYMBOL '{' enum_list '}' ';'"""
+        p[0] = self.BuildNamed('Enum', p, 3, ListFromConcat(p[1], p[5]))
+        if self.parse_debug:
+            DumpReduction('enum_block', p)
 
-#
-# Enumeration
-#
-# An enumeration is a set of named integer constants.  An enumeration
-# is valid type which can be referenced in other definitions.
-#
-  def p_enum_block(self, p):
-    """enum_block : modifiers ENUM SYMBOL '{' enum_list '}' ';'"""
-    p[0] = self.BuildNamed('Enum', p, 3, ListFromConcat(p[1], p[5]))
-    if self.parse_debug: DumpReduction('enum_block', p)
+    # Recover from enum error and continue parsing at the next top match.
+    def p_enum_errorA(self, p):
+        """enum_block : modifiers ENUM error '{' enum_list '}' ';'"""
+        p[0] = []
 
-  # Recover from enum error and continue parsing at the next top match.
-  def p_enum_errorA(self, p):
-    """enum_block : modifiers ENUM error '{' enum_list '}' ';'"""
-    p[0] = []
+    def p_enum_errorB(self, p):
+        """enum_block : modifiers ENUM error ';'"""
+        p[0] = []
 
-  def p_enum_errorB(self, p):
-    """enum_block : modifiers ENUM error ';'"""
-    p[0] = []
-
-  def p_enum_list(self, p):
-    """enum_list : modifiers SYMBOL '=' expression enum_cont
+    def p_enum_list(self, p):
+        """enum_list : modifiers SYMBOL '=' expression enum_cont
                  | modifiers SYMBOL enum_cont"""
-    if len(p) > 4:
-      val  = self.BuildAttribute('VALUE', p[4])
-      enum = self.BuildNamed('EnumItem', p, 2, ListFromConcat(val, p[1]))
-      p[0] = ListFromConcat(enum, p[5])
-    else:
-      enum = self.BuildNamed('EnumItem', p, 2, p[1])
-      p[0] = ListFromConcat(enum, p[3])
-    if self.parse_debug: DumpReduction('enum_list', p)
+        if len(p) > 4:
+            val = self.BuildAttribute('VALUE', p[4])
+            enum = self.BuildNamed('EnumItem', p, 2, ListFromConcat(val, p[1]))
+            p[0] = ListFromConcat(enum, p[5])
+        else:
+            enum = self.BuildNamed('EnumItem', p, 2, p[1])
+            p[0] = ListFromConcat(enum, p[3])
+        if self.parse_debug:
+            DumpReduction('enum_list', p)
 
-  def p_enum_cont(self, p):
-    """enum_cont : ',' enum_list
+    def p_enum_cont(self, p):
+        """enum_cont : ',' enum_list
                  |"""
-    if len(p) > 1: p[0] = p[2]
-    if self.parse_debug: DumpReduction('enum_cont', p)
+        if len(p) > 1:
+            p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('enum_cont', p)
+
+    def p_enum_cont_error(self, p):
+        """enum_cont : error enum_cont"""
+        p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('enum_error', p)
 
-  def p_enum_cont_error(self, p):
-    """enum_cont : error enum_cont"""
-    p[0] = p[2]
-    if self.parse_debug: DumpReduction('enum_error', p)
-
-
-#
-# Label
-#
-# A label is a special kind of enumeration which allows us to go from a
-# set of labels
-#
-  def p_label_block(self, p):
-    """label_block : modifiers LABEL SYMBOL '{' label_list '}' ';'"""
-    p[0] = self.BuildNamed('Label', p, 3, ListFromConcat(p[1], p[5]))
-    if self.parse_debug: DumpReduction('label_block', p)
+    #
+    # Label
+    #
+    # A label is a special kind of enumeration which allows us to go from a
+    # set of labels
+    #
+    def p_label_block(self, p):
+        """label_block : modifiers LABEL SYMBOL '{' label_list '}' ';'"""
+        p[0] = self.BuildNamed('Label', p, 3, ListFromConcat(p[1], p[5]))
+        if self.parse_debug:
+            DumpReduction('label_block', p)
 
-  def p_label_list(self, p):
-    """label_list : modifiers SYMBOL '=' FLOAT label_cont"""
-    val  = self.BuildAttribute('VALUE', p[4])
-    label = self.BuildNamed('LabelItem', p, 2, ListFromConcat(val, p[1]))
-    p[0] = ListFromConcat(label, p[5])
-    if self.parse_debug: DumpReduction('label_list', p)
+    def p_label_list(self, p):
+        """label_list : modifiers SYMBOL '=' FLOAT label_cont"""
+        val = self.BuildAttribute('VALUE', p[4])
+        label = self.BuildNamed('LabelItem', p, 2, ListFromConcat(val, p[1]))
+        p[0] = ListFromConcat(label, p[5])
+        if self.parse_debug:
+            DumpReduction('label_list', p)
 
-  def p_label_cont(self, p):
-    """label_cont : ',' label_list
+    def p_label_cont(self, p):
+        """label_cont : ',' label_list
                  |"""
-    if len(p) > 1: p[0] = p[2]
-    if self.parse_debug: DumpReduction('label_cont', p)
+        if len(p) > 1:
+            p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('label_cont', p)
 
-  def p_label_cont_error(self, p):
-    """label_cont : error label_cont"""
-    p[0] = p[2]
-    if self.parse_debug: DumpReduction('label_error', p)
-
+    def p_label_cont_error(self, p):
+        """label_cont : error label_cont"""
+        p[0] = p[2]
+        if self.parse_debug:
+            DumpReduction('label_error', p)
 
-#
-# Members
-#
-# A member attribute or function of a struct or interface.
-#
-  def p_member_attribute(self, p):
-    """member_attribute : modifiers typeref arrays questionmark identifier"""
-    typeref = self.BuildAttribute('TYPEREF', p[2])
-    children = ListFromConcat(p[1], typeref, p[3], p[4])
-    p[0] = self.BuildNamed('Member', p, 5, children)
-    if self.parse_debug: DumpReduction('attribute', p)
-
-  def p_member_attribute_union(self, p):
-    """member_attribute : modifiers '(' union_list ')' questionmark identifier"""
-    union = self.BuildAttribute('Union', True)
-    children = ListFromConcat(p[1], p[3], p[5], union)
-    p[0] = self.BuildNamed('Member', p, 6, children)
-    if self.parse_debug: DumpReduction('attribute', p)
+    #
+    # Members
+    #
+    # A member attribute or function of a struct or interface.
+    #
+    def p_member_attribute(self, p):
+        """member_attribute : modifiers typeref arrays questionmark identifier"""
+        typeref = self.BuildAttribute('TYPEREF', p[2])
+        children = ListFromConcat(p[1], typeref, p[3], p[4])
+        p[0] = self.BuildNamed('Member', p, 5, children)
+        if self.parse_debug:
+            DumpReduction('attribute', p)
 
-  def p_member_function(self, p):
-    """member_function : modifiers static typeref arrays SYMBOL param_list"""
-    typeref = self.BuildAttribute('TYPEREF', p[3])
-    children = ListFromConcat(p[1], p[2], typeref, p[4], p[6])
-    p[0] = self.BuildNamed('Member', p, 5, children)
-    if self.parse_debug: DumpReduction('function', p)
+    def p_member_attribute_union(self, p):
+        """member_attribute : modifiers '(' union_list ')' questionmark identifier"""
+        union = self.BuildAttribute('Union', True)
+        children = ListFromConcat(p[1], p[3], p[5], union)
+        p[0] = self.BuildNamed('Member', p, 6, children)
+        if self.parse_debug:
+            DumpReduction('attribute', p)
 
-  def p_static(self, p):
-    """static : STATIC
-              | """
-    if len(p) == 2:
-      p[0] = self.BuildAttribute('STATIC', True)
+    def p_member_function(self, p):
+        """member_function : modifiers static typeref arrays SYMBOL param_list"""
+        typeref = self.BuildAttribute('TYPEREF', p[3])
+        children = ListFromConcat(p[1], p[2], typeref, p[4], p[6])
+        p[0] = self.BuildNamed('Member', p, 5, children)
+        if self.parse_debug:
+            DumpReduction('function', p)
 
-  def p_questionmark(self, p):
-    """questionmark : '?'
+    def p_static(self, p):
+        """static : STATIC
+              | """
+        if len(p) == 2:
+            p[0] = self.BuildAttribute('STATIC', True)
+
+    def p_questionmark(self, p):
+        """questionmark : '?'
                     | """
-    if len(p) == 2:
-      p[0] = self.BuildAttribute('OPTIONAL', True)
+        if len(p) == 2:
+            p[0] = self.BuildAttribute('OPTIONAL', True)
 
-#
-# Interface
-#
-# An interface is a named collection of functions.
-#
-  def p_interface_block(self, p):
-    """interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' ';'"""
-    p[0] = self.BuildNamed('Interface', p, 3, ListFromConcat(p[1], p[5]))
-    if self.parse_debug: DumpReduction('interface_block', p)
+            #
+            # Interface
+            #
+            # An interface is a named collection of functions.
+            #
 
-  def p_interface_error(self, p):
-    """interface_block : modifiers INTERFACE error '{' interface_list '}' ';'"""
-    p[0] = []
+    def p_interface_block(self, p):
+        """interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' ';'"""
+        p[0] = self.BuildNamed('Interface', p, 3, ListFromConcat(p[1], p[5]))
+        if self.parse_debug:
+            DumpReduction('interface_block', p)
 
-  def p_interface_list(self, p):
-    """interface_list : member_function ';' interface_list
-                      | """
-    if len(p) > 1 :
-      p[0] = ListFromConcat(p[1], p[3])
-      if self.parse_debug: DumpReduction('interface_list', p)
+    def p_interface_error(self, p):
+        """interface_block : modifiers INTERFACE error '{' interface_list '}' ';'"""
+        p[0] = []
 
+    def p_interface_list(self, p):
+        """interface_list : member_function ';' interface_list
+                      | """
+        if len(p) > 1:
+            p[0] = ListFromConcat(p[1], p[3])
+            if self.parse_debug:
+                DumpReduction('interface_list', p)
+            #
+            # Struct
+            #
+            # A struct is a named collection of members which in turn reference other
+            # types.  The struct is a referencable type.
+            #
 
-#
-# Struct
-#
-# A struct is a named collection of members which in turn reference other
-# types.  The struct is a referencable type.
-#
-  def p_struct_block(self, p):
-    """struct_block : modifiers STRUCT SYMBOL '{' struct_list '}' ';'"""
-    children = ListFromConcat(p[1], p[5])
-    p[0] = self.BuildNamed('Struct', p, 3, children)
-    if self.parse_debug: DumpReduction('struct_block', p)
+    def p_struct_block(self, p):
+        """struct_block : modifiers STRUCT SYMBOL '{' struct_list '}' ';'"""
+        children = ListFromConcat(p[1], p[5])
+        p[0] = self.BuildNamed('Struct', p, 3, children)
+        if self.parse_debug:
+            DumpReduction('struct_block', p)
 
-  # Recover from struct error and continue parsing at the next top match.
-  def p_struct_error(self, p):
-    """enum_block : modifiers STRUCT error '{' struct_list '}' ';'"""
-    p[0] = []
+    # Recover from struct error and continue parsing at the next top match.
+    def p_struct_error(self, p):
+        """enum_block : modifiers STRUCT error '{' struct_list '}' ';'"""
+        p[0] = []
 
-  def p_struct_list(self, p):
-    """struct_list : member_attribute ';' struct_list
+    def p_struct_list(self, p):
+        """struct_list : member_attribute ';' struct_list
                    | member_function ';' struct_list
                    |"""
-    if len(p) > 1: p[0] = ListFromConcat(p[1], p[3])
-
+        if len(p) > 1:
+            p[0] = ListFromConcat(p[1], p[3])
 
-#
-# Parser Errors
-#
-# p_error is called whenever the parser can not find a pattern match for
-# a set of items from the current state.  The p_error function defined here
-# is triggered logging an error, and parsing recover happens as the
-# p_<type>_error functions defined above are called.  This allows the parser
-# to continue so as to capture more than one error per file.
-#
-  def p_error(self, t):
-    filename = self.lexobj.filename
-    self.parse_errors += 1
-    if t:
-      lineno = t.lineno
-      pos = t.lexpos
-      prev = self.yaccobj.symstack[-1]
-      if type(prev) == lex.LexToken:
-        msg = "Unexpected %s after %s." % (
-            TokenTypeName(t), TokenTypeName(prev))
-      else:
-        msg = "Unexpected %s." % (t.value)
-    else:
-      lineno = self.last.lineno
-      pos = self.last.lexpos
-      msg = "Unexpected end of file after %s." % TokenTypeName(self.last)
-      self.yaccobj.restart()
+    #
+    # Parser Errors
+    #
+    # p_error is called whenever the parser can not find a pattern match for
+    # a set of items from the current state.  The p_error function defined here
+    # is triggered logging an error, and parsing recover happens as the
+    # p_<type>_error functions defined above are called.  This allows the parser
+    # to continue so as to capture more than one error per file.
+    #
+    def p_error(self, t):
+        filename = self.lexobj.filename
+        self.parse_errors += 1
+        if t:
+            lineno = t.lineno
+            pos = t.lexpos
+            prev = self.yaccobj.symstack[-1]
+            if type(prev) == lex.LexToken:
+                msg = "Unexpected %s after %s." % (
+                    TokenTypeName(t), TokenTypeName(prev))
+            else:
+                msg = "Unexpected %s." % (t.value)
+        else:
+            lineno = self.last.lineno
+            pos = self.last.lexpos
+            msg = "Unexpected end of file after %s." % TokenTypeName(self.last)
+            self.yaccobj.restart()
 
-    # Attempt to remap the error to a friendlier form
-    if msg in ERROR_REMAP:
-      msg = ERROR_REMAP[msg]
+        # Attempt to remap the error to a friendlier form
+        if msg in ERROR_REMAP:
+            msg = ERROR_REMAP[msg]
 
-    # Log the error
-    ErrOut.LogLine(filename, lineno, pos, msg)
+        # Log the error
+        ErrOut.LogLine(filename, lineno, pos, msg)
 
-  def Warn(self, node, msg):
-    WarnOut.LogLine(node.filename, node.lineno, node.pos, msg)
-    self.parse_warnings += 1
+    def Warn(self, node, msg):
+        WarnOut.LogLine(node.filename, node.lineno, node.pos, msg)
+        self.parse_warnings += 1
 
-  def __init__(self):
-    IDLLexer.__init__(self)
-    self.yaccobj = yacc.yacc(module=self, tabmodule=None, debug=False,
-                             optimize=0, write_tables=0)
+    def __init__(self):
+        IDLLexer.__init__(self)
+        self.yaccobj = yacc.yacc(module=self, tabmodule=None, debug=False,
+                                 optimize=0, write_tables=0)
 
-    self.build_debug = GetOption('build_debug')
-    self.parse_debug = GetOption('parse_debug')
-    self.token_debug = GetOption('token_debug')
-    self.verbose = GetOption('verbose')
-    self.parse_errors = 0
+        self.build_debug = GetOption('build_debug')
+        self.parse_debug = GetOption('parse_debug')
+        self.token_debug = GetOption('token_debug')
+        self.verbose = GetOption('verbose')
+        self.parse_errors = 0
+        self.parse_warnings = 0
 
-#
-# Tokenizer
-#
-# The token function returns the next token provided by IDLLexer for matching
-# against the leaf paterns.
-#
-  def token(self):
-    tok = self.lexobj.token()
-    if tok:
-      self.last = tok
-      if self.token_debug:
-        InfoOut.Log("TOKEN %s(%s)" % (tok.type, tok.value))
-    return tok
+    #
+    # Tokenizer
+    #
+    # The token function returns the next token provided by IDLLexer for matching
+    # against the leaf paterns.
+    #
+    def token(self):
+        tok = self.lexobj.token()
+        if tok:
+            self.last = tok
+            if self.token_debug:
+                InfoOut.Log("TOKEN %s(%s)" % (tok.type, tok.value))
+        return tok
 
-#
-# BuildProduction
-#
-# Production is the set of items sent to a grammar rule resulting in a new
-# item being returned.
-#
-# p - Is the Yacc production object containing the stack of items
-# index - Index into the production of the name for the item being produced.
-# cls - The type of item being producted
-# childlist - The children of the new item
-  def BuildProduction(self, cls, p, index, childlist=None):
-    if not childlist: childlist = []
-    filename = self.lexobj.filename
-    lineno = p.lineno(index)
-    pos = p.lexpos(index)
-    out = IDLNode(cls, filename, lineno, pos, childlist)
-    if self.build_debug:
-      InfoOut.Log("Building %s" % out)
-    return out
+    #
+    # BuildProduction
+    #
+    # Production is the set of items sent to a grammar rule resulting in a new
+    # item being returned.
+    #
+    # p - Is the Yacc production object containing the stack of items
+    # index - Index into the production of the name for the item being produced.
+    # cls - The type of item being producted
+    # childlist - The children of the new item
+    def BuildProduction(self, cls, p, index, childlist=None):
+        if not childlist:
+            childlist = []
+        filename = self.lexobj.filename
+        lineno = p.lineno(index)
+        pos = p.lexpos(index)
+        out = IDLNode(cls, filename, lineno, pos, childlist)
+        if self.build_debug:
+            InfoOut.Log("Building %s" % out)
+        return out
 
-  def BuildNamed(self, cls, p, index, childlist=None):
-    if not childlist: childlist = []
-    childlist.append(self.BuildAttribute('NAME', p[index]))
-    return self.BuildProduction(cls, p, index, childlist)
+    def BuildNamed(self, cls, p, index, childlist=None):
+        if not childlist:
+            childlist = []
+        childlist.append(self.BuildAttribute('NAME', p[index]))
+        return self.BuildProduction(cls, p, index, childlist)
 
-  def BuildComment(self, cls, p, index):
-    name = p[index]
+    def BuildComment(self, cls, p, index):
+        name = p[index]
 
-    # Remove comment markers
-    lines = []
-    if name[:2] == '//':
-      # For C++ style, remove any leading whitespace and the '//' marker from
-      # each line.
-      form = 'cc'
-      for line in name.split('\n'):
-        start = line.find('//')
-        lines.append(line[start+2:])
-    else:
-      # For C style, remove ending '*/''
-      form = 'c'
-      for line in name[:-2].split('\n'):
-        # Remove characters until start marker for this line '*' if found
-        # otherwise it should be blank.
-        offs = line.find('*')
-        if offs >= 0:
-          line = line[offs + 1:].rstrip()
+        # Remove comment markers
+        lines = []
+        if name[:2] == '//':
+            # For C++ style, remove any leading whitespace and the '//' marker from
+            # each line.
+            form = 'cc'
+            for line in name.split('\n'):
+                start = line.find('//')
+                lines.append(line[start + 2:])
         else:
-          line = ''
-        lines.append(line)
-    name = '\n'.join(lines)
+            # For C style, remove ending '*/''
+            form = 'c'
+            for line in name[:-2].split('\n'):
+                # Remove characters until start marker for this line '*' if found
+                # otherwise it should be blank.
+                offs = line.find('*')
+                if offs >= 0:
+                    line = line[offs + 1:].rstrip()
+                else:
+                    line = ''
+                lines.append(line)
+        name = '\n'.join(lines)
 
-    childlist = [self.BuildAttribute('NAME', name),
-                 self.BuildAttribute('FORM', form)]
-    return self.BuildProduction(cls, p, index, childlist)
+        childlist = [self.BuildAttribute('NAME', name),
+                     self.BuildAttribute('FORM', form)]
+        return self.BuildProduction(cls, p, index, childlist)
 
-#
-# BuildAttribute
-#
-# An ExtendedAttribute is a special production that results in a property
-# which is applied to the adjacent item.  Attributes have no children and
-# instead represent key/value pairs.
-#
-  def BuildAttribute(self, key, val):
-    return IDLAttribute(key, val)
-
+    #
+    # BuildAttribute
+    #
+    # An ExtendedAttribute is a special production that results in a property
+    # which is applied to the adjacent item.  Attributes have no children and
+    # instead represent key/value pairs.
+    #
+    def BuildAttribute(self, key, val):
+        return IDLAttribute(key, val)
 
-#
-# ParseData
-#
-# Attempts to parse the current data loaded in the lexer.
-#
-  def ParseData(self, data, filename='<Internal>'):
-    self.SetData(filename, data)
-    try:
-      self.parse_errors = 0
-      self.parse_warnings = 0
-      return self.yaccobj.parse(lexer=self)
+    #
+    # ParseData
+    #
+    # Attempts to parse the current data loaded in the lexer.
+    #
+    def ParseData(self, data, filename='<Internal>'):
+        self.SetData(filename, data)
+        try:
+            self.parse_errors = 0
+            self.parse_warnings = 0
+            return self.yaccobj.parse(lexer=self)
 
-    except lex.LexError as le:
-      ErrOut.Log(str(le))
-      return []
+        except lex.LexError as le:
+            ErrOut.Log(str(le))
+            return []
 
-#
-# ParseFile
-#
-# Loads a new file into the lexer and attemps to parse it.
-#
-  def ParseFile(self, filename):
-    date = time.ctime(os.path.getmtime(filename))
-    data = open(filename).read()
-    if self.verbose:
-      InfoOut.Log("Parsing %s" % filename)
-    try:
-      out = self.ParseData(data, filename)
+            #
+            # ParseFile
+            #
+            # Loads a new file into the lexer and attemps to parse it.
+            #
 
-      # If we have a src root specified, remove it from the path
-      srcroot = GetOption('srcroot')
-      if srcroot and filename.find(srcroot) == 0:
-        filename = filename[len(srcroot) + 1:]
-      filenode = IDLFile(filename, out, self.parse_errors + self.lex_errors)
-      filenode.SetProperty('DATETIME', date)
-      return filenode
+    def ParseFile(self, filename):
+        date = time.ctime(os.path.getmtime(filename))
+        data = open(filename).read()
+        if self.verbose:
+            InfoOut.Log("Parsing %s" % filename)
+        try:
+            out = self.ParseData(data, filename)
 
-    except Exception as e:
-      ErrOut.LogLine(filename, self.last.lineno, self.last.lexpos,
-                     'Internal parsing error - %s.' % str(e))
-      raise
+            # If we have a src root specified, remove it from the path
+            srcroot = GetOption('srcroot')
+            if srcroot and filename.find(srcroot) == 0:
+                filename = filename[len(srcroot) + 1:]
+            filenode = IDLFile(filename, out, self.parse_errors + self.lex_errors)
+            filenode.SetProperty('DATETIME', date)
+            return filenode
 
+        except Exception as e:
+            ErrOut.LogLine(filename, self.last.lineno, self.last.lexpos,
+                           'Internal parsing error - %s.' % str(e))
+            raise
 
 
 #
 # Flatten Tree
 #
 # Flattens the tree of IDLNodes for use in testing.
 #
 def FlattenTree(node):
-  add_self = False
-  out = []
-  for child in node.GetChildren():
-    if child.IsA('Comment'):
-      add_self = True
-    else:
-      out.extend(FlattenTree(child))
+    add_self = False
+    out = []
+    for child in node.GetChildren():
+        if child.IsA('Comment'):
+            add_self = True
+        else:
+            out.extend(FlattenTree(child))
 
-  if add_self:
-    out = [str(node)] + out
-  return out
+    if add_self:
+        out = [str(node)] + out
+    return out
 
 
 def TestErrors(filename, filenode):
-  nodelist = filenode.GetChildren()
+    nodelist = filenode.GetChildren()
 
-  lexer = IDLLexer()
-  data = open(filename).read()
-  lexer.SetData(filename, data)
+    lexer = IDLLexer()
+    data = open(filename).read()
+    lexer.SetData(filename, data)
 
-  pass_comments = []
-  fail_comments = []
-  while True:
-    tok = lexer.lexobj.token()
-    if tok == None: break
-    if tok.type == 'COMMENT':
-      args = tok.value[3:-3].split()
-      if args[0] == 'OK':
-        pass_comments.append((tok.lineno, ' '.join(args[1:])))
-      else:
-        if args[0] == 'FAIL':
-          fail_comments.append((tok.lineno, ' '.join(args[1:])))
-  obj_list = []
-  for node in nodelist:
-    obj_list.extend(FlattenTree(node))
+    pass_comments = []
+    fail_comments = []
+    while True:
+        tok = lexer.lexobj.token()
+        if tok is None:
+            break
+        if tok.type == 'COMMENT':
+            args = tok.value[3:-3].split()
+            if args[0] == 'OK':
+                pass_comments.append((tok.lineno, ' '.join(args[1:])))
+            else:
+                if args[0] == 'FAIL':
+                    fail_comments.append((tok.lineno, ' '.join(args[1:])))
+    obj_list = []
+    for node in nodelist:
+        obj_list.extend(FlattenTree(node))
 
-  errors = 0
+    errors = 0
 
-  #
-  # Check for expected successes
-  #
-  obj_cnt = len(obj_list)
-  pass_cnt = len(pass_comments)
-  if obj_cnt != pass_cnt:
-    InfoOut.Log("Mismatched pass (%d) vs. nodes built (%d)."
-        % (pass_cnt, obj_cnt))
-    InfoOut.Log("PASS: %s" % [x[1] for x in pass_comments])
-    InfoOut.Log("OBJS: %s" % obj_list)
-    errors += 1
-    if pass_cnt > obj_cnt: pass_cnt = obj_cnt
+    #
+    # Check for expected successes
+    #
+    obj_cnt = len(obj_list)
+    pass_cnt = len(pass_comments)
+    if obj_cnt != pass_cnt:
+        InfoOut.Log("Mismatched pass (%d) vs. nodes built (%d)."
+                    % (pass_cnt, obj_cnt))
+        InfoOut.Log("PASS: %s" % [x[1] for x in pass_comments])
+        InfoOut.Log("OBJS: %s" % obj_list)
+        errors += 1
+        if pass_cnt > obj_cnt:
+            pass_cnt = obj_cnt
 
-  for i in range(pass_cnt):
-    line, comment = pass_comments[i]
-    if obj_list[i] != comment:
-      ErrOut.LogLine(filename, line, None, "OBJ %s : EXPECTED %s\n" %
-                     (obj_list[i], comment))
-      errors += 1
+    for i in range(pass_cnt):
+        line, comment = pass_comments[i]
+        if obj_list[i] != comment:
+            ErrOut.LogLine(filename, line, None, "OBJ %s : EXPECTED %s\n" %
+                           (obj_list[i], comment))
+            errors += 1
 
-  #
-  # Check for expected errors
-  #
-  err_list = ErrOut.DrainLog()
-  err_cnt = len(err_list)
-  fail_cnt = len(fail_comments)
-  if err_cnt != fail_cnt:
-    InfoOut.Log("Mismatched fail (%d) vs. errors seen (%d)."
-        % (fail_cnt, err_cnt))
-    InfoOut.Log("FAIL: %s" % [x[1] for x in fail_comments])
-    InfoOut.Log("ERRS: %s" % err_list)
-    errors += 1
-    if fail_cnt > err_cnt:  fail_cnt = err_cnt
+    #
+    # Check for expected errors
+    #
+    err_list = ErrOut.DrainLog()
+    err_cnt = len(err_list)
+    fail_cnt = len(fail_comments)
+    if err_cnt != fail_cnt:
+        InfoOut.Log("Mismatched fail (%d) vs. errors seen (%d)."
+                    % (fail_cnt, err_cnt))
+        InfoOut.Log("FAIL: %s" % [x[1] for x in fail_comments])
+        InfoOut.Log("ERRS: %s" % err_list)
+        errors += 1
+        if fail_cnt > err_cnt:
+            fail_cnt = err_cnt
 
-  for i in range(fail_cnt):
-    line, comment = fail_comments[i]
-    err = err_list[i].strip()
+    for i in range(fail_cnt):
+        line, comment = fail_comments[i]
+        err = err_list[i].strip()
 
-    if err_list[i] != comment:
-      ErrOut.Log("%s(%d) Error\n\tERROR : %s\n\tEXPECT: %s" % (
-        filename, line, err_list[i], comment))
-      errors += 1
+        if err_list[i] != comment:
+            ErrOut.Log("%s(%d) Error\n\tERROR : %s\n\tEXPECT: %s" % (
+                filename, line, err_list[i], comment))
+            errors += 1
 
-  # Clear the error list for the next run
-  err_list = []
-  return errors
+    # Clear the error list for the next run
+    err_list = []
+    return errors
 
 
 def TestFile(parser, filename):
-  # Capture errors instead of reporting them so we can compare them
-  # with the expected errors.
-  ErrOut.SetConsole(False)
-  ErrOut.SetCapture(True)
+    # Capture errors instead of reporting them so we can compare them
+    # with the expected errors.
+    ErrOut.SetConsole(False)
+    ErrOut.SetCapture(True)
 
-  filenode = parser.ParseFile(filename)
+    filenode = parser.ParseFile(filename)
 
-  # Renable output
-  ErrOut.SetConsole(True)
-  ErrOut.SetCapture(False)
+    # Renable output
+    ErrOut.SetConsole(True)
+    ErrOut.SetCapture(False)
 
-  # Compare captured errors
-  return TestErrors(filename, filenode)
+    # Compare captured errors
+    return TestErrors(filename, filenode)
 
 
 def TestErrorFiles(filter):
-  idldir = os.path.split(sys.argv[0])[0]
-  idldir = os.path.join(idldir, 'test_parser', '*.idl')
-  filenames = glob.glob(idldir)
-  parser = IDLParser()
-  total_errs = 0
-  for filename in filenames:
-    if filter and filename not in filter: continue
-    errs = TestFile(parser, filename)
-    if errs:
-      ErrOut.Log("%s test failed with %d error(s)." % (filename, errs))
-      total_errs += errs
+    idldir = os.path.split(sys.argv[0])[0]
+    idldir = os.path.join(idldir, 'test_parser', '*.idl')
+    filenames = glob.glob(idldir)
+    parser = IDLParser()
+    total_errs = 0
+    for filename in filenames:
+        if filter and filename not in filter:
+            continue
+        errs = TestFile(parser, filename)
+        if errs:
+            ErrOut.Log("%s test failed with %d error(s)." % (filename, errs))
+            total_errs += errs
 
-  if total_errs:
-    ErrOut.Log("Failed parsing test.")
-  else:
-    InfoOut.Log("Passed parsing test.")
-  return total_errs
+    if total_errs:
+        ErrOut.Log("Failed parsing test.")
+    else:
+        InfoOut.Log("Passed parsing test.")
+    return total_errs
 
 
 def TestNamespaceFiles(filter):
-  idldir = os.path.split(sys.argv[0])[0]
-  idldir = os.path.join(idldir, 'test_namespace', '*.idl')
-  filenames = glob.glob(idldir)
-  testnames = []
+    idldir = os.path.split(sys.argv[0])[0]
+    idldir = os.path.join(idldir, 'test_namespace', '*.idl')
+    filenames = glob.glob(idldir)
+    testnames = []
 
-  for filename in filenames:
-    if filter and filename not in filter: continue
-    testnames.append(filename)
+    for filename in filenames:
+        if filter and filename not in filter:
+            continue
+        testnames.append(filename)
 
-  # If we have no files to test, then skip this test
-  if not testnames:
-    InfoOut.Log('No files to test for namespace.')
-    return 0
+    # If we have no files to test, then skip this test
+    if not testnames:
+        InfoOut.Log('No files to test for namespace.')
+        return 0
 
-  InfoOut.SetConsole(False)
-  ast = ParseFiles(testnames)
-  InfoOut.SetConsole(True)
+    InfoOut.SetConsole(False)
+    ast = ParseFiles(testnames)
+    InfoOut.SetConsole(True)
 
-  errs = ast.GetProperty('ERRORS')
-  if errs:
-    ErrOut.Log("Failed namespace test.")
-  else:
-    InfoOut.Log("Passed namespace test.")
-  return errs
-
+    errs = ast.GetProperty('ERRORS')
+    if errs:
+        ErrOut.Log("Failed namespace test.")
+    else:
+        InfoOut.Log("Passed namespace test.")
+    return errs
 
 
 def FindVersionError(releases, node):
-  err_cnt = 0
-  if node.IsA('Interface', 'Struct'):
-    comment_list = []
-    comment = node.GetOneOf('Comment')
-    if comment and comment.GetName()[:4] == 'REL:':
-      comment_list = comment.GetName()[5:].strip().split(' ')
+    err_cnt = 0
+    if node.IsA('Interface', 'Struct'):
+        comment_list = []
+        comment = node.GetOneOf('Comment')
+        if comment and comment.GetName()[:4] == 'REL:':
+            comment_list = comment.GetName()[5:].strip().split(' ')
 
-    first_list = [node.first_release[rel] for rel in releases]
-    first_list = sorted(set(first_list))
-    if first_list != comment_list:
-      node.Error("Mismatch in releases: %s vs %s." % (
-          comment_list, first_list))
-      err_cnt += 1
+        first_list = [node.first_release[rel] for rel in releases]
+        first_list = sorted(set(first_list))
+        if first_list != comment_list:
+            node.Error("Mismatch in releases: %s vs %s." % (
+                comment_list, first_list))
+            err_cnt += 1
 
-  for child in node.GetChildren():
-    err_cnt += FindVersionError(releases, child)
-  return err_cnt
+    for child in node.GetChildren():
+        err_cnt += FindVersionError(releases, child)
+    return err_cnt
 
 
 def TestVersionFiles(filter):
-  idldir = os.path.split(sys.argv[0])[0]
-  idldir = os.path.join(idldir, 'test_version', '*.idl')
-  filenames = glob.glob(idldir)
-  testnames = []
+    idldir = os.path.split(sys.argv[0])[0]
+    idldir = os.path.join(idldir, 'test_version', '*.idl')
+    filenames = glob.glob(idldir)
+    testnames = []
 
-  for filename in filenames:
-    if filter and filename not in filter: continue
-    testnames.append(filename)
+    for filename in filenames:
+        if filter and filename not in filter:
+            continue
+        testnames.append(filename)
 
-  # If we have no files to test, then skip this test
-  if not testnames:
-    InfoOut.Log('No files to test for version.')
-    return 0
+    # If we have no files to test, then skip this test
+    if not testnames:
+        InfoOut.Log('No files to test for version.')
+        return 0
 
-  ast = ParseFiles(testnames)
-  errs = FindVersionError(ast.releases, ast)
-  errs += ast.errors
+    ast = ParseFiles(testnames)
+    errs = FindVersionError(ast.releases, ast)
+    errs += ast.errors
 
-  if errs:
-    ErrOut.Log("Failed version test.")
-  else:
-    InfoOut.Log("Passed version test.")
-  return errs
+    if errs:
+        ErrOut.Log("Failed version test.")
+    else:
+        InfoOut.Log("Passed version test.")
+    return errs
 
 
 default_dirs = ['.', 'trusted', 'dev', 'private']
+
+
 def ParseFiles(filenames):
-  parser = IDLParser()
-  filenodes = []
+    parser = IDLParser()
+    filenodes = []
 
-  if not filenames:
-    filenames = []
-    srcroot = GetOption('srcroot')
-    dirs = default_dirs
-    if GetOption('include_private'):
-      dirs += ['private']
-    for dirname in dirs:
-      srcdir = os.path.join(srcroot, dirname, '*.idl')
-      srcdir = os.path.normpath(srcdir)
-      filenames += sorted(glob.glob(srcdir))
+    if not filenames:
+        filenames = []
+        srcroot = GetOption('srcroot')
+        dirs = default_dirs
+        if GetOption('include_private'):
+            dirs += ['private']
+        for dirname in dirs:
+            srcdir = os.path.join(srcroot, dirname, '*.idl')
+            srcdir = os.path.normpath(srcdir)
+            filenames += sorted(glob.glob(srcdir))
 
-  if not filenames:
-    ErrOut.Log('No sources provided.')
+    if not filenames:
+        ErrOut.Log('No sources provided.')
+
+    for filename in filenames:
+        filenode = parser.ParseFile(filename)
+        filenodes.append(filenode)
 
-  for filename in filenames:
-    filenode = parser.ParseFile(filename)
-    filenodes.append(filenode)
+    ast = IDLAst(filenodes)
+    if GetOption('dump_tree'):
+        ast.Dump(0)
 
-  ast = IDLAst(filenodes)
-  if GetOption('dump_tree'): ast.Dump(0)
-
-  Lint(ast)
-  return ast
+    Lint(ast)
+    return ast
 
 
 def Main(args):
-  filenames = ParseOptions(args)
+    filenames = ParseOptions(args)
 
-  # If testing...
-  if GetOption('test'):
-    errs = TestErrorFiles(filenames)
-    errs = TestNamespaceFiles(filenames)
-    errs = TestVersionFiles(filenames)
+    # If testing...
+    if GetOption('test'):
+        errs = TestErrorFiles(filenames)
+        errs = TestNamespaceFiles(filenames)
+        errs = TestVersionFiles(filenames)
+        if errs:
+            ErrOut.Log("Parser failed with %d errors." % errs)
+            return -1
+        return 0
+
+    # Otherwise, build the AST
+    ast = ParseFiles(filenames)
+    errs = ast.GetProperty('ERRORS')
     if errs:
-      ErrOut.Log("Parser failed with %d errors." % errs)
-      return  -1
-    return 0
-
-  # Otherwise, build the AST
-  ast = ParseFiles(filenames)
-  errs = ast.GetProperty('ERRORS')
-  if errs:
-    ErrOut.Log('Found %d error(s).' % errs);
-  InfoOut.Log("%d files processed." % len(filenames))
-  return errs
+        ErrOut.Log('Found %d error(s).' % errs)
+    InfoOut.Log("%d files processed." % len(filenames))
+    return errs
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
-
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_propertynode.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_propertynode.py
@@ -1,114 +1,116 @@
 #!/usr/bin/env python
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """ Hierarchical property system for IDL AST """
-import re
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
+from idl_log import ErrOut, InfoOut
+
 
 #
 # IDLPropertyNode
 #
 # A property node is a hierarchically aware system for mapping
 # keys to values, such that a local dictionary is search first,
 # followed by parent dictionaries in order.
 #
 class IDLPropertyNode(object):
-  def __init__(self):
-    self.parents = []
-    self.property_map = {}
+    def __init__(self):
+        self.parents = []
+        self.property_map = {}
 
-  def AddParent(self, parent):
-    assert parent
-    self.parents.append(parent)
+    def AddParent(self, parent):
+        assert parent
+        self.parents.append(parent)
 
-  def SetProperty(self, name, val):
-    self.property_map[name] = val
+    def SetProperty(self, name, val):
+        self.property_map[name] = val
 
-  def GetProperty(self, name):
-    # Check locally for the property, and return it if found.
-    prop = self.property_map.get(name, None)
-    if prop is not None:
-      return prop
-    # If not, seach parents in order
-    for parent in self.parents:
-      prop = parent.GetProperty(name)
-      if prop is not None:
-        return prop
-    # Otherwise, it can not be found.
-    return None
+    def GetProperty(self, name):
+        # Check locally for the property, and return it if found.
+        prop = self.property_map.get(name, None)
+        if prop is not None:
+            return prop
+        # If not, seach parents in order
+        for parent in self.parents:
+            prop = parent.GetProperty(name)
+            if prop is not None:
+                return prop
+        # Otherwise, it can not be found.
+        return None
 
-  def GetPropertyLocal(self, name):
-    # Search for the property, but only locally.
-    return self.property_map.get(name, None)
+    def GetPropertyLocal(self, name):
+        # Search for the property, but only locally.
+        return self.property_map.get(name, None)
 
-  def GetPropertyList(self):
-    return self.property_map.keys()
+    def GetPropertyList(self):
+        return self.property_map.keys()
+
 
 #
 # Testing functions
 #
 
 # Build a property node, setting the properties including a name, and
 # associate the children with this new node.
 #
 def BuildNode(name, props, children=None, parents=None):
-  node = IDLPropertyNode()
-  node.SetProperty('NAME', name)
-  for prop in props:
-    toks = prop.split('=')
-    node.SetProperty(toks[0], toks[1])
-  if children:
-    for child in children:
-      child.AddParent(node)
-  if parents:
-    for parent in parents:
-      node.AddParent(parent)
-  return node
+    node = IDLPropertyNode()
+    node.SetProperty('NAME', name)
+    for prop in props:
+        toks = prop.split('=')
+        node.SetProperty(toks[0], toks[1])
+    if children:
+        for child in children:
+            child.AddParent(node)
+    if parents:
+        for parent in parents:
+            node.AddParent(parent)
+    return node
+
 
 def ExpectProp(node, name, val):
-  found = node.GetProperty(name)
-  if found != val:
-    ErrOut.Log('Got property %s expecting %s' % (found, val))
-    return 1
-  return 0
+    found = node.GetProperty(name)
+    if found != val:
+        ErrOut.Log('Got property %s expecting %s' % (found, val))
+        return 1
+    return 0
+
 
 #
 # Verify property inheritance
 #
 def PropertyTest():
-  errors = 0
-  left = BuildNode('Left', ['Left=Left'])
-  right = BuildNode('Right', ['Right=Right'])
-  top = BuildNode('Top', ['Left=Top', 'Right=Top'], [left, right])
+    errors = 0
+    left = BuildNode('Left', ['Left=Left'])
+    right = BuildNode('Right', ['Right=Right'])
+    top = BuildNode('Top', ['Left=Top', 'Right=Top'], [left, right])
 
-  errors += ExpectProp(top, 'Left', 'Top')
-  errors += ExpectProp(top, 'Right', 'Top')
+    errors += ExpectProp(top, 'Left', 'Top')
+    errors += ExpectProp(top, 'Right', 'Top')
 
-  errors += ExpectProp(left, 'Left', 'Left')
-  errors += ExpectProp(left, 'Right', 'Top')
+    errors += ExpectProp(left, 'Left', 'Left')
+    errors += ExpectProp(left, 'Right', 'Top')
 
-  errors += ExpectProp(right, 'Left', 'Top')
-  errors += ExpectProp(right, 'Right', 'Right')
+    errors += ExpectProp(right, 'Left', 'Top')
+    errors += ExpectProp(right, 'Right', 'Right')
 
-  if not errors:
-    InfoOut.Log('Passed PropertyTest')
-  return errors
+    if not errors:
+        InfoOut.Log('Passed PropertyTest')
+    return errors
 
 
 def Main():
-  errors = 0
-  errors += PropertyTest()
+    errors = 0
+    errors += PropertyTest()
 
-  if errors:
-    ErrOut.Log('IDLNode failed with %d errors.' % errors)
-    return  -1
-  return 0
+    if errors:
+        ErrOut.Log('IDLNode failed with %d errors.' % errors)
+        return -1
+    return 0
 
 
 if __name__ == '__main__':
-  sys.exit(Main())
-
+    sys.exit(Main())
--- a/browser/extensions/mortar/ppapi/generators/idl_release.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_release.py
@@ -7,350 +7,360 @@
 IDLRelease for PPAPI
 
 This file defines the behavior of the AST namespace which allows for resolving
 a symbol as one or more AST nodes given a Release or range of Releases.
 """
 
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
-from idl_option import GetOption, Option, ParseOptions
+from idl_log import InfoOut
+from idl_option import GetOption, Option
 
 Option('release_debug', 'Debug Release data')
 Option('wgap', 'Ignore Release gap warning')
 
-
 #
 # Module level functions and data used for testing.
 #
 error = None
 warning = None
+
+
 def ReportReleaseError(msg):
-  global error
-  error = msg
+    global error
+    error = msg
+
 
 def ReportReleaseWarning(msg):
-  global warning
-  warning = msg
+    global warning
+    warning = msg
+
 
 def ReportClear():
-  global error, warning
-  error = None
-  warning = None
+    global error, warning
+    error = None
+    warning = None
+
 
 #
 # IDLRelease
 #
 # IDLRelease is an object which stores the association of a given symbol
 # name, with an AST node for a range of Releases for that object.
 #
 # A vmin value of None indicates that the object begins at the earliest
 # available Release number.  The value of vmin is always inclusive.
 
 # A vmax value of None indicates that the object is never deprecated, so
 # it exists until it is overloaded or until the latest available Release.
 # The value of vmax is always exclusive, representing the first Release
 # on which the object is no longer valid.
 class IDLRelease(object):
-  def __init__(self, rmin, rmax):
-    self.rmin = rmin
-    self.rmax = rmax
+    def __init__(self, rmin, rmax):
+        self.rmin = rmin
+        self.rmax = rmax
 
-  def __str__(self):
-    if not self.rmin:
-      rmin = '0'
-    else:
-      rmin = str(self.rmin)
-    if not self.rmax:
-      rmax = '+oo'
-    else:
-      rmax = str(self.rmax)
-    return '[%s,%s)' % (rmin, rmax)
+    def __str__(self):
+        if not self.rmin:
+            rmin = '0'
+        else:
+            rmin = str(self.rmin)
+        if not self.rmax:
+            rmax = '+oo'
+        else:
+            rmax = str(self.rmax)
+        return '[%s,%s)' % (rmin, rmax)
 
-  def SetReleaseRange(self, rmin, rmax):
-    self.rmin = rmin
-    self.rmax = rmax
+    def SetReleaseRange(self, rmin, rmax):
+        self.rmin = rmin
+        self.rmax = rmax
 
-  # True, if Release falls within the interval [self.vmin, self.vmax)
-  def IsRelease(self, release):
-    if self.rmax and self.rmax <= release:
-      return False
-    if self.rmin and self.rmin > release:
-      return False
-    if GetOption('release_debug'):
-      InfoOut.Log('%f is in %s' % (release, self))
-    return True
-
-  # True, if Release falls within the interval [self.vmin, self.vmax)
-  def InReleases(self, releases):
-    if not releases: return False
+    # True, if Release falls within the interval [self.vmin, self.vmax)
+    def IsRelease(self, release):
+        if self.rmax and self.rmax <= release:
+            return False
+        if self.rmin and self.rmin > release:
+            return False
+        if GetOption('release_debug'):
+            InfoOut.Log('%f is in %s' % (release, self))
+        return True
 
-    # Check last release first, since InRange does not match last item
-    if self.IsRelease(releases[-1]): return True
-    if len(releases) > 1:
-      return self.InRange(releases[0], releases[-1])
-    return False
+    # True, if Release falls within the interval [self.vmin, self.vmax)
+    def InReleases(self, releases):
+        if not releases:
+            return False
 
-  # True, if interval [vmin, vmax) overlaps interval [self.vmin, self.vmax)
-  def InRange(self, rmin, rmax):
-    assert (rmin == None) or rmin < rmax
-
-    # An min of None always passes a min bound test
-    # An max of None always passes a max bound test
-    if rmin is not None and self.rmax is not None:
-      if self.rmax <= rmin:
-        return False
-    if rmax is not None and self.rmin is not None:
-      if self.rmin >= rmax:
+        # Check last release first, since InRange does not match last item
+        if self.IsRelease(releases[-1]):
+            return True
+        if len(releases) > 1:
+            return self.InRange(releases[0], releases[-1])
         return False
 
-    if GetOption('release_debug'):
-      InfoOut.Log('%f to %f is in %s' % (rmin, rmax, self))
-    return True
+    # True, if interval [vmin, vmax) overlaps interval [self.vmin, self.vmax)
+    def InRange(self, rmin, rmax):
+        assert (rmin is None) or rmin < rmax
 
-  def GetMinMax(self, releases = None):
-    if not releases:
-      return self.rmin, self.rmax
+        # An min of None always passes a min bound test
+        # An max of None always passes a max bound test
+        if rmin is not None and self.rmax is not None:
+            if self.rmax <= rmin:
+                return False
+        if rmax is not None and self.rmin is not None:
+            if self.rmin >= rmax:
+                return False
+
+        if GetOption('release_debug'):
+            InfoOut.Log('%f to %f is in %s' % (rmin, rmax, self))
+        return True
 
-    if not self.rmin:
-      rmin = releases[0]
-    else:
-      rmin = str(self.rmin)
-    if not self.rmax:
-      rmax = releases[-1]
-    else:
-      rmax = str(self.rmax)
-    return (rmin, rmax)
+    def GetMinMax(self, releases=None):
+        if not releases:
+            return self.rmin, self.rmax
 
-  def SetMin(self, release):
-    assert not self.rmin
-    self.rmin = release
+        if not self.rmin:
+            rmin = releases[0]
+        else:
+            rmin = str(self.rmin)
+        if not self.rmax:
+            rmax = releases[-1]
+        else:
+            rmax = str(self.rmax)
+        return (rmin, rmax)
 
-  def Error(self, msg):
-    ReportReleaseError(msg)
+    def SetMin(self, release):
+        assert not self.rmin
+        self.rmin = release
 
-  def Warn(self, msg):
-    ReportReleaseWarning(msg)
+    def Error(self, msg):
+        ReportReleaseError(msg)
+
+    def Warn(self, msg):
+        ReportReleaseWarning(msg)
 
 
 #
 # IDLReleaseList
 #
 # IDLReleaseList is a list based container for holding IDLRelease
 # objects in order.  The IDLReleaseList can be added to, and searched by
 # range.  Objects are stored in order, and must be added in order.
 #
 class IDLReleaseList(object):
-  def __init__(self):
-    self._nodes = []
+    def __init__(self):
+        self._nodes = []
 
-  def GetReleases(self):
-    return self._nodes
+    def GetReleases(self):
+        return self._nodes
 
-  def FindRelease(self, release):
-    for node in self._nodes:
-      if node.IsRelease(release):
-        return node
-    return None
+    def FindRelease(self, release):
+        for node in self._nodes:
+            if node.IsRelease(release):
+                return node
+        return None
 
-  def FindRange(self, rmin, rmax):
-    assert (rmin == None) or rmin != rmax
+    def FindRange(self, rmin, rmax):
+        assert (rmin is None) or rmin != rmax
 
-    out = []
-    for node in self._nodes:
-      if node.InRange(rmin, rmax):
-        out.append(node)
-    return out
+        out = []
+        for node in self._nodes:
+            if node.InRange(rmin, rmax):
+                out.append(node)
+        return out
 
-  def AddNode(self, node):
-    if GetOption('release_debug'):
-      InfoOut.Log('\nAdding %s %s' % (node.Location(), node))
-    last = None
+    def AddNode(self, node):
+        if GetOption('release_debug'):
+            InfoOut.Log('\nAdding %s %s' % (node.Location(), node))
+        last = None
 
-    # Check current releases in that namespace
-    for cver in self._nodes:
-      if GetOption('release_debug'): InfoOut.Log('  Checking %s' % cver)
+        # Check current releases in that namespace
+        for cver in self._nodes:
+            if GetOption('release_debug'):
+                InfoOut.Log('  Checking %s' % cver)
 
-      # We should only be missing a 'release' tag for the first item.
-      if not node.rmin:
-        node.Error('Missing release on overload of previous %s.' %
-                   cver.Location())
-        return False
+            # We should only be missing a 'release' tag for the first item.
+            if not node.rmin:
+                node.Error('Missing release on overload of previous %s.' %
+                           cver.Location())
+                return False
 
-      # If the node has no max, then set it to this one
-      if not cver.rmax:
-        cver.rmax = node.rmin
-        if GetOption('release_debug'): InfoOut.Log('  Update %s' % cver)
+            # If the node has no max, then set it to this one
+            if not cver.rmax:
+                cver.rmax = node.rmin
+                if GetOption('release_debug'):
+                    InfoOut.Log('  Update %s' % cver)
 
-      # if the max and min overlap, than's an error
-      if cver.rmax > node.rmin:
-        if node.rmax and cver.rmin >= node.rmax:
-          node.Error('Declarations out of order.')
-        else:
-          node.Error('Overlap in releases: %s vs %s when adding %s' %
-                     (cver.rmax, node.rmin, node))
-        return False
-      last = cver
+            # if the max and min overlap, than's an error
+            if cver.rmax > node.rmin:
+                if node.rmax and cver.rmin >= node.rmax:
+                    node.Error('Declarations out of order.')
+                else:
+                    node.Error('Overlap in releases: %s vs %s when adding %s' %
+                               (cver.rmax, node.rmin, node))
+                return False
+            last = cver
 
-    # Otherwise, the previous max and current min should match
-    # unless this is the unlikely case of something being only
-    # temporarily deprecated.
-    if last and last.rmax != node.rmin:
-      node.Warn('Gap in release numbers.')
+        # Otherwise, the previous max and current min should match
+        # unless this is the unlikely case of something being only
+        # temporarily deprecated.
+        if last and last.rmax != node.rmin:
+            node.Warn('Gap in release numbers.')
 
-    # If we made it here, this new node must be the 'newest'
-    # and does not overlap with anything previously added, so
-    # we can add it to the end of the list.
-    if GetOption('release_debug'): InfoOut.Log('Done %s' % node)
-    self._nodes.append(node)
-    return True
+        # If we made it here, this new node must be the 'newest'
+        # and does not overlap with anything previously added, so
+        # we can add it to the end of the list.
+        if GetOption('release_debug'):
+            InfoOut.Log('Done %s' % node)
+        self._nodes.append(node)
+        return True
+
 
 #
 # IDLReleaseMap
 #
 # A release map, can map from an float interface release, to a global
 # release string.
 #
 class IDLReleaseMap(object):
-  def __init__(self, release_info):
-    self.version_to_release = {}
-    self.release_to_version = {}
-    self.release_to_channel = {}
-    for release, version, channel in release_info:
-      self.version_to_release[version] = release
-      self.release_to_version[release] = version
-      self.release_to_channel[release] = channel
-    self.releases = sorted(self.release_to_version.keys())
-    self.versions = sorted(self.version_to_release.keys())
+    def __init__(self, release_info):
+        self.version_to_release = {}
+        self.release_to_version = {}
+        self.release_to_channel = {}
+        for release, version, channel in release_info:
+            self.version_to_release[version] = release
+            self.release_to_version[release] = version
+            self.release_to_channel[release] = channel
+        self.releases = sorted(self.release_to_version.keys())
+        self.versions = sorted(self.version_to_release.keys())
 
-  def GetVersion(self, release):
-    return self.release_to_version.get(release, None)
+    def GetVersion(self, release):
+        return self.release_to_version.get(release, None)
 
-  def GetVersions(self):
-    return self.versions
+    def GetVersions(self):
+        return self.versions
 
-  def GetRelease(self, version):
-    return self.version_to_release.get(version, None)
+    def GetRelease(self, version):
+        return self.version_to_release.get(version, None)
 
-  def GetReleases(self):
-    return self.releases
+    def GetReleases(self):
+        return self.releases
 
-  def GetReleaseRange(self):
-    return (self.releases[0], self.releases[-1])
+    def GetReleaseRange(self):
+        return self.releases[0], self.releases[-1]
 
-  def GetVersionRange(self):
-    return (self.versions[0], self.version[-1])
+    def GetVersionRange(self):
+        return self.versions[0], self.versions[-1]
 
-  def GetChannel(self, release):
-    return self.release_to_channel.get(release, None)
+    def GetChannel(self, release):
+        return self.release_to_channel.get(release, None)
+
 
 #
 # Test Code
 #
 def TestReleaseNode():
-  FooXX = IDLRelease(None, None)
-  Foo1X = IDLRelease('M14', None)
-  Foo23 = IDLRelease('M15', 'M16')
+    FooXX = IDLRelease(None, None)
+    Foo1X = IDLRelease('M14', None)
+    Foo23 = IDLRelease('M15', 'M16')
 
-  assert FooXX.IsRelease('M13')
-  assert FooXX.IsRelease('M14')
-  assert FooXX.InRange('M13', 'M13A')
-  assert FooXX.InRange('M14','M15')
+    assert FooXX.IsRelease('M13')
+    assert FooXX.IsRelease('M14')
+    assert FooXX.InRange('M13', 'M13A')
+    assert FooXX.InRange('M14', 'M15')
 
-  assert not Foo1X.IsRelease('M13')
-  assert Foo1X.IsRelease('M14')
-  assert Foo1X.IsRelease('M15')
+    assert not Foo1X.IsRelease('M13')
+    assert Foo1X.IsRelease('M14')
+    assert Foo1X.IsRelease('M15')
 
-  assert not Foo1X.InRange('M13', 'M14')
-  assert not Foo1X.InRange('M13A', 'M14')
-  assert Foo1X.InRange('M14', 'M15')
-  assert Foo1X.InRange('M15', 'M16')
+    assert not Foo1X.InRange('M13', 'M14')
+    assert not Foo1X.InRange('M13A', 'M14')
+    assert Foo1X.InRange('M14', 'M15')
+    assert Foo1X.InRange('M15', 'M16')
 
-  assert not Foo23.InRange('M13', 'M14')
-  assert not Foo23.InRange('M13A', 'M14')
-  assert not Foo23.InRange('M14', 'M15')
-  assert Foo23.InRange('M15', 'M16')
-  assert Foo23.InRange('M14', 'M15A')
-  assert Foo23.InRange('M15B', 'M17')
-  assert not Foo23.InRange('M16', 'M17')
-  print "TestReleaseNode - Passed"
+    assert not Foo23.InRange('M13', 'M14')
+    assert not Foo23.InRange('M13A', 'M14')
+    assert not Foo23.InRange('M14', 'M15')
+    assert Foo23.InRange('M15', 'M16')
+    assert Foo23.InRange('M14', 'M15A')
+    assert Foo23.InRange('M15B', 'M17')
+    assert not Foo23.InRange('M16', 'M17')
+    print "TestReleaseNode - Passed"
 
 
 def TestReleaseListWarning():
-  FooXX = IDLRelease(None, None)
-  Foo1X = IDLRelease('M14', None)
-  Foo23 = IDLRelease('M15', 'M16')
-  Foo45 = IDLRelease('M17', 'M18')
+    # FooXX = IDLRelease(None, None)
+    # Foo1X = IDLRelease('M14', None)
+    Foo23 = IDLRelease('M15', 'M16')
+    Foo45 = IDLRelease('M17', 'M18')
 
-  # Add nodes out of order should fail
-  ReportClear()
-  releases = IDLReleaseList()
-  assert releases.AddNode(Foo23)
-  assert releases.AddNode(Foo45)
-  assert warning
-  print "TestReleaseListWarning - Passed"
+    # Add nodes out of order should fail
+    ReportClear()
+    releases = IDLReleaseList()
+    assert releases.AddNode(Foo23)
+    assert releases.AddNode(Foo45)
+    assert warning
+    print "TestReleaseListWarning - Passed"
 
 
 def TestReleaseListError():
-  FooXX = IDLRelease(None, None)
-  Foo1X = IDLRelease('M14', None)
-  Foo23 = IDLRelease('M15', 'M16')
-  Foo45 = IDLRelease('M17', 'M18')
+    FooXX = IDLRelease(None, None)
+    Foo1X = IDLRelease('M14', None)
+    Foo23 = IDLRelease('M15', 'M16')
+    # Foo45 = IDLRelease('M17', 'M18')
 
-  # Add nodes out of order should fail
-  ReportClear()
-  releases = IDLReleaseList()
-  assert releases.AddNode(FooXX)
-  assert releases.AddNode(Foo23)
-  assert not releases.AddNode(Foo1X)
-  assert error
-  print "TestReleaseListError - Passed"
+    # Add nodes out of order should fail
+    ReportClear()
+    releases = IDLReleaseList()
+    assert releases.AddNode(FooXX)
+    assert releases.AddNode(Foo23)
+    assert not releases.AddNode(Foo1X)
+    assert error
+    print "TestReleaseListError - Passed"
 
 
 def TestReleaseListOK():
-  FooXX = IDLRelease(None, None)
-  Foo1X = IDLRelease('M14', None)
-  Foo23 = IDLRelease('M15', 'M16')
-  Foo45 = IDLRelease('M17', 'M18')
+    FooXX = IDLRelease(None, None)
+    Foo1X = IDLRelease('M14', None)
+    Foo23 = IDLRelease('M15', 'M16')
+    Foo45 = IDLRelease('M17', 'M18')
 
-  # Add nodes in order should work
-  ReportClear()
-  releases = IDLReleaseList()
-  assert releases.AddNode(FooXX)
-  assert releases.AddNode(Foo1X)
-  assert releases.AddNode(Foo23)
-  assert not error and not warning
-  assert releases.AddNode(Foo45)
-  assert warning
+    # Add nodes in order should work
+    ReportClear()
+    releases = IDLReleaseList()
+    assert releases.AddNode(FooXX)
+    assert releases.AddNode(Foo1X)
+    assert releases.AddNode(Foo23)
+    assert not error and not warning
+    assert releases.AddNode(Foo45)
+    assert warning
 
-  assert releases.FindRelease('M13') == FooXX
-  assert releases.FindRelease('M14') == Foo1X
-  assert releases.FindRelease('M15') == Foo23
-  assert releases.FindRelease('M16') == None
-  assert releases.FindRelease('M17') == Foo45
-  assert releases.FindRelease('M18') == None
+    assert releases.FindRelease('M13') == FooXX
+    assert releases.FindRelease('M14') == Foo1X
+    assert releases.FindRelease('M15') == Foo23
+    assert releases.FindRelease('M16') is None
+    assert releases.FindRelease('M17') == Foo45
+    assert releases.FindRelease('M18') is None
 
-  assert releases.FindRange('M13','M14') == [FooXX]
-  assert releases.FindRange('M13','M17') == [FooXX, Foo1X, Foo23]
-  assert releases.FindRange('M16','M17') == []
-  assert releases.FindRange(None, None) == [FooXX, Foo1X, Foo23, Foo45]
+    assert releases.FindRange('M13', 'M14') == [FooXX]
+    assert releases.FindRange('M13', 'M17') == [FooXX, Foo1X, Foo23]
+    assert releases.FindRange('M16', 'M17') == []
+    assert releases.FindRange(None, None) == [FooXX, Foo1X, Foo23, Foo45]
 
-  # Verify we can find the correct versions
-  print "TestReleaseListOK - Passed"
+    # Verify we can find the correct versions
+    print "TestReleaseListOK - Passed"
 
 
 def TestReleaseMap():
-  print "TestReleaseMap- Passed"
+    print "TestReleaseMap- Passed"
 
 
 def Main(args):
-  TestReleaseNode()
-  TestReleaseListWarning()
-  TestReleaseListError()
-  TestReleaseListOK()
-  print "Passed"
-  return 0
+    TestReleaseNode()
+    TestReleaseListWarning()
+    TestReleaseListError()
+    TestReleaseListOK()
+    print "Passed"
+    return 0
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
-
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_tests.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_tests.py
@@ -3,43 +3,44 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """ Test runner for IDL Generator changes """
 
 import subprocess
 import sys
 
+
 def TestIDL(testname, args):
-  print '\nRunning unit tests for %s.' % testname
-  try:
-    args = [sys.executable, testname] + args
-    subprocess.check_call(args)
-    return 0
-  except subprocess.CalledProcessError as err:
-    print 'Failed with %s.' % str(err)
-    return 1
+    print '\nRunning unit tests for %s.' % testname
+    try:
+        args = [sys.executable, testname] + args
+        subprocess.check_call(args)
+        return 0
+    except subprocess.CalledProcessError as err:
+        print 'Failed with %s.' % str(err)
+        return 1
+
 
 def main(args):
-  errors = 0
-  errors += TestIDL('idl_lexer.py', ['--test'])
-  assert errors == 0
-  errors += TestIDL('idl_parser.py', ['--test'])
-  assert errors == 0
-  errors += TestIDL('idl_c_header.py', [])
-  assert errors == 0
-  errors += TestIDL('idl_c_proto.py', ['--wnone', '--test'])
-  assert errors == 0
-  errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test'])
-  assert errors == 0
-  errors += TestIDL('idl_namespace.py', [])
-  assert errors == 0
-  errors += TestIDL('idl_node.py', [])
-  assert errors == 0
+    errors = 0
+    errors += TestIDL('idl_lexer.py', ['--test'])
+    assert errors == 0
+    errors += TestIDL('idl_parser.py', ['--test'])
+    assert errors == 0
+    errors += TestIDL('idl_c_header.py', [])
+    assert errors == 0
+    errors += TestIDL('idl_c_proto.py', ['--wnone', '--test'])
+    assert errors == 0
+    errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test'])
+    assert errors == 0
+    errors += TestIDL('idl_namespace.py', [])
+    assert errors == 0
+    errors += TestIDL('idl_node.py', [])
+    assert errors == 0
 
-  if errors:
-    print '\nFailed tests.'
-  return errors
+    if errors:
+        print '\nFailed tests.'
+    return errors
 
 
 if __name__ == '__main__':
-  sys.exit(main(sys.argv[1:]))
-
+    sys.exit(main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_thunk.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_thunk.py
@@ -2,580 +2,578 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """ Generator for C++ style thunks """
 
 import glob
 import os
-import re
 import sys
 
-from idl_log import ErrOut, InfoOut, WarnOut
-from idl_node import IDLAttribute, IDLNode
-from idl_ast import IDLAst
 from idl_option import GetOption, Option, ParseOptions
 from idl_outfile import IDLOutFile
 from idl_parser import ParseFiles
-from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment
+from idl_c_proto import CGen
 from idl_generator import Generator, GeneratorByFile
 
 Option('thunkroot', 'Base directory of output',
        default=os.path.join('..', 'thunk'))
 
 
 class TGenError(Exception):
-  def __init__(self, msg):
-    self.value = msg
+    def __init__(self, msg):
+        self.value = msg
 
-  def __str__(self):
-    return repr(self.value)
+    def __str__(self):
+        return repr(self.value)
 
 
 class ThunkBodyMetadata(object):
-  """Metadata about thunk body. Used for selecting which headers to emit."""
-  def __init__(self):
-    self._apis = set()
-    self._builtin_includes = set()
-    self._includes = set()
+    """Metadata about thunk body. Used for selecting which headers to emit."""
 
-  def AddApi(self, api):
-    self._apis.add(api)
+    def __init__(self):
+        self._apis = set()
+        self._builtin_includes = set()
+        self._includes = set()
 
-  def Apis(self):
-    return self._apis
+    def AddApi(self, api):
+        self._apis.add(api)
 
-  def AddInclude(self, include):
-    self._includes.add(include)
+    def Apis(self):
+        return self._apis
 
-  def Includes(self):
-    return self._includes
+    def AddInclude(self, include):
+        self._includes.add(include)
 
-  def AddBuiltinInclude(self, include):
-    self._builtin_includes.add(include)
+    def Includes(self):
+        return self._includes
 
-  def BuiltinIncludes(self):
-    return self._builtin_includes
+    def AddBuiltinInclude(self, include):
+        self._builtin_includes.add(include)
+
+    def BuiltinIncludes(self):
+        return self._builtin_includes
 
 
 def _GetBaseFileName(filenode):
-  """Returns the base name for output files, given the filenode.
+    """Returns the base name for output files, given the filenode.
 
   Examples:
     'dev/ppb_find_dev.h' -> 'ppb_find_dev'
     'trusted/ppb_buffer_trusted.h' -> 'ppb_buffer_trusted'
   """
-  path, name = os.path.split(filenode.GetProperty('NAME'))
-  name = os.path.splitext(name)[0]
-  return name
+    path, name = os.path.split(filenode.GetProperty('NAME'))
+    name = os.path.splitext(name)[0]
+    return name
 
 
 def _GetHeaderFileName(filenode):
-  """Returns the name for the header for this file."""
-  path, name = os.path.split(filenode.GetProperty('NAME'))
-  name = os.path.splitext(name)[0]
-  if path:
-    header = "ppapi/c/%s/%s.h" % (path, name)
-  else:
-    header = "ppapi/c/%s.h" % name
-  return header
+    """Returns the name for the header for this file."""
+    path, name = os.path.split(filenode.GetProperty('NAME'))
+    name = os.path.splitext(name)[0]
+    if path:
+        header = "ppapi/c/%s/%s.h" % (path, name)
+    else:
+        header = "ppapi/c/%s.h" % name
+    return header
 
 
 def _GetThunkFileName(filenode, relpath):
-  """Returns the thunk file name."""
-  path = os.path.split(filenode.GetProperty('NAME'))[0]
-  name = _GetBaseFileName(filenode)
-  # We don't reattach the path for thunk.
-  if relpath: name = os.path.join(relpath, name)
-  name = '%s%s' % (name, '_thunk.cc')
-  return name
+    """Returns the thunk file name."""
+    # path = os.path.split(filenode.GetProperty('NAME'))[0]
+    name = _GetBaseFileName(filenode)
+    # We don't reattach the path for thunk.
+    if relpath:
+        name = os.path.join(relpath, name)
+    name = '%s%s' % (name, '_thunk.cc')
+    return name
 
 
 def _StripFileName(filenode):
-  """Strips path  and dev, trusted, and private suffixes from the file name."""
-  api_basename = _GetBaseFileName(filenode)
-  if api_basename.endswith('_dev'):
-    api_basename = api_basename[:-len('_dev')]
-  if api_basename.endswith('_trusted'):
-    api_basename = api_basename[:-len('_trusted')]
-  if api_basename.endswith('_private'):
-    api_basename = api_basename[:-len('_private')]
-  return api_basename
+    """Strips path  and dev, trusted, and private suffixes from the file name."""
+    api_basename = _GetBaseFileName(filenode)
+    if api_basename.endswith('_dev'):
+        api_basename = api_basename[:-len('_dev')]
+    if api_basename.endswith('_trusted'):
+        api_basename = api_basename[:-len('_trusted')]
+    if api_basename.endswith('_private'):
+        api_basename = api_basename[:-len('_private')]
+    return api_basename
 
 
 def _StripApiName(api_name):
-  """Strips Dev, Private, and Trusted suffixes from the API name."""
-  if api_name.endswith('Trusted'):
-    api_name = api_name[:-len('Trusted')]
-  if api_name.endswith('_Dev'):
-    api_name = api_name[:-len('_Dev')]
-  if api_name.endswith('_Private'):
-    api_name = api_name[:-len('_Private')]
-  return api_name
+    """Strips Dev, Private, and Trusted suffixes from the API name."""
+    if api_name.endswith('Trusted'):
+        api_name = api_name[:-len('Trusted')]
+    if api_name.endswith('_Dev'):
+        api_name = api_name[:-len('_Dev')]
+    if api_name.endswith('_Private'):
+        api_name = api_name[:-len('_Private')]
+    return api_name
 
 
 def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
                    meta):
-  """Returns an EnterInstance/EnterResource string for a function."""
-  api_name = _StripApiName(interface.GetName()) + '_API'
-  if member.GetProperty('api'):  # Override API name.
-    manually_provided_api = True
-    # TODO(teravest): Automatically guess the API header file.
-    api_name = member.GetProperty('api')
-  else:
-    manually_provided_api = False
-
-  if arg[0] == 'PP_Instance':
-    if callback is None:
-      arg_string = arg[1]
+    """Returns an EnterInstance/EnterResource string for a function."""
+    api_name = _StripApiName(interface.GetName()) + '_API'
+    if member.GetProperty('api'):  # Override API name.
+        manually_provided_api = True
+        # TODO(teravest): Automatically guess the API header file.
+        api_name = member.GetProperty('api')
     else:
-      arg_string = '%s, %s' % (arg[1], callback)
-    if interface.GetProperty('singleton') or member.GetProperty('singleton'):
-      if not manually_provided_api:
-        meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
-      return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string)
+        manually_provided_api = False
+
+    if arg[0] == 'PP_Instance':
+        if callback is None:
+            arg_string = arg[1]
+        else:
+            arg_string = '%s, %s' % (arg[1], callback)
+        if interface.GetProperty('singleton') or member.GetProperty('singleton'):
+            if not manually_provided_api:
+                meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
+            return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string)
+        else:
+            return 'EnterInstance enter(%s);' % arg_string
+    elif arg[0] == 'PP_Resource':
+        enter_type = 'EnterResource<%s>' % api_name
+        if not manually_provided_api:
+            meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
+        if callback is None:
+            return '%s enter(%s, %s);' % (enter_type, arg[1],
+                                          str(handle_errors).lower())
+        else:
+            return '%s enter(%s, %s, %s);' % (enter_type, arg[1],
+                                              callback,
+                                              str(handle_errors).lower())
     else:
-      return 'EnterInstance enter(%s);' % arg_string
-  elif arg[0] == 'PP_Resource':
-    enter_type = 'EnterResource<%s>' % api_name
-    if not manually_provided_api:
-      meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
-    if callback is None:
-      return '%s enter(%s, %s);' % (enter_type, arg[1],
-                                    str(handle_errors).lower())
-    else:
-      return '%s enter(%s, %s, %s);' % (enter_type, arg[1],
-                                        callback,
-                                        str(handle_errors).lower())
-  else:
-    raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0])
+        raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0])
 
 
 def _GetShortName(interface, filter_suffixes):
-  """Return a shorter interface name that matches Is* and Create* functions."""
-  parts = interface.GetName().split('_')[1:]
-  tail = parts[len(parts) - 1]
-  if tail in filter_suffixes:
-    parts = parts[:-1]
-  return ''.join(parts)
+    """Return a shorter interface name that matches Is* and Create* functions."""
+    parts = interface.GetName().split('_')[1:]
+    tail = parts[len(parts) - 1]
+    if tail in filter_suffixes:
+        parts = parts[:-1]
+    return ''.join(parts)
 
 
 def _IsTypeCheck(interface, node, args):
-  """Returns true if node represents a type-checking function."""
-  if len(args) == 0 or args[0][0] != 'PP_Resource':
-    return False
-  return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private'])
+    """Returns true if node represents a type-checking function."""
+    if len(args) == 0 or args[0][0] != 'PP_Resource':
+        return False
+    return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private'])
 
 
 def _GetCreateFuncName(interface):
-  """Returns the creation function name for an interface."""
-  return 'Create%s' % _GetShortName(interface, ['Dev'])
+    """Returns the creation function name for an interface."""
+    return 'Create%s' % _GetShortName(interface, ['Dev'])
 
 
 def _GetDefaultFailureValue(t):
-  """Returns the default failure value for a given type.
+    """Returns the default failure value for a given type.
 
   Returns None if no default failure value exists for the type.
   """
-  values = {
-      'PP_Bool': 'PP_FALSE',
-      'PP_Resource': '0',
-      'struct PP_Var': 'PP_MakeUndefined()',
-      'float': '0.0f',
-      'int32_t': 'enter.retval()',
-      'uint16_t': '0',
-      'uint32_t': '0',
-      'uint64_t': '0',
-      'void*': 'NULL'
-  }
-  if t in values:
-    return values[t]
-  return None
+    values = {
+        'PP_Bool': 'PP_FALSE',
+        'PP_Resource': '0',
+        'struct PP_Var': 'PP_MakeUndefined()',
+        'float': '0.0f',
+        'int32_t': 'enter.retval()',
+        'uint16_t': '0',
+        'uint32_t': '0',
+        'uint64_t': '0',
+        'void*': 'NULL'
+    }
+    if t in values:
+        return values[t]
+    return None
 
 
 def _MakeCreateMemberBody(interface, member, args):
-  """Returns the body of a Create() function.
+    """Returns the body of a Create() function.
 
   Args:
     interface - IDLNode for the interface
     member - IDLNode for member function
     args - List of arguments for the Create() function
   """
-  if args[0][0] == 'PP_Resource':
-    body = 'Resource* object =\n'
-    body += '    PpapiGlobals::Get()->GetResourceTracker()->'
-    body += 'GetResource(%s);\n' % args[0][1]
-    body += 'if (!object)\n'
+    if args[0][0] == 'PP_Resource':
+        body = 'Resource* object =\n'
+        body += '    PpapiGlobals::Get()->GetResourceTracker()->'
+        body += 'GetResource(%s);\n' % args[0][1]
+        body += 'if (!object)\n'
+        body += '  return 0;\n'
+        body += 'EnterResourceCreation enter(object->pp_instance());\n'
+    elif args[0][0] == 'PP_Instance':
+        body = 'EnterResourceCreation enter(%s);\n' % args[0][1]
+    else:
+        raise TGenError('Unknown arg type for Create(): %s' % args[0][0])
+
+    body += 'if (enter.failed())\n'
     body += '  return 0;\n'
-    body += 'EnterResourceCreation enter(object->pp_instance());\n'
-  elif args[0][0] == 'PP_Instance':
-    body = 'EnterResourceCreation enter(%s);\n' % args[0][1]
-  else:
-    raise TGenError('Unknown arg type for Create(): %s' % args[0][0])
-
-  body += 'if (enter.failed())\n'
-  body += '  return 0;\n'
-  arg_list = ', '.join([a[1] for a in args])
-  if member.GetProperty('create_func'):
-    create_func = member.GetProperty('create_func')
-  else:
-    create_func = _GetCreateFuncName(interface)
-  body += 'return enter.functions()->%s(%s);' % (create_func,
-                                                 arg_list)
-  return body
+    arg_list = ', '.join([a[1] for a in args])
+    if member.GetProperty('create_func'):
+        create_func = member.GetProperty('create_func')
+    else:
+        create_func = _GetCreateFuncName(interface)
+    body += 'return enter.functions()->%s(%s);' % (create_func,
+                                                   arg_list)
+    return body
 
 
 def _GetOutputParams(member, release):
-  """Returns output parameters (and their types) for a member function.
+    """Returns output parameters (and their types) for a member function.
 
   Args:
     member - IDLNode for the member function
     release - Release to get output parameters for
   Returns:
     A list of name strings for all output parameters of the member
     function.
   """
-  out_params = []
-  callnode = member.GetOneOf('Callspec')
-  if callnode:
-    cgen = CGen()
-    for param in callnode.GetListOf('Param'):
-      mode = cgen.GetParamMode(param)
-      if mode == 'out':
-        # We use the 'store' mode when getting the parameter type, since we
-        # need to call sizeof() for memset().
-        _, pname, _, _ = cgen.GetComponents(param, release, 'store')
-        out_params.append(pname)
-  return out_params
+    out_params = []
+    callnode = member.GetOneOf('Callspec')
+    if callnode:
+        cgen = CGen()
+        for param in callnode.GetListOf('Param'):
+            mode = cgen.GetParamMode(param)
+            if mode == 'out':
+                # We use the 'store' mode when getting the parameter type, since we
+                # need to call sizeof() for memset().
+                _, pname, _, _ = cgen.GetComponents(param, release, 'store')
+                out_params.append(pname)
+    return out_params
 
 
 def _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
                           include_version, meta):
-  """Returns the body of a typical function.
+    """Returns the body of a typical function.
 
   Args:
     filenode - IDLNode for the file
     release - release to generate body for
     node - IDLNode for the interface
     member - IDLNode for the member function
     rtype - Return type for the member function
     args - List of 4-tuple arguments for the member function
     include_version - whether to include the version in the invocation
     meta - ThunkBodyMetadata for header hints
   """
-  if len(args) == 0:
-    # Calling into the "Shared" code for the interface seems like a reasonable
-    # heuristic when we don't have any arguments; some thunk code follows this
-    # convention today.
-    meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
-    return 'return %s::%s();' % (_StripApiName(node.GetName()) + '_Shared',
-                                 member.GetName())
+    if len(args) == 0:
+        # Calling into the "Shared" code for the interface seems like a reasonable
+        # heuristic when we don't have any arguments; some thunk code follows this
+        # convention today.
+        meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
+        return 'return %s::%s();' % (_StripApiName(node.GetName()) + '_Shared',
+                                     member.GetName())
 
-  is_callback_func = args[len(args) - 1][0] == 'struct PP_CompletionCallback'
+    is_callback_func = args[len(args) - 1][0] == 'struct PP_CompletionCallback'
 
-  if is_callback_func:
-    call_args = args[:-1] + [('', 'enter.callback()', '', '')]
-    meta.AddInclude('ppapi/c/pp_completion_callback.h')
-  else:
-    call_args = args
+    if is_callback_func:
+        call_args = args[:-1] + [('', 'enter.callback()', '', '')]
+        meta.AddInclude('ppapi/c/pp_completion_callback.h')
+    else:
+        call_args = args
 
-  if args[0][0] == 'PP_Instance':
-    call_arglist = ', '.join(a[1] for a in call_args)
-    function_container = 'functions'
-  elif args[0][0] == 'PP_Resource':
-    call_arglist = ', '.join(a[1] for a in call_args[1:])
-    function_container = 'object'
-  else:
-    # Calling into the "Shared" code for the interface seems like a reasonable
-    # heuristic when the first argument isn't a PP_Instance or a PP_Resource;
-    # some thunk code follows this convention today.
-    meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
-    return 'return %s::%s(%s);' % (_StripApiName(node.GetName()) + '_Shared',
-                                   member.GetName(),
-                                   ', '.join(a[1] for a in args))
+    if args[0][0] == 'PP_Instance':
+        call_arglist = ', '.join(a[1] for a in call_args)
+        function_container = 'functions'
+    elif args[0][0] == 'PP_Resource':
+        call_arglist = ', '.join(a[1] for a in call_args[1:])
+        function_container = 'object'
+    else:
+        # Calling into the "Shared" code for the interface seems like a reasonable
+        # heuristic when the first argument isn't a PP_Instance or a PP_Resource;
+        # some thunk code follows this convention today.
+        meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode))
+        return 'return %s::%s(%s);' % (_StripApiName(node.GetName()) + '_Shared',
+                                       member.GetName(),
+                                       ', '.join(a[1] for a in args))
 
-  function_name = member.GetName()
-  if include_version:
-    version = node.GetVersion(release).replace('.', '_')
-    function_name += version
+    function_name = member.GetName()
+    if include_version:
+        version = node.GetVersion(release).replace('.', '_')
+        function_name += version
 
-  invocation = 'enter.%s()->%s(%s)' % (function_container,
-                                       function_name,
-                                       call_arglist)
+    invocation = 'enter.%s()->%s(%s)' % (function_container,
+                                         function_name,
+                                         call_arglist)
 
-  handle_errors = not (member.GetProperty('report_errors') == 'False')
-  out_params = _GetOutputParams(member, release)
-  if is_callback_func:
-    body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
-                                   handle_errors, args[len(args) - 1][1], meta)
-    failure_value = member.GetProperty('on_failure')
-    if failure_value is None:
-      failure_value = 'enter.retval()'
-    failure_return = 'return %s;' % failure_value
-    success_return = 'return enter.SetResult(%s);' % invocation
-  elif rtype == 'void':
-    body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
-                                   handle_errors, None, meta)
-    failure_return = 'return;'
-    success_return = '%s;' % invocation  # We don't return anything for void.
-  else:
-    body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
-                                   handle_errors, None, meta)
-    failure_value = member.GetProperty('on_failure')
-    if failure_value is None:
-      failure_value = _GetDefaultFailureValue(rtype)
-    if failure_value is None:
-      raise TGenError('There is no default value for rtype %s. '
-                      'Maybe you should provide an on_failure attribute '
-                      'in the IDL file.' % rtype)
-    failure_return = 'return %s;' % failure_value
-    success_return = 'return %s;' % invocation
+    handle_errors = not (member.GetProperty('report_errors') == 'False')
+    out_params = _GetOutputParams(member, release)
+    if is_callback_func:
+        body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+                                       handle_errors, args[len(args) - 1][1], meta)
+        failure_value = member.GetProperty('on_failure')
+        if failure_value is None:
+            failure_value = 'enter.retval()'
+        failure_return = 'return %s;' % failure_value
+        success_return = 'return enter.SetResult(%s);' % invocation
+    elif rtype == 'void':
+        body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+                                       handle_errors, None, meta)
+        failure_return = 'return;'
+        success_return = '%s;' % invocation  # We don't return anything for void.
+    else:
+        body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0],
+                                       handle_errors, None, meta)
+        failure_value = member.GetProperty('on_failure')
+        if failure_value is None:
+            failure_value = _GetDefaultFailureValue(rtype)
+        if failure_value is None:
+            raise TGenError('There is no default value for rtype %s. '
+                            'Maybe you should provide an on_failure attribute '
+                            'in the IDL file.' % rtype)
+        failure_return = 'return %s;' % failure_value
+        success_return = 'return %s;' % invocation
 
-  if member.GetProperty('always_set_output_parameters'):
-    body += 'if (enter.failed()) {\n'
-    for param in out_params:
-      body += '  memset(%s, 0, sizeof(*%s));\n' % (param, param)
-    body += '  %s\n' % failure_return
-    body += '}\n'
-    body += '%s' % success_return
-    meta.AddBuiltinInclude('string.h')
-  else:
-    body += 'if (enter.failed())\n'
-    body += '  %s\n' % failure_return
-    body += '%s' % success_return
-  return body
+    if member.GetProperty('always_set_output_parameters'):
+        body += 'if (enter.failed()) {\n'
+        for param in out_params:
+            body += '  memset(%s, 0, sizeof(*%s));\n' % (param, param)
+        body += '  %s\n' % failure_return
+        body += '}\n'
+        body += '%s' % success_return
+        meta.AddBuiltinInclude('string.h')
+    else:
+        body += 'if (enter.failed())\n'
+        body += '  %s\n' % failure_return
+        body += '%s' % success_return
+    return body
 
 
 def DefineMember(filenode, node, member, release, include_version, meta):
-  """Returns a definition for a member function of an interface.
+    """Returns a definition for a member function of an interface.
 
   Args:
     filenode - IDLNode for the file
     node - IDLNode for the interface
     member - IDLNode for the member function
     release - release to generate
     include_version - include the version in emitted function name.
     meta - ThunkMetadata for header hints
   Returns:
     A string with the member definition.
   """
-  cgen = CGen()
-  rtype, name, arrays, args = cgen.GetComponents(member, release, 'return')
-  log_body = '\"%s::%s()\";' % (node.GetName(), member.GetName())
-  if len(log_body) > 69:  # Prevent lines over 80 characters.
-    body = 'VLOG(4) <<\n'
-    body += '    %s\n' % log_body
-  else:
-    body = 'VLOG(4) << %s\n' % log_body
+    cgen = CGen()
+    rtype, name, arrays, args = cgen.GetComponents(member, release, 'return')
+    log_body = '\"%s::%s()\";' % (node.GetName(), member.GetName())
+    if len(log_body) > 69:  # Prevent lines over 80 characters.
+        body = 'VLOG(4) <<\n'
+        body += '    %s\n' % log_body
+    else:
+        body = 'VLOG(4) << %s\n' % log_body
 
-  if _IsTypeCheck(node, member, args):
-    body += '%s\n' % _MakeEnterLine(filenode, node, member, args[0], False,
-                                    None, meta)
-    body += 'return PP_FromBool(enter.succeeded());'
-  elif member.GetName() == 'Create' or member.GetName() == 'CreateTrusted':
-    body += _MakeCreateMemberBody(node, member, args)
-  else:
-    body += _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
-                                  include_version, meta)
+    if _IsTypeCheck(node, member, args):
+        body += '%s\n' % _MakeEnterLine(filenode, node, member, args[0], False,
+                                        None, meta)
+        body += 'return PP_FromBool(enter.succeeded());'
+    elif member.GetName() == 'Create' or member.GetName() == 'CreateTrusted':
+        body += _MakeCreateMemberBody(node, member, args)
+    else:
+        body += _MakeNormalMemberBody(filenode, release, node, member, rtype, args,
+                                      include_version, meta)
 
-  signature = cgen.GetSignature(member, release, 'return', func_as_ptr=False,
-                                include_version=include_version)
-  return '%s\n%s\n}' % (cgen.Indent('%s {' % signature, tabs=0),
-                        cgen.Indent(body, tabs=1))
+    signature = cgen.GetSignature(member, release, 'return', func_as_ptr=False,
+                                  include_version=include_version)
+    return '%s\n%s\n}' % (cgen.Indent('%s {' % signature, tabs=0),
+                          cgen.Indent(body, tabs=1))
 
 
 def _IsNewestMember(member, members, releases):
-  """Returns true if member is the newest node with its name in members.
+    """Returns true if member is the newest node with its name in members.
 
   Currently, every node in the AST only has one version. This means that we
   will have two sibling nodes with the same name to represent different
   versions.
   See http://crbug.com/157017 .
 
   Special handling is required for nodes which share their name with others,
   but aren't the newest version in the IDL.
 
   Args:
     member - The member which is checked if it's newest
     members - The list of members to inspect
     releases - The set of releases to check for versions in.
   """
-  build_list = member.GetUniqueReleases(releases)
-  release = build_list[0]  # Pick the oldest release.
-  same_name_siblings = filter(
-      lambda n: str(n) == str(member) and n != member, members)
+    build_list = member.GetUniqueReleases(releases)
+    release = build_list[0]  # Pick the oldest release.
+    same_name_siblings = filter(
+        lambda n: str(n) == str(member) and n != member, members)
 
-  for s in same_name_siblings:
-    sibling_build_list = s.GetUniqueReleases(releases)
-    sibling_release = sibling_build_list[0]
-    if sibling_release > release:
-      return False
-  return True
+    for s in same_name_siblings:
+        sibling_build_list = s.GetUniqueReleases(releases)
+        sibling_release = sibling_build_list[0]
+        if sibling_release > release:
+            return False
+    return True
 
 
 class TGen(GeneratorByFile):
-  def __init__(self):
-    Generator.__init__(self, 'Thunk', 'tgen', 'Generate the C++ thunk.')
+    def __init__(self):
+        Generator.__init__(self, 'Thunk', 'tgen', 'Generate the C++ thunk.')
 
-  def GenerateFile(self, filenode, releases, options):
-    savename = _GetThunkFileName(filenode, GetOption('thunkroot'))
-    my_min, my_max = filenode.GetMinMax(releases)
-    if my_min > releases[-1] or my_max < releases[0]:
-      if os.path.isfile(savename):
-        print "Removing stale %s for this range." % filenode.GetName()
-        os.remove(os.path.realpath(savename))
-      return False
-    do_generate = filenode.GetProperty('generate_thunk')
-    if not do_generate:
-      return False
+    def GenerateFile(self, filenode, releases, options):
+        savename = _GetThunkFileName(filenode, GetOption('thunkroot'))
+        my_min, my_max = filenode.GetMinMax(releases)
+        if my_min > releases[-1] or my_max < releases[0]:
+            if os.path.isfile(savename):
+                print "Removing stale %s for this range." % filenode.GetName()
+                os.remove(os.path.realpath(savename))
+            return False
+        do_generate = filenode.GetProperty('generate_thunk')
+        if not do_generate:
+            return False
 
-    thunk_out = IDLOutFile(savename)
-    body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
-    # TODO(teravest): How do we handle repeated values?
-    if filenode.GetProperty('thunk_include'):
-      meta.AddInclude(filenode.GetProperty('thunk_include'))
-    self.WriteHead(thunk_out, filenode, releases, options, meta)
-    thunk_out.Write('\n\n'.join(body))
-    self.WriteTail(thunk_out, filenode, releases, options)
-    thunk_out.ClangFormat()
-    return thunk_out.Close()
+        thunk_out = IDLOutFile(savename)
+        body, meta = self.GenerateBody(thunk_out, filenode, releases, options)
+        # TODO(teravest): How do we handle repeated values?
+        if filenode.GetProperty('thunk_include'):
+            meta.AddInclude(filenode.GetProperty('thunk_include'))
+        self.WriteHead(thunk_out, filenode, releases, options, meta)
+        thunk_out.Write('\n\n'.join(body))
+        self.WriteTail(thunk_out, filenode, releases, options)
+        thunk_out.ClangFormat()
+        return thunk_out.Close()
 
-  def WriteHead(self, out, filenode, releases, options, meta):
-    __pychecker__ = 'unusednames=options'
-    cgen = CGen()
+    def WriteHead(self, out, filenode, releases, options, meta):
+        __pychecker__ = 'unusednames=options'
+        cgen = CGen()
 
-    cright_node = filenode.GetChildren()[0]
-    assert(cright_node.IsA('Copyright'))
-    out.Write('%s\n' % cgen.Copyright(cright_node, cpp_style=True))
+        cright_node = filenode.GetChildren()[0]
+        assert (cright_node.IsA('Copyright'))
+        out.Write('%s\n' % cgen.Copyright(cright_node, cpp_style=True))
 
-    from_text = 'From %s' % (
-        filenode.GetProperty('NAME').replace(os.sep,'/'))
-    modified_text = 'modified %s.' % (
-        filenode.GetProperty('DATETIME'))
-    out.Write('// %s %s\n\n' % (from_text, modified_text))
+        from_text = 'From %s' % (
+            filenode.GetProperty('NAME').replace(os.sep, '/'))
+        modified_text = 'modified %s.' % (
+            filenode.GetProperty('DATETIME'))
+        out.Write('// %s %s\n\n' % (from_text, modified_text))
 
-    if meta.BuiltinIncludes():
-      for include in sorted(meta.BuiltinIncludes()):
-        out.Write('#include <%s>\n' % include)
-      out.Write('\n')
+        if meta.BuiltinIncludes():
+            for include in sorted(meta.BuiltinIncludes()):
+                out.Write('#include <%s>\n' % include)
+            out.Write('\n')
 
-    # TODO(teravest): Don't emit includes we don't need.
-    includes = ['ppapi/c/pp_errors.h',
-                'ppapi/shared_impl/tracked_callback.h',
-                'ppapi/thunk/enter.h',
-                'ppapi/thunk/ppapi_thunk_export.h']
-    includes.append(_GetHeaderFileName(filenode))
-    for api in meta.Apis():
-      includes.append('%s' % api.lower())
-    for i in meta.Includes():
-      includes.append(i)
-    for include in sorted(includes):
-      out.Write('#include "%s"\n' % include)
-    out.Write('\n')
-    out.Write('namespace ppapi {\n')
-    out.Write('namespace thunk {\n')
-    out.Write('\n')
-    out.Write('namespace {\n')
-    out.Write('\n')
+        # TODO(teravest): Don't emit includes we don't need.
+        includes = ['ppapi/c/pp_errors.h',
+                    'ppapi/shared_impl/tracked_callback.h',
+                    'ppapi/thunk/enter.h',
+                    'ppapi/thunk/ppapi_thunk_export.h',
+                    _GetHeaderFileName(filenode)]
+        for api in meta.Apis():
+            includes.append('%s' % api.lower())
+        for i in meta.Includes():
+            includes.append(i)
+        for include in sorted(includes):
+            out.Write('#include "%s"\n' % include)
+        out.Write('\n')
+        out.Write('namespace ppapi {\n')
+        out.Write('namespace thunk {\n')
+        out.Write('\n')
+        out.Write('namespace {\n')
+        out.Write('\n')
 
-  def GenerateBody(self, out, filenode, releases, options):
-    """Generates a member function lines to be written and metadata.
+    def GenerateBody(self, out, filenode, releases, options):
+        """Generates a member function lines to be written and metadata.
 
     Returns a tuple of (body, meta) where:
       body - a list of lines with member function bodies
       meta - a ThunkMetadata instance for hinting which headers are needed.
     """
-    __pychecker__ = 'unusednames=options'
-    out_members = []
-    meta = ThunkBodyMetadata()
-    for node in filenode.GetListOf('Interface'):
-      # Skip if this node is not in this release
-      if not node.InReleases(releases):
-        print "Skipping %s" % node
-        continue
+        __pychecker__ = 'unusednames=options'
+        out_members = []
+        meta = ThunkBodyMetadata()
+        for node in filenode.GetListOf('Interface'):
+            # Skip if this node is not in this release
+            if not node.InReleases(releases):
+                print "Skipping %s" % node
+                continue
 
-      # Generate Member functions
-      if node.IsA('Interface'):
-        members = node.GetListOf('Member')
-        for child in members:
-          build_list = child.GetUniqueReleases(releases)
-          # We have to filter out releases this node isn't in.
-          build_list = filter(lambda r: child.InReleases([r]), build_list)
-          if len(build_list) == 0:
-            continue
-          release = build_list[-1]
-          include_version = not _IsNewestMember(child, members, releases)
-          member = DefineMember(filenode, node, child, release, include_version,
-                                meta)
-          if not member:
-            continue
-          out_members.append(member)
-    return (out_members, meta)
+            # Generate Member functions
+            if node.IsA('Interface'):
+                members = node.GetListOf('Member')
+                for child in members:
+                    build_list = child.GetUniqueReleases(releases)
+                    # We have to filter out releases this node isn't in.
+                    build_list = filter(lambda r: child.InReleases([r]), build_list)
+                    if len(build_list) == 0:
+                        continue
+                    release = build_list[-1]
+                    include_version = not _IsNewestMember(child, members, releases)
+                    member = DefineMember(filenode, node, child, release, include_version,
+                                          meta)
+                    if not member:
+                        continue
+                    out_members.append(member)
+        return out_members, meta
 
-  def WriteTail(self, out, filenode, releases, options):
-    __pychecker__ = 'unusednames=options'
-    cgen = CGen()
+    def WriteTail(self, out, filenode, releases, options):
+        __pychecker__ = 'unusednames=options'
+        cgen = CGen()
 
-    version_list = []
-    out.Write('\n\n')
-    for node in filenode.GetListOf('Interface'):
-      build_list = node.GetUniqueReleases(releases)
-      for build in build_list:
-        version = node.GetVersion(build).replace('.', '_')
-        thunk_name = 'g_' + node.GetName().lower() + '_thunk_' + \
-                      version
-        thunk_type = '_'.join((node.GetName(), version))
-        version_list.append((thunk_type, thunk_name))
+        version_list = []
+        out.Write('\n\n')
+        for node in filenode.GetListOf('Interface'):
+            build_list = node.GetUniqueReleases(releases)
+            for build in build_list:
+                version = node.GetVersion(build).replace('.', '_')
+                thunk_name = 'g_' + node.GetName().lower() + '_thunk_' + \
+                             version
+                thunk_type = '_'.join((node.GetName(), version))
+                version_list.append((thunk_type, thunk_name))
 
-        out.Write('const %s %s = {\n' % (thunk_type, thunk_name))
-        generated_functions = []
-        members = node.GetListOf('Member')
-        for child in members:
-          rtype, name, arrays, args = cgen.GetComponents(
-              child, build, 'return')
-          if child.InReleases([build]):
-            if not _IsNewestMember(child, members, releases):
-              version = child.GetVersion(
-                  child.first_release[build]).replace('.', '_')
-              name += '_' + version
-            generated_functions.append(name)
-        out.Write(',\n'.join(['  &%s' % f for f in generated_functions]))
-        out.Write('\n};\n\n')
+                out.Write('const %s %s = {\n' % (thunk_type, thunk_name))
+                generated_functions = []
+                members = node.GetListOf('Member')
+                for child in members:
+                    rtype, name, arrays, args = cgen.GetComponents(
+                        child, build, 'return')
+                    if child.InReleases([build]):
+                        if not _IsNewestMember(child, members, releases):
+                            version = child.GetVersion(
+                                child.first_release[build]).replace('.', '_')
+                            name += '_' + version
+                        generated_functions.append(name)
+                out.Write(',\n'.join(['  &%s' % f for f in generated_functions]))
+                out.Write('\n};\n\n')
 
-    out.Write('}  // namespace\n')
-    out.Write('\n')
-    for thunk_type, thunk_name in version_list:
-      out.Write('PPAPI_THUNK_EXPORT const %s* Get%s_Thunk() {\n' %
-                    (thunk_type, thunk_type))
-      out.Write('  return &%s;\n' % thunk_name)
-      out.Write('}\n')
-      out.Write('\n')
-    out.Write('}  // namespace thunk\n')
-    out.Write('}  // namespace ppapi\n')
+        out.Write('}  // namespace\n')
+        out.Write('\n')
+        for thunk_type, thunk_name in version_list:
+            out.Write('PPAPI_THUNK_EXPORT const %s* Get%s_Thunk() {\n' %
+                      (thunk_type, thunk_type))
+            out.Write('  return &%s;\n' % thunk_name)
+            out.Write('}\n')
+            out.Write('\n')
+        out.Write('}  // namespace thunk\n')
+        out.Write('}  // namespace ppapi\n')
 
 
 tgen = TGen()
 
 
 def Main(args):
-  # Default invocation will verify the golden files are unchanged.
-  failed = 0
-  if not args:
-    args = ['--wnone', '--diff', '--test', '--thunkroot=.']
+    # Default invocation will verify the golden files are unchanged.
+    failed = 0
+    if not args:
+        args = ['--wnone', '--diff', '--test', '--thunkroot=.']
 
-  ParseOptions(args)
+    ParseOptions(args)
 
-  idldir = os.path.split(sys.argv[0])[0]
-  idldir = os.path.join(idldir, 'test_thunk', '*.idl')
-  filenames = glob.glob(idldir)
-  ast = ParseFiles(filenames)
-  if tgen.GenerateRange(ast, ['M13', 'M14', 'M15'], {}):
-    print "Golden file for M13-M15 failed."
-    failed = 1
-  else:
-    print "Golden file for M13-M15 passed."
+    idldir = os.path.split(sys.argv[0])[0]
+    idldir = os.path.join(idldir, 'test_thunk', '*.idl')
+    filenames = glob.glob(idldir)
+    ast = ParseFiles(filenames)
+    if tgen.GenerateRange(ast, ['M13', 'M14', 'M15'], {}):
+        print "Golden file for M13-M15 failed."
+        failed = 1
+    else:
+        print "Golden file for M13-M15 passed."
 
-  return failed
+    return failed
 
 
 if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
+    sys.exit(Main(sys.argv[1:]))
--- a/browser/extensions/mortar/ppapi/generators/idl_visitor.py
+++ b/browser/extensions/mortar/ppapi/generators/idl_visitor.py
@@ -1,45 +1,47 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """ Visitor Object for traversing AST """
 
+
 #
 # IDLVisitor
 #
 # The IDLVisitor class will traverse an AST truncating portions of the tree
 # when 'VisitFilter' returns false.  After the filter returns true, for each
 # node, the visitor will call the 'Arrive' member passing in the node and
 # and generic data object from the parent call.  The returned value is then
 # passed to all children who's results are aggregated into a list.  The child
 # results along with the original Arrive result are passed to the Depart
 # function which returns the final result of the Visit.  By default this is
 # the exact value that was return from the original arrive.
 #
 
 class IDLVisitor(object):
-  def __init__(self):
-    pass
+    def __init__(self):
+        pass
 
-  # Return TRUE if the node should be visited
-  def VisitFilter(self, node, data):
-    return True
+    # Return TRUE if the node should be visited
+    def VisitFilter(self, node, data):
+        return True
 
-  def Visit(self, node, data):
-    if not self.VisitFilter(node, data): return None
+    def Visit(self, node, data):
+        if not self.VisitFilter(node, data):
+            return None
 
-    childdata = []
-    newdata = self.Arrive(node, data)
-    for child in node.GetChildren():
-      ret = self.Visit(child, newdata)
-      if ret is not None:
-        childdata.append(ret)
-    return self.Depart(node, newdata, childdata)
+        childdata = []
+        newdata = self.Arrive(node, data)
+        for child in node.GetChildren():
+            ret = self.Visit(child, newdata)
+            if ret is not None:
+                childdata.append(ret)
+        return self.Depart(node, newdata, childdata)
 
-  def Arrive(self, node, data):
-    __pychecker__ = 'unusednames=node'
-    return data
+    def Arrive(self, node, data):
+        __pychecker__ = 'unusednames=node'
+        return data
 
-  def Depart(self, node, data, childdata):
-    __pychecker__ = 'unusednames=node,childdata'
-    return data
+    def Depart(self, node, data, childdata):
+        __pychecker__ = 'unusednames=node,childdata'
+        return data
--- a/browser/locales/filter.py
+++ b/browser/locales/filter.py
@@ -1,39 +1,40 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-def test(mod, path, entity = None):
-  import re
-  # ignore anything but Firefox
-  if mod not in ("netwerk", "dom", "toolkit", "security/manager",
-                 "devtools/client", "devtools/shared",
-                 "browser",
-                 "browser/extensions/webcompat-reporter",
-                 "extensions/spellcheck",
-                 "other-licenses/branding/firefox",
-                 "browser/branding/official",
-                 "services/sync"):
-    return "ignore"
-  if mod not in ("browser", "extensions/spellcheck"):
-    # we only have exceptions for browser and extensions/spellcheck
-    return "error"
-  if not entity:
-    # the only files to ignore are spell checkers
+
+def test(mod, path, entity=None):
+    import re
+    # ignore anything but Firefox
+    if mod not in ("netwerk", "dom", "toolkit", "security/manager",
+                   "devtools/client", "devtools/shared",
+                   "browser",
+                   "browser/extensions/webcompat-reporter",
+                   "extensions/spellcheck",
+                   "other-licenses/branding/firefox",
+                   "browser/branding/official",
+                   "services/sync"):
+        return "ignore"
+    if mod not in ("browser", "extensions/spellcheck"):
+        # we only have exceptions for browser and extensions/spellcheck
+        return "error"
+    if not entity:
+        # the only files to ignore are spell checkers
+        if mod == "extensions/spellcheck":
+            return "ignore"
+        return "error"
     if mod == "extensions/spellcheck":
-      return "ignore"
-    return "error"
-  if mod == "extensions/spellcheck":
-    # l10n ships en-US dictionary or something, do compare
-    return "error"
-  if path == "defines.inc":
-    return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error"
+        # l10n ships en-US dictionary or something, do compare
+        return "error"
+    if path == "defines.inc":
+        return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error"
 
-  if mod == "browser" and path == "chrome/browser-region/region.properties":
-    # only region.properties exceptions remain, compare all others
-    return ("ignore"
-            if (re.match(r"browser\.search\.order\.[1-9]", entity) or
-                re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
-                re.match(r"gecko\.handlerService\.schemes\.", entity) or
-                re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
-            else "error")
-  return "error"
+    if mod == "browser" and path == "chrome/browser-region/region.properties":
+        # only region.properties exceptions remain, compare all others
+        return ("ignore"
+                if (re.match(r"browser\.search\.order\.[1-9]", entity) or
+                    re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
+                    re.match(r"gecko\.handlerService\.schemes\.", entity) or
+                    re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
+                else "error")
+    return "error"
--- a/browser/themes/preprocess-tab-svgs.py
+++ b/browser/themes/preprocess-tab-svgs.py
@@ -1,31 +1,32 @@
 #!/usr/bin/env python
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import buildconfig
+from mozbuild.preprocessor import preprocess
 
-from mozbuild.preprocessor import preprocess
 
 # By default, the pre-processor used for jar.mn will use "%" as a marker
 # for ".css" files and "#" otherwise. This falls apart when a file using
 # one marker needs to include a file with the other marker since the
 # pre-processor instructions in the included file will not be
 # processed. The following SVG files need to include a file which uses
 # "%" as the marker so we invoke the pre- processor ourselves here with
 # the marker specified. The resulting SVG files will get packaged by the
 # processing of the jar file in the appropriate directory.
 def _do_preprocessing(output_svg, input_svg_file, additional_defines):
     additional_defines.update(buildconfig.defines)
     return preprocess(output=output_svg,
                       includes=[input_svg_file],
                       marker='%',
                       defines=additional_defines)
 
+
 def tab_side_start(output_svg, input_svg_file):
     return _do_preprocessing(output_svg, input_svg_file, {'TAB_SIDE': 'start'})
 
+
 def tab_side_end(output_svg, input_svg_file):
     return _do_preprocessing(output_svg, input_svg_file, {'TAB_SIDE': 'end'})
-