static Pair<S, LS> ai_groupUsingProductionsAndReturnGroups(S s, AI_BottomUpParser1 p) { p.splitSplittables = false; p.parse(javaTokNPunctuation(s)); new LS groups; for (AI_BottomUpParser1.Word g : p.groups()) { int i = g.wordFrom*2+1, j = g.wordTo*2-1; S pre = get(p.cnc, i-1), post = get(p.cnc, j+1); //print("pre=" + pre + ", post=" + post); groups.add(joinSubList(p.cnc, i, j+1)); if (endsWith(pre, "{") && startsWith(post, "}")) continue; tokPrepend(p.cnc, i, "{"); tokAppend(p.cnc, j, "}"); } ret pair(join(p.cnc), groups); }
Began life as a copy of #1018199
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1021311 |
| Snippet name: | ai_groupUsingProductionsAndReturnGroups |
| Eternal ID of this version: | #1021311/4 |
| Text MD5: | 4f0905a07cfbb25b627e1e2da4e9b7dd |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-02-08 15:39:02 |
| Source code size: | 591 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 487 / 519 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |