1 package org.antlr.runtime 2 { 3 public class UnwantedTokenException extends MismatchedTokenException 4 { 5 public function UnwantedTokenException(expecting:int, input:IntStream) 6 { 7 super(expecting, input); 8 } 9 10 public function get unexpectedToken():Token { 11 return token; 12 } 13 14 public override function toString():String { 15 var exp:String = ", expected "+expecting; 16 if ( expecting==TokenConstants.INVALID_TOKEN_TYPE ) { 17 exp = ""; 18 } 19 if ( token==null ) { 20 return "UnwantedTokenException(found="+null+exp+")"; 21 } 22 return "UnwantedTokenException(found="+token.text+exp+")"; 23 } 24 } 25 }