1 | static S ai_subst_web_charBasedReplace(S webID, fS input) { |
2 | int n = websMadeInThread(); |
3 | Web web = assertNotNull("Web not found: " + webID, ai_getWeb(webID)); |
4 | WebRelation rel = assertNotNull(web_findRelationNamed(web, "matches")); |
5 | S pat = web_unquoted(rel.a), cmd = web_unquoted(rel.b); |
6 | assertEquals("substitute * => * with *", pat); |
7 | new Matches m; |
8 | assertTrue(flexMatchIC(pat, cmd, m)); |
9 | S src = $1; |
10 | fS var = $3; |
11 | L<S> terms = unquoteAll(trimAll(splitAtJavaToken(m.get(1), ","))); |
12 | O replacer = func(S s) { replaceIC(s, var, input) }; |
13 | src = (S) callF(replacer, src); |
14 | terms = map(replacer, terms); |
15 | ai_postTriple_multi(src, "see:", terms); |
16 | ret nWebs(websMadeInThread()-n) + " made"; |
17 | } |
Began life as a copy of #1011554
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011561 |
Snippet name: | ai_subst_web_charBasedReplace [ignores case] |
Eternal ID of this version: | #1011561/6 |
Text MD5: | a0d8ca1e2d8b8c6e0e7b9e42e36188bf |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-26 20:52:34 |
Source code size: | 724 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 483 / 499 |
Version history: | 5 change(s) |
Referenced in: | [show references] |