[−][src]Trait lark_parser::syntax::Syntax
Associated Types
type Data
The value that is produced (often, but not always, Self
) by the
parsing routine.
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>
&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.
Implementations on Foreign Types
impl<T, 'parse, '_> Syntax<'parse> for &'_ mut T where
T: Syntax<'parse>,
[src]
T: Syntax<'parse>,
type Data = T::Data
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
Implementors
impl<'parse> Syntax<'parse> for EntitySyntax
[src]
type Data = ParsedEntity
fn test(&mut self, parser: &Parser) -> bool
[src]
fn expect(&mut self, parser: &mut Parser) -> Result<Self::Data, ErrorReported>
[src]
impl<'parse> Syntax<'parse> for FunctionSignature
[src]
type Data = ParsedFunctionSignature
fn test(&mut self, parser: &Parser) -> bool
[src]
fn expect(&mut self, parser: &mut Parser) -> Result<Self::Data, ErrorReported>
[src]
impl<'parse> Syntax<'parse> for SpannedGlobalIdentifier
[src]
type Data = Spanned<GlobalIdentifier, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for SpannedLocalIdentifier
[src]
type Data = Spanned<&'parse str, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Field
[src]
type Data = Spanned<ParsedField, FileName>
fn test(&mut self, parser: &Parser) -> bool
[src]
fn expect(&mut self, parser: &mut Parser) -> Result<Self::Data, ErrorReported>
[src]
impl<'parse> Syntax<'parse> for Member
[src]
type Data = Spanned<ParsedMember, FileName>
fn test(&mut self, parser: &Parser) -> bool
[src]
fn expect(&mut self, parser: &mut Parser) -> Result<Self::Data, ErrorReported>
[src]
impl<'parse> Syntax<'parse> for CloseCurly
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for CloseParenthesis
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for CloseSquare
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Colon
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Comma
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Dot
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Equals
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for ExclamationPoint
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Let
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Minus
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for OpenCurly
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for OpenParenthesis
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for OpenSquare
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Plus
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for RightArrow
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Semicolon
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Slash
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for Star
[src]
type Data = Spanned<LexToken, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<'parse> Syntax<'parse> for TypeReference
[src]
type Data = ParsedTypeReference
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<ParsedTypeReference, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<ParsedTypeReference, ErrorReported>
impl<D, 'parse> Syntax<'parse> for Matched<D> where
D: Delimiter<'parse>,
[src]
D: Delimiter<'parse>,
type Data = Spanned<ParsedMatch, FileName>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<D, T, 'parse> Syntax<'parse> for Delimited<D, T> where
D: Delimiter<'parse>,
T: Syntax<'parse>,
[src]
D: Delimiter<'parse>,
T: Syntax<'parse>,
type Data = T::Data
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<G, V, 'parse> Syntax<'parse> for Guard<G, V> where
G: NonEmptySyntax<'parse>,
V: Syntax<'parse>,
[src]
G: NonEmptySyntax<'parse>,
V: Syntax<'parse>,
type Data = V::Data
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<T, 'parse> Syntax<'parse> for CommaList<T> where
T: Syntax<'parse>,
[src]
T: Syntax<'parse>,
type Data = Seq<T::Data>
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Seq<T::Data>, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Seq<T::Data>, ErrorReported>
impl<T, 'parse> Syntax<'parse> for SkipNewline<T> where
T: Syntax<'parse>,
[src]
T: Syntax<'parse>,
type Data = T::Data
fn test(&mut self, parser: &Parser<'parse>) -> bool
[src]
fn expect(
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
[src]
&mut self,
parser: &mut Parser<'parse>
) -> Result<Self::Data, ErrorReported>
impl<T, S, 'parse> Syntax<'parse> for SeparatedList<T, S> where
T: Syntax<'parse>,
S: Syntax<'parse>,
[src]
T: Syntax<'parse>,
S: Syntax<'parse>,