Fix bugs in SGScriptReader & SGScriptParser

1. In SGScriptReader, script string length should use the modified
version’s length.
2. Add Parser test function.