src/utils/TokenUtils.js
function movePrevToken(ctx, precise) {
        if (precise === undefined) {
            precise = true;
        }

        if (ctx.pos.ch <= 0 || ctx.token.start <= 0) {
            //move up a line
            if (ctx.pos.line <= 0) {
                return false; //at the top already
            }
            ctx.pos.line--;
            ctx.pos.ch = ctx.editor.getLine(ctx.pos.line).length;
        } else {
            ctx.pos.ch = ctx.token.start;
        }
        ctx.token = getTokenAt(ctx.editor, ctx.pos, precise);
        return true;
    }
function movePrevToken(ctx, precise) {
        if (precise === undefined) {
            precise = true;
        }

        if (ctx.pos.ch <= 0 || ctx.token.start <= 0) {
            //move up a line
            if (ctx.pos.line <= 0) {
                return false; //at the top already
            }
            ctx.pos.line--;
            ctx.pos.ch = ctx.editor.getLine(ctx.pos.line).length;
        } else {
            ctx.pos.ch = ctx.token.start;
        }
        ctx.token = getTokenAt(ctx.editor, ctx.pos, precise);
        return true;
    }
function movePrevToken ( ctx , precise ) { if ( precise === undefined ) { precise = true ; } if ( ctx . pos . ch <= 0 || ctx . token . start <= 0 ) { //move up a line if ( ctx . pos . line <= 0 ) { return false ; //at the top already } ctx . pos . line -- ; ctx . pos . ch = ctx . editor . getLine ( ctx . pos . line ) . length ; } else { ctx . pos . ch = ctx . token . start ; } ctx . token = getTokenAt ( ctx . editor , ctx . pos , precise ) ; return true ; }
Moves the given context backwards by one token.
@param {!{editor:!CodeMirror, pos:!{ch:number, line:number}, token:Object}} ctx
@param {boolean=} precise If code is being edited, use true (default) for accuracy.
If parsing unchanging code, use false to use cache for performance.
@return {boolean} whether the context changed
Moves the given context backwards by one token .