Struct semver_parser::parser::Parser [−][src]
pub struct Parser<'input> { /* fields omitted */ }
A recursive-descent parser for parsing version requirements.
Methods
impl<'input> Parser<'input>
[src]
impl<'input> Parser<'input>
pub fn new(input: &'input str) -> Result<Parser<'input>, Error<'input>>
[src]
pub fn new(input: &'input str) -> Result<Parser<'input>, Error<'input>>
Construct a new parser for the given input.
pub fn comma_predicate(&mut self) -> Result<Option<Predicate>, Error<'input>>
[src]
pub fn comma_predicate(&mut self) -> Result<Option<Predicate>, Error<'input>>
Parse an optional comma separator, then if that is present a predicate.
pub fn component(&mut self) -> Result<Option<u64>, Error<'input>>
[src]
pub fn component(&mut self) -> Result<Option<u64>, Error<'input>>
Parse a single component.
Returns None
if the component is a wildcard.
pub fn numeric(&mut self) -> Result<u64, Error<'input>>
[src]
pub fn numeric(&mut self) -> Result<u64, Error<'input>>
Parse a single numeric.
pub fn dot_component(&mut self) -> Result<(Option<u64>, bool), Error<'input>>
[src]
pub fn dot_component(&mut self) -> Result<(Option<u64>, bool), Error<'input>>
Optionally parse a dot, then a component.
The second component of the tuple indicates if a wildcard has been encountered, and is
always false
if the first component is Some
.
If a dot is not encountered, (None, false)
is returned.
If a wildcard is encountered, (None, true)
is returned.
pub fn dot_numeric(&mut self) -> Result<u64, Error<'input>>
[src]
pub fn dot_numeric(&mut self) -> Result<u64, Error<'input>>
Parse a dot, then a numeric.
pub fn identifier(&mut self) -> Result<Identifier, Error<'input>>
[src]
pub fn identifier(&mut self) -> Result<Identifier, Error<'input>>
Parse an string identifier.
Like, foo
, or bar
.
pub fn op(&mut self) -> Result<Op, Error<'input>>
[src]
pub fn op(&mut self) -> Result<Op, Error<'input>>
Optionally parse a single operator.
Like, ~
, or ^
.
pub fn predicate(&mut self) -> Result<Option<Predicate>, Error<'input>>
[src]
pub fn predicate(&mut self) -> Result<Option<Predicate>, Error<'input>>
Parse a single predicate.
Like, ^1
, or >=2.0.0
.
pub fn range(&mut self) -> Result<VersionReq, Error<'input>>
[src]
pub fn range(&mut self) -> Result<VersionReq, Error<'input>>
Parse a single range.
Like, ^1.0
or >=3.0.0, <4.0.0
.
pub fn comparator(&mut self) -> Result<Comparator, Error<'input>>
[src]
pub fn comparator(&mut self) -> Result<Comparator, Error<'input>>
Parse a comparator.
Like, 1.0 || 2.0
or ^1 || >=3.0.0, <4.0.0
.
pub fn version(&mut self) -> Result<Version, Error<'input>>
[src]
pub fn version(&mut self) -> Result<Version, Error<'input>>
Parse a version.
Like, 1.0.0
or 3.0.0-beta.1
.
pub fn is_eof(&mut self) -> bool
[src]
pub fn is_eof(&mut self) -> bool
Check if we have reached the end of input.
pub fn tail(&mut self) -> Result<Vec<Token<'input>>, Error<'input>>
[src]
pub fn tail(&mut self) -> Result<Vec<Token<'input>>, Error<'input>>
Get the rest of the tokens in the parser.
Useful for debugging.