// returns: (CtxCase, closing line number) // or null static Pair<CtxCase, Int> ctxCase(L<S> lines, int i) { new Matches m; new CtxCase c; while (i <= l(lines) && emptyAfterTrim(get(lines, i))) ++i; S l = get(lines, i); if (startsWith(trim(get(lines, i+1)), ")")) { lines.set(i, l += get(lines, i+1)); lines.remove(i+1); } if (jmatch("DEFAULT ACTION", l) || jmatch("ACTION", l)) {} else if (flexMatch("CASE (*) ACTION", l, m, false)) c.condition = m.get(0); else null; Pair<SS, Int> p = ctxParseProperties(lines, i+1); c.properties = p.a; int opening = p.b; int closing = indexOfClosingCurlyBracket(lines, p.b); c.action = tok_unCurlyBracket(lines(subList(lines, p.b, closing+1))); ret pair(c, closing); }
Began life as a copy of #1008883
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: | #1008924 |
| Snippet name: | ctxCase |
| Eternal ID of this version: | #1008924/6 |
| Text MD5: | 337c9b1c32f58c44a1117859ef002d3f |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-07-14 18:37:17 |
| Source code size: | 782 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 668 / 734 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |