Jmespath/Ast.pm untested

filter: Statementstmt 0.0% 0 / 60 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 22 totaltotal 0.0% 0 / 106 CC 1 SCAR 6.9
CC
1
Cov
0%
comparator
2.0
current_node
2.0
expref
2.0
CRAP 2.0
1 package Jmespath::Ast;
2 use strict;
3 use warnings;
4  
5  
6 sub comparator {
7 my ($class, $name, $first, $second) = @_;
8 return { type => 'comparator',
9 children => [$first, $second],
10 value => $name,
11 };
12 }
13  
14 sub current_node {
15 return { type => 'current', children => [] };
16 }
17  
18 sub expref {
19 my ( $class, $expression ) = @_;
20 return { type => 'expref', 'children' => [$expression] };
21 }
22  
23 sub function_expression {
24 my ($class, $name, $args) = @_;
25 return { type => 'function_expression', children => $args, value => $name };
26 }
27  
28 sub field {
29 my ($class, $name) = @_;
30 return { type => 'field', children => [], value => $name };
31 }
32  
33 sub filter_projection {
34 my ($class, $left, $right, $comp) = @_;
35 return { type => 'filter_projection', children => [ $left, $right, $comp ] };
36 }
37  
38 sub flatten {
39 my ($class, $node) = @_;
40 return { type => 'flatten', children => [$node] };
41 }
42  
43 sub identity {
44 return { type => 'identity', 'children' => [] };
45 }
46  
47 sub index_of {
48 my ($class, $index) = @_;
49 return { type => 'index', value => $index, children => [] };
50 }
51  
52 sub index_expression {
53 my ($class, $children) = @_;
54 return { type => 'index_expression', children => $children };
55 }
56  
57 sub key_val_pair {
58 my ($class, $key_name, $node) = @_;
59 return { type => 'key_val_pair', children => [$node], value => $key_name };
60 }
61  
62 sub literal {
63 my ($class, $literal_value) = @_;
64 return { type => 'literal', value => $literal_value, children => [] };
65 }
66  
67 sub multi_select_hash {
68 my ($class, $nodes) = @_;
69 return {type => 'multi_select_hash', children => $nodes };
70 }
71  
72 sub multi_select_list {
73 my ($class, $nodes) = @_;
74 return { type => 'multi_select_list', children => $nodes };
75 }
76  
77 sub or_expression {
78 my ($class, $left, $right) = @_;
79 return { type => 'or_expression', children => [$left, $right]};
80 }
81  
82 sub and_expression {
83 my ($class, $left, $right) = @_;
84 return { type => 'and_expression', children => [$left, $right]};
85 }
86  
87 sub not_expression {
88 my ($class, $expr) = @_;
89 return { type => 'not_expression', children => [$expr] };
90 }
91  
92 sub pipe_oper {
93 my ($class, $left, $right) = @_;
94 return { type => 'pipe', children => [$left, $right]};
95 }
96  
97 sub projection {
98 my ($class, $left, $right) = @_;
99 return { type => 'projection', children => [$left, $right] };
100 }
101  
102 sub subexpression {
103 my ($class, $children) = @_;
104 return { type => 'subexpression', children => $children};
105 }
106  
107 sub slice {
108 my ($class, $start, $end, $step) = @_;
109 return { type => 'slice', children => [$start, $end, $step]};
110 }
111  
112 sub value_projection {
113 my ($class, $left, $right) = @_;
114 return { type => 'value_projection', children => [$left, $right] };
115 }
116  
117 1;