| 1066 | } |
| 1067 | |
| 1068 | func (p *pattern) String() string { |
| 1069 | if p.t&patternOption != 0 { |
| 1070 | return fmt.Sprintf("%s(%s, %s, %d, %+v)", p.t, p.short, p.long, p.argcount, p.value) |
| 1071 | } else if p.t&patternLeaf != 0 { |
| 1072 | return fmt.Sprintf("%s(%s, %+v)", p.t, p.name, p.value) |
| 1073 | } else if p.t&patternBranch != 0 { |
| 1074 | result := "" |
| 1075 | for i, child := range p.children { |
| 1076 | if i > 0 { |
| 1077 | result += ", " |
| 1078 | } |
| 1079 | result += child.String() |
| 1080 | } |
| 1081 | return fmt.Sprintf("%s(%s)", p.t, result) |
| 1082 | } |
| 1083 | panic("unmatched type") |
| 1084 | } |
| 1085 | |
| 1086 | func (p *pattern) transform() *pattern { |
| 1087 | /* |