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).

1  
svoid philosophyBot1_orHandler(PhilosophyBot1 bot) {
2  
  bot.addLogicRulePreprocessor(rule -> {
3  
    if (!(rule.lhs instanceof S)) false;
4  
    
5  
    LS tok = bot.mainTokenize(tok_deCurlyOrRound((S) rule.lhs));
6  
    if (countCodeTokens(tok) == 3 && eq(secondCodeToken(tok), "|")) {
7  
      // split into two rules
8  
      print("Splitting or: " + tok);
9  
      bot.addLogicRule(new PhilosophyBot1.LogicRule(firstCodeToken(tok), rule.rhs));
10  
      bot.addLogicRule(new PhilosophyBot1.LogicRule(lastCodeToken(tok), rule.rhs));
11  
      true;
12  
    }
13  
    false;
14  
  });
15  
}

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: 206 / 327
Version history: 8 change(s)
Referenced in: [show references]