{
Expr expr = null ;
if ( item.isList() )
{
ItemList list = item.getList() ;
if ( list.size() == 0 )
BuilderLib.broken(item, "Empty list for expression") ;
Item head = list.get(0) ;
if ( head.isNode() )
{
if ( head.getNode().isVariable() && list.size() == 1 )
{
// The case of (?z)
return new ExprVar(Var.alloc(head.getNode())) ;
}
return buildFunctionCall(list) ;
}
else if ( head.isList() )
BuilderLib.broken(item, "Head is a list") ;
else if ( head.isSymbol() )
{
if ( item.isTagged(Tags.tagExpr) )
{
BuilderLib.checkLength(2, list, "Wrong length: "+item.shortString()) ;
item = list.get(1) ;
return buildItem(item) ;
}
return buildKnownFunction(list) ;
}