Code coverage report for lib/interpret.js

Statements: 100% (13 / 13)      Branches: 100% (4 / 4)      Functions: 100% (1 / 1)      Lines: 100% (12 / 12)      Ignored: none     

All files » lib/ » interpret.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28    1   1 6   6             6 31 31 25 25 13   12         1  
'use strict';
 
var word = require('./word');
 
function interpret (str) {
    var input, w, wordLink;
 
    input = {
        buf: str,
        ptr: 0,
        last: str.length - 1,
        word: word.str
    };
 
    while (true) {
        w = input.word('\\s');
        if (w === undefined) { return; }
        wordLink = this.O[w.toLowerCase()];
        if (wordLink) {
            this[wordLink.index]();
        } else {
            this.dpush(Number(w));
        }
    }
}
 
module.exports = interpret;