parseGeometry_() {
    const token = this.token_;
    if (this.match(TokenType.TEXT)) {
      const geomType = /** @type {string} */ (token.value);
      this.layout_ = this.parseGeometryLayout_();
      const isEmpty = this.isEmptyGeometry_();
      if (geomType == 'GEOMETRYCOLLECTION') {
        if (isEmpty) {
          return new GeometryCollection([]);
        }
        const geometries = this.parseGeometryCollectionText_();
        return new GeometryCollection(geometries);
      }
      const ctor = GeometryConstructor[geomType];
      if (!ctor) {
        throw new Error('Invalid geometry type: ' + geomType);
      }

      let coordinates;

      if (isEmpty) {
        if (geomType == 'POINT') {
          coordinates = [NaN, NaN];
        } else {
          coordinates = [];
        }
      } else {
        switch (geomType) {
          case 'POINT': {
            coordinates = this.parsePointText_();
            break;
          }
          case 'LINESTRING': {
            coordinates = this.parseLineStringText_();
            break;
          }
          case 'POLYGON': {
            coordinates = this.parsePolygonText_();
            break;
          }
          case 'MULTIPOINT': {
            coordinates = this.parseMultiPointText_();
            break;
          }
          case 'MULTILINESTRING': {
            coordinates = this.parseMultiLineStringText_();
            break;
          }
          case 'MULTIPOLYGON': {
            coordinates = this.parseMultiPolygonText_();
            break;
          }
          default:
            break;
        }
      }

      return new ctor(coordinates, this.layout_);
    }
    throw new Error(this.formatErrorMessage_());
  }
@return {import("../geom/Geometry.js").default} The geometry.
@private