Libraryless. Click here for Pure Java version (9857L/55K).
srecord noeq Tok_IdentifierSemicolonToReturnStatement(LS tok) { Set<S> exceptions = defaultExceptions; static Set<S> defaultExceptions = litset("break", "continue", "return", "else", "endifdef", "endif"); Set<S> precedingTokens = defaultPrecedingTokens; static Set<S> defaultPrecedingTokens = litset("}", ";"); TokCondition cond = new { public bool get(L<S> tok, int nIdx) { ret contains(precedingTokens, _get(tok, nIdx-1)) && !contains(exceptions, tok.get(nIdx+1)); } }; run { for (S pre : precedingTokens) jreplace(tok, "<id>;", "ret $1;", cond); } }
Began life as a copy of #1035525
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035526 |
| Snippet name: | Tok_IdentifierSemicolonToReturnStatement |
| Eternal ID of this version: | #1035526/5 |
| Text MD5: | 8e74d624a2e0fefec5b777cfef09ad2e |
| Transpilation MD5: | 04660ac12894f8b38c50f6ac7815342d |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-06-04 05:02:32 |
| Source code size: | 625 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 577 / 694 |
| Version history: | 4 change(s) |
| Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |