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

22
LINES

< > BotCompany Repo | #1009207 // flexMatchIC_namedVars [dev.]

JavaX fragment (include)

1  
sS flexMatchIC_namedVars(S id, S name, S s) {
2  
  new Matches m;
3  
  L<S> tok = javaTokC(name);
4  
  if (l(tok) < 2) null;
5  
  //replace(tok, "*", "\\*");
6  
  if (tok.contains("*")) null;
7  
  int n = numberOfXYZVars_c(tok);
8  
  if (n == 0) null;
9  
  S pat = formatXYZ(name, rep(n, "*"));
10  
  bool yes = flexMatchIC2(pat, s, m, false);
11  
  if (englishToConceptLanguage_xyz_debug && yes)
12  
    print("xyz: " + n + " " + pat + " - " + s + " => " + (yes ? struct(m) : "-"));
13  
  if (!yes) null;
14  
  if (n != l(m.m)) null;
15  
  new TreeMap<Int, S> map;
16  
  for i over tok: {
17  
    int x = xyzVarToIndex(tok.get(i));
18  
    if (x != 0)
19  
      map.put(i, englishToConceptLanguage_xyz_sub(name, s, m.m[x-1]));
20  
  }
21  
  ret aiUsing(id) + " " + join(" ", values(map));
22  
}

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: #1009207
Snippet name: flexMatchIC_namedVars [dev.]
Eternal ID of this version: #1009207/1
Text MD5: 1a87eb3d4d8d12eec23e945705ac7d79
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-16 18:36:01
Source code size: 740 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 512
Referenced in: [show references]