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

47
LINES

< > BotCompany Repo | #1009078 // ctxProcessStatement

JavaX fragment (include)

1  
static void ctxProcessStatement(L<S> tok) {
2  
  tok = ctxStringProcessing(tok);
3  
  
4  
  if (jfind(tok, "<id> = true;") == 1) {
5  
    ctxSetVar(tok.get(1), "true");
6  
    ctxProcessAction(subList(tok, 8));
7  
    ret;
8  
  }
9  
  
10  
  if (jfind(tok, "string <id> = ") == 1)
11  
    tok = subList(tok, 2);
12  
    
13  
  if (jfind(tok, "<id> = ") == 1) {
14  
    int semicolon = tok.indexOf(";");
15  
    CtxExpr e = ctxParseExpression(join(subList(tok, 5, semicolon-1)));
16  
    ctxSetVar(tok.get(1), e.str());
17  
    ctxProcessAction(subList(tok, semicolon+1));
18  
    ret;
19  
  }
20  
  
21  
  if (jfind(tok, "agent.say(*);") == 1 && isQuoted(tok.get(9))) {
22  
    ctxAppendOutput(unquoteCtx(tok.get(9)));
23  
    ctxProcessAction(subList(tok, 14));
24  
    ret;
25  
  }
26  
  
27  
  if (jmatch("jumpaway();", tok)) {
28  
    print("jumpaway.");
29  
    ctxContext().jumpaway = true;
30  
    ret;
31  
  }
32  
  
33  
  if (jmatch("thinkagain();", tok)) {
34  
    print("thinkagain.");
35  
    ctxContext().thinkagain = true;
36  
    ret;
37  
  }
38  
  
39  
  if (jfind(tok, "agent.openUrl(*);") == 1) {
40  
    S url = ctxGetVar(tok.get(9));
41  
    ctxContext().urlsToOpen.add(url);
42  
    ctxProcessAction(subList(tok, 14));
43  
    ret;
44  
  }
45  
  
46  
  print("ctxProcessStatement unknown: " + structForUser(join(tok)));
47  
}

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: 406 / 448
Referenced in: [show references]