Transpiled version (4712L) is out of date.
// Note: In the transpiler, this version is used: #1025802 static int findCodeTokens(L<S> tok, S... tokens) { ret findCodeTokens(tok, 1, false, tokens); } static int findCodeTokens(L<S> tok, boolean ignoreCase, S... tokens) { ret findCodeTokens(tok, 1, ignoreCase, tokens); } static int findCodeTokens(L<S> tok, int startIdx, boolean ignoreCase, S... tokens) { ret findCodeTokens(tok, startIdx, ignoreCase, tokens, null); } static HashSet<S> findCodeTokens_specials = lithashset("*", "<quoted>", "<id>", "<int>", "\\*"); static int findCodeTokens_bails, findCodeTokens_nonbails; sinterface findCodeTokens_Matcher { bool get(S token); } static int findCodeTokens(LS tok, int startIdx, boolean ignoreCase, S[] tokens, O condition) { int end = tok.size()-tokens.length*2+2, nTokens = tokens.length; int i = startIdx | 1; if (i >= end) ret -1; // bail out early if first token not found (works great with IndexedList) S firstToken = tokens[0]; if (!ignoreCase && !findCodeTokens_specials.contains(firstToken)) { ifclass IndexedList2 if (tok instanceof IndexedList2 && !tok.contains(firstToken)) { ++findCodeTokens_bails; ret -1; } ++findCodeTokens_nonbails; endif // quickly scan for first token while (i < end && !firstToken.equals(tok.get(i))) i += 2; } findCodeTokens_Matcher[] matchers = new[nTokens]; for j to nTokens: { S p = tokens[j]; findCodeTokens_Matcher matcher; if (p.equals("*")) matcher = t -> true; else if (p.equals("<quoted>")) matcher = t -> isQuoted(t); else if (p.equals("<id>")) ifdef findCodeTokens_quickIsIdentifier matcher = t -> startsLikeIdentifier(t); endifdef ifndef findCodeTokens_quickIsIdentifier matcher = t -> isIdentifier(t); endifndef else if (p.equals("<int>")) ifdef findCodeTokens_quickIsInteger matcher = t -> startsWithDigit(t); endifdef ifndef findCodeTokens_quickIsInteger matcher = t -> isInteger(t); endifndef else if (p.equals("\\*")) matcher = t -> t.equals("*"); else if (ignoreCase) matcher = t -> eqic(p, t); else matcher = t -> t.equals(p); matchers[j] = matcher; } outer: for (; i < end; i += 2) { for (int j = 0; j < nTokens; j++) if (!matchers[j].get(tok.get(i+j*2))) continue outer; if (condition == null || checkTokCondition(condition, tok, i-1)) // pass N index return i; } return -1; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment