зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1566952: Part 0 - Fix comment processing in multi-line directives. r=ahal
The current comment processing code strips whitespace from a line, calculates comment offsets based on the unstripped version, and then strips those offsets from the stripped version. That means that, for multi-line directives, which typically have two spaces at the front, the offsets are wrong and lines with comments end up with a trailing "# " that the expression parser doesn't understand. This patch fixes the comment parser to correctly use the stripped line for offset calculations instead. Differential Revision: https://phabricator.services.mozilla.com/D38724 --HG-- extra : rebase_source : 9f19314ccab3fb2fa68642ff0aef978cb5c3e13c
This commit is contained in:
Родитель
088b7f4827
Коммит
73e321aadc
|
@ -67,11 +67,11 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
|
|||
while comment_start == sys.maxsize and inline_prefixes:
|
||||
next_prefixes = {}
|
||||
for prefix, index in inline_prefixes.items():
|
||||
index = line.find(prefix, index+1)
|
||||
index = stripped.find(prefix, index+1)
|
||||
if index == -1:
|
||||
continue
|
||||
next_prefixes[prefix] = index
|
||||
if index == 0 or (index > 0 and line[index-1].isspace()):
|
||||
if index == 0 or (index > 0 and stripped[index-1].isspace()):
|
||||
comment_start = min(comment_start, index)
|
||||
inline_prefixes = next_prefixes
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче