pub struct Lexer<'a> { /* private fields */ }Expand description
XPath 1.0 expression tokenizer.
The lexer processes an XPath expression string and produces a sequence of
Tokens. It handles the disambiguation rules from XPath 1.0 section 3.7
to correctly distinguish between operators and name tests for *, and
between function names, node type tests, axis names, and plain name tests.
§Examples
ⓘ
use xmloxide::xpath::lexer::Lexer;
let mut lexer = Lexer::new("child::p[@class='intro']");
let tokens = lexer.tokenize().unwrap();Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
Sourcepub fn tokenize(&mut self) -> Result<Vec<Token>, XPathError>
pub fn tokenize(&mut self) -> Result<Vec<Token>, XPathError>
Tokenizes the entire input expression into a sequence of tokens.
Applies the XPath 1.0 disambiguation rules (section 3.7) to correctly
classify tokens based on their context.
§Errors
Returns XPathError if the input contains an invalid token, such as
an unterminated string literal or an unexpected character.
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more