Пример #1
0
 private static bool IsPrimaryExpr(XPathScanner scanner)
 {
     return(
         scanner.Kind == XPathScanner.LexKind.String ||
         scanner.Kind == XPathScanner.LexKind.Number ||
         scanner.Kind == XPathScanner.LexKind.Dollar ||
         scanner.Kind == XPathScanner.LexKind.LParens ||
         scanner.Kind == XPathScanner.LexKind.Name && scanner.CanBeFunction && !IsNodeType(scanner)
         );
 }
Пример #2
0
        private Axis.AxisType GetAxis(XPathScanner scaner)
        {
            Debug.Assert(scaner.Kind == XPathScanner.LexKind.Axe);
            object axis = AxesTable[scaner.Name];

            if (axis == null)
            {
                throw new XPathException(String.Format("'{0}' has an invalid token.", scanner.SourceText));
            }
            return((Axis.AxisType)axis);
        }
Пример #3
0
 private static bool IsNodeType(XPathScanner scaner)
 {
     return(
         scaner.Prefix.Length == 0 && (
             scaner.Name == "node" ||
             scaner.Name == "text" ||
             scaner.Name == "processing-instruction" ||
             scaner.Name == "comment"
             )
         );
 }
Пример #4
0
        public static AstNode ParseXPathPattern(string xpathPattern)
        {
            XPathScanner scanner = new XPathScanner(xpathPattern);
            XPathParser  parser  = new XPathParser(scanner);
            AstNode      result  = parser.ParsePattern(null);

            if (scanner.Kind != XPathScanner.LexKind.Eof)
            {
                throw new XPathException(string.Format("'{0}' has an invalid token.", scanner.SourceText));
            }
            return(result);
        }
Пример #5
0
 private XPathParser(XPathScanner scanner)
 {
     this.scanner = scanner;
 }