[][src]Trait lark_parser::syntax::Syntax

pub trait Syntax<'parse>: DebugWith {
    type Data;
    fn test(&mut self, parser: &Parser<'parse>) -> bool;
fn expect(
        &mut self,
        parser: &mut Parser<'parse>
    ) -> Result<Self::Data, ErrorReported>; }

Associated Types

type Data

The value that is produced (often, but not always, Self) by the parsing routine.

Loading content...

Required methods

fn test(&mut self, parser: &Parser<'parse>) -> bool

Routine to check if this syntax applies. This often does a much more shallow check than expect, e.g., just checking an initial token or two.

fn expect(
    &mut self,
    parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>

Routine to do the parsing itself. This will produce a parse error if the syntax is not found at the current point.

Relationship to test: If test returns false, errors are guaranteed. Even if test returns true, however, errors are still possible, since test does a more shallow check.

Loading content...

Implementations on Foreign Types

impl<T, 'parse, '_> Syntax<'parse> for &'_ mut T where
    T: Syntax<'parse>, 
[src]

type Data = T::Data

Loading content...

Implementors

impl<'parse> Syntax<'parse> for EntitySyntax[src]

type Data = ParsedEntity

impl<'parse> Syntax<'parse> for FunctionSignature[src]

type Data = ParsedFunctionSignature

impl<'parse> Syntax<'parse> for SpannedGlobalIdentifier[src]

type Data = Spanned<GlobalIdentifier, FileName>

impl<'parse> Syntax<'parse> for SpannedLocalIdentifier[src]

type Data = Spanned<&'parse str, FileName>

impl<'parse> Syntax<'parse> for Field[src]

type Data = Spanned<ParsedField, FileName>

impl<'parse> Syntax<'parse> for Member[src]

type Data = Spanned<ParsedMember, FileName>

impl<'parse> Syntax<'parse> for CloseCurly[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for CloseParenthesis[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for CloseSquare[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Colon[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Comma[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Dot[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Equals[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for ExclamationPoint[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Let[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Minus[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for OpenCurly[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for OpenParenthesis[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for OpenSquare[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Plus[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for RightArrow[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Semicolon[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Slash[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for Star[src]

type Data = Spanned<LexToken, FileName>

impl<'parse> Syntax<'parse> for TypeReference[src]

type Data = ParsedTypeReference

impl<D, 'parse> Syntax<'parse> for Matched<D> where
    D: Delimiter<'parse>, 
[src]

type Data = Spanned<ParsedMatch, FileName>

impl<D, T, 'parse> Syntax<'parse> for Delimited<D, T> where
    D: Delimiter<'parse>,
    T: Syntax<'parse>, 
[src]

type Data = T::Data

impl<G, V, 'parse> Syntax<'parse> for Guard<G, V> where
    G: NonEmptySyntax<'parse>,
    V: Syntax<'parse>, 
[src]

type Data = V::Data

impl<T, 'parse> Syntax<'parse> for CommaList<T> where
    T: Syntax<'parse>, 
[src]

type Data = Seq<T::Data>

impl<T, 'parse> Syntax<'parse> for SkipNewline<T> where
    T: Syntax<'parse>, 
[src]

type Data = T::Data

impl<T, S, 'parse> Syntax<'parse> for SeparatedList<T, S> where
    T: Syntax<'parse>,
    S: Syntax<'parse>, 
[src]

type Data = Seq<T::Data>

Loading content...