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

20
LINES

< > BotCompany Repo | #1001104 // match3 function

JavaX fragment (include)

static boolean match3(S pat, S s) {
  return match3(pat, s, null);
}

static boolean match3(S pat, S s, Matches matches) {
  if (pat == null || s == null) return false;
  ret match3(pat, parse3_cachedInput(s), matches);
}
  
static boolean match3(S pat, L<S> toks, Matches matches) {
  L<S> tokpat = parse3_cachedPattern(pat);
  ret match3(tokpat, toks, matches);
}

static boolean match3(L<S> tokpat, L<S> toks, Matches matches) {
  S[] m = match2(tokpat, toks);
  //print(structure(tokpat) + " on " + structure(toks) + " => " + structure(m));
  if (m == null) false;
  if (matches != null) matches.m = m; true;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 22 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, mqsvbyillbrs, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001104
Snippet name: match3 function
Eternal ID of this version: #1001104/5
Text MD5: f2c0818bd4f3b345276012df89ec1ede
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-11 13:35:26
Source code size: 633 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 978 / 7525
Version history: 4 change(s)
Referenced in: #1001232 - find3 function
#1001233 - parse3 - parse function e.g. for mmo2_match
#1001793 - matchStart function - match first tokens, return rest
#1001842 - match - synonym of match3
#1001876 - jmatch function (match with javaTok, keeps punctuation) - pattern goes first (unlike jfind). See also jmatch2
#1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1016378 - match_brackets - match3 + combining round/curly brackets
#1017874 - match3_plusBrackets - allows {} in s
#1020944 - match3_noWildcards - compare two sentences
#1026743 - matchUppercaseVars - match3 with uppercase variables (returns mapping or null)
#3000382 - Answer for ferdie (>> t = 1, f = 0)