File tree Expand file tree Collapse file tree 5 files changed +109
-1
lines changed Expand file tree Collapse file tree 5 files changed +109
-1
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 14
14
"uri" : " file://test.test_ExtractInFuncs_/results.txt"
15
15
}
16
16
],
17
+ "test.test[ExtractPragmas]" : [
18
+ {
19
+ "uri" : " file://test.test_ExtractPragmas_/results.txt"
20
+ }
21
+ ],
17
22
"test.test[ExtractTypes]" : [
18
23
{
19
24
"uri" : " file://test.test_ExtractTypes_/results.txt"
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "Write" = [
4
+ {
5
+ "Type" = [
6
+ "ListType";
7
+ [
8
+ "StructType";
9
+ [
10
+ [
11
+ "q";
12
+ [
13
+ "DataType";
14
+ "String"
15
+ ]
16
+ ];
17
+ [
18
+ "column1";
19
+ [
20
+ "OptionalType";
21
+ [
22
+ "ListType";
23
+ [
24
+ "TupleType";
25
+ [
26
+ [
27
+ "DataType";
28
+ "String"
29
+ ];
30
+ [
31
+ "DataType";
32
+ "String"
33
+ ];
34
+ [
35
+ "DataType";
36
+ "Uint64"
37
+ ]
38
+ ]
39
+ ]
40
+ ]
41
+ ]
42
+ ]
43
+ ]
44
+ ]
45
+ ];
46
+ "Data" = [
47
+ [
48
+ "pragma dq.Foo";
49
+ [
50
+ [
51
+ [
52
+ "PRAGMA";
53
+ "dq.Foo";
54
+ "1"
55
+ ]
56
+ ]
57
+ ]
58
+ ];
59
+ [
60
+ "pragma warningmsg('foo')";
61
+ [
62
+ [
63
+ [
64
+ "PRAGMA";
65
+ "warningmsg";
66
+ "1"
67
+ ]
68
+ ]
69
+ ]
70
+ ];
71
+ [
72
+ "pragma yt.Bar";
73
+ [
74
+ [
75
+ [
76
+ "PRAGMA";
77
+ "yt.Bar";
78
+ "1"
79
+ ]
80
+ ]
81
+ ]
82
+ ]
83
+ ]
84
+ }
85
+ ]
86
+ }
87
+ ]
Original file line number Diff line number Diff line change
1
+ SELECT
2
+ q,ListSort(ListFilter(YqlLang::RuleFreq(q),($x)- > ($x .0 in (" PRAGMA" ))))
3
+ FROM (VALUES
4
+ (" pragma warningmsg('foo')" ),
5
+ (" pragma dq.Foo" ),
6
+ (" pragma yt.Bar" )
7
+ ) AS a(q)
8
+ order by q
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ class TRuleFreqVisitor {
45
45
VisitUnaryCasualSubexpr (dynamic_cast <const TRule_in_unary_casual_subexpr&>(msg));
46
46
} else if (descr == TRule_type_name_simple::GetDescriptor ()) {
47
47
VisitSimpleType (dynamic_cast <const TRule_type_name_simple&>(msg));
48
+ } else if (descr == TRule_pragma_stmt::GetDescriptor ()) {
49
+ VisitPragmaStmt (dynamic_cast <const TRule_pragma_stmt&>(msg));
48
50
}
49
51
50
52
TStringBuf fullName = descr->full_name ();
@@ -85,6 +87,12 @@ class TRuleFreqVisitor {
85
87
}
86
88
}
87
89
90
+ void VisitPragmaStmt (const TRule_pragma_stmt& msg) {
91
+ const TString prefix = OptIdPrefixAsStr (msg.GetRule_opt_id_prefix_or_type2 (), Translation);
92
+ const TString pragma (Id (msg.GetRule_an_id3 (), Translation));
93
+ Freqs[std::make_pair (" PRAGMA" , prefix.empty () ? pragma : (prefix + " ." + pragma))] += 1 ;
94
+ }
95
+
88
96
template <typename TUnaryCasualExprRule>
89
97
void VisitUnaryCasualSubexpr (const TUnaryCasualExprRule& msg) {
90
98
const auto & block = msg.GetBlock1 ();
You can’t perform that action at this time.
0 commit comments