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

24
LINES

< > BotCompany Repo | #1025723 // smartParser1_subParse

JavaX fragment (include)

1  
static LS smartParser1_subParse(S s) {
2  
  // drop outer brackets, keep first spacing if it's pythonesque
3  
  s = tok_deRoundOrCurlyBracket_keepFirstSpacing(s);
4  
  s = withoutLeadingLinesEmptyAfterTrim(s);
5  
  bool lineByLine = ai_isLineByLine(s);
6  
  if (lineByLine) {
7  
    LS l = tlftj(s);
8  
    if (l(l) > 1) ret l;
9  
  }
10  
11  
  // find logic rule
12  
  LS l = tok_splitAtDoubleArrow(s);
13  
  if (l(l) > 1) ret intersperse("=>", l);
14  
  
15  
  // split at &
16  
  l = tok_splitAtAmpersand(s);
17  
  if (l(l) > 1) ret intersperse("&", l);
18  
  
19  
  // split at =
20  
  l = tok_splitAtEquals(s);
21  
  if (l(l) > 1) ret intersperse("=", l);
22  
  
23  
  ret wordTokC(s);
24  
}

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: #1025723
Snippet name: smartParser1_subParse
Eternal ID of this version: #1025723/3
Text MD5: 9ebd064a6141ee9ed2bbc9ffdc168eaa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-15 16:21:10
Source code size: 636 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 320
Version history: 2 change(s)
Referenced in: [show references]