(depth int)
| 462 | } |
| 463 | |
| 464 | func (t *tree) P(depth int) Node { |
| 465 | debugf(depth, "P pre : %v", t.Cur()) |
| 466 | n := t.M(depth) |
| 467 | debugf(depth, "P post: %v", t.Cur()) |
| 468 | for { |
| 469 | switch cur := t.Cur(); cur.T { |
| 470 | case lex.TokenPlus, lex.TokenMinus: |
| 471 | t.Next() |
| 472 | n = NewBinaryNode(cur, n, t.M(depth+1)) |
| 473 | default: |
| 474 | return n |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | func (t *tree) M(depth int) Node { |
| 480 | debugf(depth, "M pre : %v", t.Cur()) |