samples/JavaScript/ccalc-lex.js
// return next match that has a token
return next match that has a token
return next match that has a token
function lexer_lex() {
        var r;
        if (typeof this.options.pre_lex === 'function') {
            r = this.options.pre_lex.call(this);
        }
        while (!r) {
            r = this.next();
        }
        if (typeof this.options.post_lex === 'function') {
            r = this.options.post_lex.call(this, r) || r;
        }
        return r;
    }
function lexer_lex ( ) { var r ; if ( typeof this . options . pre_lex === 'function' ) { r = this . options . pre_lex . call ( this ) ; } while ( ! r ) { r = this . next ( ) ; } if ( typeof this . options . post_lex === 'function' ) { r = this . options . post_lex . call ( this , r ) || r ; } return r ; }
return next match that has a token
return next match that has a token
// allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: // (also account for a userdef function which does not return any value: keep the token as is)