Enum piston_meta::Rule [] [src]

pub enum Rule {
    Whitespace(Whitespace),
    Token(Token),
    UntilAny(UntilAny),
    UntilAnyOrWhitespace(UntilAnyOrWhitespace),
    Text(Text),
    Number(Number),
    Select(Select),
    Sequence(Sequence),
    SeparatedBy(Box<SeparatedBy>),
    Repeat(Box<Repeat>),
    Lines(Box<Lines>),
    Node(Node),
    Optional(Box<Optional>),
}

A rule describes how some section of a document should be parsed.

Variants

Whitespace(Whitespace)

Read whitespace.

Token(Token)

Match against a token.

UntilAny(UntilAny)

Reads until any character.

UntilAnyOrWhitespace(UntilAnyOrWhitespace)

Read until any character or whitespace.

Text(Text)

Read text.

Number(Number)

Read number.

Select(Select)

Select one of the sub rules. If the first one does not succeed, try another and so on. If all sub rules fail, then the rule fails.

Sequence(Sequence)

Run each sub rule in sequence. If any sub rule fails, the rule fails.

SeparatedBy(Box<SeparatedBy>)

Repeat rule separated by another rule.

Repeat(Box<Repeat>)

Repeat rule.

Lines(Box<Lines>)

Repeat rule separated by one or more lines.

Node(Node)

Read node.

Optional(Box<Optional>)

Read optional.

Methods

impl Rule
[src]

fn parse(&self, tokenizer: &mut Tokenizer, state: &TokenizerState, chars: &[char], offset: usize, refs: &[(Rc<String>, Rule)]) -> ParseResult<TokenizerState>

Parses rule.

fn update_refs(&self, refs: &[(Rc<String>, Rule)])

Updates replacing names with the references.

The references contains the name, but this can not be borrowed as when the same reference is updated.

Trait Implementations

impl Clone for Rule
[src]

fn clone(&self) -> Rule

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more