process method

TagserResult? process(
  1. ProcessMessage msg,
  2. TagserContext context
)

Implementation

TagserResult? process(ProcessMessage msg, TagserContext context) {
  final charCode = msg.charCode;

  if (charCode == charEos) {
    return TagserResult(
      err: TagserError(
          code: errorUnexpectedEos, text: getError(errorUnexpectedEos, null)),
    );
  } else if (TagserUtils.isAvailableCharacter(charCode)) {
    _name += String.fromCharCode(charCode!);
  } else if (charCode == charCloseBracket ||
      charCode == charSpace ||
      charCode == charSlash) {
    return TagserResult(
      pop: true,
      message: NotifyMessage(
        value: _name,
        charCode: charCode,
        type: notifyTagNameResult,
      ),
    );
  } else {
    return TagserResult(
      err: TagserError(
        code: errorWrongTagCharacter,
        text: getError(
          errorWrongTagCharacter,
          {'char': String.fromCharCode(charCode!)},
        ),
      ),
    );
  }

  return null;
}