logo
pub fn single_expression<'a, Input: 'a>(
    input: Input,
    indexer: &mut usize
) -> IResult<Input, SingleExpression<Input>, Error<Input>> where
    Input: Clone + Display + Offset + InputLength + InputTake + InputTakeAtPosition<Item = char> + Slice<RangeFrom<usize>> + InputIter + for<'s> Compare<&'s str>,
    <Input as InputIter>::Item: AsChar + Copy,
    Error<Input>: ParseError<Input>,
    for<'s> &'s str: FindToken<<Input as InputIter>::Item>, 
Expand description

Parses a single-expression as defined in the grammar spec.

Grammar

single-expression       = alternation
                           | optional
                           | parameter
                           | text-without-whitespace+
                           | whitespace+
text-without-whitespace = (- (text-to-escape | whitespace))
                           | ('\', text-to-escape)
text-to-escape          = '(' | '{' | '/' | '\'

Example

text(opt)/text
(opt)
{string}
text

Errors

Irrecoverable Failure

Any Failure of alternation(), optional() or parameter().

Indexing

The given indexer is incremented only if the parsed SingleExpression is returned and it represents a Parameter.