You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: delete-useless-parentheses.sh
+14
Original file line number
Diff line number
Diff line change
@@ -68,10 +68,24 @@ cat $temp | $command '
68
68
(: Find all blocks... :)
69
69
//(block[
70
70
(: except not one of these ... :)
71
+
72
+
(: do not flag "a ( b | c )* d" or with other operator :)
71
73
not(./parent::ebnf/blockSuffix and ./altList/OR) and
74
+
75
+
(: do not flag "(a ( b | c )* )?" because it is not the same as the '*?'-operator. :)
76
+
not(./parent::ebnf/blockSuffix/ebnfSuffix/QUESTION and ./altList[count(./*) = 1]/alternative[count(./*) = 1]/element[count(./*) = 1]/ebnf[./block and ./blockSuffix/ebnfSuffix/*]) and
77
+
78
+
(: do not flag blocks that contain a lot of elements like "(a b c)*" :)
72
79
not(./parent::ebnf/blockSuffix and count(./altList/alternative/element) > 1) and
80
+
81
+
(: do not flag if there are alts *and* it is preceed or followed by an element,
82
+
e.g., "a (b | c d)" or "(a | b) c". :)
73
83
not(./altList/OR and ../../following-sibling::element) and
74
84
not(./altList/OR and ../../preceding-sibling::element) and
85
+
86
+
(: do not flag "a ( v += b )* c" or with other operator :)
87
+
not(./altList/alternative/element/labeledElement/(ASSIGN or PLUS_ASSIGN) and ./parent::ebnf/blockSuffix) and
88
+
75
89
not(./parent::labeledElement/(ASSIGN or PLUS_ASSIGN))
0 commit comments