feat: add readonly modifier

This commit is contained in:
hayden 2023-12-12 19:45:54 +08:00 committed by Hayden
parent eb5b0a5550
commit 17eba1f2aa
2 changed files with 30 additions and 30 deletions

View File

@ -4,9 +4,9 @@
*/
export interface CaretPosition {
/** start at 1 */
lineNumber: number;
readonly lineNumber: number;
/** start at 1 */
column: number;
readonly column: number;
}
/**
@ -45,23 +45,23 @@ export enum SyntaxContextType {
export interface WordRange {
/** content of word */
text: string;
readonly text: string;
/** start at 0 */
startIndex: number;
stopIndex: number;
readonly startIndex: number;
readonly stopIndex: number;
/** start at 1 */
line: number;
readonly line: number;
/** start at 1 */
startColumn: number;
stopColumn: number;
readonly startColumn: number;
readonly stopColumn: number;
}
/**
* Suggested information analyzed from the input
*/
export interface SyntaxSuggestion<T = WordRange> {
syntaxContextType: SyntaxContextType;
wordRanges: T[];
readonly syntaxContextType: SyntaxContextType;
readonly wordRanges: T[];
}
/**
@ -71,22 +71,22 @@ export interface Suggestions<T = WordRange> {
/**
* Suggestions about syntax
*/
syntax: SyntaxSuggestion<T>[];
readonly syntax: SyntaxSuggestion<T>[];
/**
* Suggestions about keywords
*/
keywords: string[];
readonly keywords: string[];
}
export interface TextSlice {
/** start at 0 */
startIndex: number;
endIndex: number;
readonly startIndex: number;
readonly endIndex: number;
/** start at 1 */
startLine: number;
endLine: number;
readonly startLine: number;
readonly endLine: number;
/** start at 1 */
startColumn: number;
endColumn: number;
text: string;
readonly startColumn: number;
readonly endColumn: number;
readonly text: string;
}

View File

@ -5,23 +5,23 @@ import { ATNSimulator } from 'antlr4ts/atn/ATNSimulator';
* Converted from {@link SyntaxError}.
*/
export interface ParseError {
startLine: number;
endLine: number;
startCol: number;
endCol: number;
message: string;
readonly startLine: number;
readonly endLine: number;
readonly startCol: number;
readonly endCol: number;
readonly message: string;
}
/**
* The type of error resulting from lexical parsing and parsing.
*/
export interface SyntaxError<T> {
recognizer: Recognizer<T, ATNSimulator>;
offendingSymbol: Token;
line: number;
charPositionInLine: number;
msg: string;
e: RecognitionException;
readonly recognizer: Recognizer<T, ATNSimulator>;
readonly offendingSymbol: Token;
readonly line: number;
readonly charPositionInLine: number;
readonly msg: string;
readonly e: RecognitionException;
}
/**