function getModeAt(cm, pos, precise) {
        precise = precise || true;
        var modeData = cm.getMode(),
            name;

        if (modeData.innerMode) {
            modeData = CodeMirror.innerMode(modeData, getTokenAt(cm, pos, precise).state).mode;
        }

        name = (modeData.name === "xml") ?
                modeData.configuration : modeData.name;

        return {mode: modeData, name: name};
    }
Returns the mode object and mode name string at a given position
@param {!CodeMirror} cm CodeMirror instance
@param {!{line:number, ch:number}} pos Position to query for mode
@param {boolean} precise If given, results in more current results. Suppresses caching.
@return {mode:{Object}, name:string}