protected void appendNodeDeclarationAndMain(String loadedSource, StringBuilder sourceDeclaration, StringBuilder source, ShaderNode shaderNode, ShaderGenerationInfo info, String shaderPath) {
        if (loadedSource.length() > 1) {
            loadedSource = loadedSource.substring(0, loadedSource.lastIndexOf("}"));
            String[] sourceParts = loadedSource.split("\\s*void\\s*main\\s*\\(\\s*\\)\\s*\\{");
            if(sourceParts.length<2){
                throw new IllegalArgumentException("Syntax error in "+ shaderPath +". Cannot find 'void main(){' in \n"+ loadedSource);
            }
            generateDeclarativeSection(sourceDeclaration, shaderNode, sourceParts[0], info);
            generateNodeMainSection(source, shaderNode, sourceParts[1], info);
        } else {
            //if source is empty, we still call generateNodeMainSection so that mappings can be done.
            generateNodeMainSection(source, shaderNode, loadedSource, info);
        }

    }
Appends declaration and main part of a node to the shader declaration and
main part. the loadedSource is split by "void main(){" to split
declaration from main part of the node source code.The trailing "}" is
removed from the main part. Each part is then respectively passed to
generateDeclarativeSection and generateNodeMainSection.

@see ShaderGenerator#generateDeclarativeSection
@see ShaderGenerator#generateNodeMainSection

@param loadedSource the actual source code loaded for this node.
@param shaderPath path to the shader file
@param sourceDeclaration the Shader declaration part string builder.
@param source the Shader main part StringBuilder.
@param shaderNode the shader node.
@param info the ShaderGenerationInfo.
jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java