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