public XPathParserException TokenExpectedException(Lexeme t, string actualToken)
        {
            string expectedToken = LexemeToString(t);
            var    x             = new XPathParserException(xpathExpr, lexStart, curIndex,
                                                            string.Format("Expected token '{0}', found '{1}'.", expectedToken, actualToken)
                                                            );

            x.NextAllowed = AllowedWhenExpected(t);
            return(x);
        }
        public XPathParserException NodeTestExpectedException()
        {
            string token = this.RawValue;
            var    x     = new XPathParserException(xpathExpr, lexStart, curIndex,
                                                    string.Format("Expected a node test, found '{0}'.", token)
                                                    );

            if (lexemeStack.Count > 0)
            {
                x.PriorToken  = this.lexemeStack.Peek();
                x.NextAllowed = AllowedFollowing(this.lexemeStack.Peek());
            }
            return(x);
        }
        // XPath error messages
        // --------------------

        public XPathParserException UnexpectedTokenException()
        {
            string token = this.RawValue;
            var    x     = new XPathParserException(xpathExpr, lexStart, curIndex,
                                                    string.Format("Unexpected token '{0}' in the expression.", token)
                                                    );

            if (lexemeStack.Count > 0)
            {
                x.PriorToken  = this.lexemeStack.Peek();
                x.NextAllowed = AllowedFollowing(this.lexemeStack.Peek());
            }
            return(x);
        }
 // XPath error messages
 // --------------------
 public XPathParserException UnexpectedTokenException()
 {
     string token = this.RawValue;
     var x = new XPathParserException(xpathExpr, lexStart, curIndex,
         string.Format("Unexpected token '{0}' in the expression.", token)
     );
     if (lexemeStack.Count > 0)
     {
         x.PriorToken = this.lexemeStack.Peek();
         x.NextAllowed = AllowedFollowing(this.lexemeStack.Peek());
     }
     return x;
 }
 public XPathParserException TokenExpectedException(Lexeme t, string actualToken)
 {
     string expectedToken = LexemeToString(t);
     var x = new XPathParserException(xpathExpr, lexStart, curIndex,
         string.Format("Expected token '{0}', found '{1}'.", expectedToken, actualToken)
     );
     x.NextAllowed= AllowedWhenExpected(t);
     return x;
 }
 public XPathParserException NodeTestExpectedException()
 {
     string token = this.RawValue;
     var x= new XPathParserException(xpathExpr, lexStart, curIndex,
         string.Format("Expected a node test, found '{0}'.", token)
     );
     if (lexemeStack.Count > 0)
     {
     x.PriorToken = this.lexemeStack.Peek();
     x.NextAllowed = AllowedFollowing(this.lexemeStack.Peek());
     }
     return x;
 }