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)

1  
sclass NLStringMatcher_dollarVars_underscores_dollarDollar extends StringMatcher {
2  
  // change matches only if returning true
3  
  bool match(S pat, S input, SS matches) {
4  
    pat = trim(pat);
5  
    // full-string match with $$x
6  
    if (startsWith(pat, "$$") && isDollarVar(pat))
7  
      ret strictPutIC(matches, pat, input);
8  
      
9  
    SS newMatches = matchDollarVarsIC_underscores(pat, input);
10  
    ret newMatches != null && addMapToMapWithoutOverwritingIC(matches, newMatches);
11  
  }
12  
  
13  
  S apply(S input, SS matches) {
14  
    ret replaceVars(input, matches);
15  
  }
16  
}

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: 426 / 945
Referenced in: [show references]