@@ -164,6 +164,10 @@ export interface Matcher {
164164 * Result of Grammar#match
165165 */
166166export interface MatchResult {
167+ matcher: Matcher;
168+ input: string;
169+
170+
167171 /**
168172 * True iff match succeeded
169173 */
@@ -180,22 +184,36 @@ export interface SucceededMatchResult extends MatchResult {
180184
181185export interface FailedMatchResult extends MatchResult {
182186 /**
183- * If match failed contains an error message indicating where and
184- * why the match failed. This message is suitable for end users of a
185- * language (i.e., people who do not have access to the grammar source).
186- */
187+ * If match failed contains an error message indicating where and
188+ * why the match failed. This message is suitable for end users of a
189+ * language (i.e., people who do not have access to the grammar source).
190+ */
187191 message: string;
188192
189193 /**
190- * If match failed contains an abbreviated version of this.message that
191- * does not include an excerpt from the invalid input.
192- */
194+ * If match failed contains an abbreviated version of this.message that
195+ * does not include an excerpt from the invalid input.
196+ */
193197 shortMessage: string;
194198
195199 /**
196- * If this MatchResult is a failure, returns an Interval indicating
197- * the position of the rightmost failure.
198- */
200+ * Returns the position at which the error should be reported. This is used
201+ * to construct `message` and `shortMessage`.
202+ */
203+ getRightmostFailurePosition(): number;
204+
205+ /**
206+ * Return a string summarizing the expected contents of the input stream
207+ * at the rightmost failure position. This is used to construct `message`
208+ * and `shortMessage`.
209+ */
210+ getExpectedText(): string;
211+
212+
213+ /**
214+ * If this MatchResult is a failure, returns an Interval indicating
215+ * the position of the rightmost failure.
216+ */
199217 getInterval(): Interval;
200218}
201219
0 commit comments