[kernel-team] 15/86: lib/kconfigeditor/kconfig/menu/file.py: Support escaped \" in strings.
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Dec 21 00:34:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch benh/kconfigeditor2
in repository kernel-team.
commit 8a7e44486183fa9257fc952370d6c877d6f76b07
Author: Bastian Blank <waldi at debian.org>
Date: Tue Mar 11 18:11:36 2008 +0000
lib/kconfigeditor/kconfig/menu/file.py: Support escaped \" in strings.
svn path=/people/waldi/utils/kconfigeditor2/; revision=10810
---
.../lib/kconfigeditor/kconfig/menu/file.py | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
index b0b8646..157eac8 100644
--- a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
@@ -21,7 +21,7 @@ class FileSource(object):
class Parser(object):
def __call__(self, fd, filename):
- lineno = 0
+ lineno = 1
stack = _Stack()
_BlockRoot(stack, File(filename))
@@ -33,7 +33,10 @@ class Parser(object):
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 @@ class _BlockConfigData(_BlockObject, _BlockContainerDepends):
_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):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git
More information about the Kernel-svn-changes
mailing list