static S[] match2x(L<S> pat, L<S> tok) {
new ArrayList<S> result;
if (pat.size() != tok.size()) null;
for (int i = 1; i < pat.size(); i += 2) {
S p = pat.get(i), t = tok.get(i);
bool match;
if (eq(p, "*")) match = true;
else if (eq(p, "<quoted>")) match = isQuoted(t);
else if (eq(p, "<id>")) match = isIdentifier(t);
else if (eq(p, "<int>")) match = isInteger(t);
else { if (!eq(p, t)) null; continue; }
if (!match) null;
result.add(t);
}
return result.toArray(new S[result.size()]);
}
Began life as a copy of #1000812
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017132 |
| Snippet name: | match2x |
| Eternal ID of this version: | #1017132/2 |
| Text MD5: | 738f9f91f238993d54e2145ff9568bcc |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-12 17:58:31 |
| Source code size: | 549 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 825 / 867 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |