Bug 1573080 - Supporting indenting of directives in preprocessor.py. r=glandium

Depends on D41494

Differential Revision: https://phabricator.services.mozilla.com/D41495

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-08-13 22:18:55 +00:00
parent 4e52c0f072
commit 13a7295574
2 changed files with 11 additions and 1 deletions

View File

@ -373,7 +373,7 @@ class Preprocessor:
"""
self.marker = aMarker
if aMarker:
self.instruction = re.compile('{0}(?P<cmd>[a-z]+)(?:\s+(?P<args>.*?))?\s*$'
self.instruction = re.compile('\s*{0}(?P<cmd>[a-z]+)(?:\s+(?P<args>.*?))?\s*$'
.format(aMarker))
self.comment = re.compile(aMarker, re.U)
else:

View File

@ -179,6 +179,16 @@ class TestPreprocessor(unittest.TestCase):
'#endif',
])
def test_indentation(self):
self.do_include_pass([
' #define NULLVAL 0',
' #if !NULLVAL',
'PASS',
' #else',
'FAIL',
' #endif',
])
def test_expand(self):
self.do_include_pass([
'#define ASVAR AS',