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)

sS flexMatchIC_namedVars(S id, S name, S s) {
  new Matches m;
  L<S> tok = javaTokC(name);
  if (l(tok) < 2) null;
  //replace(tok, "*", "\\*");
  if (tok.contains("*")) null;
  int n = numberOfXYZVars_c(tok);
  if (n == 0) null;
  S pat = formatXYZ(name, rep(n, "*"));
  bool yes = flexMatchIC2(pat, s, m, false);
  if (englishToConceptLanguage_xyz_debug && yes)
    print("xyz: " + n + " " + pat + " - " + s + " => " + (yes ? struct(m) : "-"));
  if (!yes) null;
  if (n != l(m.m)) null;
  new TreeMap<Int, S> map;
  for i over tok: {
    int x = xyzVarToIndex(tok.get(i));
    if (x != 0)
      map.put(i, englishToConceptLanguage_xyz_sub(name, s, m.m[x-1]));
  }
  ret aiUsing(id) + " " + join(" ", values(map));
}

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: 435 / 426
Referenced in: