Skip to content

Commit 17eba1f

Browse files
committed
feat: add readonly modifier
1 parent eb5b0a5 commit 17eba1f

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/parser/common/basic-parser-types.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55
export interface CaretPosition {
66
/** start at 1 */
7-
lineNumber: number;
7+
readonly lineNumber: number;
88
/** start at 1 */
9-
column: number;
9+
readonly column: number;
1010
}
1111

1212
/**
@@ -45,23 +45,23 @@ export enum SyntaxContextType {
4545

4646
export interface WordRange {
4747
/** content of word */
48-
text: string;
48+
readonly text: string;
4949
/** start at 0 */
50-
startIndex: number;
51-
stopIndex: number;
50+
readonly startIndex: number;
51+
readonly stopIndex: number;
5252
/** start at 1 */
53-
line: number;
53+
readonly line: number;
5454
/** start at 1 */
55-
startColumn: number;
56-
stopColumn: number;
55+
readonly startColumn: number;
56+
readonly stopColumn: number;
5757
}
5858

5959
/**
6060
* Suggested information analyzed from the input
6161
*/
6262
export interface SyntaxSuggestion<T = WordRange> {
63-
syntaxContextType: SyntaxContextType;
64-
wordRanges: T[];
63+
readonly syntaxContextType: SyntaxContextType;
64+
readonly wordRanges: T[];
6565
}
6666

6767
/**
@@ -71,22 +71,22 @@ export interface Suggestions<T = WordRange> {
7171
/**
7272
* Suggestions about syntax
7373
*/
74-
syntax: SyntaxSuggestion<T>[];
74+
readonly syntax: SyntaxSuggestion<T>[];
7575
/**
7676
* Suggestions about keywords
7777
*/
78-
keywords: string[];
78+
readonly keywords: string[];
7979
}
8080

8181
export interface TextSlice {
8282
/** start at 0 */
83-
startIndex: number;
84-
endIndex: number;
83+
readonly startIndex: number;
84+
readonly endIndex: number;
8585
/** start at 1 */
86-
startLine: number;
87-
endLine: number;
86+
readonly startLine: number;
87+
readonly endLine: number;
8888
/** start at 1 */
89-
startColumn: number;
90-
endColumn: number;
91-
text: string;
89+
readonly startColumn: number;
90+
readonly endColumn: number;
91+
readonly text: string;
9292
}

src/parser/common/parseErrorListener.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import { ATNSimulator } from 'antlr4ts/atn/ATNSimulator';
55
* Converted from {@link SyntaxError}.
66
*/
77
export interface ParseError {
8-
startLine: number;
9-
endLine: number;
10-
startCol: number;
11-
endCol: number;
12-
message: string;
8+
readonly startLine: number;
9+
readonly endLine: number;
10+
readonly startCol: number;
11+
readonly endCol: number;
12+
readonly message: string;
1313
}
1414

1515
/**
1616
* The type of error resulting from lexical parsing and parsing.
1717
*/
1818
export interface SyntaxError<T> {
19-
recognizer: Recognizer<T, ATNSimulator>;
20-
offendingSymbol: Token;
21-
line: number;
22-
charPositionInLine: number;
23-
msg: string;
24-
e: RecognitionException;
19+
readonly recognizer: Recognizer<T, ATNSimulator>;
20+
readonly offendingSymbol: Token;
21+
readonly line: number;
22+
readonly charPositionInLine: number;
23+
readonly msg: string;
24+
readonly e: RecognitionException;
2525
}
2626

2727
/**

0 commit comments

Comments
 (0)