Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Please add scanUntil and scanUntilAny #35

Open
jolleekin opened this issue Feb 3, 2021 · 1 comment
Open

[Proposal] Please add scanUntil and scanUntilAny #35

jolleekin opened this issue Feb 3, 2021 · 1 comment
Labels
type-enhancement A request for a change that isn't a bug

Comments

@jolleekin
Copy link

Please consider adding these methods

  /// Scans until [delimiter] matches [string] at the current position.
  ///
  /// Returns `true` if something is consumed, `false` otherwise.
  bool scanUntil(Pattern delimiter) {
    final oldPosition = position;
    while (!isDone && !matches(delimiter)) readChar();
    return oldPosition < position;
  }

  /// Scans until any of [delimiters] matches [string] at the current position.
  ///
  /// Returns `true` if something is consumed, `false` otherwise.
  scanUntilAny(List<Pattern> delimiters) {
    final oldPosition = position;
    while (!isDone && !delimiters.any(matches)) readChar();
    return oldPosition < position;
  }
@mit-mit mit-mit added the type-enhancement A request for a change that isn't a bug label Sep 3, 2021
@Ttamez68A
Copy link

Please consider adding these methods

  /// Scans until [delimiter] matches [string] at the current position.
  ///
  /// Returns `true` if something is consumed, `false` otherwise.
  bool scanUntil(Pattern delimiter) {
    final oldPosition = position;
    while (!isDone && !matches(delimiter)) readChar();
    return oldPosition < position;
  }

  /// Scans until any of [delimiters] matches [string] at the current position.
  ///
  /// Returns `true` if something is consumed, `false` otherwise.
  scanUntilAny(List<Pattern> delimiters) {
    final oldPosition = position;
    while (!isDone && !delimiters.any(matches)) readChar();
    return oldPosition < position;
  }

{"status":{"code":0,"name":"OK"},"sigs":[{"seqno":6,"payload_hash":"81b23cbd9aee3ed979134cbaf7d3b89e8bba99164e183d872d56b57747f1f9fd","merkle_seqno":24400171,"sig_id":"145d21b7c032b354cca14d468e434f9309b660dd973f0b4af666c579d160836f22","sig_id_short":"FF0ht8Ays1TMoU1GjkNPkwm2YN2XPwtK9mbF","kid":"012060f4ac2096c63cbcbfef6d9fa6ff7a08360cec815d5b78237ac2af6eb21482cb0a","sig":"hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgYPSsIJbGPLy/722fpv96CDYM7IFdW3gjesKvbrIUgssKp3BheWxvYWTESpcCBsQgZfLRF+2fnZe8TnG3aTW9hrEU1DjJ2pa7/rNRVWe+xbPEIFV/wjN5flBrdN49CHxpoLd5W85fpu/ApvRrmLGRlY3mDwHDo3NpZ8RAHhnmHQtODLFxGT90PPT9wEniMI1X7WmKW5bVa8YUzV3OWfM+FoFtZV0A+TDlH5zMATeaTvhUnwZxOzv9K/NRBKhzaWdfdHlwZSCkaGFzaIKkdHlwZQildmFsdWXEIPC1cfPHlzv6O0XT+zohpkisaczys4G1m88Dz4eqBdypo3RhZ80CAqd2ZXJzaW9uAQ==","payload_json":"{"body":{"key":{"eldest_kid":"012060f4ac2096c63cbcbfef6d9fa6ff7a08360cec815d5b78237ac2af6eb21482cb0a","host":"keybase.io","kid":"012060f4ac2096c63cbcbfef6d9fa6ff7a08360cec815d5b78237ac2af6eb21482cb0a","uid":"4d69b9f9742756d905fcebfa97a89219","username":"djjessejay"},"merkle_root":{"ctime":1682968825,"hash":"dcaf2e3acb80f740175ec4ff548471d01f456db405c8870ea96e3f6e5055528e69a55727d9a2b2c3d9889dd36bb888f723ad5621190669b2d699c6d174c7a53a","hash_meta":"4c0817713f2dc9fce5c3b3f05d490c2f029276aecc4eac07b34b09bf4abfb3f5","seqno":24400170},"type":"wallet.stellar","version":2,"wallet":{"address":"GD7TINTAYNW4SJRSLB4E44NCBBV2YCZAM4ZXBCOQD4NYZ4ABB73LZPHF","entropy":"G0wC+nZ4QU8RRDAMp5brWOlU","network":"stellar"},"wallet_key":{"kid":"0120ff343660c36dc9263258784e71a2086bac0b2067337089d01f1b8cf0010ff6bc0a","reverse_sig":"hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEg/zQ2YMNtyS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ZmMzQzNjYwYzM2ZGM5MjYzMjU4Nzg0ZTcxYTIwODZiYWMwYjIwNjczMzcwODlkMDFmMWI4Y2YwMDEwZmY2YmMwYSIsInJldmVyc2Vfc2lnIjpudWxsfX0sImNsaWVudCI6eyJuYW1lIjoia2V5YmFzZS5pbyBnbyBjbGllbnQiLCJ2ZXJzaW9uIjoiNi4wLjEifSwiY3RpbWUiOjE2ODI5Njg4NjMsImV4cGlyZV9pbiI6NTA0NTc2MDAwLCJpZ25vcmVfaWZfdW5zdXBwb3J0ZWQiOnRydWUsInByZXYiOiI2NWYyZDExN2VkOWY5ZDk3YmM0ZTcxYjc2OTM1YmQ4NmIxMTRkNDM4YzlkYTk2YmJmZWIzNTE1NTY3YmVjNWIzIiwic2Vxbm8iOjYsInRhZyI6InNpZ25hdHVyZSJ9o3NpZ8RA8e0RtvsXxdcHT62btTdsFm0xt7R+f4vrC50Cz+RHqHgopJnVsltPt4Gy3sA3Ab96g21qP3ASyVW5DTsS58NSC6hzaWdfdHlwZSCkaGFzaIKkdHlwZQildmFsdWXEIHdfRyoaoXFnEZOHG4KsyX2nQBhoAPgRnbz0VQCd3+A/o3RhZ80CAqd2ZXJzaW9uAQ=="}},"client":{"name":"keybase.io go client","version":"6.0.1"},"ctime":1682968863,"expire_in":504576000,"ignore_if_unsupported":true,"prev":"65f2d117ed9f9d97bc4e71b76935bd86b114d438c9da96bbfeb3515567bec5b3","seqno":6,"tag":"signature"}","sig_type":1,"sig_version":2,"ctime":1682968863,"etime":2147483647,"rtime":null,"eldest_seqno":1,"sig_status":0,"prev":"65f2d117ed9f9d97bc4e71b76935bd86b114d438c9da96bbfeb3515567bec5b3","proof_id":null,"proof_type":null,"proof_text_check":null,"proof_text_full":null,"check_data_json":null,"remote_id":null,"api_url":null,"human_url":null,"proof_state":null,"proof_status":null,"retry_count":null,"hard_fail_count":null,"last_check":null,"last_success":null,"version":null,"is_eldest":0,"fingerprint":""}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants