mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 774032 part 2 - Allow to disable markers in Preprocessor.py. r=ted
This commit is contained in:
parent
afb4432cd9
commit
67045cf5c5
@ -92,10 +92,17 @@ class Preprocessor:
|
||||
"""
|
||||
Set the marker to be used for processing directives.
|
||||
Used for handling CSS files, with pp.setMarker('%'), for example.
|
||||
The given marker may be None, in which case no markers are processed.
|
||||
"""
|
||||
self.marker = aMarker
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
if aMarker:
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
else:
|
||||
class NoMatch(object):
|
||||
def match(self, *args):
|
||||
return False
|
||||
self.instruction = self.comment = NoMatch()
|
||||
|
||||
def clone(self):
|
||||
"""
|
||||
|
@ -33,6 +33,16 @@ PASS
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), "PASS\n")
|
||||
|
||||
def test_no_marker(self):
|
||||
no_marker = """#if 0
|
||||
PASS
|
||||
#endif
|
||||
"""
|
||||
f = NamedIO("no_marker.in", no_marker)
|
||||
self.pp.setMarker(None)
|
||||
self.pp.do_include(f)
|
||||
self.assertEqual(self.pp.out.getvalue(), no_marker)
|
||||
|
||||
def test_string_value(self):
|
||||
f = NamedIO("string_value.in", """#define FOO STRING
|
||||
#if FOO
|
||||
|
@ -92,10 +92,17 @@ class Preprocessor:
|
||||
"""
|
||||
Set the marker to be used for processing directives.
|
||||
Used for handling CSS files, with pp.setMarker('%'), for example.
|
||||
The given marker may be None, in which case no markers are processed.
|
||||
"""
|
||||
self.marker = aMarker
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
if aMarker:
|
||||
self.instruction = re.compile('%s(?P<cmd>[a-z]+)(?:\s(?P<args>.*))?$'%aMarker, re.U)
|
||||
self.comment = re.compile(aMarker, re.U)
|
||||
else:
|
||||
class NoMatch(object):
|
||||
def match(self, *args):
|
||||
return False
|
||||
self.instruction = self.comment = NoMatch()
|
||||
|
||||
def clone(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user