Author: waldi
Date: Tue Mar 11 18:11:36 2008
New Revision: 10810

Log:
lib/kconfigeditor/kconfig/menu/file.py: Support escaped \" in strings.


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

Modified: 
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py    
(original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py    
Tue Mar 11 18:11:36 2008
@@ -21,7 +21,7 @@
 
 class Parser(object):
     def __call__(self, fd, filename):
-        lineno = 0
+        lineno = 1
 
         stack = _Stack()
         _BlockRoot(stack, File(filename))
@@ -33,7 +33,10 @@
             elif line.lstrip()[0] == '#':
                 pass
             else:
-                stack.top().process_line(line)
+                try:
+                    stack.top().process_line(line)
+                except:
+                    raise Exception("Can't parse: '%s' (%d)" % (line, lineno))
             lineno += 1
         return stack.top().process_stop(lineno, 0)
 
@@ -192,16 +195,15 @@
     _prompt_rules = r"""
 ^
     (
-        "(?P<text1>[^"]*)"
+        "(?P<text1>.*((?<=\\)".*)*)"
         |
-        '(?P<text2>[^']*)'
+        '(?P<text2>.*((?<=\\)".*)*)'
     )
     (
         \s*
-        if
-        \s+
         (?P<expression>.*)
     )?
+    ;?
 $"""
     _prompt_re = re.compile(_prompt_rules, re.X)
 
@@ -215,6 +217,8 @@
             if match:
                 self.entry.prompt = match.group('text1') or 
match.group('text2')
                 text = match.group('expression')
+            else:
+                raise Exception
             _BlockType(self, text, ind)
 
     def process_bool(self, text, ind):

_______________________________________________
Kernel-svn-changes mailing list
Kernel-svn-changes@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/kernel-svn-changes

Reply via email to