parses till rightSquare is found (parses [a, b]) excluding leftSquare This function can be reused for query later
(it *lex.ItemIterator)
| 1114 | // parses till rightSquare is found (parses [a, b]) excluding leftSquare |
| 1115 | // This function can be reused for query later |
| 1116 | func parseListItemNames(it *lex.ItemIterator) ([]string, error) { |
| 1117 | var items []string |
| 1118 | for it.Next() { |
| 1119 | item := it.Item() |
| 1120 | switch item.Typ { |
| 1121 | case itemRightSquare: |
| 1122 | return items, nil |
| 1123 | case itemName: |
| 1124 | val := collectName(it, item.Val) |
| 1125 | items = append(items, val) |
| 1126 | case itemComma: |
| 1127 | it.Next() |
| 1128 | item = it.Item() |
| 1129 | if item.Typ != itemName { |
| 1130 | return items, item.Errorf("Invalid scheam block") |
| 1131 | } |
| 1132 | val := collectName(it, item.Val) |
| 1133 | items = append(items, val) |
| 1134 | default: |
| 1135 | return items, item.Errorf("Invalid schema block") |
| 1136 | } |
| 1137 | } |
| 1138 | return items, it.Errorf("Expecting ] to end list but none was found") |
| 1139 | } |
| 1140 | |
| 1141 | // parseSchemaPredsOrTypes parses till rightround is found |
| 1142 | func parseSchemaPredsOrTypes(it *lex.ItemIterator, s *pb.SchemaRequest) error { |
no test coverage detected