logtags: Support # line comments.

Allow # line comments to start anywhere in a line, not just in column 0.

Test: Added trailing # comments to SecurityLogTags.logtags and checked
      that 'make droid' still worked.
Test: Piped a few example lines through a small test script to verify
      that the following line behaved as expected:
      line = re.sub('#.*$', '', line)

Change-Id: Ib7904620adf8da7d11511ef6d8300e5fb4c73c29
gugelfrei-debug
Tobias Thierer 5 years ago
parent e7c1f6314c
commit 07f622b078

@ -62,9 +62,9 @@ class TagFile(object):
try:
for self.linenum, line in enumerate(file_object):
self.linenum += 1
line = re.sub('#.*$', '', line) # strip trailing comments
line = line.strip()
if not line or line[0] == '#': continue
if not line: continue
parts = re.split(r"\s+", line, 2)
if len(parts) < 2:

Loading…
Cancel
Save