public EndUserParseException(Token token, string filename, string errorcode, string message, params object[] parameters)
     : base("{0}({1},{2}):{3}:{4}".format(filename, token.Row, token.Column, errorcode, message.format(parameters))) {
     Token = token;
 }
        public IEnumerable<Token> Tokanize(String pattern)
        {
            Contract.Assert(pattern != null);
            if (this.cachedTokens.ContainsKey(pattern))
            {
                foreach (var token in this.cachedTokens[pattern])
                {
                    yield return token;
                }
                yield break;
            }
            else
            {

                List<Token> currentResult = new List<Token>();

                int start = 0;
                for (int end = 0; end < pattern.Length; end++)
                {
                    if (pattern[end] == '*')
                    {
                        if (end > 0)
                        {
                            var token = new Token(pattern.Substring(start, end - start), start == 0);
                            yield return token;
                            currentResult.Add(token);
                        }
                        start = end + 1;
                    }
                }
                if (pattern[pattern.Length - 1] != '*')
                {
                    var token = new Token(pattern.Substring(start), start == 0, true);
                    yield return token;
                    currentResult.Add(token);
                }
                this.cachedTokens[pattern] = currentResult;
            }
        }
 public SourceLocation(Token t, string sourceFile = null) {
     _sourceToken = t;
     SourceFile = sourceFile;
 }
 public ParseException(Token token, string filename, ErrorCode errorcode, string message, params object[] parameters)
     : base("{0}({1},{2}):PSP {3}:{4}".format(filename, token.Row, token.Column, (int)errorcode, message.format(parameters))) {
     Token = token;
 }