"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const contiguousMultilineTokens = require("./contiguousMultilineTokens.js");
class ContiguousMultilineTokensBuilder {
  constructor() {
    this._tokens = [];
  }
  add(lineNumber, lineTokens) {
    if (this._tokens.length > 0) {
      const last = this._tokens[this._tokens.length - 1];
      if (last.endLineNumber + 1 === lineNumber) {
        last.appendLineTokens(lineTokens);
        return;
      }
    }
    this._tokens.push(new contiguousMultilineTokens.ContiguousMultilineTokens(lineNumber, [lineTokens]));
  }
  finalize() {
    return this._tokens;
  }
}
exports.ContiguousMultilineTokensBuilder = ContiguousMultilineTokensBuilder;
