1 | static L<S> ocr_parseGroups(S s) { |
2 | new L<S> l; |
3 | for i over s: |
4 | if (s.charAt(i) == '\\' && i+1 < l(s)) { // parse escaped character |
5 | ++i; |
6 | l.add(substring(s, i, i+1)); |
7 | } else if (s.charAt(i) == '[') { // parse group |
8 | int j = i+1; |
9 | new StringBuilder buf; |
10 | while (j < l(s) && s.charAt(j) != ']') { |
11 | if (s.charAt(j) == '\\' && j+1 < l(s) |
12 | && eqOneOf(s.charAt(j+1), '[', ']')) ++j; |
13 | buf.append(s.charAt(j++)); |
14 | } |
15 | l.add(str(buf)); |
16 | i = j; |
17 | } else |
18 | l.add(substring(s, i, i+1)); |
19 | ret l; |
20 | } |
Began life as a copy of #1006107
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006254 |
Snippet name: | ocr_parseGroups - see: ocr_escapeMeaning |
Eternal ID of this version: | #1006254/1 |
Text MD5: | 86ad8ac2275c178fe52dfa1466d4a0cb |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-26 00:47:34 |
Source code size: | 582 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 527 / 525 |
Referenced in: | [show references] |