Libraryless. Click here for Pure Java version (1871L/12K).
1 | // returns pair(regexp, vars) |
2 | static Pair<S, LS> dollarVarsToRegexp_generic(S replacement, S s) { |
3 | new L<S> varNames_out; |
4 | L<S> tok = javaTok(s); |
5 | int j = 0; |
6 | for (int i = 1; i < l(tok); i += 2) { |
7 | S t = tok.get(i); |
8 | if (isDollarVar(t)) { |
9 | replaceTokens(tok, j, i, regexpQuote(joinSubList(tok, j, i))); |
10 | listAdd(varNames_out, t); |
11 | tok.set(i, replacement); |
12 | j = i+1; |
13 | } |
14 | } |
15 | replaceTokens(tok, j, l(tok), regexpQuote(joinSubList(tok, j))); |
16 | ret pair(join(tok), varNames_out); |
17 | } |
Began life as a copy of #1024301
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024302 |
Snippet name: | dollarVarsToRegexp_generic |
Eternal ID of this version: | #1024302/3 |
Text MD5: | 4749f22a5d2deccec54e28e1891b9e21 |
Transpilation MD5: | 06bb8dbc03c9a0a803dc7383cecc5314 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-30 22:59:32 |
Source code size: | 529 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 184 / 267 |
Version history: | 2 change(s) |
Referenced in: | [show references] |