Improve CIL parsing
treble_sepolicy_tests gets very confused by parentheses in comments. Fix the search for the opening parenthesis of a statement to skip comments. And then update a comment that was intended to use parentheses to actually do so. (Without the parser change, this fails horribly.) Test: Build Change-Id: I1e36136e97dd9b8190add29b7f2155a08ea87d80
This commit is contained in:
parent
e65ff877d2
commit
39507ae44e
2 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
;; This type may or may not already exist in vendor policy. Re-define it here - duplicate
|
;; This type may or may not already exist in vendor policy. Re-define it here (duplicate
|
||||||
;; definitions in CIL will be ignored - so we can reference it in 202404.cil.
|
;; definitions in CIL will be ignored) - so we can reference it in 202404.cil.
|
||||||
(type vendor_hidraw_device)
|
(type vendor_hidraw_device)
|
||||||
(typeattributeset dev_type (vendor_hidraw_device))
|
(typeattributeset dev_type (vendor_hidraw_device))
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,13 @@ class MiniCilParser:
|
||||||
s = ""
|
s = ""
|
||||||
c = infile.read(1)
|
c = infile.read(1)
|
||||||
# get to first statement
|
# get to first statement
|
||||||
while c and c != "(":
|
while c:
|
||||||
|
if c == ';':
|
||||||
|
# comment, get rid of rest of the line
|
||||||
|
while c != '\n':
|
||||||
|
c = infile.read(1)
|
||||||
|
elif c == '(':
|
||||||
|
break
|
||||||
c = infile.read(1)
|
c = infile.read(1)
|
||||||
|
|
||||||
parens += 1
|
parens += 1
|
||||||
|
|
Loading…
Reference in a new issue