| 364 | } |
| 365 | |
| 366 | func (t *tree) C(depth int) Node { |
| 367 | debugf(depth, "C pre: %v", t.Cur()) |
| 368 | n := t.P(depth) |
| 369 | for { |
| 370 | debugf(depth, "C post: %v peek=%v n=%v", t.Cur(), t.Peek(), n) |
| 371 | switch cur := t.Cur(); cur.T { |
| 372 | case lex.TokenNegate: |
| 373 | debugf(depth+1, "C NEGATE Urnary?: %v", t.Cur()) |
| 374 | t.Next() |
| 375 | return NewUnary(cur, t.cInner(n, depth+1)) |
| 376 | case lex.TokenIs: |
| 377 | t.Next() |
| 378 | if t.Cur().T == lex.TokenNegate { |
| 379 | cur = t.Next() |
| 380 | ne := lex.Token{T: lex.TokenNE, V: "!="} |
| 381 | return NewBinaryNode(ne, n, t.P(depth+1)) |
| 382 | } |
| 383 | u.Warnf("TokenIS? is this supported?") |
| 384 | return NewUnary(cur, t.cInner(n, depth+1)) |
| 385 | default: |
| 386 | return t.cInner(n, depth) |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | func (t *tree) cInner(n Node, depth int) Node { |
| 392 | for { |