Uploading the main structure

هذا الالتزام موجود في:
2025-08-18 23:23:28 +03:00
التزام e696f2f4cd
1011 ملفات معدلة مع 275020 إضافات و0 حذوفات

14
node_modules/token-stream/.npmignore مولّد مباع Normal file
عرض الملف

@@ -0,0 +1,14 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
npm-debug.log
node_modules
coverage

16
node_modules/token-stream/.travis.yml مولّد مباع Normal file
عرض الملف

@@ -0,0 +1,16 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"
after_success:
- npm run coverage
- npm i coveralls
- cat ./coverage/lcov.info | coveralls
notifications:
email:
on_success: never

5
node_modules/token-stream/HISTORY.md مولّد مباع Normal file
عرض الملف

@@ -0,0 +1,5 @@
1.0.0 / 2016-06-01
==================
* Update repo URL in `package.json`.
* Mark as stable.

19
node_modules/token-stream/LICENSE مولّد مباع 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 مولّد مباع Normal file
عرض الملف

@@ -0,0 +1,68 @@
# token-stream
Take an array of token and produce a more useful API to give to a parser.
[![Build Status](https://img.shields.io/travis/pugjs/token-stream/master.svg)](https://travis-ci.org/pugjs/token-stream)
[![Dependency Status](https://img.shields.io/david/pugjs/token-stream.svg)](https://david-dm.org/pugjs/token-stream)
[![NPM version](https://img.shields.io/npm/v/token-stream.svg)](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.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

30
node_modules/token-stream/index.js مولّد مباع 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);
};

19
node_modules/token-stream/package.json مولّد مباع Normal file
عرض الملف

@@ -0,0 +1,19 @@
{
"name": "token-stream",
"version": "1.0.0",
"description": "Take an array of token and produce a more useful API to give to a parser",
"dependencies": {},
"devDependencies": {
"istanbul": "*"
},
"scripts": {
"test": "node test && npm run coverage",
"coverage": "istanbul cover test"
},
"repository": {
"type": "git",
"url": "https://github.com/pugjs/token-stream.git"
},
"author": "ForbesLindesay",
"license": "MIT"
}

46
node_modules/token-stream/test/index.js مولّد مباع 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();
});