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

36
LINES

< > BotCompany Repo | #1024261 // agiBlue_parseQueryLine

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

Libraryless. Click here for Pure Java version (3213L/20K).

1  
static ALQLLine agiBlue_parseQueryLine(S s) {
2  
  LS tok = javaTokWithBrackets(s);
3  
  
4  
  // TODO: improve jmatch and use here
5  
  if (eqGet(tok, 1, "return") && isIdentifier(get(tok, 3))) {
6  
    LS l = tok_splitAtComma(subList(tok, 2));
7  
    if (l(l) == 1)
8  
      ret ALQLReturn(first(l));
9  
    else
10  
      ret ALQLReturnTuple(l);
11  
  }
12  
    
13  
  T3S t = agiBlue_parseTriple(tok);
14  
  if (t != null)
15  
    ret ALQLTriple(t);
16  
    
17  
  if (lCodeTokens(tok) == 2 && eqGet(tok, 1, "lock")) {
18  
    t = agiBlue_parseTriple(uncurly(tok.get(3)));
19  
    if (t == null) fail("Bad lock statement: " + s);
20  
    ret ALQLLockStatement(t);
21  
  }
22  
    
23  
  if (lCodeTokens(tok) == 2 && eqGet(tok, 1, "page")) {
24  
    S page = uncurly(tok.get(3));
25  
    S method = containsDollarVars(page) ? "flexMatchDollarVarsIC_first" : "eqic";
26  
    ret ALQLPage(page, method);
27  
  }
28  
    
29  
  if (lCodeTokens(tok) == 3 && eqGet(tok, 1, "slice")) {
30  
    S slice = unquote(tok.get(3));
31  
    S contents = uncurly(tok.get(5));
32  
    ret ALQLSlice(slice, agiBlue_parseQueryScript(print(+contents)));
33  
  }
34  
  
35  
  fail("Can't parse ALQL line: " + s);
36  
}

Author comment

Began life as a copy of #1024260

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: #1024261
Snippet name: agiBlue_parseQueryLine
Eternal ID of this version: #1024261/12
Text MD5: 89f875274312bd5231fb0a97d080fa6a
Transpilation MD5: 855db322ced48ceb9c4d41e3eaf0f070
Author: stefan
Category: javax / agi.blue
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-03 17:00:34
Source code size: 1104 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 214 / 324
Version history: 11 change(s)
Referenced in: [show references]