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

47
LINES

< > BotCompany Repo | #1009078 // ctxProcessStatement

JavaX fragment (include)

static void ctxProcessStatement(L<S> tok) {
  tok = ctxStringProcessing(tok);
  
  if (jfind(tok, "<id> = true;") == 1) {
    ctxSetVar(tok.get(1), "true");
    ctxProcessAction(subList(tok, 8));
    ret;
  }
  
  if (jfind(tok, "string <id> = ") == 1)
    tok = subList(tok, 2);
    
  if (jfind(tok, "<id> = ") == 1) {
    int semicolon = tok.indexOf(";");
    CtxExpr e = ctxParseExpression(join(subList(tok, 5, semicolon-1)));
    ctxSetVar(tok.get(1), e.str());
    ctxProcessAction(subList(tok, semicolon+1));
    ret;
  }
  
  if (jfind(tok, "agent.say(*);") == 1 && isQuoted(tok.get(9))) {
    ctxAppendOutput(unquoteCtx(tok.get(9)));
    ctxProcessAction(subList(tok, 14));
    ret;
  }
  
  if (jmatch("jumpaway();", tok)) {
    print("jumpaway.");
    ctxContext().jumpaway = true;
    ret;
  }
  
  if (jmatch("thinkagain();", tok)) {
    print("thinkagain.");
    ctxContext().thinkagain = true;
    ret;
  }
  
  if (jfind(tok, "agent.openUrl(*);") == 1) {
    S url = ctxGetVar(tok.get(9));
    ctxContext().urlsToOpen.add(url);
    ctxProcessAction(subList(tok, 14));
    ret;
  }
  
  print("ctxProcessStatement unknown: " + structForUser(join(tok)));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009078
Snippet name: ctxProcessStatement
Eternal ID of this version: #1009078/1
Text MD5: 7983bbb967cb7dc1e2eca8e514e453c4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-01 19:13:45
Source code size: 1216 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 474 / 517
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)