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

20
LINES

< > BotCompany Repo | #1010855 // Test matching with dollar vars [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (6162L/42K).

!7

p {
  autoRestart();
  new L<S> vars;
  S pat = print(dollarVarsToStars("a $adjective1 $noun1", vars));
  print("Vars: " + sfu(vars));
  new Matches m;
  assertTrue(match(pat, "a funny game", m));
  new SS map;
  for (int i = 0; i < l(m.m); i++)
    map.put(vars.get(i), m.get(i));
  pnl(map);
    
  print(" => " + formatDollarVars("a $noun1", map));
  
  assertNull(matchDollarVars("a $x $x", "a funny game"));
  assertNotNull(matchDollarVars("a $x $y", "a funny game"));
  print("OK");
}

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: #1010855
Snippet name: Test matching with dollar vars [OK]
Eternal ID of this version: #1010855/12
Text MD5: 959e0425c54105aef33c5f3b108c6b88
Transpilation MD5: 05d9585e74b7831aa6922a9910f98cb8
Author: stefan
Category: javax / parsing
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-26 13:15:23
Source code size: 513 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 1132
Version history: 11 change(s)
Referenced in: #1010858 - matchDollarVars