private InvarType searchType (final String name, final Node n) throws Exception
    {
        String[] names = name.split(SPLIT_PACK_TYPE);
        String typeName = null;
        InvarPackage typePack = null;
        InvarType fieldType = null;
        if (names.length == 1)
        {
            typeName = names[0];
        }
        else if (names.length == 2)
        {
            typePack = context.findOrCreatePack(names[0]);
            typeName = names[1];
        }
        else
        {
            onError(n, "Invalid type name: " + name);
        }
        fieldType = context.findBuildInType(typeName);
        if (fieldType != null)
            return fieldType;
        if (typePack != null)
        {
            fieldType = typePack.getType(typeName);
            if (fieldType != null)
                return fieldType;
        }
        else
        {
            List<InvarType> types = context.findTypes(typeName);
            if (types.size() == 1)
            {
                fieldType = types.get(0);
                return fieldType;
            }
            else if (types.size() > 1)
            {
                StringBuilder s = new StringBuilder();
                for (InvarType t : types)
                    s.append("\n" + t.fullName(SPLIT_PACK_TYPE));
                onError(n, "Find " + types.size() + " types. You should select one." + s.toString());
            }
            else
            {
            }
        }
        if (fieldType == null)
        {
            onError(n, "Undefined type: " + name);
        }
        return fieldType;
    }