* The next token (CSS Syntax §3 "next token") — the upcoming token without * consuming it; the `<eof-token>` once the source is exhausted. This is the * token the consume algorithms dispatch on (the spec's "process"). Tokenized * from `_pos` on first use and cached until consumed; comment toke
()
| 1937 | * @returns {MutableToken} the next token |
| 1938 | */ |
| 1939 | next() { |
| 1940 | if (this._next === undefined) { |
| 1941 | const input = this.input; |
| 1942 | const tok = this._tok; |
| 1943 | let pos = this._pos; |
| 1944 | for (;;) { |
| 1945 | const t = readToken(input, pos, tok); |
| 1946 | if (t === undefined) { |
| 1947 | this._next = fill(tok, TT_EOF, input.length, input.length); |
| 1948 | break; |
| 1949 | } |
| 1950 | if (t.type === TT_COMMENT) { |
| 1951 | if (t.start >= this._commentHigh) { |
| 1952 | if (this._onComment) this._onComment(input, t.start, t.end); |
| 1953 | this._commentHigh = t.end; |
| 1954 | } |
| 1955 | pos = t.end; |
| 1956 | continue; |
| 1957 | } |
| 1958 | this._next = t; |
| 1959 | break; |
| 1960 | } |
| 1961 | } |
| 1962 | return /** @type {MutableToken} */ (this._next); |
| 1963 | } |
| 1964 | |
| 1965 | /** |
| 1966 | * Consume a token (CSS Syntax §3 "consume a token") — return the next token |
no test coverage detected