Enum piston_meta::Rule [] [src]

pub enum Rule {
    Whitespace(Whitespace),
    Token(Token),
    UntilAny(UntilAny),
    UntilAnyOrWhitespace(UntilAnyOrWhitespace),
    Text(Text),
    Number(Number),
    Select(Select),
    Sequence(Sequence),
    SeparateBy(Box<SeparateBy>),
    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.

SeparateBy(Box<SeparateBy>)

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, tokens: &mut Vec<(Range, MetaData)>, state: &TokenizerState, chars: &[char], offset: usize, refs: &[Rule]) -> ParseResult<TokenizerState>

Parses rule.

fn update_refs(&mut self, names: &[Arc<String>])

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 PartialEq for Rule
[src]

fn eq(&self, __arg_0: &Rule) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Rule) -> bool

This method tests for !=.

impl Debug for Rule
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

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