token-stream

WebJar for token-stream

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

token-stream
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

token-stream
WebJar for token-stream
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/pugjs/token-stream

Скачать token-stream

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/token-stream/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>token-stream</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/token-stream/
implementation 'org.webjars.npm:token-stream:0.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/token-stream/
implementation ("org.webjars.npm:token-stream:0.0.1")
'org.webjars.npm:token-stream:jar:0.0.1'
<dependency org="org.webjars.npm" name="token-stream" rev="0.0.1">
  <artifact name="token-stream" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='token-stream', version='0.0.1')
)
libraryDependencies += "org.webjars.npm" % "token-stream" % "0.0.1"
[org.webjars.npm/token-stream "0.0.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

token-stream

Take an array of token and produce a more useful API to give to a parser.

Build Status Dependency Status NPM version

Installation

npm install token-stream

Usage

var TokenStream = require('token-stream');

var stream = new TokenStream([
  'a',
  'b',
  'c',
  'd'
]);
assert(stream.peek() === 'a');
assert(stream.lookahead(0) == 'a');
assert(stream.lookahead(1) == 'b');

assert(stream.advance() === 'a');
assert(stream.peek() === 'b');
assert(stream.lookahead(0) == 'b');
assert(stream.lookahead(1) == 'c');

stream.defer('z');
assert(stream.peek() === 'z');
assert(stream.lookahead(0) == 'z');
assert(stream.lookahead(1) == 'b');
assert(stream.advance() === 'z');
assert(stream.advance() === 'b');
assert(stream.advance() === 'c');
assert(stream.advance() === 'd');

// an error is thrown if you try and advance beyond the end of the stream
assert.throws(function () {
  stream.advance();
});

API

stream.peek()

Gets and returns the next item in the stream without advancing the stream's position.

stream.advance()

Returns the next item in the stream and advances the stream by one item.

stream.defer(token)

Put a token on the start of the stream (useful if you need to back track after calling advance).

stream.lookahead(index)

Return the item at index position from the start of the stream, but don't advance the stream. stream.lookahead(0) is equivalent to stream.peek().

License

MIT

org.webjars.npm

Pug

Версии библиотеки

Версия
0.0.1