Pidgin

Namespace Pidgin.Permutation

Classes

PermutationParser

Contains tools for running sequences of parsers in an order-insensitive manner.

PermutationParser<TToken, T>

A permutation parser represents a collection of parsers which can be run in an order-insensitive manner.

Declaration modifiers in C# are an example of an order-insensitive grammar. Modifiers can appear in any order: protected internal static readonly int x; means the same as internal readonly protected static int x;.

Usage of this class involves calling Add<U>(Parser<TToken, U>) or AddOptional<U>(Parser<TToken, U>, U) to add parsers to the permutation parser, and then calling Build() to create a parser which runs them in an order-insensitive manner and returns the results in a nested tuple.

Note that the parsers that are added to the permutation parser must always consume input before succeeding. If a parser succeeds on empty input the permutation parser will not work correctly. If you want to run a parser optionally, use AddOptional<U>(Parser<TToken, U>, U).

This class is immutable.