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

29
LINES

< > BotCompany Repo | #1025378 // tok_standardBot - use tok_standardBot1 instead

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

Libraryless. Click here for Pure Java version (2765L/18K).

svoid tok_standardBot(LS tok) {
  int i;
  while ((i = jfind(tok, "standard bot <id> {")) >= 0) {
    int iOpening = indexOf(tok, i, "{");
    S name = tok.get(iOpening-2);
    int iClosing = findEndOfBracketPart(tok, iOpening)-1;
    LS contents = subList(tok, iOpening+1, iClosing);
    
    int j = jfind(contents, "allServers {");
    int k = findEndOfBracketPart(contents, j+2);
    S allServers = joinSubList(contents, j+4, k-2);
    clearTokens(contents, j, k);

    replaceTokens_reTok(tok, i, iClosing+1,
      [[ cmodule ]] + name + [[ extends DynTalkBot2<.ByServer> {
        void init {
          super.init();
          makeByServer = () -> new ByServer;
          useAGIBlueForDropPunctuation = false;
          preprocessAtSelfToMyName = false;
        }
        
        ]] + allServers + [[

        class ByServer extends DynTalkBot2.ByServer { ]]
        + join(contents)
        + "} }");
  }
}

Author comment

Began life as a copy of #1025200

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025378
Snippet name: tok_standardBot - use tok_standardBot1 instead
Eternal ID of this version: #1025378/11
Text MD5: f3454e7239541b93da56416d7c98fae4
Transpilation MD5: 3e10fea68900d2eba643de169c4bf68f
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-01 18:40:48
Source code size: 942 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 260 / 428
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1025520 - tok_standardBot1