getNextWord static method

String getNextWord(
  1. WKTTokenizer tokenizer
)

Returns the next word in the stream.

@return the next word in the stream as uppercase text @throws ParseException if the next token is not a word @throws IOException if an I/O error occurs @param tokenizer tokenizer over a stream of text in Well-known Text

Implementation

static String getNextWord(WKTTokenizer tokenizer) {
  WKTToken token = tokenizer.next()!;
  switch (token.type) {
    case WKTTokenType.KEYWORD:
      String word = token.value;
      if (StringUtils.equalsIgnoreCase(word, EMPTY)) {
        return EMPTY;
      }
      return word;

    case WKTTokenType.LPAREN:
      return L_PAREN; //'('
    case WKTTokenType.RPAREN:
      return R_PAREN; //')'
    case WKTTokenType.COMMA:
      return COMMA; //','
  }
  throw ArgumentError(
      "Expected word token but found ${token.type}: ${token.value}");
}