Libraryless. Click here for Pure Java version (2934L/18K).
1 | static L<Tree<S>> indentedStringsToForest(LS l) {
|
2 | if (empty(l)) ret emptyList(); |
3 | int baseIndent = indentWidth(first(l)); |
4 | new L<Tree<S>> forest; |
5 | for ping (int i = 0; i < l(l); ) {
|
6 | int j = i+1; |
7 | while (j < l(l) && indentWidth(l.get(j)) > baseIndent) ++j; |
8 | forest.add(new Tree<S>(ltrim(l.get(i)), indentedStringsToForest(subList(l, i+1, j)))); |
9 | i = j; |
10 | } |
11 | ret forest; |
12 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1030348 |
| Snippet name: | indentedStringsToForest |
| Eternal ID of this version: | #1030348/5 |
| Text MD5: | d32caa18489b0f2fd68ba540cf60c4f0 |
| Transpilation MD5: | e8ffdfe95ae795e2031d9adde775ccca |
| Author: | stefan |
| Category: | javax / parsing |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-12-05 21:04:35 |
| Source code size: | 400 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 387 / 502 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |