Skip to content
Browse files

Better error message for /<perl>/ et al (fixes #69)

  • Loading branch information...
1 parent db7fa59 commit 1b30eff2a764f1bcf56164ce238584912fac1048 @sorear committed Oct 30, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/Cursor.cs
View
8 lib/Cursor.cs
@@ -261,7 +261,13 @@ public sealed class RxFrame: IFreeze {
}
public void IncorporateChild(string[] names, bool passcap, P6any match) {
- Cursor child = (Cursor) match;
+ Cursor child = match as Cursor;
+
+ if (child == null)
+ throw new NieczaException((names.Length == 0 ?
+ "Anonymous submatch" : "Submatch to be bound to " + names[0]) +
+ " returned a " + match.mo.name + " instead of a Cursor, " +
+ "violating the submatch protocol.");
SetPos(child.pos);
if (passcap)

0 comments on commit 1b30eff

Please sign in to comment.
Something went wrong with that request. Please try again.