static S[] match2x(L pat, L tok) { new ArrayList 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, "")) match = isQuoted(t); else if (eq(p, "")) match = isIdentifier(t); else if (eq(p, "")) match = isInteger(t); else { if (!eq(p, t)) null; continue; } if (!match) null; result.add(t); } return result.toArray(new S[result.size()]); }