checkAnnotation method

bool checkAnnotation(
  1. String? ch
)

Implementation

bool checkAnnotation(String? ch) {
  if (ch == '{') {
    final StringBuffer buffer = StringBuffer();
    while (ch != '}') {
      ch = nextChar();
      if (ch != null) {
        if (!Utilities.isAsciiChar(ch)) {
          throw UcumException(
              "Error processing unit '$source': Annotation contains non-ascii characters");
        }
        if (ch == noChar) {
          throw UcumException(
              "Error processing unit '$source': unterminated annotation");
        }
        buffer.write(ch);
      }
    }
    token = buffer.toString();
    type = TokenType.annotation;
    return true;
  }
  return false;
}