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

17
LINES

< > BotCompany Repo | #1033796 // tok_gettableFields backup

JavaX fragment (include)

1  
svoid tok_gettableFields(LS tok) {
2  
  int i = -1;
3  
  while ((i = jfind(tok, i+1, "gettable <id>")) >= 0) {
4  
    int iModifiers = i+2;
5  
    int iEndOfModifiers = tok_scanModifiers_idx(tok, iModifiers);
6  
    int iType = iEndOfModifiers;
7  
    int iEndOfType = tok_endOfType(tok, iEndOfModifiers);
8  
    S type = joinSubList_cToC(tok, iType, iEndOfType);
9  
    S var = identifierOrQuestionMark(get(tok, iEndOfType));
10  
    printVars(+i, +iModifiers, +iEndOfModifiers, +iType, +iEndOfType, +type, +var);
11  
    tokReplace_reTok(tok, i, i+2,
12  
      join(listMinus(subList(tok, iModifiers, iEndOfModifiers),   "volatile"))
13  
      + tok_formatDollarVars(
14  
        "public $type $var aka $getVar() { ret $var; } ",
15  
          +type, +var, getVar := "get" + firstToUpper(var)));
16  
  }
17  
}

Author comment

Began life as a copy of #1032961

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033796
Snippet name: tok_gettableFields backup
Eternal ID of this version: #1033796/1
Text MD5: 2970435e60c60a73d1c5f241509a70e3
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-05 02:54:58
Source code size: 771 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 192
Referenced in: [show references]