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


< > BotCompany Repo | #1026500 - mmo_match_parsedPattern

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3663L/23K).

sbool mmo_match_parsedPattern(MMOPattern pattern, S s) {
  S s2 = trim(s);
  if (pattern == null) false;
  if (pattern cast MMOPattern.Phrase) {
    S p = pattern.phrase;
    if (pattern.quoted) ret cicWithSmartWordBoundary(s2, p);
    ret startsWith(p, "#") ? eqic(p, s2) : find3(p, s2);
  if (pattern cast MMOPattern.And)
    ret all(pattern.l, pat -> mmo_match_parsedPattern(pat, s2));
  if (pattern cast MMOPattern.Or)
    ret any(pattern.l, pat -> mmo_match_parsedPattern(pat, s2));
  if (pattern cast MMOPattern.Not)
    ret !mmo_match_parsedPattern(pattern.p, s2);
  fail("what. " + pattern);

sbool mmo_match_parsedPattern(S pattern, S s) {
  ret mmo_match_parsedPattern(mmo_parsePattern_cached(pattern), s);

Author comment

Began life as a copy of #1026018

download  show line numbers  debug dex   

Travelled to 4 computer(s): mqqgnosmbjvj, tvejysmllsmz, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026500
Snippet name: mmo_match_parsedPattern
Eternal ID of this version: #1026500/10
Text MD5: cb47eea20aff35f947aa68630f5d6a93
Transpilation MD5: 5ad8f3e93706b7f915a1015f53ddb1dc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-15 15:18:31
Source code size: 743 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 58 / 118
Version history: 9 change(s)
Referenced in: [show references]

Formerly at &