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) ); }
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); }
private static bool IsNodeType(XPathScanner scaner) { return( scaner.Prefix.Length == 0 && ( scaner.Name == "node" || scaner.Name == "text" || scaner.Name == "processing-instruction" || scaner.Name == "comment" ) ); }
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); }
private XPathParser(XPathScanner scanner) { this.scanner = scanner; }