19
LINES
JavaX fragment (include)
1 | static int matchMeta(L<S> tok, S... tokens) {
|
2 | outer: for (int i = 1; i+l(tokens)*2-2 < l(tok); i += 2) {
|
3 | for (int j = 0; j < l(tokens); j++) {
|
4 | S p = tokens[j];
|
5 | S t = tok.get(i+j*2);
|
6 | boolean ok;
|
7 | if (eq(p, "<number>"))
|
8 | ok = isInteger(t);
|
9 | else if (eq(p, "*"))
|
10 | ok = true;
|
11 | else
|
12 | ok = eq(p, t);
|
13 | if (!ok)
|
14 | continue outer;
|
15 | }
|
16 | return i;
|
17 | }
|
18 | return -1;
|
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
ID |
Author/Program |
Comment |
Date |
1190 | stefan | Actually, it's a "find", not a "match" (looks for a partial match) | 2015-12-13 17:32:41 |
add comment
Snippet ID: |
#1001944 |
Snippet name: |
matchMeta |
Eternal ID of this version: |
#1001944/1 |
Text MD5: |
6da45cb07227511f73dd1cdcee896750 |
Author: |
stefan |
Category: |
|
Type: |
JavaX fragment (include) |
Public (visible to everyone): |
Yes |
Archived (hidden from active list): |
No |
Created/modified: |
2015-12-09 01:06:34 |
Source code size: |
449 bytes / 19 lines |
Pitched / IR pitched: |
No / Yes |
Views / Downloads: |
997 / 1155 |
Referenced in: |
[show references] |