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;QACD,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;QACD,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;SAClF;QACD,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;SAClF;IACH,CAAC;IA3JD;;OAEG;IACoB,eAAK,GAAc,IAAI,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAyJpE,gBAAC;CAAA,AA7JD,IA6JC;SA7JY,SAAS","sourcesContent":["/**\r\n * Text coordinates represented as a line number and column number.\r\n *\r\n * @remarks\r\n * The first character in a file is considered to be in column 1 of line 1.\r\n * The location with column 0 and line 0 is used to represent an empty, unspecified,\r\n * or unknown location.\r\n */\r\nexport interface ITextLocation {\r\n line: number;\r\n column: number;\r\n}\r\n\r\n/**\r\n * Efficiently references a range of text from a string buffer.\r\n */\r\nexport class TextRange {\r\n /**\r\n * Used to represent an empty or unknown range.\r\n */\r\n public static readonly empty: TextRange = new TextRange('', 0, 0);\r\n\r\n /**\r\n * The starting index into the associated text buffer.\r\n *\r\n * @remarks\r\n * The text range corresponds to the `range.buffer.substring(range.pos, range.end)`.\r\n */\r\n public readonly pos: number;\r\n\r\n /**\r\n * The (non-inclusive) ending index for the associated text buffer.\r\n *\r\n * @remarks\r\n * The text range corresponds to the `range.buffer.substring(range.pos, range.end)`.\r\n */\r\n public readonly end: number;\r\n\r\n /**\r\n * The string buffer that the `pos` and `end` indexes refer to.\r\n */\r\n public readonly buffer: string;\r\n\r\n private constructor(buffer: string, pos: number, end: number) {\r\n this.buffer = buffer;\r\n this.pos = pos;\r\n this.end = end;\r\n this._validateBounds()
|