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

18
LINES

< > BotCompany Repo | #1027883 // parseFragmentExpressionToFunctionCall

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

Libraryless. Click here for Pure Java version (2657L/17K).

1  
static FunctionCall parseFragmentExpressionToFunctionCall(O o) {
2  
  if (!o instanceof L) null;
3  
  L l = cast o;
4  
  O first = first(l);
5  
  if (!first instanceof Fragment) null;
6  
  S first2 = first/Fragment.text;
7  
  if (!isIdentifierPlusOpeningBracket(first2)) null;
8  
  if (!eq(last(l), Fragment(")"))) null;
9  
  int i = 1, n = l(l)-1;
10  
  S fname = dropLast(first2);
11  
  new L args;
12  
  while (i < n) {
13  
    args.add(get(l, i++));
14  
    if (i >= n) break;
15  
    if (!eq(get(l, i++), Fragment(","))) null;
16  
  }
17  
  ret FunctionCall(fname, toObjectArray(args));
18  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027883
Snippet name: parseFragmentExpressionToFunctionCall
Eternal ID of this version: #1027883/3
Text MD5: 609e626125bfec7b1fde6d15818a4433
Transpilation MD5: 02b832c09de6523bf49521c3e9e4984e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 14:45:21
Source code size: 554 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 272
Version history: 2 change(s)
Referenced in: [show references]