finishMultilineString method

Token finishMultilineString(
  1. int quote
)

Implementation

Token finishMultilineString(int quote) {
  var buf = <int>[];
  while (true) {
    var ch = _nextChar();
    if (ch == 0) {
      return _errorToken();
    } else if (ch == quote) {
      if (_maybeEatChar(quote)) {
        if (_maybeEatChar(quote)) {
          return _makeStringToken(buf, false);
        }
        buf.add(quote);
      }
      buf.add(quote);
    } else if (ch == TokenChar.BACKSLASH) {
      var escapeVal = readEscapeSequence();
      if (escapeVal == -1) {
        return _errorToken('invalid hex escape sequence');
      } else {
        buf.add(escapeVal);
      }
    } else {
      buf.add(ch);
    }
  }
}