Farkle


RuntimeFarkle<'TResult> Type

A reusable parser and post-processor, created for a specific grammar, and returning a specific type of object that best describes an expression of the language of this grammar.

Its parsing methods return an F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Exceptions during post-processing (apart from ParserApplicationException) are thrown after being wrapped in a PostProcessorException.

Record fields

Record Field Description

Grammar

Full Usage: Grammar

Field type: Result<Grammar, BuildError list>
Field type: Result<Grammar, BuildError list>

PostProcessor

Full Usage: PostProcessor

Field type: PostProcessor<'TResult>
Field type: PostProcessor<'TResult>

TokenizerFactory

Full Usage: TokenizerFactory

Field type: TokenizerFactory
Field type: TokenizerFactory

Instance members

Instance member Description

this.Cast

Full Usage: this.Cast

Returns: RuntimeFarkle<obj>

Changes the runtime Farkle's returning type to Object, without changing its post-processsor.

Returns: RuntimeFarkle<obj>

this.ChangePostProcessor

Full Usage: this.ChangePostProcessor

Parameters:
Returns: RuntimeFarkle<'TNewResult> A new runtime Farkle with ite post- processor changed to pp.

Changes the PostProcessor of this runtime Farkle.

pp : PostProcessor<'TNewResult>

The new post-processor.

Returns: RuntimeFarkle<'TNewResult>

A new runtime Farkle with ite post- processor changed to pp.

this.ChangeTokenizer

Full Usage: this.ChangeTokenizer

Returns: RuntimeFarkle<'TResult> A new runtime Farkle that will parse text with tokenizers of type .

Changes the Tokenizer type this runtime Farkle will use.

A new tokenizer will be created with each parse operation.

Returns: RuntimeFarkle<'TResult>

A new runtime Farkle that will parse text with tokenizers of type .

MissingMethodEsception does not have a public constructor that accepts a Grammar.

this.ChangeTokenizer

Full Usage: this.ChangeTokenizer

Parameters:
Returns: RuntimeFarkle<'TResult> A new runtime Farkle that will parse text with the tokenizer tokenizerFactory will create.

Changes the TokenizerFactory of this runtime Farkle.

A new tokenizer will be created with each parse operation.

tokenizerFactory : TokenizerFactory

The new tokenizer factory

Returns: RuntimeFarkle<'TResult>

A new runtime Farkle that will parse text with the tokenizer tokenizerFactory will create.

this.GetBuildErrorMessage

Full Usage: this.GetBuildErrorMessage

Returns: string

Returns a user-friendly error message that describes what had gone wrong while building, or an empty string if building had been successful.

Returns: string

this.GetBuildErrors

Full Usage: this.GetBuildErrors

Returns: BuildError list

Returns a list of `BuildError` objects that describe what had gone wrong while building, or returns an empty list if building had been successful.

Returns: BuildError list

this.GetGrammar

Full Usage: this.GetGrammar

Returns: Grammar

Gets the Grammar behind the RuntimeFarkle{TResult}.

Returns: Grammar
InvalidOperationException Building the grammar had failed. The exception's message contains further details.

this.IsBuildSuccessful

Full Usage: this.IsBuildSuccessful

Returns: bool

Returns whether building was successful. If loaded from an EGT file, it will always return true.

Returns: bool

this.Parse

Full Usage: this.Parse

Parameters:
    textReader : TextReader - The text reader to parse.

Returns: Result<'TResult, FarkleError> An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Parses and post-processes a TextReader.

The text reader's content will be lazily read.

textReader : TextReader

The text reader to parse.

Returns: Result<'TResult, FarkleError>

An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

this.Parse

Full Usage: this.Parse

Parameters:
    inputString : string - The string to parse.

Returns: Result<'TResult, FarkleError> An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Parses and post-processes a string.

inputString : string

The string to parse.

Returns: Result<'TResult, FarkleError>

An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

this.Parse

Full Usage: this.Parse

Parameters:
Returns: Result<'TResult, FarkleError> An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Parses and post-processes a ReadOnlyMemory{Char}.

input : ReadOnlyMemory<char>

The read-only memory to parse.

Returns: Result<'TResult, FarkleError>

An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

this.Parse

Full Usage: this.Parse

Parameters:
    input : CharStream - The character stream to parse.

Returns: Result<'TResult, FarkleError> An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Parses and post-processes a CharStream.

input : CharStream

The character stream to parse.

Returns: Result<'TResult, FarkleError>

An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

this.ParseFile

Full Usage: this.ParseFile

Parameters:
    path : string - The path of the file to parse.

Returns: Result<'TResult, FarkleError> An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

Parses and post-processes a file.

The file's content will be lazily read.

path : string

The path of the file to parse.

Returns: Result<'TResult, FarkleError>

An F# result type containing either the post-processed return type, or a type describing what did wrong and where.

this.SyntaxCheck

Full Usage: this.SyntaxCheck

Returns: RuntimeFarkle<obj>

Changes the PostProcessor of this runtime Farkle to a dummy one that is useful for syntax-checking instead of parsing.

Returns: RuntimeFarkle<obj>

Static members

Static member Description

RuntimeFarkle.Create(grammar, postProcessor)

Full Usage: RuntimeFarkle.Create(grammar, postProcessor)

Parameters:
Returns: RuntimeFarkle<'TResult>

Creates a RuntimeFarkle{TResult} from the given Grammar and PostProcessor{TResult}.

grammar : Grammar
postProcessor : PostProcessor<'TResult>
Returns: RuntimeFarkle<'TResult>