Initial commit
This commit is contained in:
66
node_modules/pug-lexer/History.md
generated
vendored
Normal file
66
node_modules/pug-lexer/History.md
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
2.3.0 / 2016-09-11
|
||||
==================
|
||||
|
||||
* Update is-expression to 3.0.0
|
||||
|
||||
2.2.2 / 2016-09-07
|
||||
==================
|
||||
|
||||
* Support non-standard class names that start with two hyphens in class
|
||||
literals, most notably used in Bemto
|
||||
|
||||
2.2.1 / 2016-08-29
|
||||
==================
|
||||
|
||||
* Fix semantics of `isExpression` plugin
|
||||
|
||||
2.2.0 / 2016-08-26
|
||||
==================
|
||||
|
||||
* Allow customizing `isExpression`
|
||||
|
||||
2.1.0 / 2016-08-22
|
||||
==================
|
||||
|
||||
* Allow attributes that start with a colon
|
||||
|
||||
2.0.3 / 2016-08-07
|
||||
==================
|
||||
|
||||
* Allow `when` expressions with colons
|
||||
* Fix incorrect location of some errors
|
||||
|
||||
2.0.2 / 2016-06-02
|
||||
==================
|
||||
|
||||
* Fix incorrect location of some invalid expressions in an attribute.
|
||||
|
||||
2.0.1 / 2016-05-31
|
||||
==================
|
||||
|
||||
* Update README for `filename` option
|
||||
|
||||
2.0.0 / 2016-05-14
|
||||
==================
|
||||
|
||||
* Take the `filename` as an option rather than special casing it. This means that lex only takes 2 arguments rather than 3
|
||||
* Add support for an inline comment after a block. This means block names can no longer contain `//`
|
||||
* Add type checking on arguments
|
||||
|
||||
1.2.0 / 2016-05-14
|
||||
==================
|
||||
|
||||
* Throw a more helpful error if someone attempts to use the old `- each foo in bar` syntax (it should not have the `- ` prefix)
|
||||
* Add Error reporting for invalid case expressions
|
||||
|
||||
1.0.1 / 2016-04-18
|
||||
==================
|
||||
|
||||
* Update dependencies
|
||||
- Update to `is-expression@2` which allows ES2015-style template strings
|
||||
by default.
|
||||
|
||||
1.0.0 / 2015-12-23
|
||||
==================
|
||||
|
||||
* First stable release
|
19
node_modules/pug-lexer/LICENSE
generated
vendored
Normal file
19
node_modules/pug-lexer/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.
|
73
node_modules/pug-lexer/README.md
generated
vendored
Normal file
73
node_modules/pug-lexer/README.md
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# pug-lexer
|
||||
|
||||
The pug lexer. This module is responsible for taking a string and converting it into an array of tokens.
|
||||
|
||||
[](https://travis-ci.org/pugjs/pug-lexer)
|
||||
[](https://david-dm.org/pugjs/pug?path=packages/pug-lexer)
|
||||
[](https://david-dm.org/pugjs/pug?path=packages/pug-lexer&type=dev)
|
||||
[](https://www.npmjs.org/package/pug-lexer)
|
||||
[](https://codecov.io/gh/pugjs/pug-lexer)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install pug-lexer
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var lex = require('pug-lexer');
|
||||
```
|
||||
|
||||
### `lex(str, options)`
|
||||
|
||||
Convert Pug string to an array of tokens.
|
||||
|
||||
`options` can contain the following properties:
|
||||
|
||||
- `filename` (string): The name of the Pug file; it is used in error handling if provided.
|
||||
- `plugins` (array): An array of plugins, in the order they should be applied.
|
||||
|
||||
```js
|
||||
console.log(JSON.stringify(lex('div(data-foo="bar")', {filename: 'my-file.pug'}), null, ' '))
|
||||
```
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "tag",
|
||||
"line": 1,
|
||||
"val": "div",
|
||||
"selfClosing": false
|
||||
},
|
||||
{
|
||||
"type": "attrs",
|
||||
"line": 1,
|
||||
"attrs": [
|
||||
{
|
||||
"name": "data-foo",
|
||||
"val": "\"bar\"",
|
||||
"escaped": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "eos",
|
||||
"line": 1
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### `new lex.Lexer(str, options)`
|
||||
|
||||
Constructor for a Lexer class. This is not meant to be used directly unless you know what you are doing.
|
||||
|
||||
`options` may contain the following properties:
|
||||
|
||||
- `filename` (string): The name of the Pug file; it is used in error handling if provided.
|
||||
- `interpolated` (boolean): if the Lexer is created as a child lexer for inline tag interpolation (e.g. `#[p Hello]`). Defaults to `false`.
|
||||
- `startingLine` (integer): the real line number of the first line in the input. It is also used for inline tag interpolation. Defaults to `1`.
|
||||
- `plugins` (array): An array of plugins, in the order they should be applied.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
366
node_modules/pug-lexer/index.d.ts
generated
vendored
Normal file
366
node_modules/pug-lexer/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,366 @@
|
||||
declare module 'pug-lexer' {
|
||||
namespace lex {
|
||||
export interface Loc {
|
||||
start: {line: number; column: number};
|
||||
end: {line: number; column: number};
|
||||
}
|
||||
|
||||
export type LexTokenType =
|
||||
| ':'
|
||||
| '&attributes'
|
||||
| 'attribute'
|
||||
| 'block'
|
||||
| 'blockcode'
|
||||
| 'call'
|
||||
| 'case'
|
||||
| 'class'
|
||||
| 'code'
|
||||
| 'comment'
|
||||
| 'default'
|
||||
| 'doctype'
|
||||
| 'dot'
|
||||
| 'each'
|
||||
| 'eachOf'
|
||||
| 'else-if'
|
||||
| 'else'
|
||||
| 'end-attributes'
|
||||
| 'end-pipeless-text'
|
||||
| 'end-pug-interpolation'
|
||||
| 'eos'
|
||||
| 'extends'
|
||||
| 'filter'
|
||||
| 'id'
|
||||
| 'if'
|
||||
| 'include'
|
||||
| 'indent'
|
||||
| 'interpolated-code'
|
||||
| 'interpolation'
|
||||
| 'mixin-block'
|
||||
| 'mixin'
|
||||
| 'newline'
|
||||
| 'outdent'
|
||||
| 'path'
|
||||
| 'slash'
|
||||
| 'start-attributes'
|
||||
| 'start-pipeless-text'
|
||||
| 'start-pug-interpolation'
|
||||
| 'tag'
|
||||
| 'text-html'
|
||||
| 'text'
|
||||
| 'when'
|
||||
| 'while'
|
||||
| 'yield';
|
||||
|
||||
export interface LexToken<Type extends LexTokenType> {
|
||||
type: Type;
|
||||
loc: Loc;
|
||||
}
|
||||
|
||||
export interface TagToken extends LexToken<'tag'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type StartAttributesToken = LexToken<'start-attributes'>;
|
||||
|
||||
export interface AttributeToken extends LexToken<'attribute'> {
|
||||
name: string;
|
||||
val: string | boolean;
|
||||
mustEscape: boolean;
|
||||
}
|
||||
|
||||
export type EndAttributesToken = LexToken<'end-attributes'>;
|
||||
|
||||
export interface IndentToken extends LexToken<'indent'> {
|
||||
val: number;
|
||||
}
|
||||
|
||||
export interface ClassToken extends LexToken<'class'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type OutdentToken = LexToken<'outdent'>;
|
||||
|
||||
export type EosToken = LexToken<'eos'>;
|
||||
|
||||
export interface CommentToken extends LexToken<'comment'> {
|
||||
val: string;
|
||||
buffer: boolean;
|
||||
}
|
||||
|
||||
export type NewlineToken = LexToken<'newline'>;
|
||||
|
||||
export interface TextToken extends LexToken<'text'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface InterpolatedCodeToken
|
||||
extends LexToken<'interpolated-code'> {
|
||||
mustEscape: boolean;
|
||||
buffer: boolean;
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface CodeToken extends LexToken<'code'> {
|
||||
val: string;
|
||||
mustEscape: boolean;
|
||||
buffer: boolean;
|
||||
}
|
||||
|
||||
export interface IdToken extends LexToken<'id'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type StartPipelessTextToken = LexToken<'start-pipeless-text'>;
|
||||
|
||||
export type EndPipelessTextToken = LexToken<'end-pipeless-text'>;
|
||||
|
||||
export interface DoctypeToken extends LexToken<'doctype'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type DotToken = LexToken<'dot'>;
|
||||
|
||||
export interface BlockToken extends LexToken<'block'> {
|
||||
val: string;
|
||||
mode: 'replace' | 'prepend' | 'append';
|
||||
}
|
||||
|
||||
export type ExtendsToken = LexToken<'extends'>;
|
||||
|
||||
export interface PathToken extends LexToken<'path'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type StartPugInterpolationToken = LexToken<
|
||||
'start-pug-interpolation'
|
||||
>;
|
||||
|
||||
export type EndPugInterpolationToken = LexToken<'end-pug-interpolation'>;
|
||||
|
||||
export interface InterpolationToken extends LexToken<'interpolation'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type IncludeToken = LexToken<'include'>;
|
||||
|
||||
export interface FilterToken extends LexToken<'filter'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface CallToken extends LexToken<'call'> {
|
||||
val: string;
|
||||
args: string;
|
||||
}
|
||||
|
||||
export interface MixinToken extends LexToken<'mixin'> {
|
||||
val: string;
|
||||
args: string | null;
|
||||
}
|
||||
|
||||
export interface IfToken extends LexToken<'if'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type MixinBlockToken = LexToken<'mixin-block'>;
|
||||
|
||||
export interface ElseToken extends LexToken<'else'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface AndAttributesToken extends LexToken<'&attributes'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface TextHtmlToken extends LexToken<'text-html'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface EachToken extends LexToken<'each'> {
|
||||
val: string;
|
||||
key: string | null;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface EachOfToken extends LexToken<'eachOf'> {
|
||||
val: string;
|
||||
value: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface WhileToken extends LexToken<'while'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface CaseToken extends LexToken<'case'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export interface WhenToken extends LexToken<'when'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type ColonToken = LexToken<':'>;
|
||||
|
||||
export type DefaultToken = LexToken<'default'>;
|
||||
|
||||
export interface ElseIfToken extends LexToken<'else-if'> {
|
||||
val: string;
|
||||
}
|
||||
|
||||
export type BlockcodeToken = LexToken<'blockcode'>;
|
||||
|
||||
export type YieldToken = LexToken<'yield'>;
|
||||
|
||||
export type SlashToken = LexToken<'slash'>;
|
||||
|
||||
export type Token =
|
||||
| AndAttributesToken
|
||||
| AttributeToken
|
||||
| BlockcodeToken
|
||||
| BlockToken
|
||||
| CallToken
|
||||
| CaseToken
|
||||
| ClassToken
|
||||
| CodeToken
|
||||
| ColonToken
|
||||
| CommentToken
|
||||
| DefaultToken
|
||||
| DoctypeToken
|
||||
| DotToken
|
||||
| EachToken
|
||||
| EachOfToken
|
||||
| ElseIfToken
|
||||
| ElseToken
|
||||
| EndAttributesToken
|
||||
| EndPipelessTextToken
|
||||
| EndPugInterpolationToken
|
||||
| EosToken
|
||||
| ExtendsToken
|
||||
| FilterToken
|
||||
| IdToken
|
||||
| IfToken
|
||||
| IncludeToken
|
||||
| IndentToken
|
||||
| InterpolatedCodeToken
|
||||
| InterpolationToken
|
||||
| MixinBlockToken
|
||||
| MixinToken
|
||||
| NewlineToken
|
||||
| OutdentToken
|
||||
| PathToken
|
||||
| SlashToken
|
||||
| StartAttributesToken
|
||||
| StartPipelessTextToken
|
||||
| StartPugInterpolationToken
|
||||
| TagToken
|
||||
| TextHtmlToken
|
||||
| TextToken
|
||||
| WhenToken
|
||||
| WhileToken
|
||||
| YieldToken;
|
||||
|
||||
export type LexerFunction = (type: string, exp?: any) => boolean;
|
||||
export interface LexerOptions {
|
||||
filename: string;
|
||||
interpolated?: boolean;
|
||||
startingLine?: number;
|
||||
startingColumn?: number;
|
||||
plugins?: LexerFunction[];
|
||||
}
|
||||
export class Lexer {
|
||||
input: string;
|
||||
originalInput: string;
|
||||
filename?: string;
|
||||
interpolated: boolean;
|
||||
lineno: number;
|
||||
colno: number;
|
||||
plugins: LexerFunction[];
|
||||
indentStack: number[];
|
||||
indentRe: RegExp | null;
|
||||
interpolationAllowed: boolean;
|
||||
whitespaceRe: RegExp;
|
||||
tokens: Token[];
|
||||
ended: boolean;
|
||||
constructor(str: string, options?: LexerOptions);
|
||||
error(code: string, message: string): never;
|
||||
assert(value: any, message: string): void;
|
||||
isExpression(exp: string): boolean;
|
||||
assertExpression(exp: string, noThrow?: boolean): boolean;
|
||||
assertNestingCorrect(exp: string): void;
|
||||
private tok<Type extends LexTokenType>(
|
||||
type: Type,
|
||||
val?: any,
|
||||
): LexToken<Type>;
|
||||
private tokEnd<Type extends LexTokenType>(
|
||||
tok: LexToken<Type>,
|
||||
): LexToken<Type>;
|
||||
private incrementLine(increment: number): void;
|
||||
private incrementColumn(increment: number): void;
|
||||
private consume(len: number): void;
|
||||
private scan<Type extends LexTokenType>(
|
||||
regexp: RegExp,
|
||||
type: Type,
|
||||
): LexToken<Type> | undefined;
|
||||
private scanEndOfLine<Type extends LexTokenType>(
|
||||
regexp: RegExp,
|
||||
type: Type,
|
||||
): LexToken<Type> | undefined;
|
||||
private bracketExpression(skip?: number): number;
|
||||
scanIndentation(): RegExpExecArray | null;
|
||||
eos(): true | undefined;
|
||||
blank(): true | undefined;
|
||||
comment(): true | undefined;
|
||||
interpolation(): true | undefined;
|
||||
tag(): true | undefined;
|
||||
filter(): true | undefined;
|
||||
doctype(): true | undefined;
|
||||
id(): true | undefined;
|
||||
className(): true | undefined;
|
||||
endInterpolation(): true | undefined;
|
||||
addText(
|
||||
type: LexTokenType,
|
||||
value: string,
|
||||
prefix?: string,
|
||||
escaped?: number,
|
||||
): void;
|
||||
text(): true | undefined;
|
||||
textHtml(): true | undefined;
|
||||
dot(): true | undefined;
|
||||
extends(): true | undefined;
|
||||
prepend(): true | undefined;
|
||||
append(): true | undefined;
|
||||
block(): true | undefined;
|
||||
mixinBlock(): true | undefined;
|
||||
yield(): true | undefined;
|
||||
include(): true | undefined;
|
||||
path(): true | undefined;
|
||||
case(): true | undefined;
|
||||
when(): true | undefined;
|
||||
default(): true | undefined;
|
||||
call(): true | undefined;
|
||||
mixin(): true | undefined;
|
||||
conditional(): true | undefined;
|
||||
while(): true | undefined;
|
||||
each(): true | undefined;
|
||||
eachOf(): true | undefined;
|
||||
code(): true | undefined;
|
||||
blockCode(): true | undefined;
|
||||
attribute(): string;
|
||||
attributeValue(
|
||||
str: string,
|
||||
): {val?: string; mustEscape?: boolean; remainingSource: string};
|
||||
attrs(): true | undefined;
|
||||
attributesBlock(): true | undefined;
|
||||
indent(): true | NewlineToken | undefined;
|
||||
pipelessText(indents?: number): boolean | undefined;
|
||||
slash(): true | undefined;
|
||||
colon(): true | undefined;
|
||||
fail(): never;
|
||||
callLexerFunction(func: string): boolean;
|
||||
private advance(): boolean;
|
||||
getTokens(): Token[];
|
||||
}
|
||||
}
|
||||
function lex(str: string, options?: lex.LexerOptions): lex.Token[];
|
||||
export = lex;
|
||||
}
|
1710
node_modules/pug-lexer/index.js
generated
vendored
Normal file
1710
node_modules/pug-lexer/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27
node_modules/pug-lexer/package.json
generated
vendored
Normal file
27
node_modules/pug-lexer/package.json
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "pug-lexer",
|
||||
"version": "5.0.1",
|
||||
"description": "The pug lexer (takes a string and converts it to an array of tokens)",
|
||||
"keywords": [
|
||||
"pug"
|
||||
],
|
||||
"dependencies": {
|
||||
"character-parser": "^2.2.0",
|
||||
"is-expression": "^4.0.0",
|
||||
"pug-error": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
"acorn-walk": "^7.1.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pugjs/pug/tree/master/packages/pug-lexer"
|
||||
},
|
||||
"author": "ForbesLindesay",
|
||||
"license": "MIT"
|
||||
}
|
Reference in New Issue
Block a user