ArrayNode parses multi-argument array nodes aka: IN (a,b,c).
(depth int)
| 787 | |
| 788 | // ArrayNode parses multi-argument array nodes aka: IN (a,b,c). |
| 789 | func (t *tree) ArrayNode(depth int) Node { |
| 790 | |
| 791 | an := NewArrayNode() |
| 792 | t.expect(lex.TokenLeftParenthesis, "Expected left paren: (") |
| 793 | t.Next() // Consume Left Paren |
| 794 | |
| 795 | for { |
| 796 | debugf(depth, "ArrayNode(%d): %v", len(an.Args), t.Cur()) |
| 797 | switch cur := t.Cur(); cur.T { |
| 798 | case lex.TokenRightParenthesis: |
| 799 | t.Next() // Consume the Paren |
| 800 | debugf(depth, "ArrayNode EXIT: %v", an) |
| 801 | return an |
| 802 | case lex.TokenComma: |
| 803 | t.Next() |
| 804 | default: |
| 805 | n := t.O(depth) |
| 806 | if n != nil { |
| 807 | an.Append(n) |
| 808 | } else { |
| 809 | u.Warnf("invalid? %v", t.Cur()) |
| 810 | return an |
| 811 | } |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | // ValueArray |
| 817 | // IN ("a","b","c") |