static L<TokenAndRange> addRangesToTokenization(S text, LS tokens) { if (tokens == null) null; L<TokenAndRange> out = emptyList(tokens); int i = 0; for (S tok : tokens) { int j = i+l(tok); out.add(TokenAndRange(tok, intRange(i, j), text)); i = j; } ret out; } static L<TokenAndRange> addRangesToTokenization(LS tokens) { ret addRangesToTokenization(join(tokens), tokens); }
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: | #1021204 |
Snippet name: | addRangesToTokenization |
Eternal ID of this version: | #1021204/2 |
Text MD5: | e9fa4a249932fe45cfc905e129f11ff5 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-03 00:54:20 |
Source code size: | 414 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 393 / 419 |
Version history: | 1 change(s) |
Referenced in: | [show references] |