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

25
LINES

< > BotCompany Repo | #1018048 // ai_ruleAccessesInput

JavaX fragment (include)

// OLD version
sbool ai_ruleAccessesInput(S rule) {
  L<S> tok = javaTokC(rule);
  S t;
  if (contains(tok, "ai_input")) true;
  for i over tok:
    if (eqGet(tok, i+1, "(") && isIdentifier(t = tok.get(i)))
      if (eq(t, "i") || swic(t, "input") || ewic(t, "input")) true;
  false;
}

// NEW version
sbool ai_ruleAccessesInput(IfThen rule) {
  final new Flag flag;
  nlLogic_visit(rule.in, voidfunc(O o) {
    if (o cast Func) {
      S t = o.name;
      if (eqOneOf(t, "i", "phrase") || swic(t, "input") || ewic(t, "input"))
        flag.raise();
    }
    if (o cast Exp)
      if (jcontains(o.text(), "ai_input()")) flag.raise();
  });
  ret flag.isUp();
}

Author comment

Began life as a copy of #1017925

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: #1018048
Snippet name: ai_ruleAccessesInput
Eternal ID of this version: #1018048/7
Text MD5: c6402d928d97ad77a6251285262edf37
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-23 15:09:14
Source code size: 685 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 356 / 390
Version history: 6 change(s)
Referenced in: [show references]