fastParseEol method

void fastParseEol(
  1. State<String> state
)

Eol = '\n' / '\r\n' / '\r' ;

Implementation

void fastParseEol(State<String> state) {
  final $1 = state.pos;
  var $0 = 0;
  if (state.pos < state.input.length) {
    final input = state.input;
    final c = input.codeUnitAt(state.pos);
    // ignore: unused_local_variable
    final pos2 = state.pos + 1;
    switch (c) {
      case 10:
        $0 = 1;
        break;
      case 13:
        final ok = pos2 < input.length && input.codeUnitAt(pos2) == 10;
        if (ok) {
          $0 = 2;
        } else {
          $0 = 1;
        }
        break;
    }
  }
  if ($0 > 0) {
    state.pos += $0;
    state.setOk(true);
  } else {
    state.pos = $1;
    state.fail(const ErrorExpectedTags(['\n', '\r\n', '\r']));
  }
}