Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

30
LINES

< > BotCompany Repo | #1029562 // CCI_SingleChar - CharacterClassIterator accepting a single character, then forwarding to a follow-up iterator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2667L/17K).

sclass CCI_SingleChar extends CharacterClassIterator {
  char c;
  CharacterClassIterator next;

  *() {}
  *(char *c, CharacterClassIterator *next) {}
  
  // no check because of method contract
  CharacterClassIterator acceptChar(char c) {
    ret next == null ? new CCI_End : next;
  }

  bool canEndHere() {
    false;
  }
  
  bool canAcceptChar(char x) {
    ret x == c;
  }
  
  Cl<Char> acceptedChars() { ret ll(c); }

  CharRange acceptedCharRange() {
    ret singletonCharRange(c);
  }
  
  CharacterClassIterator cloneCCI() {
    this;
  }
}  

Author comment

Began life as a copy of #1029558

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029562
Snippet name: CCI_SingleChar - CharacterClassIterator accepting a single character, then forwarding to a follow-up iterator
Eternal ID of this version: #1029562/4
Text MD5: a5b57e13e3fb341d8d1ff8e6433509ed
Transpilation MD5: d662e8fb1993f7d5e8efd27162967f7a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-23 12:53:58
Source code size: 585 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 471
Version history: 3 change(s)
Referenced in: [show references]