Libraryless. Click here for Pure Java version (637L/5K/15K).
1 | !752 |
2 | |
3 | p {
|
4 | S rule = "= = idword"; |
5 | L<S> lr = splitAtJavaToken(rule, "="); |
6 | print(structure(lr)); |
7 | S l, r; |
8 | if (l(lr) == 1) {
|
9 | l = ""; |
10 | r = lr.get(0); |
11 | } else if (l(lr) >= 2) {
|
12 | l = join(" = ", lr.subList(0, l(lr)-1));
|
13 | r = last(lr); |
14 | } else {
|
15 | print("Weird rule: " + rule);
|
16 | ret; |
17 | } |
18 | print(quote(l) + " = " + quote(r)); |
19 | } |
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: | #1002737 |
| Snippet name: | Test = splitting |
| Eternal ID of this version: | #1002737/1 |
| Text MD5: | 68d915aa163cc3ca96adf648c65e65ba |
| Transpilation MD5: | d8b52a1aea4a64b2d97533dd2879e36b |
| Author: | stefan |
| Category: | snl |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-02-18 21:37:27 |
| Source code size: | 366 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 802 / 896 |
| Referenced in: | [show references] |