{
// TODO optimize with hardcoded parser??
StringTokenizer st = new StringTokenizer( script, " \t\n\r\f(){}", false );
if( !st.hasMoreTokens() )
{
throw new ScriptException( "The word \"function\" was not found in script: " + scriptName );
}
String fx = st.nextToken();
if( !"function".equals( fx ) )
{
throw new ScriptException( "The word \"function\" was not found in script: " + scriptName );
}
if( !st.hasMoreTokens() )
{
throw new ScriptException( "Invalid syntax in: " + scriptName + "\n No function name." );
}
return st.nextToken();
}