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

16
LINES

< > BotCompany Repo | #1031876 // tok_castToStatements

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

Libraryless. Click here for Pure Java version (5400L/31K).

1  
// e.g. cast req to Req; 
2  
// (converts req to (Req) req for the rest of the block)
3  
svoid tok_castToStatements(LS tok) {
4  
  int i;
5  
  while ((i = jfind(tok, "cast <id> to")) >= 0) {
6  
    S id = tok.get(i+2);
7  
    int iTypeStart = i+6;
8  
    int semicolon = findEndOfStatement(tok, iTypeStart)-1;
9  
    int endOfOuterBlock = findEndOfBracketPart(tok, semicolon)-1;
10  
    S type = joinSubList(tok, iTypeStart, semicolon-1);
11  
    
12  
    tok_insertCasts_noReTok(tok, semicolon+2, endOfOuterBlock, id, type);
13  
    clearTokens(tok, i, semicolon+1);
14  
    reTok(tok, i, endOfOuterBlock);
15  
  }
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031876
Snippet name: tok_castToStatements
Eternal ID of this version: #1031876/3
Text MD5: 8eb09ad309949e8e674f12acbbf2b4ea
Transpilation MD5: 6518fe6bfa4f28f6328fc521b87d4d32
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-24 22:05:52
Source code size: 588 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 252
Version history: 2 change(s)
Referenced in: [show references]