github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/eval/boilerplate.go (about) 1 package eval 2 3 import "github.com/u-root/u-root/cmds/core/elvish/parse" 4 5 func (cp *compiler) chunkOp(n *parse.Chunk) Op { 6 cp.compiling(n) 7 return Op{cp.chunk(n), n.Begin(), n.End()} 8 } 9 10 func (cp *compiler) chunkOps(ns []*parse.Chunk) []Op { 11 ops := make([]Op, len(ns)) 12 for i, n := range ns { 13 ops[i] = cp.chunkOp(n) 14 } 15 return ops 16 } 17 18 func (cp *compiler) pipelineOp(n *parse.Pipeline) Op { 19 cp.compiling(n) 20 return Op{cp.pipeline(n), n.Begin(), n.End()} 21 } 22 23 func (cp *compiler) pipelineOps(ns []*parse.Pipeline) []Op { 24 ops := make([]Op, len(ns)) 25 for i, n := range ns { 26 ops[i] = cp.pipelineOp(n) 27 } 28 return ops 29 } 30 31 func (cp *compiler) formOp(n *parse.Form) Op { 32 cp.compiling(n) 33 return Op{cp.form(n), n.Begin(), n.End()} 34 } 35 36 func (cp *compiler) formOps(ns []*parse.Form) []Op { 37 ops := make([]Op, len(ns)) 38 for i, n := range ns { 39 ops[i] = cp.formOp(n) 40 } 41 return ops 42 } 43 44 func (cp *compiler) assignmentOp(n *parse.Assignment) Op { 45 cp.compiling(n) 46 return Op{cp.assignment(n), n.Begin(), n.End()} 47 } 48 49 func (cp *compiler) assignmentOps(ns []*parse.Assignment) []Op { 50 ops := make([]Op, len(ns)) 51 for i, n := range ns { 52 ops[i] = cp.assignmentOp(n) 53 } 54 return ops 55 } 56 57 func (cp *compiler) redirOp(n *parse.Redir) Op { 58 cp.compiling(n) 59 return Op{cp.redir(n), n.Begin(), n.End()} 60 } 61 62 func (cp *compiler) redirOps(ns []*parse.Redir) []Op { 63 ops := make([]Op, len(ns)) 64 for i, n := range ns { 65 ops[i] = cp.redirOp(n) 66 } 67 return ops 68 } 69 70 func (cp *compiler) compoundOp(n *parse.Compound) ValuesOp { 71 cp.compiling(n) 72 return ValuesOp{cp.compound(n), n.Begin(), n.End()} 73 } 74 75 func (cp *compiler) compoundOps(ns []*parse.Compound) []ValuesOp { 76 ops := make([]ValuesOp, len(ns)) 77 for i, n := range ns { 78 ops[i] = cp.compoundOp(n) 79 } 80 return ops 81 } 82 83 func (cp *compiler) arrayOp(n *parse.Array) ValuesOp { 84 cp.compiling(n) 85 return ValuesOp{cp.array(n), n.Begin(), n.End()} 86 } 87 88 func (cp *compiler) arrayOps(ns []*parse.Array) []ValuesOp { 89 ops := make([]ValuesOp, len(ns)) 90 for i, n := range ns { 91 ops[i] = cp.arrayOp(n) 92 } 93 return ops 94 } 95 96 func (cp *compiler) indexingOp(n *parse.Indexing) ValuesOp { 97 cp.compiling(n) 98 return ValuesOp{cp.indexing(n), n.Begin(), n.End()} 99 } 100 101 func (cp *compiler) indexingOps(ns []*parse.Indexing) []ValuesOp { 102 ops := make([]ValuesOp, len(ns)) 103 for i, n := range ns { 104 ops[i] = cp.indexingOp(n) 105 } 106 return ops 107 } 108 109 func (cp *compiler) primaryOp(n *parse.Primary) ValuesOp { 110 cp.compiling(n) 111 return ValuesOp{cp.primary(n), n.Begin(), n.End()} 112 } 113 114 func (cp *compiler) primaryOps(ns []*parse.Primary) []ValuesOp { 115 ops := make([]ValuesOp, len(ns)) 116 for i, n := range ns { 117 ops[i] = cp.primaryOp(n) 118 } 119 return ops 120 } 121 122 func (cp *compiler) listOp(n *parse.Primary) ValuesOp { 123 cp.compiling(n) 124 return ValuesOp{cp.list(n), n.Begin(), n.End()} 125 } 126 127 func (cp *compiler) listOps(ns []*parse.Primary) []ValuesOp { 128 ops := make([]ValuesOp, len(ns)) 129 for i, n := range ns { 130 ops[i] = cp.listOp(n) 131 } 132 return ops 133 } 134 135 func (cp *compiler) lambdaOp(n *parse.Primary) ValuesOp { 136 cp.compiling(n) 137 return ValuesOp{cp.lambda(n), n.Begin(), n.End()} 138 } 139 140 func (cp *compiler) lambdaOps(ns []*parse.Primary) []ValuesOp { 141 ops := make([]ValuesOp, len(ns)) 142 for i, n := range ns { 143 ops[i] = cp.lambdaOp(n) 144 } 145 return ops 146 } 147 148 func (cp *compiler) map_Op(n *parse.Primary) ValuesOp { 149 cp.compiling(n) 150 return ValuesOp{cp.map_(n), n.Begin(), n.End()} 151 } 152 153 func (cp *compiler) map_Ops(ns []*parse.Primary) []ValuesOp { 154 ops := make([]ValuesOp, len(ns)) 155 for i, n := range ns { 156 ops[i] = cp.map_Op(n) 157 } 158 return ops 159 } 160 161 func (cp *compiler) bracedOp(n *parse.Primary) ValuesOp { 162 cp.compiling(n) 163 return ValuesOp{cp.braced(n), n.Begin(), n.End()} 164 } 165 166 func (cp *compiler) bracedOps(ns []*parse.Primary) []ValuesOp { 167 ops := make([]ValuesOp, len(ns)) 168 for i, n := range ns { 169 ops[i] = cp.bracedOp(n) 170 } 171 return ops 172 }