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 (3576L/22K).

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(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/9
Text MD5: c1cb01d441228a3ac679c0b38c94fd97
Transpilation MD5: f04e7d3211e203a47e99857339763c38
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-12 15:52:14
Source code size: 736 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 40 / 92
Version history: 8 change(s)
Referenced in: [show references]

Formerly at &