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

15
LINES

< > BotCompany Repo | #1025757 // philosophyBot1_orHandler - handle | in logic rules

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7705L/49K).

svoid philosophyBot1_orHandler(PhilosophyBot1 bot) {
  bot.addLogicRulePreprocessor(rule -> {
    if (!(rule.lhs instanceof S)) false;
    
    LS tok = bot.mainTokenize(tok_deCurlyOrRound((S) rule.lhs));
    if (countCodeTokens(tok) == 3 && eq(secondCodeToken(tok), "|")) {
      // split into two rules
      print("Splitting or: " + tok);
      bot.addLogicRule(new PhilosophyBot1.LogicRule(firstCodeToken(tok), rule.rhs));
      bot.addLogicRule(new PhilosophyBot1.LogicRule(lastCodeToken(tok), rule.rhs));
      true;
    }
    false;
  });
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025757
Snippet name: philosophyBot1_orHandler - handle | in logic rules
Eternal ID of this version: #1025757/9
Text MD5: b2276d26185d381cd383bc0d77a3b680
Transpilation MD5: dfc71748675d27d551bacce43f8f701f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-01 12:05:39
Source code size: 561 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 252
Version history: 8 change(s)
Referenced in: [show references]