1 | sbool nlLogic_flexMatch_iterate_debug; |
2 | |
3 | svoid nlLogic_flexMatch_iterate(S pat, S input, NLLogicChecker_v2.Matching m, Runnable onMatch, VarMatches oldMatches) { |
4 | if (nlLogic_flexMatch_iterate_debug) |
5 | print("nlLogic_flexMatch_iterate " + pat + " / " + input); |
6 | L<S> tokPat = parse3_cachedPattern(pat), tokInput = parse3_cachedInput(input); |
7 | // fail if crucial words not found (could be optimized more) |
8 | new L<Int> varIndices; |
9 | for (int i = 1; i < l(tokPat); i += 2) { |
10 | S t = tokPat.get(i); |
11 | if (isDollarVar(t)) |
12 | varIndices.add(i); |
13 | else if (isIdentifier(t) && !cicAtOddPosition(tokInput, t)) { |
14 | if (nlLogic_flexMatch_iterate_debug) |
15 | print("Crucial word fail (" + t + "): " + pat + " / " + input); |
16 | ret; |
17 | } |
18 | } |
19 | if (nlLogic_flexMatch_iterate_debug) |
20 | printStructs(+varIndices, +tokPat, +tokInput); |
21 | LL<S> spreadInputs = ai_spreadCertainIndices(tokPat, tokInput, varIndices); |
22 | for (L<S> tok : spreadInputs) { |
23 | if (nlLogic_flexMatch_iterate_debug) |
24 | print("Testing spread input: " + sfu(tok)); |
25 | SS newMatches = matchDollarVarsIC(pat, tok); |
26 | if (newMatches != null && addMapToMapWithoutOverwritingIC(m.matches, newMatches)) |
27 | try { callF(onMatch); } finally { m.matches = oldMatches; } |
28 | } |
29 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018145 |
Snippet name: | nlLogic_flexMatch_iterate |
Eternal ID of this version: | #1018145/9 |
Text MD5: | 241dad2700b92e54ff70e491869c97dd |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-30 02:13:33 |
Source code size: | 1278 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 412 / 464 |
Version history: | 8 change(s) |
Referenced in: | [show references] |