plaxtony
Version:
Static code analysis of SC2 Galaxy Script
53 lines (52 loc) • 1.66 kB
TypeScript
import { SyntaxKind, DiagnosticMessage } from './types';
export interface ErrorCallback {
(message: DiagnosticMessage, pos: number, length: number): void;
}
export declare function stringToToken(s: string): SyntaxKind | undefined;
export declare function tokenToString(t: SyntaxKind): string | undefined;
export declare function isIdentifierStart(ch: number): boolean;
export declare function isIdentifierPart(ch: number): boolean;
export declare function isLineBreak(ch: number): boolean;
export declare function isDigit(ch: number): boolean;
export declare function isOctalDigit(ch: number): boolean;
export declare class Scanner {
private line;
private char;
private pos;
private end;
private startPos;
private tokenPos;
private text;
private token;
private tokenValue;
private onError?;
private lineMap;
constructor(onError?: ErrorCallback);
private error;
private speculationHelper;
lookAhead<T>(callback: () => T): T;
tryScan<T>(callback: () => T): T;
private scanHexDigits;
private scanEscapeSequence;
private scanString;
private scanNumber;
private scanBinaryOrOctalDigits;
private scanOctalDigits;
private getIdentifierToken;
setText(text: string): void;
scan(): SyntaxKind;
getLine(): number;
getChar(): number;
getCurrentPos(): number;
/**
* Absolute start position - including adjacent whitespace
*/
getStartPos(): number;
/**
* Actual start position - excluding adjacent whitespace
*/
getTokenPos(): number;
getTokenValue(): string;
getTokenText(): string;
getLineMap(): number[];
}