Preserve spaces before comments at the beginning of a file

This commit is contained in:
Peter Eckersley 2016-07-13 17:24:05 -07:00
parent b7cf928852
commit 7183896ed7
2 changed files with 1 additions and 7 deletions

View file

@ -2,7 +2,6 @@
# This map is not a full windows-1251 <> utf8 map: it does not
# contain Serbian and Macedonian letters. If you need a full map,
# use contrib/unicode2nginx/win-utf map instead.
#
charset_map windows-1251 utf-8 {

View file

@ -73,16 +73,11 @@ class RawNginxParser(object):
block << Group(block_begin + left_bracket + block_innards + right_bracket)
script = OneOrMore(Group(comment | assignment) ^ block ^ map_block) + space + stringEnd
script.parseWithTabs()
testLine = OneOrMore(Group(space + key + location_statement)).leaveWhitespace()
testTwo = OneOrMore(block)
script.parseWithTabs().leaveWhitespace()
def __init__(self, source):
self.source = source
def test(self):
return self.testLine.parseString(self.source)
def parse(self):
"""Returns the parsed tree."""
return self.script.parseString(self.source)