docs: function scan(tokens, states, i, j) {
    let newItem
      , curr = states[i][j];
  
    // scan
    if (curr.rule[curr.position] instanceof RegExp) {
      // regex matches token
      if (curr.rule[curr.position].test(tokens[i]) && i < tokens.length) {
        newItem = Object.assign({}, curr);
        newItem.position += 1;
        states[i + 1].push(newItem);
      }
    }
    if (typeof curr.rule[curr.position] === 'string') {
      // string equals token
      if (curr.rule[curr.position] === tokens[i] && i < tokens.length) {
        newItem = Object.assign({}, curr);
        newItem.position += 1;
        states[i + 1].push(newItem);
      }
    }
  }