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

17
LINES

< > BotCompany Repo | #1014328 // callAndMake_extended - also accepts function calls on x

JavaX fragment (include)

static O callAndMake_extended(S code, fO... args) {
  if (code == null) null;
  code = trim(code);
  if (isQuoted(code)) ret unquote(code);
  if (isInteger(code)) ret parseInt(code);
  if (isIdentifier(code))
    ret eq(code, "x") ? first(args) : callAndMake(code, args);
  L<S> tok = javaTok(code);
  if (lCodeTokens(tok) == 4 && eq(second(tok), "f") && isIdentifier(get(tok, 3)) && eq("/", get(tok, 5)))
    if (eq("1", get(tok, 7)))
      ret standardFunctionReference_1(get(tok, 3));
    else if (eq("2", get(tok, 7)))
      ret standardFunctionReference_2(get(tok, 3));
  Pair<S, L<S>> p = tok_parseFunctionCall(tok);
  if (p == null) fail("Can't parse: " + code);
  ret callAndMake(p.a, map_toArray(func(S arg) -> O { callAndMake_extended(arg, args) }, p.b));
}

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: #1014328
Snippet name: callAndMake_extended - also accepts function calls on x
Eternal ID of this version: #1014328/6
Text MD5: 70bb2c61bb9de82ee1cf5e9cf54fa6fa
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-20 04:07:08
Source code size: 783 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 241 / 296
Version history: 5 change(s)
Referenced in: [show references]