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

16
LINES

< > BotCompany Repo | #1017838 // NLStringMatcher_dollarVars_underscores_dollarDollar - supports "$$x" to mean whole string

JavaX fragment (include)

sclass NLStringMatcher_dollarVars_underscores_dollarDollar extends StringMatcher {
  // change matches only if returning true
  bool match(S pat, S input, SS matches) {
    pat = trim(pat);
    // full-string match with $$x
    if (startsWith(pat, "$$") && isDollarVar(pat))
      ret strictPutIC(matches, pat, input);
      
    SS newMatches = matchDollarVarsIC_underscores(pat, input);
    ret newMatches != null && addMapToMapWithoutOverwritingIC(matches, newMatches);
  }
  
  S apply(S input, SS matches) {
    ret replaceVars(input, matches);
  }
}

Author comment

Began life as a copy of #1017696

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017838
Snippet name: NLStringMatcher_dollarVars_underscores_dollarDollar - supports "$$x" to mean whole string
Eternal ID of this version: #1017838/1
Text MD5: 0eda77c3d318baf23d05e290f141a936
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-16 15:01:44
Source code size: 570 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 359 / 881
Referenced in: [show references]