class Matcher {
    constructor(state, pos, parsed) {
        this.state = state;
        this.pos = pos;
        this.parsed = parsed;
    }
    isBetterThan(o) {
        if (o === undefined || o === null)
            return true;
        if (this.state.isBetterThan(o.state))
            return true;
        if (o.state.isBetterThan(this.state))
            return false;
        let tParsedLength = this.pos + this.parsed.length;
        let oParsedLength = o.pos + o.parsed.length;
        return tParsedLength >= oParsedLength;
    }
    toString() {
        return `${this.state.toString()}: '${this.parsed}' (${this.pos})`;
    }
}
export { Matcher };
//# sourceMappingURL=Matcher.js.map