getLineContentEnd method

int getLineContentEnd(
  1. int index
)

Skips whitespace characters and single EOL on the right from index.

If index the end of a statement or method, then in most cases this returns the start of the next line.

Implementation

int getLineContentEnd(int index) {
  var length = _buffer.length;
  // Skip whitespace characters.
  while (index < length) {
    var c = _buffer.codeUnitAt(index);
    if (!c.isWhitespace || c.isEOL) {
      break;
    }
    index++;
  }
  // Skip a single '\r' character.
  if (index < length && _buffer.codeUnitAt(index) == 0x0D) {
    index++;
  }
  // Skip a single '\n' character.
  if (index < length && _buffer.codeUnitAt(index) == 0x0A) {
    index++;
  }
  // Done.
  return index;
}