static L<E> parsePoem(S input) { if (isSnippetID(input)) ret loadPoemAndParse(input); ret parsePoem(toLinesFullTrim(input)); } static L<E> parsePoem(L<S> lines) { char mode = ' '; new L<E> entries; for (S line : lines) { new E e; if (line.startsWith("!")) { e.test = true; line = line.substring(1).trim(); } if (swicAny(line, litlist("Q:", "U:", "Usr:"))) { mode = 'q'; line = line.substring(line.indexOf(':')+1).trim(); } else if (swicAny(line, litlist("A:", "B:", "Bot:"))) { mode = 'a'; line = line.substring(line.indexOf(':')+1).trim(); } else if (startsWith(line, "[")) mode = 's'; if (mode == 'q') e.q = line; else if (mode == 'a') e.a = line; else { e.comment = getJavaLineComment(line); S s = javaDropComments(line).trim(); e.state = dropPrefix("[", dropSuffix("]", s)).trim(); } entries.add(e); } ret entries; }
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: | #1003070 |
| Snippet name: | parsePoem |
| Eternal ID of this version: | #1003070/1 |
| Text MD5: | 1ca3fc4521ce73994ad98c64ad877d73 |
| Author: | stefan |
| Category: | eleu / nl |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-07-19 17:49:49 |
| Source code size: | 990 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1117 / 1364 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |