public VariableMapping readInputMapping(Statement statement) throws MatParseException {

        VariableMapping mapping;
        try {
            mapping = parseMapping(statement, IM_HAS_NAME_SPACE);
        } catch (final Exception e) {
            throw new MatParseException("Unexpected mapping format", statement, e);
        }

        final ShaderNodeDefinition definition = shaderNode.getDefinition();
        final ShaderNodeVariable left = mapping.getLeftVariable();
        final ShaderNodeVariable right = mapping.getRightVariable();
        final String expression = mapping.getRightExpression();

        if (!updateVariableFromList(left, definition.getInputs())) {
            throw new MatParseException(left.getName() + " is not an input variable of " + definition.getName(), statement);
        } else if (left.getType().startsWith("sampler") && (right == null || !right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_MAT_PARAM))) {
            throw new MatParseException("Samplers can only be assigned to MatParams", statement);
        }

        if (right == null && expression == null) {
            throw new MatParseException("The mapping doesn't have a right variable or a right expression.", statement);
        }

        if (right == null) {
            return mapping;
        }

        if (right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_GLOBAL)) {
            right.setType("vec4"); // Globals are all vec4 for now (maybe forever...)
            storeGlobal(right, statement);
        } else if (right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_VERTEX_ATTRIBUTE)) {
            if (definition.getType() == ShaderType.Fragment) {
                throw new MatParseException("Cannot have an attribute as input in a fragment shader" + right.getName(), statement);
            }
            updateVarFromAttributes(mapping.getRightVariable(), mapping);
            storeAttribute(mapping.getRightVariable());
        } else if (right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_MAT_PARAM)) {

            MatParam param = findMatParam(right.getName());
            if (param == null) {
                throw new MatParseException("Could not find a Material Parameter named " + right.getName(), statement);
            }

            if (definition.getType() == ShaderType.Vertex) {
                if (updateRightFromUniforms(param, mapping, vertexDeclaredUniforms, statement)) {
                    updateMaterialTextureType(statement, mapping, left, param);
                    storeVertexUniform(mapping.getRightVariable());
                }
            } else {
                if (updateRightFromUniforms(param, mapping, fragmentDeclaredUniforms, statement)) {
                    updateMaterialTextureType(statement, mapping, left, param);
                    storeFragmentUniform(mapping.getRightVariable());
                }
            }

        } else if (right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_WORLD_PARAM)) {

            UniformBinding worldParam = findWorldParam(right.getName());
            if (worldParam == null) {
                throw new MatParseException("Could not find a World Parameter named " + right.getName(), statement);
            }

            if (definition.getType() == ShaderType.Vertex) {
                if (updateRightFromUniforms(worldParam, mapping, vertexDeclaredUniforms)) {
                    storeVertexUniform(mapping.getRightVariable());
                }
            } else {
                if (updateRightFromUniforms(worldParam, mapping, fragmentDeclaredUniforms)) {
                    storeFragmentUniform(mapping.getRightVariable());
                }
            }

        } else {

            ShaderNode node = nodes.get(right.getNameSpace());

            if (node == null) {
                throw new MatParseException("Undeclared node" + right.getNameSpace() +
                        ". Make sure this node is declared before the current node", statement);
            }

            ShaderNodeVariable var = findNodeOutput(node.getDefinition().getOutputs(), right.getName());

            if (var == null) {
                throw new MatParseException("Cannot find output variable" + right.getName() +
                        " form ShaderNode " + node.getName(), statement);
            }

            right.setNameSpace(node.getName());
            right.setType(var.getType());
            right.setMultiplicity(var.getMultiplicity());

            mapping.setRightVariable(right);

            storeVaryings(node, mapping.getRightVariable());
        }

        checkTypes(mapping, statement);

        return mapping;
    }
Reads an input mapping.

@param statement the statement being read.
@return the variable mapping.
@throws MatParseException if we have a problem with parsing input mapping statement.
jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java