import type { CstNodeLocation, IToken } from 'chevrotain';
import type { Code } from './project.code.js';
import type { Signifier } from './signifiers.js';
import { EnumType, FunctionType, StructType, WithableType } from './types.js';
export declare const firstLineIndex = 1;
export declare const firstColumnIndex = 1;
export type CstLocation = Required<CstNodeLocation>;
export interface IPosition {
    offset: number;
    line: number;
    column: number;
}
export interface IRange {
    start: IPosition;
    end: IPosition;
}
/**
 * Single-character tokens do not have correct end
 * location information. This function checks the `image`
 * of the token and fixes the end location if necessary.
 */
export declare function fixITokenLocation(token: IToken): IToken;
export type LinePosition = {
    line: number;
    column: number;
};
export declare class Position implements IPosition {
    readonly file: Code;
    offset: number;
    line: number;
    column: number;
    readonly $tag = "Pos";
    constructor(file: Code, offset: number, line: number, column: number);
    /**
     * Create a new Positiong instance within this same file
     * at the given location. */
    at(loc: CstNodeLocation): Position;
    /**
     * Create a new location starting at the end of
     * the given location.
     */
    atEnd(loc: CstNodeLocation): Position;
    equals(other: Position): boolean;
    static from(file: Code, loc: CstNodeLocation | Position | IPosition, fromTokenEnd?: boolean): Position;
    static fromFileStart(fileName: Code): Position;
    static fromCstStart(fileName: Code, location: CstNodeLocation): Position;
    static fromCstEnd(fileName: Code, location: CstNodeLocation): Position;
    static equals(a: Position, b: Position): boolean;
}
export declare function isRange(value: unknown): value is Range;
export declare class Range implements IRange {
    $tag: string;
    start: Position;
    end: Position;
    constructor(start: Position, end?: Position);
    get file(): Code;
    static from(file: Code, location: IRange | CstNodeLocation): Range;
    static fromCst(fileName: Code, location: CstNodeLocation): Range;
    static equals(a: Range, b: Range): boolean;
}
/**
 * A code range corresponding with a specific function argument.
 * Useful for providing signature help.
 */
export declare class FunctionArgRange extends Range {
    /** The function reference this call belongs to */
    readonly type: FunctionType;
    /** The index of the parameter we're in. */
    readonly idx: number;
    $tag: string;
    hasExpression: boolean;
    constructor(
    /** The function reference this call belongs to */
    type: FunctionType, 
    /** The index of the parameter we're in. */
    idx: number, start: Position, end?: Position);
    get param(): Signifier;
}
export declare class StructNewMemberRange extends Range {
    /** The function reference this call belongs to */
    readonly type: StructType;
    $tag: string;
    constructor(
    /** The function reference this call belongs to */
    type: StructType, start: Position, end?: Position);
}
export declare const enum ScopeFlag {
    DotAccessor = 1
}
export declare class Scope extends Range {
    local: StructType;
    self: WithableType | EnumType;
    readonly $tag = "Scope";
    /** The immediately adjacent ScopeRange */
    protected _next: Scope | undefined;
    flags: number;
    constructor(start: Position, local: StructType, self: WithableType | EnumType);
    set isDotAccessor(value: boolean);
    get isDotAccessor(): boolean;
    setEnd(atToken: CstNodeLocation | Position, fromTokenEnd?: boolean): void;
    /**
     * Create the next ScopeRange, adjacent to this one.
     * This sets the end location of this scope range to
     * match the start location of the next one. The self
     * and local values default to the same as this scope range,
     * so at least one will need to be changed!
     */
    createNext(atToken: CstNodeLocation, fromTokenEnd?: boolean): Scope;
}
export type ReferenceableType = Signifier;
export declare class Reference extends Range {
    item: Signifier;
    readonly $tag = "Ref";
    /** If this is reference marks the declaration */
    isDef: boolean;
    protected _itemNamePattern: RegExp | undefined;
    constructor(item: Signifier, start: Position, end: Position);
    get itemNamePattern(): RegExp;
    /**
     * The text in this ref's range, which does not necessarily match
     * the text of the item it refers to (e.g. it could be `self` or similar)
     */
    get text(): string;
    get isRenameable(): boolean;
    /**
     * Get full text content of this reference if what it referenced were
     * to be renamed to the given name. This **does not** actually rename
     * the identifier!
     */
    toRenamed(newName: string): string;
    static fromRange(range: Range, item: ReferenceableType): Reference;
}
//# sourceMappingURL=project.location.d.ts.map