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

15
LINES

< > BotCompany Repo | #1031773 // tok_numberFunctionNames (e.g. "1to" => "oneTo") - possible shortening level 2

JavaX fragment (include)

!tok_numberFunctionNames { // short for function definition
  for i {                  // some loop over i
    if (isInteger(number = tok.get(i)) && empty(tok.get(i+1)) && isIdentifier(id = tok.get(i+2))) pcall {
      if (eq(number, "0") && eqic(id, "x")) continue;
      replaceTokens_reTokLater(i, i+3, camelCase(numberToEnglish(parseLong(number))) + firstToUpper(id));
    }
  }
  reTok_multi;             // shortened function call
}

// I think the above is still clear enough to figure out!
// Functions get their "typical arguments" with typical types
// and always the same name. It must be possible to automate that!
// i goes over any index where the loop body makes any sense
// (determinable by looking at the calls to tok.get).

Author comment

Began life as a copy of #1031772

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1031773
Snippet name: tok_numberFunctionNames (e.g. "1to" => "oneTo") - possible shortening level 2
Eternal ID of this version: #1031773/5
Text MD5: f77099b2cc9c112fe857259643410bef
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 15:11:10
Source code size: 755 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 158
Version history: 4 change(s)
Referenced in: