-
Notifications
You must be signed in to change notification settings - Fork 1
/
strip-python.sh
90 lines (88 loc) · 3.92 KB
/
strip-python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# use in combination:
# trparse python-11.gram | bash strip-python.sh | trtext
trquery '
delete //meta/(AT | name | string | newline);
delete //rule_[rulename/name/NAME[contains(text(),"invalid_") or contains(text(),"expression_without_invalid")]];
delete //rule_[rulename/name/NAME[contains(text(),"invalid_") or contains(text(),"expression_without_invalid")]];
delete //action;
(: replace //attribute " ";
replace //attribute_name " "; :)
delete //attribute;
delete //attribute_name;
delete //lookahead[AMPER];
delete //memoflag;
delete //forced_atom/AMPER;
delete //alt[items/named_item/item/atom/name/NAME[contains(text(),"invalid_")]];
delete //rule_/more_alts/alts/VBAR[not(following-sibling::*)];
delete //rule_//VBAR[not(following-sibling::*)];
delete //rule_//VBAR[following-sibling::*[1][name()="alts"]/*[1]/name()="VBAR"];
delete //rule_[./rulename/name/NAME/text()="class_def_raw"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="function_def_raw"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="params"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="expression"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="lambda_kwds"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="kwarg_or_starred"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="kwarg_or_starred"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="star_etc"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="kwds"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="if_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="elif_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="else_block"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="while_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="for_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="with_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="try_stmt"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="except_block"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="except_star_block"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="finally_block"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="case_block"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="lambda_params"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="lambda_star_etc"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
delete //rule_[./rulename/name/NAME/text()="kwarg_or_double_starred"]/more_alts/@Before[. = "
"][following-sibling::alts/@Before[. = "
"]];
'