提交 c7745622 编写于 作者: R Radostin Stoyanov 提交者: Daniel P. Berrangé

apibuild: Simplify getline()

Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
Signed-off-by: NRadostin Stoyanov <rstoyanov1@gmail.com>
上级 437f1ead
...@@ -432,21 +432,17 @@ class CLexer: ...@@ -432,21 +432,17 @@ class CLexer:
line = self.input.readline() line = self.input.readline()
if not line: if not line:
return None return None
self.lineno = self.lineno + 1 self.lineno += 1
line = line.lstrip() line = line.strip()
line = line.rstrip()
if line == '': if line == '':
continue continue
while line[-1] == '\\': while line[-1] == '\\':
line = line[:-1] line = line[:-1]
n = self.input.readline() n = self.input.readline().strip()
self.lineno = self.lineno + 1 self.lineno += 1
n = n.lstrip()
n = n.rstrip()
if not n: if not n:
break break
else: line += n
line = line + n
return line return line
def getlineno(self): def getlineno(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册