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

21
LINES

< > BotCompany Repo | #1017999 // nlLogic_matchAllFacts

JavaX fragment (include)

1  
static L<VarMatches> nlLogic_matchAllFacts(S pat, LS facts) {
2  
  new NLLogicChecker_v2 c;
3  
  c.facts = facts;
4  
  ret nlLogic_matchAllFacts(c, pat, new NLLogicChecker_v2.Matching());
5  
}
6  
7  
static L<VarMatches> nlLogic_matchAllFacts(NLLogicChecker_v2 c, S pat, NLLogicChecker_v2.Matching m) {
8  
  LS patterns = tok_splitAtVerticalBar(pat);
9  
  VarMatches m2 = null;
10  
  new L<VarMatches> choices;
11  
  for (S fact : c.facts) {
12  
    if (m2 == null) m2 = new VarMatches(m.matches);
13  
    bool result = nlLogic_matchMultiplePatterns(c, patterns, fact, m2);
14  
    if (m.verbose) print("matched " + quote(pat) + " with " + quote(fact) + " & " + sfu(m.matches) + " => " + result);
15  
    if (result) {
16  
      choices.add(m2);
17  
      m2 = null;
18  
    }
19  
  }
20  
  ret choices;
21  
}

Author comment

Began life as a copy of #1017935

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: #1017999
Snippet name: nlLogic_matchAllFacts
Eternal ID of this version: #1017999/5
Text MD5: 3c73512a0004b6180d121d30f0b84eab
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-19 16:44:19
Source code size: 757 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 474
Version history: 4 change(s)
Referenced in: [show references]