function _getContextState(ctx) {
        if (!ctx || !ctx.token) {
            return null;
        }
        var state = ctx.token.state.localState || ctx.token.state;
        // if state contains a valid html inner state use that first
        if (state.htmlState) {
            state = ctx.token.state.htmlState;
        } else {
            if (!state.context && ctx.token.state.html && ctx.token.state.html.localState) {
                state = ctx.token.state.html.localState;
            }
        }
        return state;
    }
@private
Returns state of a context
@param {{editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}}} ctx
@return {{tokenize:function, state:string, stateArg:string, context:Object}}