Some polish

This commit is contained in:
Daniel Imms
2018-05-05 08:12:52 -07:00
parent edb06c6b2a
commit 362d7698f7
5 changed files with 22 additions and 16 deletions
+9 -12
View File
@@ -5,12 +5,16 @@
import { ParserState, ParserAction, IParsingState, IDcsHandler, IEscapeSequenceParser } from './Types';
// number range macro
function r(a: number, b: number): number[] {
let c = b - a;
/**
* Returns an array fulled with numbers between the low and high parameters (inclusive).
* @param low The low number.
* @param high The high number.
*/
function r(low: number, high: number): number[] {
let c = high - low;
let arr = new Array(c);
while (c--) {
arr[c] = --b;
arr[c] = --high;
}
return arr;
}
@@ -243,7 +247,7 @@ export class EscapeSequenceParser implements IEscapeSequenceParser {
this._csiHandlerFb = (...params: any[]): void => { };
this._escHandlerFb = (...params: any[]): void => { };
this._oscHandlerFb = (...params: any[]): void => { };
this._dcsHandlerFb = new DcsDummy;
this._dcsHandlerFb = new DcsDummy();
this._errorHandlerFb = (state: IParsingState): IParsingState => state;
this._printHandler = this._printHandlerFb;
this._executeHandlers = Object.create(null);
@@ -319,9 +323,6 @@ export class EscapeSequenceParser implements IEscapeSequenceParser {
this._errorHandler = this._errorHandlerFb;
}
/**
* Reset the parser.
*/
reset(): void {
this.currentState = this.initialState;
this._osc = '';
@@ -330,10 +331,6 @@ export class EscapeSequenceParser implements IEscapeSequenceParser {
this._activeDcsHandler = null;
}
/**
* Parse string `data`.
* @param data
*/
parse(data: string): void {
let code = 0;
let transition = 0;