@spyglassmc/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/lib/common/Heap.d.ts +1 -0
- package/lib/common/Heap.js +2 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +14 -0
- package/lib/common/util.d.ts +120 -0
- package/lib/common/util.js +292 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +20 -0
- package/lib/node/AstNode.d.ts +64 -0
- package/lib/node/AstNode.js +108 -0
- package/lib/node/BooleanNode.d.ts +13 -0
- package/lib/node/BooleanNode.js +20 -0
- package/lib/node/CommentNode.d.ts +12 -0
- package/lib/node/CommentNode.js +11 -0
- package/lib/node/ErrorNode.d.ts +8 -0
- package/lib/node/ErrorNode.js +12 -0
- package/lib/node/FileNode.d.ts +21 -0
- package/lib/node/FileNode.js +11 -0
- package/lib/node/FloatNode.d.ts +13 -0
- package/lib/node/FloatNode.js +21 -0
- package/lib/node/IntegerNode.d.ts +13 -0
- package/lib/node/IntegerNode.js +20 -0
- package/lib/node/ListNode.d.ts +15 -0
- package/lib/node/ListNode.js +11 -0
- package/lib/node/LiteralNode.d.ts +19 -0
- package/lib/node/LiteralNode.js +22 -0
- package/lib/node/LongNode.d.ts +13 -0
- package/lib/node/LongNode.js +20 -0
- package/lib/node/RecordNode.d.ts +20 -0
- package/lib/node/RecordNode.js +11 -0
- package/lib/node/ResourceLocationNode.d.ts +41 -0
- package/lib/node/ResourceLocationNode.js +65 -0
- package/lib/node/Sequence.d.ts +22 -0
- package/lib/node/Sequence.js +11 -0
- package/lib/node/StringNode.d.ts +63 -0
- package/lib/node/StringNode.js +43 -0
- package/lib/node/SymbolNode.d.ts +21 -0
- package/lib/node/SymbolNode.js +22 -0
- package/lib/node/TableNode.d.ts +17 -0
- package/lib/node/TableNode.js +11 -0
- package/lib/node/index.d.ts +16 -0
- package/lib/node/index.js +28 -0
- package/lib/parser/Parser.d.ts +16 -0
- package/lib/parser/Parser.js +5 -0
- package/lib/parser/boolean.d.ts +4 -0
- package/lib/parser/boolean.js +11 -0
- package/lib/parser/comment.d.ts +12 -0
- package/lib/parser/comment.js +34 -0
- package/lib/parser/empty.d.ts +3 -0
- package/lib/parser/empty.js +7 -0
- package/lib/parser/error.d.ts +8 -0
- package/lib/parser/error.js +22 -0
- package/lib/parser/file.d.ts +9 -0
- package/lib/parser/file.js +37 -0
- package/lib/parser/float.d.ts +33 -0
- package/lib/parser/float.js +57 -0
- package/lib/parser/index.d.ts +17 -0
- package/lib/parser/index.js +36 -0
- package/lib/parser/integer.d.ts +33 -0
- package/lib/parser/integer.js +46 -0
- package/lib/parser/list.d.ts +12 -0
- package/lib/parser/list.js +70 -0
- package/lib/parser/literal.d.ts +5 -0
- package/lib/parser/literal.js +41 -0
- package/lib/parser/long.d.ts +33 -0
- package/lib/parser/long.js +50 -0
- package/lib/parser/record.d.ts +22 -0
- package/lib/parser/record.js +97 -0
- package/lib/parser/resourceLocation.d.ts +4 -0
- package/lib/parser/resourceLocation.js +67 -0
- package/lib/parser/string.d.ts +18 -0
- package/lib/parser/string.js +129 -0
- package/lib/parser/symbol.d.ts +12 -0
- package/lib/parser/symbol.js +33 -0
- package/lib/parser/table.d.ts +22 -0
- package/lib/parser/table.js +97 -0
- package/lib/parser/util.d.ts +134 -0
- package/lib/parser/util.js +224 -0
- package/lib/processor/ColorInfoProvider.d.ts +87 -0
- package/lib/processor/ColorInfoProvider.js +141 -0
- package/lib/processor/InlayHintProvider.d.ts +8 -0
- package/lib/processor/InlayHintProvider.js +3 -0
- package/lib/processor/SignatureHelpProvider.d.ts +18 -0
- package/lib/processor/SignatureHelpProvider.js +3 -0
- package/lib/processor/checker/Checker.d.ts +7 -0
- package/lib/processor/checker/Checker.js +7 -0
- package/lib/processor/checker/builtin.d.ts +23 -0
- package/lib/processor/checker/builtin.js +83 -0
- package/lib/processor/checker/index.d.ts +3 -0
- package/lib/processor/checker/index.js +28 -0
- package/lib/processor/colorizer/Colorizer.d.ts +23 -0
- package/lib/processor/colorizer/Colorizer.js +70 -0
- package/lib/processor/colorizer/builtin.d.ts +17 -0
- package/lib/processor/colorizer/builtin.js +84 -0
- package/lib/processor/colorizer/index.d.ts +3 -0
- package/lib/processor/colorizer/index.js +28 -0
- package/lib/processor/completer/Completer.d.ts +75 -0
- package/lib/processor/completer/Completer.js +92 -0
- package/lib/processor/completer/builtin.d.ts +30 -0
- package/lib/processor/completer/builtin.js +172 -0
- package/lib/processor/completer/index.d.ts +3 -0
- package/lib/processor/completer/index.js +28 -0
- package/lib/processor/formatter/Formatter.d.ts +6 -0
- package/lib/processor/formatter/Formatter.js +19 -0
- package/lib/processor/formatter/builtin.d.ts +15 -0
- package/lib/processor/formatter/builtin.js +60 -0
- package/lib/processor/formatter/index.d.ts +3 -0
- package/lib/processor/formatter/index.js +28 -0
- package/lib/processor/index.d.ts +10 -0
- package/lib/processor/index.js +22 -0
- package/lib/processor/linter/Linter.d.ts +4 -0
- package/lib/processor/linter/Linter.js +3 -0
- package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +4 -0
- package/lib/processor/linter/builtin/undeclaredSymbol.js +73 -0
- package/lib/processor/linter/builtin.d.ts +15 -0
- package/lib/processor/linter/builtin.js +120 -0
- package/lib/processor/linter/index.d.ts +3 -0
- package/lib/processor/linter/index.js +28 -0
- package/lib/processor/util.d.ts +17 -0
- package/lib/processor/util.js +32 -0
- package/lib/service/CacheService.d.ts +54 -0
- package/lib/service/CacheService.js +195 -0
- package/lib/service/CommandExecutor.d.ts +3 -0
- package/lib/service/CommandExecutor.js +7 -0
- package/lib/service/Config.d.ts +218 -0
- package/lib/service/Config.js +264 -0
- package/lib/service/Context.d.ts +143 -0
- package/lib/service/Context.js +143 -0
- package/lib/service/Dependency.d.ts +10 -0
- package/lib/service/Dependency.js +11 -0
- package/lib/service/Downloader.d.ts +67 -0
- package/lib/service/Downloader.js +185 -0
- package/lib/service/ErrorReporter.d.ts +27 -0
- package/lib/service/ErrorReporter.js +49 -0
- package/lib/service/FileService.d.ts +96 -0
- package/lib/service/FileService.js +224 -0
- package/lib/service/Hover.d.ts +10 -0
- package/lib/service/Hover.js +16 -0
- package/lib/service/Logger.d.ts +31 -0
- package/lib/service/Logger.js +30 -0
- package/lib/service/MetaRegistry.d.ts +106 -0
- package/lib/service/MetaRegistry.js +192 -0
- package/lib/service/Operations.d.ts +8 -0
- package/lib/service/Operations.js +26 -0
- package/lib/service/Profiler.d.ts +33 -0
- package/lib/service/Profiler.js +76 -0
- package/lib/service/Project.d.ts +173 -0
- package/lib/service/Project.js +593 -0
- package/lib/service/Service.d.ts +55 -0
- package/lib/service/Service.js +207 -0
- package/lib/service/SymbolLocations.d.ts +17 -0
- package/lib/service/SymbolLocations.js +16 -0
- package/lib/service/SymbolRegistrar.d.ts +5 -0
- package/lib/service/SymbolRegistrar.js +3 -0
- package/lib/service/fileUtil.d.ts +121 -0
- package/lib/service/fileUtil.js +268 -0
- package/lib/service/index.d.ts +18 -0
- package/lib/service/index.js +33 -0
- package/lib/source/IndexMap.d.ts +16 -0
- package/lib/source/IndexMap.js +46 -0
- package/lib/source/LanguageError.d.ts +27 -0
- package/lib/source/LanguageError.js +15 -0
- package/lib/source/Location.d.ts +19 -0
- package/lib/source/Location.js +25 -0
- package/lib/source/Offset.d.ts +13 -0
- package/lib/source/Offset.js +25 -0
- package/lib/source/Position.d.ts +23 -0
- package/lib/source/Position.js +43 -0
- package/lib/source/PositionRange.d.ts +38 -0
- package/lib/source/PositionRange.js +83 -0
- package/lib/source/Range.d.ts +68 -0
- package/lib/source/Range.js +155 -0
- package/lib/source/Source.d.ts +110 -0
- package/lib/source/Source.js +222 -0
- package/lib/source/index.d.ts +9 -0
- package/lib/source/index.js +21 -0
- package/lib/symbol/Symbol.d.ts +219 -0
- package/lib/symbol/Symbol.js +324 -0
- package/lib/symbol/SymbolUtil.d.ts +407 -0
- package/lib/symbol/SymbolUtil.js +880 -0
- package/lib/symbol/UriBinder.d.ts +3 -0
- package/lib/symbol/UriBinder.js +3 -0
- package/lib/symbol/index.d.ts +4 -0
- package/lib/symbol/index.js +16 -0
- package/package.json +41 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { IndexMap } from '.';
|
|
2
|
+
import type { RangeContainer } from './Range';
|
|
3
|
+
import { Range } from './Range';
|
|
4
|
+
declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
5
|
+
declare type Space = ' ' | '\t';
|
|
6
|
+
declare type Newline = '\r\n' | '\r' | '\n';
|
|
7
|
+
declare type Whitespace = Space | Newline;
|
|
8
|
+
export declare const CRLF = "\r\n";
|
|
9
|
+
export declare const CR = "\r";
|
|
10
|
+
export declare const LF = "\n";
|
|
11
|
+
export declare const Whitespaces: readonly [" ", "\n", "\r", "\t"];
|
|
12
|
+
export declare class ReadonlySource {
|
|
13
|
+
readonly string: string;
|
|
14
|
+
readonly indexMap: IndexMap;
|
|
15
|
+
innerCursor: number;
|
|
16
|
+
constructor(string: string, indexMap?: IndexMap);
|
|
17
|
+
get cursor(): number;
|
|
18
|
+
/**
|
|
19
|
+
* @param offset The index to offset from cursor. Defaults to 0.
|
|
20
|
+
*
|
|
21
|
+
* @returns The range of the specified character.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* getCharRange(-1) // Returns the range of the character before cursor.
|
|
25
|
+
* getCharRange() // Returns the range of the character at cursor.
|
|
26
|
+
* getCharRange(1) // Returns the range of the character after cursor.
|
|
27
|
+
*/
|
|
28
|
+
getCharRange(offset?: number): Range;
|
|
29
|
+
/**
|
|
30
|
+
* Peeks a substring from the current cursor.
|
|
31
|
+
* @param length The length of the substring. Defaults to 1
|
|
32
|
+
* @param offset The index to offset from cursor. Defaults to 0
|
|
33
|
+
*/
|
|
34
|
+
peek(length?: number, offset?: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* If the `expectedValue` is right after the cursor, returns `true`. Otherwise returns `false`.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link Source.trySkip}
|
|
39
|
+
*/
|
|
40
|
+
tryPeek(expectedValue: string): boolean;
|
|
41
|
+
slice(start: number, end?: number): string;
|
|
42
|
+
slice(rangeLike: Range | RangeContainer): string;
|
|
43
|
+
sliceToCursor(start: number): string;
|
|
44
|
+
}
|
|
45
|
+
export declare class Source extends ReadonlySource {
|
|
46
|
+
string: string;
|
|
47
|
+
indexMap: IndexMap;
|
|
48
|
+
constructor(string: string, indexMap?: IndexMap);
|
|
49
|
+
get cursor(): number;
|
|
50
|
+
set cursor(cursor: number);
|
|
51
|
+
clone(): Source;
|
|
52
|
+
canRead(length?: number): boolean;
|
|
53
|
+
canReadInLine(): boolean;
|
|
54
|
+
read(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Skips the current character.
|
|
57
|
+
* @param step The step to skip. @default 1
|
|
58
|
+
*/
|
|
59
|
+
skip(step?: number): this;
|
|
60
|
+
/**
|
|
61
|
+
* If the `expectedValue` is right after the cursor, skips it and returns `true`. Otherwise returns `false`.
|
|
62
|
+
*
|
|
63
|
+
* This is a shortcut for the following piece of code:
|
|
64
|
+
* ```typescript
|
|
65
|
+
* declare const src: Source
|
|
66
|
+
* if (src.peek(expectedValue.length) === expectedValue) {
|
|
67
|
+
* src.skip(expectedValue.length)
|
|
68
|
+
* // Do something here.
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @see {@link Source.tryPeek}
|
|
73
|
+
*/
|
|
74
|
+
trySkip(expectedValue: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Reads until the end of this line.
|
|
77
|
+
*/
|
|
78
|
+
readLine(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Skips until the end of this line.
|
|
81
|
+
*/
|
|
82
|
+
skipLine(): this;
|
|
83
|
+
/**
|
|
84
|
+
* Jumps to the beginning of the next line.
|
|
85
|
+
*/
|
|
86
|
+
nextLine(): this;
|
|
87
|
+
readSpace(): string;
|
|
88
|
+
skipSpace(): this;
|
|
89
|
+
readWhitespace(): string;
|
|
90
|
+
skipWhitespace(): this;
|
|
91
|
+
/**
|
|
92
|
+
* @param terminators Ending character. Will not be skipped or included in the result.
|
|
93
|
+
*/
|
|
94
|
+
readUntil(...terminators: string[]): string;
|
|
95
|
+
/**
|
|
96
|
+
* @param terminators Ending character. Will not be skipped.
|
|
97
|
+
*/
|
|
98
|
+
skipUntilOrEnd(...terminators: string[]): this;
|
|
99
|
+
readUntilLineEnd(): string;
|
|
100
|
+
skipUntilLineEnd(): this;
|
|
101
|
+
readRemaining(): string;
|
|
102
|
+
skipRemaining(): this;
|
|
103
|
+
static isDigit(c: string): c is Digit;
|
|
104
|
+
static isBrigadierQuote(c: string): c is '"' | "'";
|
|
105
|
+
static isNewline(c: string): c is Newline;
|
|
106
|
+
static isSpace(c: string): c is Space;
|
|
107
|
+
static isWhitespace(c: string): c is Whitespace;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=Source.d.ts.map
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Source = exports.ReadonlySource = exports.Whitespaces = exports.LF = exports.CR = exports.CRLF = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const Range_1 = require("./Range");
|
|
6
|
+
exports.CRLF = '\r\n';
|
|
7
|
+
exports.CR = '\r';
|
|
8
|
+
exports.LF = '\n';
|
|
9
|
+
exports.Whitespaces = Object.freeze([' ', '\n', '\r', '\t']);
|
|
10
|
+
class ReadonlySource {
|
|
11
|
+
constructor(string, indexMap = []) {
|
|
12
|
+
this.string = string;
|
|
13
|
+
this.indexMap = indexMap;
|
|
14
|
+
this.innerCursor = 0;
|
|
15
|
+
}
|
|
16
|
+
get cursor() {
|
|
17
|
+
return _1.IndexMap.toOuterOffset(this.indexMap, this.innerCursor);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @param offset The index to offset from cursor. Defaults to 0.
|
|
21
|
+
*
|
|
22
|
+
* @returns The range of the specified character.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* getCharRange(-1) // Returns the range of the character before cursor.
|
|
26
|
+
* getCharRange() // Returns the range of the character at cursor.
|
|
27
|
+
* getCharRange(1) // Returns the range of the character after cursor.
|
|
28
|
+
*/
|
|
29
|
+
getCharRange(offset = 0) {
|
|
30
|
+
return _1.IndexMap.toOuterRange(this.indexMap, Range_1.Range.create(this.innerCursor + offset, this.innerCursor + offset + 1));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Peeks a substring from the current cursor.
|
|
34
|
+
* @param length The length of the substring. Defaults to 1
|
|
35
|
+
* @param offset The index to offset from cursor. Defaults to 0
|
|
36
|
+
*/
|
|
37
|
+
peek(length = 1, offset = 0) {
|
|
38
|
+
return this.string.slice(this.innerCursor + offset, this.innerCursor + offset + length);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* If the `expectedValue` is right after the cursor, returns `true`. Otherwise returns `false`.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link Source.trySkip}
|
|
44
|
+
*/
|
|
45
|
+
tryPeek(expectedValue) {
|
|
46
|
+
return this.peek(expectedValue.length) === expectedValue;
|
|
47
|
+
}
|
|
48
|
+
slice(param0, end) {
|
|
49
|
+
if (typeof param0 === 'number') {
|
|
50
|
+
const innerStart = _1.IndexMap.toInnerOffset(this.indexMap, param0);
|
|
51
|
+
const innerEnd = end !== undefined ? _1.IndexMap.toInnerOffset(this.indexMap, end) : undefined;
|
|
52
|
+
return this.string.slice(innerStart, innerEnd);
|
|
53
|
+
}
|
|
54
|
+
const range = _1.IndexMap.toInnerRange(this.indexMap, Range_1.Range.get(param0));
|
|
55
|
+
return this.string.slice(range.start, range.end);
|
|
56
|
+
}
|
|
57
|
+
sliceToCursor(start) {
|
|
58
|
+
const innerStart = _1.IndexMap.toInnerOffset(this.indexMap, start);
|
|
59
|
+
return this.string.slice(innerStart, this.innerCursor);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ReadonlySource = ReadonlySource;
|
|
63
|
+
class Source extends ReadonlySource {
|
|
64
|
+
constructor(string, indexMap = []) {
|
|
65
|
+
super(string, indexMap);
|
|
66
|
+
this.string = string;
|
|
67
|
+
this.indexMap = indexMap;
|
|
68
|
+
}
|
|
69
|
+
get cursor() {
|
|
70
|
+
return super.cursor;
|
|
71
|
+
}
|
|
72
|
+
set cursor(cursor) {
|
|
73
|
+
this.innerCursor = _1.IndexMap.toInnerOffset(this.indexMap, cursor);
|
|
74
|
+
}
|
|
75
|
+
clone() {
|
|
76
|
+
const ans = new Source(this.string, this.indexMap);
|
|
77
|
+
ans.innerCursor = this.innerCursor;
|
|
78
|
+
return ans;
|
|
79
|
+
}
|
|
80
|
+
canRead(length = 1) {
|
|
81
|
+
return this.innerCursor + length <= this.string.length;
|
|
82
|
+
}
|
|
83
|
+
canReadInLine() {
|
|
84
|
+
return this.canRead() && this.peek() !== exports.CR && this.peek() !== exports.LF;
|
|
85
|
+
}
|
|
86
|
+
read() {
|
|
87
|
+
return this.string.charAt(this.innerCursor++);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Skips the current character.
|
|
91
|
+
* @param step The step to skip. @default 1
|
|
92
|
+
*/
|
|
93
|
+
skip(step = 1) {
|
|
94
|
+
this.innerCursor += step;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* If the `expectedValue` is right after the cursor, skips it and returns `true`. Otherwise returns `false`.
|
|
99
|
+
*
|
|
100
|
+
* This is a shortcut for the following piece of code:
|
|
101
|
+
* ```typescript
|
|
102
|
+
* declare const src: Source
|
|
103
|
+
* if (src.peek(expectedValue.length) === expectedValue) {
|
|
104
|
+
* src.skip(expectedValue.length)
|
|
105
|
+
* // Do something here.
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @see {@link Source.tryPeek}
|
|
110
|
+
*/
|
|
111
|
+
trySkip(expectedValue) {
|
|
112
|
+
if (this.peek(expectedValue.length) === expectedValue) {
|
|
113
|
+
this.skip(expectedValue.length);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Reads until the end of this line.
|
|
120
|
+
*/
|
|
121
|
+
readLine() {
|
|
122
|
+
return this.readUntil(exports.CR, exports.LF);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Skips until the end of this line.
|
|
126
|
+
*/
|
|
127
|
+
skipLine() {
|
|
128
|
+
this.readLine();
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Jumps to the beginning of the next line.
|
|
133
|
+
*/
|
|
134
|
+
nextLine() {
|
|
135
|
+
this.skipLine();
|
|
136
|
+
if (this.peek(2) === exports.CRLF) {
|
|
137
|
+
this.skip(2);
|
|
138
|
+
}
|
|
139
|
+
else if (this.peek() === exports.CR || this.peek() === exports.LF) {
|
|
140
|
+
this.skip();
|
|
141
|
+
}
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
readSpace() {
|
|
145
|
+
const start = this.innerCursor;
|
|
146
|
+
this.skipSpace();
|
|
147
|
+
return this.string.slice(start, this.innerCursor);
|
|
148
|
+
}
|
|
149
|
+
skipSpace() {
|
|
150
|
+
while (this.canRead() && Source.isSpace(this.peek())) {
|
|
151
|
+
this.skip();
|
|
152
|
+
}
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
readWhitespace() {
|
|
156
|
+
const start = this.innerCursor;
|
|
157
|
+
this.skipWhitespace();
|
|
158
|
+
return this.string.slice(start, this.innerCursor);
|
|
159
|
+
}
|
|
160
|
+
skipWhitespace() {
|
|
161
|
+
while (this.canRead() && Source.isWhitespace(this.peek())) {
|
|
162
|
+
this.skip();
|
|
163
|
+
}
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @param terminators Ending character. Will not be skipped or included in the result.
|
|
168
|
+
*/
|
|
169
|
+
readUntil(...terminators) {
|
|
170
|
+
let ans = '';
|
|
171
|
+
while (this.canRead()) {
|
|
172
|
+
const c = this.peek();
|
|
173
|
+
if (terminators.includes(c)) {
|
|
174
|
+
return ans;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
ans += c;
|
|
178
|
+
}
|
|
179
|
+
this.skip();
|
|
180
|
+
}
|
|
181
|
+
return ans;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @param terminators Ending character. Will not be skipped.
|
|
185
|
+
*/
|
|
186
|
+
skipUntilOrEnd(...terminators) {
|
|
187
|
+
this.readUntil(...terminators);
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
readUntilLineEnd() {
|
|
191
|
+
return this.readUntil(exports.CR, exports.LF);
|
|
192
|
+
}
|
|
193
|
+
skipUntilLineEnd() {
|
|
194
|
+
return this.skipUntilOrEnd(exports.CR, exports.LF);
|
|
195
|
+
}
|
|
196
|
+
readRemaining() {
|
|
197
|
+
const start = this.innerCursor;
|
|
198
|
+
this.innerCursor = this.string.length;
|
|
199
|
+
return this.string.slice(start);
|
|
200
|
+
}
|
|
201
|
+
skipRemaining() {
|
|
202
|
+
this.readRemaining();
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
static isDigit(c) {
|
|
206
|
+
return c >= '0' && c <= '9';
|
|
207
|
+
}
|
|
208
|
+
static isBrigadierQuote(c) {
|
|
209
|
+
return c === '"' || c === "'";
|
|
210
|
+
}
|
|
211
|
+
static isNewline(c) {
|
|
212
|
+
return c === '\r\n' || c === '\r' || c === '\n';
|
|
213
|
+
}
|
|
214
|
+
static isSpace(c) {
|
|
215
|
+
return c === ' ' || c === '\t';
|
|
216
|
+
}
|
|
217
|
+
static isWhitespace(c) {
|
|
218
|
+
return Source.isSpace(c) || Source.isNewline(c);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.Source = Source;
|
|
222
|
+
//# sourceMappingURL=Source.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './IndexMap';
|
|
2
|
+
export * from './LanguageError';
|
|
3
|
+
export * from './Location';
|
|
4
|
+
export * from './Offset';
|
|
5
|
+
export * from './Position';
|
|
6
|
+
export * from './PositionRange';
|
|
7
|
+
export * from './Range';
|
|
8
|
+
export * from './Source';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./IndexMap"), exports);
|
|
14
|
+
__exportStar(require("./LanguageError"), exports);
|
|
15
|
+
__exportStar(require("./Location"), exports);
|
|
16
|
+
__exportStar(require("./Offset"), exports);
|
|
17
|
+
__exportStar(require("./Position"), exports);
|
|
18
|
+
__exportStar(require("./PositionRange"), exports);
|
|
19
|
+
__exportStar(require("./Range"), exports);
|
|
20
|
+
__exportStar(require("./Source"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|