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

18
LINES

< > BotCompany Repo | #1033078 - tok_settableFields

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

Transpiled version (4758L) is out of date.

svoid tok_settableFields(LS tok) {
  int i = -1;
  while ((i = jfind(tok, i+1, "settable <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, tok_formatDollarVars(
      joinSubList(tok, iModifiers, iEndOfModifiers)
        + "public selfType $var aka $setVar($type $var) { this.$var = $var; this; } gettable ",
      +type, +var, setVar := "set" + firstToUpper(var)));
  }
  
  tok_gettableFields(tok);
}

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: #1033078
Snippet name: tok_settableFields
Eternal ID of this version: #1033078/12
Text MD5: d3de39edc47918628696793aa93db37f
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-18 06:41:56
Source code size: 800 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 30 / 71
Version history: 11 change(s)
Referenced in: [show references]