mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 05:52:02 +02:00
Initial commit
This commit is contained in:
14
node_modules/token-stream/.npmignore
generated
vendored
Normal file
14
node_modules/token-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
pids
|
||||
logs
|
||||
results
|
||||
npm-debug.log
|
||||
node_modules
|
||||
coverage
|
3
node_modules/token-stream/.travis.yml
generated
vendored
Normal file
3
node_modules/token-stream/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
19
node_modules/token-stream/LICENSE
generated
vendored
Normal file
19
node_modules/token-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 Forbes Lindesay
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
68
node_modules/token-stream/README.md
generated
vendored
Normal file
68
node_modules/token-stream/README.md
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# token-stream
|
||||
|
||||
Take an array of token and produce a more useful API to give to a parser.
|
||||
|
||||
[](https://travis-ci.org/jadejs/token-stream)
|
||||
[](https://gemnasium.com/jadejs/token-stream)
|
||||
[](https://www.npmjs.org/package/token-stream)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install token-stream
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
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.adavance();
|
||||
});
|
||||
```
|
||||
|
||||
## 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
|
30
node_modules/token-stream/index.js
generated
vendored
Normal file
30
node_modules/token-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = TokenStream;
|
||||
function TokenStream(tokens) {
|
||||
if (!Array.isArray(tokens)) {
|
||||
throw new TypeError('tokens must be passed to TokenStream as an array.');
|
||||
}
|
||||
this._tokens = tokens;
|
||||
}
|
||||
TokenStream.prototype.lookahead = function (index) {
|
||||
if (this._tokens.length <= index) {
|
||||
throw new Error('Cannot read past the end of a stream');
|
||||
}
|
||||
return this._tokens[index];
|
||||
};
|
||||
TokenStream.prototype.peek = function () {
|
||||
if (this._tokens.length === 0) {
|
||||
throw new Error('Cannot read past the end of a stream');
|
||||
}
|
||||
return this._tokens[0];
|
||||
};
|
||||
TokenStream.prototype.advance = function () {
|
||||
if (this._tokens.length === 0) {
|
||||
throw new Error('Cannot read past the end of a stream');
|
||||
}
|
||||
return this._tokens.shift();
|
||||
};
|
||||
TokenStream.prototype.defer = function (token) {
|
||||
this._tokens.unshift(token);
|
||||
};
|
50
node_modules/token-stream/package.json
generated
vendored
Normal file
50
node_modules/token-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"_from": "token-stream@0.0.1",
|
||||
"_id": "token-stream@0.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-zu78cXp2xDFvEm0LnbqlXX598Bo=",
|
||||
"_location": "/token-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "token-stream@0.0.1",
|
||||
"name": "token-stream",
|
||||
"escapedName": "token-stream",
|
||||
"rawSpec": "0.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pug-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz",
|
||||
"_shasum": "ceeefc717a76c4316f126d0b9dbaa55d7e7df01a",
|
||||
"_spec": "token-stream@0.0.1",
|
||||
"_where": "/home/runner/Socketio-Chat-Template/node_modules/pug-parser",
|
||||
"author": {
|
||||
"name": "ForbesLindesay"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jadejs/token-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Take an array of token and produce a more useful API to give to a parser",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.3.2"
|
||||
},
|
||||
"homepage": "https://github.com/jadejs/token-stream#readme",
|
||||
"license": "MIT",
|
||||
"name": "token-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jadejs/token-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover test",
|
||||
"test": "node test && npm run coverage"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
46
node_modules/token-stream/test/index.js
generated
vendored
Normal file
46
node_modules/token-stream/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var TokenStream = require('../');
|
||||
|
||||
assert.throws(function () {
|
||||
new TokenStream('foo,bar');
|
||||
});
|
||||
var stream = new TokenStream([
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd'
|
||||
]);
|
||||
assert.throws(function () {
|
||||
stream.lookahead(9);
|
||||
});
|
||||
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');
|
||||
assert.throws(function () {
|
||||
stream.peek();
|
||||
});
|
||||
assert.throws(function () {
|
||||
stream.lookahead(0);
|
||||
});
|
||||
assert.throws(function () {
|
||||
stream.lookahead(1);
|
||||
});
|
||||
assert.throws(function () {
|
||||
stream.advance();
|
||||
});
|
Reference in New Issue
Block a user