}
if (tid != TTokenID.VARID
&& tid != TTokenID.CONID
&& tid != TTokenID.QUALIFIER
&& (tid < TTokenID.LOP0 || tid > TTokenID.SOMEOP)) return null;
final TMaybe mb = TGlobal.resolved(g, tok);
final DJust just = mb._Just();
if (just == null) return null;
final TEither lr = Delayed.<TEither>forced( just.mem1 );
final DRight right = lr._Right();
if (right != null) {
// this is a QName
TQName q = Delayed.<TQName>forced( right.mem1 );
final TMaybe mbsym = TGlobal.findit(g, q).<TMaybe>forced();
final DJust jsym = mbsym._Just();
if (jsym == null) return null; // not found?
final TSymbolT sym = Delayed.<TSymbolT>forced( jsym.mem1 );
System.err.println("getLinkTarget: " + QNames.IShow_QName.show(q));
return new Symbol(g, sym);
}
final DLeft left = lr._Left();
if (left != null) {
// this is a namespace
String ns = TToken.value(tok);
final TTree tree = TGlobal.namespaces(g);
final TMaybe mbpack = TTree.M.lookupS(tree, ns);
final DJust jpack = mbpack._Just();
if (jpack == null) return null;
String pack = Delayed.<java.lang.String>forced(jpack.mem1);
return new Namespace(g, ns, pack);
}
}