parseTokenOption(it, factory) constructs OptionPair instances and validates that the options are okay via the factory. TokenOption ::= OptionName ':' OptionValue OptionName ::= {itemText from Lexer} OptionValue ::= {itemQuotedText from Lexer}
(it *lex.ItemIterator, factory tok.IndexFactory)
| 377 | // OptionName ::= {itemText from Lexer} |
| 378 | // OptionValue ::= {itemQuotedText from Lexer} |
| 379 | func parseTokenOption(it *lex.ItemIterator, factory tok.IndexFactory) (*pb.OptionPair, error) { |
| 380 | it.Next() |
| 381 | nextItem := it.Item() |
| 382 | if nextItem.Typ != itemText { |
| 383 | return nil, nextItem.Errorf( |
| 384 | "unexpected '%s' found when expecting option name", |
| 385 | nextItem.Val) |
| 386 | } |
| 387 | optName := nextItem.Val |
| 388 | it.Next() |
| 389 | nextItem = it.Item() |
| 390 | if nextItem.Typ != itemColon { |
| 391 | return nil, nextItem.Errorf( |
| 392 | "unexpected '%s' found when expecting ':'", |
| 393 | nextItem.Val) |
| 394 | } |
| 395 | it.Next() |
| 396 | nextItem = it.Item() |
| 397 | if nextItem.Typ != itemQuotedText { |
| 398 | return nil, nextItem.Errorf( |
| 399 | "unexpected '%s' found when expecting quoted text", |
| 400 | nextItem.Val) |
| 401 | } |
| 402 | optVal := nextItem.Val[1 : len(nextItem.Val)-1] |
| 403 | return &pb.OptionPair{Key: optName, Value: optVal}, nil |
| 404 | } |
| 405 | |
| 406 | func HasTokenizerOrVectorIndexSpec(update *pb.SchemaUpdate) bool { |
| 407 | if update == nil { |
no test coverage detected