(expressionType classSetExpressionType)
| 687 | } |
| 688 | |
| 689 | func (p *regExpParser) scanClassSetSubExpression(expressionType classSetExpressionType) { |
| 690 | expressionMayContainStrings := p.mayContainStrings |
| 691 | for p.pos() < p.end { |
| 692 | ch := p.char() |
| 693 | if p.isClassContentExit(ch) { |
| 694 | break |
| 695 | } |
| 696 | switch ch { |
| 697 | case '-': |
| 698 | p.incPos(1) |
| 699 | if p.char() == '-' { |
| 700 | p.incPos(1) |
| 701 | if expressionType != classSetExpressionTypeClassSubtraction { |
| 702 | p.error(diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, p.pos()-2, 2) |
| 703 | } |
| 704 | } else { |
| 705 | p.error(diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, p.pos()-1, 1) |
| 706 | } |
| 707 | case '&': |
| 708 | p.incPos(1) |
| 709 | if p.char() == '&' { |
| 710 | p.incPos(1) |
| 711 | if expressionType != classSetExpressionTypeClassIntersection { |
| 712 | p.error(diagnostics.Operators_must_not_be_mixed_within_a_character_class_Wrap_it_in_a_nested_class_instead, p.pos()-2, 2) |
| 713 | } |
| 714 | if p.char() == '&' { |
| 715 | p.error(diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, p.pos(), 1, string(ch)) |
| 716 | p.incPos(1) |
| 717 | } |
| 718 | } else { |
| 719 | p.error(diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, p.pos()-1, 1, string(ch)) |
| 720 | } |
| 721 | default: |
| 722 | switch expressionType { |
| 723 | case classSetExpressionTypeClassSubtraction: |
| 724 | p.error(diagnostics.X_0_expected, p.pos(), 0, "--") |
| 725 | case classSetExpressionTypeClassIntersection: |
| 726 | p.error(diagnostics.X_0_expected, p.pos(), 0, "&&") |
| 727 | } |
| 728 | } |
| 729 | ch = p.char() |
| 730 | if p.isClassContentExit(ch) { |
| 731 | p.error(diagnostics.Expected_a_class_set_operand, p.pos(), 0) |
| 732 | break |
| 733 | } |
| 734 | p.scanClassSetOperand() |
| 735 | if expressionType == classSetExpressionTypeClassIntersection { |
| 736 | expressionMayContainStrings = expressionMayContainStrings && p.mayContainStrings |
| 737 | } |
| 738 | } |
| 739 | p.mayContainStrings = expressionMayContainStrings |
| 740 | } |
| 741 | |
| 742 | // ClassSetOperand ::= |
| 743 | // |
no test coverage detected