1 | /**
|
2 | * @license
|
3 | * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
4 | * This code may only be used under the BSD style license found at
|
5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
|
6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
|
7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
|
8 | * Google as part of the polymer project is also subject to an additional IP
|
9 | * rights grant found at http://polymer.github.io/PATENTS.txt
|
10 | */
|
11 | /**
|
12 | * An enumeration of Token types.
|
13 | */
|
14 | export declare enum TokenType {
|
15 | none = 0,
|
16 | whitespace,
|
17 | string,
|
18 | comment,
|
19 | word,
|
20 | boundary,
|
21 | propertyBoundary,
|
22 | openParenthesis,
|
23 | closeParenthesis,
|
24 | at,
|
25 | openBrace,
|
26 | closeBrace,
|
27 | semicolon,
|
28 | colon,
|
29 | hyphen,
|
30 | underscore,
|
31 | }
|
32 | /**
|
33 | * Class that describes individual tokens as produced by the Tokenizer.
|
34 | */
|
35 | declare class Token {
|
36 | static type: typeof TokenType;
|
37 | readonly type: TokenType;
|
38 | readonly start: number;
|
39 | readonly end: number;
|
40 | previous: Token | null;
|
41 | next: Token | null;
|
42 | /**
|
43 | * Create a Token instance.
|
44 | * @param type The lexical type of the Token.
|
45 | * @param start The start index of the text corresponding to the
|
46 | * Token in the CSS text.
|
47 | * @param end The end index of the text corresponding to the Token
|
48 | * in the CSS text.
|
49 | */
|
50 | constructor(type: TokenType, start: number, end: number);
|
51 | /**
|
52 | * Test if the Token matches a given numeric type. Types match if the bitwise
|
53 | * AND of the Token's type and the argument type are equivalent to the
|
54 | * argument type.
|
55 | * @param type The numeric type to test for equivalency with the
|
56 | * Token.
|
57 | */
|
58 | is(type: TokenType): boolean;
|
59 | }
|
60 | /**
|
61 | * A mapping of boundary token text to their corresponding types.
|
62 | */
|
63 | declare const boundaryTokenTypes: {
|
64 | [boundaryText: string]: TokenType | undefined;
|
65 | };
|
66 | export { Token, boundaryTokenTypes };
|