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: find-useless-parentheses.sh
+23-10
Original file line number
Diff line number
Diff line change
@@ -31,31 +31,44 @@ main() {
31
31
32
32
compute() {
33
33
found=0
34
-
cat o.pt |trxgrep -- '
34
+
cat o.pt |trquery -- grep'
35
35
(: Find all blocks... :)
36
36
//block[
37
37
(: except not one of these ... :)
38
38
39
39
(: do not flag "a ( b | c )* d" or with other operator :)
40
-
not(./parent::ebnf/blockSuffix and ./altList/OR) and
40
+
not(./parent::ebnf/blockSuffix and ./altList/OR)
41
41
42
42
(: do not flag "(a ( b | c )* )?" because it is not the same as the '*?'-operator. :)
43
-
not(./parent::ebnf/blockSuffix/ebnfSuffix/QUESTION and ./altList[count(./*) = 1]/alternative[count(./*) = 1]/element[count(./*) = 1]/ebnf[./block and ./blockSuffix/ebnfSuffix/*]) and
43
+
and not(./parent::ebnf/blockSuffix/ebnfSuffix/QUESTION and ./altList[count(./*) = 1]/alternative[count(./*) = 1]/element[count(./*) = 1]/ebnf[./block and ./blockSuffix/ebnfSuffix/*])
44
44
45
45
(: do not flag blocks that contain a lot of elements like "(a b c)*" :)
46
-
not(./parent::ebnf/blockSuffix and count(./altList/alternative/element) > 1) and
46
+
and not(./parent::ebnf/blockSuffix and count(./altList/alternative/element) > 1)
47
47
48
48
(: do not flag if there are alts *and* it is preceed or followed by an element,
49
49
e.g., "a (b | c d)" or "(a | b) c". :)
50
-
not(./altList/OR and ../../following-sibling::element) and
51
-
not(./altList/OR and ../../preceding-sibling::element) and
50
+
and not(./altList/OR and ../../following-sibling::element)
51
+
and not(./altList/OR and ../../preceding-sibling::element)
52
52
53
53
(: do not flag "a ( v += b )* c" or with other operator :)
54
-
not(./altList/alternative/element/labeledElement/(ASSIGN or PLUS_ASSIGN) and ./parent::ebnf/blockSuffix) and
0 commit comments