(lval ScanSymType)
| 662 | } |
| 663 | |
| 664 | func (s *Scanner) scanIdent(lval ScanSymType) { |
| 665 | s.normalizeIdent(lval, lexbase.IsIdentMiddle, true /* toLower */) |
| 666 | |
| 667 | isExperimental := false |
| 668 | kw := lval.Str() |
| 669 | switch { |
| 670 | case strings.HasPrefix(lval.Str(), "experimental_"): |
| 671 | kw = lval.Str()[13:] |
| 672 | isExperimental = true |
| 673 | case strings.HasPrefix(lval.Str(), "testing_"): |
| 674 | kw = lval.Str()[8:] |
| 675 | isExperimental = true |
| 676 | } |
| 677 | lval.SetID(lexbase.GetKeywordID(kw)) |
| 678 | if lval.ID() != lexbase.IDENT { |
| 679 | if isExperimental { |
| 680 | if _, ok := lexbase.AllowedExperimental[kw]; !ok { |
| 681 | // If the parsed token is not on the allowlisted set of keywords, |
| 682 | // then it might have been intended to be parsed as something else. |
| 683 | // In that case, re-tokenize the original string. |
| 684 | lval.SetID(lexbase.GetKeywordID(lval.Str())) |
| 685 | } else { |
| 686 | // It is a allowlisted keyword, so remember the shortened |
| 687 | // keyword for further processing. |
| 688 | lval.SetStr(kw) |
| 689 | } |
| 690 | } |
| 691 | } else { |
| 692 | // If the word after experimental_ or testing_ is an identifier, |
| 693 | // then we might have classified it incorrectly after removing the |
| 694 | // experimental_/testing_ prefix. |
| 695 | lval.SetID(lexbase.GetKeywordID(lval.Str())) |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | func (s *Scanner) scanNumber(lval ScanSymType, ch int) { |
| 700 | s.scanNumberImpl(lval, ch, lexbase.ERROR, lexbase.FCONST, lexbase.ICONST) |
no test coverage detected