| 606 | } |
| 607 | |
| 608 | func isTypeDeclaration(item lex.Item, it *lex.ItemIterator) bool { |
| 609 | if item.Val != "type" { |
| 610 | return false |
| 611 | } |
| 612 | |
| 613 | nextItems, err := it.Peek(2) |
| 614 | switch { |
| 615 | case err != nil || len(nextItems) != 2: |
| 616 | return false |
| 617 | |
| 618 | case nextItems[0].Typ != itemText: |
| 619 | return false |
| 620 | |
| 621 | case nextItems[1].Typ != itemLeftCurl: |
| 622 | return false |
| 623 | } |
| 624 | |
| 625 | return true |
| 626 | } |
| 627 | |
| 628 | // parse parses a schema string and returns the schema representation for it. |
| 629 | // If namespace == math.MaxUint64, then it preserves the namespace. Else it forces the passed |