[kernel] r10788 - people/waldi/utils/kconfigeditor2/kconfigeditor/kconfig/menu

Bastian Blank waldi at alioth.debian.org
Tue Mar 11 14:28:20 UTC 2008


Author: waldi
Date: Tue Mar 11 14:28:19 2008
New Revision: 10788

Log:
Update.


Modified:
   people/waldi/utils/kconfigeditor2/kconfigeditor/kconfig/menu/file.py

Modified: people/waldi/utils/kconfigeditor2/kconfigeditor/kconfig/menu/file.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/kconfigeditor/kconfig/menu/file.py	(original)
+++ people/waldi/utils/kconfigeditor2/kconfigeditor/kconfig/menu/file.py	Tue Mar 11 14:28:19 2008
@@ -11,14 +11,21 @@
     def __repr__(self):
         return "<%s(%s)>" % (self.__class__.__name__, self.name)
 
+class FileSource(object):
+    def __init__(self, filename):
+        self.filename = filename
+
+    def __repr__(self):
+        return "<%s(%s)>" % (self.__class__.__name__, self.filename)
+
 class _Parser(object):
-    def __call__(self, filename):
+    def __call__(self, fd, filename):
         lineno = 0
 
         stack = _Stack()
         _BlockRoot(stack, File(filename))
 
-        for line in file(filename):
+        for line in fd:
             line = line.rstrip()
             if not line:
                 stack.top().process_line_empty()
@@ -93,9 +100,9 @@
     (?P<ind>\s*)
     (---)?(?P<word>[a-z_]+)(---)?
     (
-        \s+(?P<rest1>.+)
+        \s*"(?P<rest2>.+)"
         |
-        "(?P<rest2>.+)"
+        \s+(?P<rest1>.+)
     )?
     \s*
 $"""
@@ -129,7 +136,7 @@
         _BlockMenuconfig(self, text)
 
     def process_source(self, text, ind):
-        pass
+        _BlockSource(self, text)
 
 class _BlockContainerDepends(_BlockContainer):
     def process_depends(self, text, ind):
@@ -289,6 +296,12 @@
         self.entry = parent.entry
         _BlockConfigData(self)
 
+class _BlockSource(_BlockObject):
+    def __init__(self, parent, text):
+        super(_BlockSource, self).__init__(parent)
+        self.entry = FileSource(text)
+        parent.entry.append(self.entry)
+
 class _BlockType(_BlockObject):
     def __init__(self, parent, text, ind):
         super(_BlockType, self).__init__(parent)
@@ -301,3 +314,4 @@
                 self.nextline = False
         else:
             return self.recurse('process_line', text)
+



More information about the Kernel-svn-changes mailing list