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).

1  
sclass CCI_SingleChar extends CharacterClassIterator {
2  
  char c;
3  
  CharacterClassIterator next;
4  
5  
  *() {}
6  
  *(char *c, CharacterClassIterator *next) {}
7  
  
8  
  // no check because of method contract
9  
  CharacterClassIterator acceptChar(char c) {
10  
    ret next == null ? new CCI_End : next;
11  
  }
12  
13  
  bool canEndHere() {
14  
    false;
15  
  }
16  
  
17  
  bool canAcceptChar(char x) {
18  
    ret x == c;
19  
  }
20  
  
21  
  Cl<Char> acceptedChars() { ret ll(c); }
22  
23  
  CharRange acceptedCharRange() {
24  
    ret singletonCharRange(c);
25  
  }
26  
  
27  
  CharacterClassIterator cloneCCI() {
28  
    this;
29  
  }
30  
}  

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: 149 / 401
Version history: 3 change(s)
Referenced in: [show references]