1 | export declare class ParseLocation {
|
---|
2 | file: ParseSourceFile;
|
---|
3 | offset: number;
|
---|
4 | line: number;
|
---|
5 | col: number;
|
---|
6 | constructor(file: ParseSourceFile, offset: number, line: number, col: number);
|
---|
7 | toString(): string;
|
---|
8 | moveBy(delta: number): ParseLocation;
|
---|
9 | getContext(maxChars: number, maxLines: number): {
|
---|
10 | before: string;
|
---|
11 | after: string;
|
---|
12 | } | null;
|
---|
13 | }
|
---|
14 | export declare class ParseSourceFile {
|
---|
15 | content: string;
|
---|
16 | url: string;
|
---|
17 | constructor(content: string, url: string);
|
---|
18 | }
|
---|
19 | export declare class ParseSourceSpan {
|
---|
20 | start: ParseLocation;
|
---|
21 | end: ParseLocation;
|
---|
22 | fullStart: ParseLocation;
|
---|
23 | details: string | null;
|
---|
24 | /**
|
---|
25 | * Create an object that holds information about spans of tokens/nodes captured during
|
---|
26 | * lexing/parsing of text.
|
---|
27 | *
|
---|
28 | * @param start
|
---|
29 | * The location of the start of the span (having skipped leading trivia).
|
---|
30 | * Skipping leading trivia makes source-spans more "user friendly", since things like HTML
|
---|
31 | * elements will appear to begin at the start of the opening tag, rather than at the start of any
|
---|
32 | * leading trivia, which could include newlines.
|
---|
33 | *
|
---|
34 | * @param end
|
---|
35 | * The location of the end of the span.
|
---|
36 | *
|
---|
37 | * @param fullStart
|
---|
38 | * The start of the token without skipping the leading trivia.
|
---|
39 | * This is used by tooling that splits tokens further, such as extracting Angular interpolations
|
---|
40 | * from text tokens. Such tooling creates new source-spans relative to the original token's
|
---|
41 | * source-span. If leading trivia characters have been skipped then the new source-spans may be
|
---|
42 | * incorrectly offset.
|
---|
43 | *
|
---|
44 | * @param details
|
---|
45 | * Additional information (such as identifier names) that should be associated with the span.
|
---|
46 | */
|
---|
47 | constructor(start: ParseLocation, end: ParseLocation, fullStart?: ParseLocation, details?: string | null);
|
---|
48 | toString(): string;
|
---|
49 | }
|
---|
50 | export declare enum ParseErrorLevel {
|
---|
51 | WARNING = 0,
|
---|
52 | ERROR = 1
|
---|
53 | }
|
---|
54 | export declare class ParseError {
|
---|
55 | span: ParseSourceSpan;
|
---|
56 | msg: string;
|
---|
57 | level: ParseErrorLevel;
|
---|
58 | constructor(span: ParseSourceSpan, msg: string, level?: ParseErrorLevel);
|
---|
59 | contextualMessage(): string;
|
---|
60 | toString(): string;
|
---|
61 | }
|
---|
62 | export declare function typeSourceSpan(kind: string, type: CompileIdentifierMetadata): ParseSourceSpan;
|
---|
63 | /**
|
---|
64 | * Generates Source Span object for a given R3 Type for JIT mode.
|
---|
65 | *
|
---|
66 | * @param kind Component or Directive.
|
---|
67 | * @param typeName name of the Component or Directive.
|
---|
68 | * @param sourceUrl reference to Component or Directive source.
|
---|
69 | * @returns instance of ParseSourceSpan that represent a given Component or Directive.
|
---|
70 | */
|
---|
71 | export declare function r3JitTypeSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan;
|
---|
72 | export declare function syntaxError(msg: string, parseErrors?: ParseError[]): Error;
|
---|
73 | export declare function isSyntaxError(error: Error): boolean;
|
---|
74 | export declare function getParseErrors(error: Error): ParseError[];
|
---|
75 | export declare function identifierName(compileIdentifier: CompileIdentifierMetadata | null | undefined): string | null;
|
---|
76 | export declare function identifierModuleUrl(compileIdentifier: CompileIdentifierMetadata): string;
|
---|
77 | export interface CompileIdentifierMetadata {
|
---|
78 | reference: any;
|
---|
79 | }
|
---|
80 | export declare function sanitizeIdentifier(name: string): string;
|
---|