Lines Matching refs:x
196 func (x *Operator) Copy() Expression {
197 ret := *x
198 ret.Args[0] = x.Args[0].Copy()
199 ret.Args[1] = x.Args[1].Copy()
203 func (x *Operator) Eval() Expression {
204 return x.Value.Eval()
207 func (x *Operator) Type() Type {
208 return x.Args[0].Type()
211 func (x *Operator) Pos() scanner.Position { return x.Args[0].Pos() }
212 func (x *Operator) End() scanner.Position { return x.Args[1].End() }
214 func (x *Operator) String() string {
215 return fmt.Sprintf("(%s %c %s = %s)@%s", x.Args[0].String(), x.Operator, x.Args[1].String(),
216 x.Value, x.OperatorPos)
225 func (x *Variable) Pos() scanner.Position { return x.NamePos }
226 func (x *Variable) End() scanner.Position { return endPos(x.NamePos, len(x.Name)) }
228 func (x *Variable) Copy() Expression {
229 ret := *x
233 func (x *Variable) Eval() Expression {
234 return x.Value.Eval()
237 func (x *Variable) String() string {
238 return x.Name + " = " + x.Value.String()
241 func (x *Variable) Type() Type { return x.Value.Type() }
249 func (x *Map) Pos() scanner.Position { return x.LBracePos }
250 func (x *Map) End() scanner.Position { return endPos(x.RBracePos, 1) }
252 func (x *Map) Copy() Expression {
253 ret := *x
254 ret.Properties = make([]*Property, len(x.Properties))
255 for i := range x.Properties {
256 ret.Properties[i] = x.Properties[i].Copy()
261 func (x *Map) Eval() Expression {
262 return x
265 func (x *Map) String() string {
266 propertyStrings := make([]string, len(x.Properties))
267 for i, property := range x.Properties {
270 return fmt.Sprintf("@%s-%s{%s}", x.LBracePos, x.RBracePos,
274 func (x *Map) Type() Type { return MapType }
278 func (x *Map) GetProperty(name string) (Property *Property, found bool) {
279 prop, found, _ := x.getPropertyImpl(name)
283 func (x *Map) getPropertyImpl(name string) (Property *Property, found bool, index int) {
284 for i, prop := range x.Properties {
293 func (x *Map) RemoveProperty(propertyName string) (removed bool) {
294 _, found, index := x.getPropertyImpl(propertyName)
296 x.Properties = append(x.Properties[:index], x.Properties[index+1:]...)
307 func (x *List) Pos() scanner.Position { return x.LBracePos }
308 func (x *List) End() scanner.Position { return endPos(x.RBracePos, 1) }
310 func (x *List) Copy() Expression {
311 ret := *x
312 ret.Values = make([]Expression, len(x.Values))
314 ret.Values[i] = x.Values[i].Copy()
319 func (x *List) Eval() Expression {
320 return x
323 func (x *List) String() string {
324 valueStrings := make([]string, len(x.Values))
325 for i, value := range x.Values {
328 return fmt.Sprintf("@%s-%s[%s]", x.LBracePos, x.RBracePos,
332 func (x *List) Type() Type { return ListType }
339 func (x *String) Pos() scanner.Position { return x.LiteralPos }
340 func (x *String) End() scanner.Position { return endPos(x.LiteralPos, len(x.Value)+2) }
342 func (x *String) Copy() Expression {
343 ret := *x
347 func (x *String) Eval() Expression {
348 return x
351 func (x *String) String() string {
352 return fmt.Sprintf("%q@%s", x.Value, x.LiteralPos)
355 func (x *String) Type() Type {
365 func (x *Int64) Pos() scanner.Position { return x.LiteralPos }
366 func (x *Int64) End() scanner.Position { return endPos(x.LiteralPos, len(x.Token)) }
368 func (x *Int64) Copy() Expression {
369 ret := *x
373 func (x *Int64) Eval() Expression {
374 return x
377 func (x *Int64) String() string {
378 return fmt.Sprintf("%q@%s", x.Value, x.LiteralPos)
381 func (x *Int64) Type() Type {
391 func (x *Bool) Pos() scanner.Position { return x.LiteralPos }
392 func (x *Bool) End() scanner.Position { return endPos(x.LiteralPos, len(x.Token)) }
394 func (x *Bool) Copy() Expression {
395 ret := *x
399 func (x *Bool) Eval() Expression {
400 return x
403 func (x *Bool) String() string {
404 return fmt.Sprintf("%t@%s", x.Value, x.LiteralPos)
407 func (x *Bool) Type() Type {
415 func (x *CommentGroup) Pos() scanner.Position { return x.Comments[0].Pos() }
416 func (x *CommentGroup) End() scanner.Position { return x.Comments[len(x.Comments)-1].End() }