Convert parts of EwtnFileIndexParser.groovy from JavaScript to Groovy.