[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { ParseSourceSpan } from '../parse_util';
|
---|
| 9 | export declare const enum TokenType {
|
---|
| 10 | TAG_OPEN_START = 0,
|
---|
| 11 | TAG_OPEN_END = 1,
|
---|
| 12 | TAG_OPEN_END_VOID = 2,
|
---|
| 13 | TAG_CLOSE = 3,
|
---|
| 14 | INCOMPLETE_TAG_OPEN = 4,
|
---|
| 15 | TEXT = 5,
|
---|
| 16 | ESCAPABLE_RAW_TEXT = 6,
|
---|
| 17 | RAW_TEXT = 7,
|
---|
| 18 | INTERPOLATION = 8,
|
---|
| 19 | ENCODED_ENTITY = 9,
|
---|
| 20 | COMMENT_START = 10,
|
---|
| 21 | COMMENT_END = 11,
|
---|
| 22 | CDATA_START = 12,
|
---|
| 23 | CDATA_END = 13,
|
---|
| 24 | ATTR_NAME = 14,
|
---|
| 25 | ATTR_QUOTE = 15,
|
---|
| 26 | ATTR_VALUE_TEXT = 16,
|
---|
| 27 | ATTR_VALUE_INTERPOLATION = 17,
|
---|
| 28 | DOC_TYPE = 18,
|
---|
| 29 | EXPANSION_FORM_START = 19,
|
---|
| 30 | EXPANSION_CASE_VALUE = 20,
|
---|
| 31 | EXPANSION_CASE_EXP_START = 21,
|
---|
| 32 | EXPANSION_CASE_EXP_END = 22,
|
---|
| 33 | EXPANSION_FORM_END = 23,
|
---|
| 34 | EOF = 24
|
---|
| 35 | }
|
---|
| 36 | export declare type Token = TagOpenStartToken | TagOpenEndToken | TagOpenEndVoidToken | TagCloseToken | IncompleteTagOpenToken | TextToken | InterpolationToken | EncodedEntityToken | CommentStartToken | CommentEndToken | CdataStartToken | CdataEndToken | AttributeNameToken | AttributeQuoteToken | AttributeValueTextToken | AttributeValueInterpolationToken | DocTypeToken | ExpansionFormStartToken | ExpansionCaseValueToken | ExpansionCaseExpressionStartToken | ExpansionCaseExpressionEndToken | ExpansionFormEndToken | EndOfFileToken;
|
---|
| 37 | export declare type InterpolatedTextToken = TextToken | InterpolationToken | EncodedEntityToken;
|
---|
| 38 | export declare type InterpolatedAttributeToken = AttributeValueTextToken | AttributeValueInterpolationToken | EncodedEntityToken;
|
---|
| 39 | export interface TokenBase {
|
---|
| 40 | type: TokenType;
|
---|
| 41 | parts: string[];
|
---|
| 42 | sourceSpan: ParseSourceSpan;
|
---|
| 43 | }
|
---|
| 44 | export interface TagOpenStartToken extends TokenBase {
|
---|
| 45 | type: TokenType.TAG_OPEN_START;
|
---|
| 46 | parts: [prefix: string, name: string];
|
---|
| 47 | }
|
---|
| 48 | export interface TagOpenEndToken extends TokenBase {
|
---|
| 49 | type: TokenType.TAG_OPEN_END;
|
---|
| 50 | parts: [];
|
---|
| 51 | }
|
---|
| 52 | export interface TagOpenEndVoidToken extends TokenBase {
|
---|
| 53 | type: TokenType.TAG_OPEN_END_VOID;
|
---|
| 54 | parts: [];
|
---|
| 55 | }
|
---|
| 56 | export interface TagCloseToken extends TokenBase {
|
---|
| 57 | type: TokenType.TAG_CLOSE;
|
---|
| 58 | parts: [prefix: string, name: string];
|
---|
| 59 | }
|
---|
| 60 | export interface IncompleteTagOpenToken extends TokenBase {
|
---|
| 61 | type: TokenType.INCOMPLETE_TAG_OPEN;
|
---|
| 62 | parts: [prefix: string, name: string];
|
---|
| 63 | }
|
---|
| 64 | export interface TextToken extends TokenBase {
|
---|
| 65 | type: TokenType.TEXT | TokenType.ESCAPABLE_RAW_TEXT | TokenType.RAW_TEXT;
|
---|
| 66 | parts: [text: string];
|
---|
| 67 | }
|
---|
| 68 | export interface InterpolationToken extends TokenBase {
|
---|
| 69 | type: TokenType.INTERPOLATION;
|
---|
| 70 | parts: [startMarker: string, expression: string, endMarker: string] | [
|
---|
| 71 | startMarker: string,
|
---|
| 72 | expression: string
|
---|
| 73 | ];
|
---|
| 74 | }
|
---|
| 75 | export interface EncodedEntityToken extends TokenBase {
|
---|
| 76 | type: TokenType.ENCODED_ENTITY;
|
---|
| 77 | parts: [decoded: string, encoded: string];
|
---|
| 78 | }
|
---|
| 79 | export interface CommentStartToken extends TokenBase {
|
---|
| 80 | type: TokenType.COMMENT_START;
|
---|
| 81 | parts: [];
|
---|
| 82 | }
|
---|
| 83 | export interface CommentEndToken extends TokenBase {
|
---|
| 84 | type: TokenType.COMMENT_END;
|
---|
| 85 | parts: [];
|
---|
| 86 | }
|
---|
| 87 | export interface CdataStartToken extends TokenBase {
|
---|
| 88 | type: TokenType.CDATA_START;
|
---|
| 89 | parts: [];
|
---|
| 90 | }
|
---|
| 91 | export interface CdataEndToken extends TokenBase {
|
---|
| 92 | type: TokenType.CDATA_END;
|
---|
| 93 | parts: [];
|
---|
| 94 | }
|
---|
| 95 | export interface AttributeNameToken extends TokenBase {
|
---|
| 96 | type: TokenType.ATTR_NAME;
|
---|
| 97 | parts: [prefix: string, name: string];
|
---|
| 98 | }
|
---|
| 99 | export interface AttributeQuoteToken extends TokenBase {
|
---|
| 100 | type: TokenType.ATTR_QUOTE;
|
---|
| 101 | parts: [quote: '\'' | '"'];
|
---|
| 102 | }
|
---|
| 103 | export interface AttributeValueTextToken extends TokenBase {
|
---|
| 104 | type: TokenType.ATTR_VALUE_TEXT;
|
---|
| 105 | parts: [value: string];
|
---|
| 106 | }
|
---|
| 107 | export interface AttributeValueInterpolationToken extends TokenBase {
|
---|
| 108 | type: TokenType.ATTR_VALUE_INTERPOLATION;
|
---|
| 109 | parts: [startMarker: string, expression: string, endMarker: string] | [
|
---|
| 110 | startMarker: string,
|
---|
| 111 | expression: string
|
---|
| 112 | ];
|
---|
| 113 | }
|
---|
| 114 | export interface DocTypeToken extends TokenBase {
|
---|
| 115 | type: TokenType.DOC_TYPE;
|
---|
| 116 | parts: [content: string];
|
---|
| 117 | }
|
---|
| 118 | export interface ExpansionFormStartToken extends TokenBase {
|
---|
| 119 | type: TokenType.EXPANSION_FORM_START;
|
---|
| 120 | parts: [];
|
---|
| 121 | }
|
---|
| 122 | export interface ExpansionCaseValueToken extends TokenBase {
|
---|
| 123 | type: TokenType.EXPANSION_CASE_VALUE;
|
---|
| 124 | parts: [value: string];
|
---|
| 125 | }
|
---|
| 126 | export interface ExpansionCaseExpressionStartToken extends TokenBase {
|
---|
| 127 | type: TokenType.EXPANSION_CASE_EXP_START;
|
---|
| 128 | parts: [];
|
---|
| 129 | }
|
---|
| 130 | export interface ExpansionCaseExpressionEndToken extends TokenBase {
|
---|
| 131 | type: TokenType.EXPANSION_CASE_EXP_END;
|
---|
| 132 | parts: [];
|
---|
| 133 | }
|
---|
| 134 | export interface ExpansionFormEndToken extends TokenBase {
|
---|
| 135 | type: TokenType.EXPANSION_FORM_END;
|
---|
| 136 | parts: [];
|
---|
| 137 | }
|
---|
| 138 | export interface EndOfFileToken extends TokenBase {
|
---|
| 139 | type: TokenType.EOF;
|
---|
| 140 | parts: [];
|
---|
| 141 | }
|
---|