private Choice parseChoice(CharSequenceScanner scanner) {

    Filter<Object> condition = parseCondition(scanner);
    List<Segment> segments = new ArrayList<>();
    while (scanner.hasNext()) {
      int index = scanner.getCurrentIndex();
      char c = scanner.peek();
      String literal = null;
      if ((c == '"') || (c == '\'')) {
        scanner.next();
        literal = scanner.readUntil(c, false, c);
        if (literal == null) {
          throw new IllegalArgumentException(scanner.substring(index, scanner.getCurrentIndex()));
        }
        c = scanner.peek();
      }
      NlsArgument argument = null;
      if (c == NlsArgumentParser.START_EXPRESSION) {
        scanner.next();
        argument = this.nlsDependencies.getArgumentParser().parse(scanner);
      }
      if ((argument != null) || (literal != null)) {
        segments.add(new Segment(literal, argument));
      } else {
        break;
      }
    }
    return new Choice(condition, segments);
  }
private Choice parseChoice ( CharSequenceScanner scanner ) { Filter < Object > condition = parseCondition ( scanner ) ; List < Segment > segments = new ArrayList < > ( ) ; while ( scanner . hasNext ( ) ) { int index = scanner . getCurrentIndex ( ) ; char c = scanner . peek ( ) ; String literal = null ; if ( ( c == '"' ) || ( c == '\'' ) ) { scanner . next ( ) ; literal = scanner . readUntil ( c , false , c ) ; if ( literal == null ) { throw new IllegalArgumentException ( scanner . substring ( index , scanner . getCurrentIndex ( ) ) ) ; } c = scanner . peek ( ) ; } NlsArgument argument = null ; if ( c == NlsArgumentParser . START_EXPRESSION ) { scanner . next ( ) ; argument = this . nlsDependencies . getArgumentParser ( ) . parse ( scanner ) ; } if ( ( argument != null ) || ( literal != null ) ) { segments . add ( new Segment ( literal , argument ) ) ; } else { break ; } } return new Choice ( condition , segments ) ; }
This method parses the {@link Choice}.

@param scanner is the {@link CharSequenceScanner}.
@return the parsed {@link Choice}.