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

25
LINES

< > BotCompany Repo | #1027999 // tok_leftScanType

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

Libraryless. Click here for Pure Java version (3876L/22K).

1  
// i = C token to the right of type
2  
// returns start index of type
3  
static int tok_leftScanType(LS tok, int i) {
4  
  while ping (true) {
5  
    // first skip ellipsis
6  
    if (subListEq(tok, i-6, ".", "", ".", "", "."))
7  
      i -= 6;
8  
    
9  
    // skip array brackets
10  
    while (eqGet(tok, i-2, "]") && eqGet(tok, i-4, "["))
11  
      i -= 4;
12  
      
13  
    // skip type args
14  
    i = tok_leftScanTypeArgsOpt(tok, i);
15  
    
16  
    i -= 2; // should be an identifier
17  
  
18  
    // package names / outer classes
19  
    if (!eqGet(tok, i-2, ".")) break;
20  
    
21  
    i -= 2;
22  
  }
23  
  
24  
  ret i;
25  
}

Author comment

Began life as a copy of #1001156

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: #1027999
Snippet name: tok_leftScanType
Eternal ID of this version: #1027999/14
Text MD5: 02369c04307214e8b0a9d6761d1e45b5
Transpilation MD5: 8911ddaedaf83c467795e4238bb9bf4c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-15 22:17:09
Source code size: 582 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 174 / 284
Version history: 13 change(s)
Referenced in: [show references]