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

21
LINES

< > BotCompany Repo | #1017999 // nlLogic_matchAllFacts

JavaX fragment (include)

static L<VarMatches> nlLogic_matchAllFacts(S pat, LS facts) {
  new NLLogicChecker_v2 c;
  c.facts = facts;
  ret nlLogic_matchAllFacts(c, pat, new NLLogicChecker_v2.Matching());
}

static L<VarMatches> nlLogic_matchAllFacts(NLLogicChecker_v2 c, S pat, NLLogicChecker_v2.Matching m) {
  LS patterns = tok_splitAtVerticalBar(pat);
  VarMatches m2 = null;
  new L<VarMatches> choices;
  for (S fact : c.facts) {
    if (m2 == null) m2 = new VarMatches(m.matches);
    bool result = nlLogic_matchMultiplePatterns(c, patterns, fact, m2);
    if (m.verbose) print("matched " + quote(pat) + " with " + quote(fact) + " & " + sfu(m.matches) + " => " + result);
    if (result) {
      choices.add(m2);
      m2 = null;
    }
  }
  ret choices;
}

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: 435 / 472
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)