source: trip-planner-front/node_modules/@angular/compiler/src/ml_parser/lexer.d.ts@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.1 KB
Line 
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 */
8import { ParseError, ParseSourceSpan } from '../parse_util';
9import { InterpolationConfig } from './interpolation_config';
10import { TagDefinition } from './tags';
11import { Token, TokenType } from './tokens';
12export declare class TokenError extends ParseError {
13 tokenType: TokenType | null;
14 constructor(errorMsg: string, tokenType: TokenType | null, span: ParseSourceSpan);
15}
16export declare class TokenizeResult {
17 tokens: Token[];
18 errors: TokenError[];
19 nonNormalizedIcuExpressions: Token[];
20 constructor(tokens: Token[], errors: TokenError[], nonNormalizedIcuExpressions: Token[]);
21}
22export interface LexerRange {
23 startPos: number;
24 startLine: number;
25 startCol: number;
26 endPos: number;
27}
28/**
29 * Options that modify how the text is tokenized.
30 */
31export interface TokenizeOptions {
32 /** Whether to tokenize ICU messages (considered as text nodes when false). */
33 tokenizeExpansionForms?: boolean;
34 /** How to tokenize interpolation markers. */
35 interpolationConfig?: InterpolationConfig;
36 /**
37 * The start and end point of the text to parse within the `source` string.
38 * The entire `source` string is parsed if this is not provided.
39 * */
40 range?: LexerRange;
41 /**
42 * If this text is stored in a JavaScript string, then we have to deal with escape sequences.
43 *
44 * **Example 1:**
45 *
46 * ```
47 * "abc\"def\nghi"
48 * ```
49 *
50 * - The `\"` must be converted to `"`.
51 * - The `\n` must be converted to a new line character in a token,
52 * but it should not increment the current line for source mapping.
53 *
54 * **Example 2:**
55 *
56 * ```
57 * "abc\
58 * def"
59 * ```
60 *
61 * The line continuation (`\` followed by a newline) should be removed from a token
62 * but the new line should increment the current line for source mapping.
63 */
64 escapedString?: boolean;
65 /**
66 * If this text is stored in an external template (e.g. via `templateUrl`) then we need to decide
67 * whether or not to normalize the line-endings (from `\r\n` to `\n`) when processing ICU
68 * expressions.
69 *
70 * If `true` then we will normalize ICU expression line endings.
71 * The default is `false`, but this will be switched in a future major release.
72 */
73 i18nNormalizeLineEndingsInICUs?: boolean;
74 /**
75 * An array of characters that should be considered as leading trivia.
76 * Leading trivia are characters that are not important to the developer, and so should not be
77 * included in source-map segments. A common example is whitespace.
78 */
79 leadingTriviaChars?: string[];
80 /**
81 * If true, do not convert CRLF to LF.
82 */
83 preserveLineEndings?: boolean;
84}
85export declare function tokenize(source: string, url: string, getTagDefinition: (tagName: string) => TagDefinition, options?: TokenizeOptions): TokenizeResult;
86/**
87 * The _Tokenizer uses objects of this type to move through the input text,
88 * extracting "parsed characters". These could be more than one actual character
89 * if the text contains escape sequences.
90 */
91interface CharacterCursor {
92 /** Initialize the cursor. */
93 init(): void;
94 /** The parsed character at the current cursor position. */
95 peek(): number;
96 /** Advance the cursor by one parsed character. */
97 advance(): void;
98 /** Get a span from the marked start point to the current point. */
99 getSpan(start?: this, leadingTriviaCodePoints?: number[]): ParseSourceSpan;
100 /** Get the parsed characters from the marked start point to the current point. */
101 getChars(start: this): string;
102 /** The number of characters left before the end of the cursor. */
103 charsLeft(): number;
104 /** The number of characters between `this` cursor and `other` cursor. */
105 diff(other: this): number;
106 /** Make a copy of this cursor */
107 clone(): CharacterCursor;
108}
109export declare class CursorError {
110 msg: string;
111 cursor: CharacterCursor;
112 constructor(msg: string, cursor: CharacterCursor);
113}
114export {};
Note: See TracBrowser for help on using the repository browser.