Transpiled version (4158L) is out of date.
svoid tok_numberFunctionNames(LS tok) { int n = l(tok); new L<IntRange> reToks; for (int i = 1; i < n-2; i += 2) { S number, id; if (isInteger(number = tok.get(i)) && empty(tok.get(i+1)) && isIdentifier(id = tok.get(i+2))) pcall { continue if eq(number, "0") && swicOneOf(id, "x", "b"); // skip hex/binary constants continue if eqic(id, "f"); // skip float constants // skip exponential floating-point constants (e.g. 1e6) if (swic(id, "e") && (l(id) == 1 && empty(get(tok, i+3)) && eqGet(tok, i+4, "-") || startsWithInteger(substring(id, 1)))) continue; // skip numbers with underscores like 1_000 if (startsWith(id, "_")) continue; replaceTokens_reTokLater(tok, reToks, i, i+3, camelCase(numberToEnglish(parseLong(number))) + firstToUpper(id)); } } reTok_multi(tok, reToks); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031769 |
Snippet name: | tok_numberFunctionNames (e.g. "1to" => "oneTo", LIVE) |
Eternal ID of this version: | #1031769/21 |
Text MD5: | 75d6c6e723df077996660e09da61cccd |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-21 18:31:24 |
Source code size: | 925 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 190 / 331 |
Version history: | 20 change(s) |
Referenced in: | [show references] |