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)

svoid tok_gettableFields(LS tok) {
  int i = -1;
  while ((i = jfind(tok, i+1, "gettable <id>")) >= 0) {
    int iModifiers = i+2;
    int iEndOfModifiers = tok_scanModifiers_idx(tok, iModifiers);
    int iType = iEndOfModifiers;
    int iEndOfType = tok_endOfType(tok, iEndOfModifiers);
    S type = joinSubList_cToC(tok, iType, iEndOfType);
    S var = identifierOrQuestionMark(get(tok, iEndOfType));
    printVars(+i, +iModifiers, +iEndOfModifiers, +iType, +iEndOfType, +type, +var);
    tokReplace_reTok(tok, i, i+2,
      join(listMinus(subList(tok, iModifiers, iEndOfModifiers),   "volatile"))
      + tok_formatDollarVars(
        "public $type $var aka $getVar() { ret $var; } ",
          +type, +var, getVar := "get" + firstToUpper(var)));
  }
}

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: 163 / 190
Referenced in: [show references]