FParsec
breaks a string into multiple lines along text element boundaries.
A primitive pretty printer.
rangeIndex, pivotAroundRangeMax = findPivot (ranges: Range[]) iBegin iEnd
precondition: iBegin < iEnd, ranges must be sorted and non-overlapping
density lengthCap (ranges: Range[]) iBegin iEnd
precondition: iBegin < iEnd, ranges must be sorted and non-overlapping
sumOfCappedLengths (lengthCap: int32) (ranges: Range[]) (iBegin: int) (iEnd: int)
precondition: iBegin < iEnd, ranges must be sorted and non-overlapping
a lengthCap <= 0 is interpreted as a lengthCap of 2^32
sumOfLengths (ranges: Range[]) (iBegin: int) (iEnd: int)
precondition: iBegin < iEnd, ranges must be sorted and non-overlapping
ranges, values = collectSortAndMergeKeyValueRanges (cmp: EqualityComparer<'T>) (keyValues: seq<int*'T>)
Duplicate keys are not allowed.
If the comparer is not null, consecutive keys with the same value are combined.
Duplicate values are allowed.
If the comparer is not null, adjacent ranges with the same value are merged.
used by emitSetMembershipTest (and indirectly by emitSwitch)
used by emitSwitch
flag used for testing purposes
`createStaticStringMapping defaultValue keyValues`
creates an optimized mapping function that maps string keys to values.
The `keyValues` sequence specifies the key-value pairs for the mapping.
All keys not specified in `keyValues` are mapped to `defaultValue`. A `null` key is not supported.
`createStaticIntRangeMapping defaultValue keyValues`
creates an optimized mapping function that maps integer key ranges to values.
The `keyValues` sequence specifies the range-value pairs for the mapping.
All keys not contained in one of the ranges in `keyValues` are mapped to `defaultValue`.
`createStaticIntMapping defaultValue keyValues`
creates an optimized mapping function that maps integer keys to values.
The `keyValues` sequence specifies the key-value pairs for the mapping.
All keys not specified in `keyValues` are mapped to `defaultValue`.
`createStaticIntRangeIndicatorFunction invert rangesInSet`
creates an optimized indicator function for the integers in the ranges specified by the `rangesInSet` sequence.
If `invert` is `false` (`true`), the returned indicator function will return `true` (`false`) if and only if it is
called with an `int` contained in at least one of the ranges of `rangesInSet`.
`createStaticIntIndicatorFunction invert valuesInSet`
creates an optimized indicator function for the integers specified by the `valuesInSet` sequence.
If `invert` is `false` (`true`), the returned indicator function will return `true` (`false`) if and only if it is
called with an integer contained in `valuesInSet`.
`createStaticCharRangeIndicatorFunction invert rangesInSet`
creates an optimized indicator function for the chars in the ranges specified by the `rangesInSet` sequence.
If `invert` is `false` (`true`), the returned indicator function will return `true` (`false`) if and only if it is
called with a char contained in at least one of the ranges of `rangesInSet`.
`createStaticCharIndicatorFunction invert charsInSet`
creates an optimized indicator function for the chars specified by the `charsInSet` sequence.
If `invert` is `false` (`true`), the returned indicator function will return `true` (`false`)
if and only if it is called with a char contained in `charsInSet`.
Writes a string representation of the `ParserError` to the given `TextWriter` value.
The format of the position information can be customized by specifying the `positionPrinter`
argument. The given function is expected to print a representation of the passed `Position` value
to the passed `TextWriter` value. If possible, it should indent text lines with the passed string
and take into account the maximum column count (including indention) passed as the last argument.
Writes a string representation of the `ParserError` to the given `TextWriter` value.
For each error position `getStreamByName` is called with the `StreamName` of the `Position`.
The returned `CharStream` must be `null` or contain the content of the `CharStream` for which
the error was generated (at the original indices).
If `getStreamByName` returns a non-null `CharStream`, the printed error position information is
augmented with the line of text surrounding the error position, together with a '^'-marker
pointing to the exact location of the error in the input stream.
Writes a string representation of the `ParserError` to the given `TextWriter` value.
The given `CharStream` must contain the content of the original `CharStream`
for which this `ParserError` was generated (at the original indices).
For each error location the printed position information is augmented
with the line of text surrounding the error position, together with a '^'-marker
pointing to the exact location of the error in the input stream.
Returns a string representation of the `ParserError`.
The given `CharStream` must contain the content of the original `CharStream`
for which this `ParserError` was generated (at the original indices).
For each error location the printed position information is augmented
with the line of text surrounding the error position, together with a '^'-marker
pointing to the exact location of the error in the input stream.
Returns a string representation of the `ParserError`.
Represents a simple container type that brings together the position, user state and error messages of a parser error.
`mergeErrors error1 error2` is equivalent to `ErrorMessageList.Merge(error1, error2)`.
`compoundError label state msgs` creates an `ErrorMessageList` with a single `CompoundError label stream.Position msgs` message,
except if `msgs` is an `ErrorMessageList` with a single `BacktrackPoint(pos2, msgs2)` message,
in which case an `ErrorMessageList` with a single `CompoundError label pos2 msgs2` message is returned instead.
`backtrackError stream msgs` creates an `ErrorMessageList` with a single `BacktrackPoint stream.Position msgs` message,
except if `msgs` is already an `ErrorMessageList` with a single `BacktrackPoint(_, _)` message,
in which case `msgs` is returned instead.
`otherError o` creates an `ErrorMessageList` with a single `OtherError o` message.
`messageError msg` creates an `ErrorMessageList` with a single `Message msg` message.
`unexpectedStringCIError str` creates an `ErrorMessageList` with a single `UnexpectedStringCI str` message.
`unexpectedStringError str` creates an `ErrorMessageList` with a single `UnexpectedString str` message.
`unexpectedError label` creates an `ErrorMessageList` with a single `Unexpected label` message.
`expectedStringCIError str` creates an `ErrorMessageList` with a single `ExpectedStringCI str` message.
`expectedStringError str` creates an `ErrorMessageList` with a single `ExpectedString str` message.
`expectedError label` creates an `ErrorMessageList` with a single `Expected label` message.
The type of the "builder object" that can be used to build parsers with
F#'s "computation expression" syntax a.k.a. "workflow" syntax.
The type of the parser functions supported by FParsec combinators.
`let p, pRef = createParserForwardedToRef()` creates a parser `p` that forwards all
calls to the parser in the reference cell `pRef`. Initially, `pRef` holds a reference
to a dummy parser that raises an exception on any invocation.
The builder object for building parsers using F#'s computation expression syntax.
The parser `chainr p op defVal` is equivalent to `chainr1 p op <|>% defVal`.
The parser `chainr1 p op` parses one or more occurrences of `p` separated by `op`
(in EBNF notation: `p (op p)*`).
It returns the value obtained by *right* associative application of all functions
returned by `op` to the results returned by `p`,
i.e. `f1 x_1 (f_2 x_2 (... (f_n x_n x_n+1) ...))`,
where `f_1` to `f_n` are the functions returned by the parser `op` and
`x_1` to `x_n+1` are the values returned by `p`. If only a single occurance
of `p` and no occurance of `op` is parsed, the result of `p` is returned directly.
The parser `chainl p op defVal` is equivalent to `chainl1 p op <|>% defVal`.
The parser `chainl1 p op` parses one or more occurrences of `p` separated by `op`
(in EBNF notation: `p (op p)*`).
It returns the value obtained by *left* associative application of all functions
returned by `op` to the results returned by `p`,
i.e. `f_n (... (f_2 (f_1 x_1 x_2) x_3) ...) x_n+1`,
where `f_1` to `f_n` are the functions returned by the parser `op` and
`x_1` to `x_n+1` are the values returned by `p`. If only a single occurance
of `p` and no occurance of `op` is parsed, the result of `p` is returned directly.
The parser `many1Till p endp` behaves like `manyTill p endp`, except that it requires `p` to succeed at least one time.
`many1Till p endp` is an optimized implementation of `pipe2 p (manyTill p endp) (fun hd tl -> hd::tl)`.
The parser `skipManyTill p endp` is an optimized implementation of `manyTill p endp |>> ignore`.
The `parser manyTill p endp` repeatedly applies the parser `p`
for as long as `endp` fails (without changing the parser state).
It returns a list of the results returned by `p`.
The parser `skipSepEndBy1 p sep` is an optimized implementation of `sepEndBy1 p sep |>> ignore`.
The parser `sepEndBy1 p sep` parses *one* or more occurrences of `p` separated and
optionally ended by `sep` (in EBNF notation: `p (sep p)* sep?`).
It returns a list of the results returned by `p`.
The parser `skipSepEndBy p sep` is an optimized implementation of `sepEndBy p sep |>> ignore`.
The parser `sepEndBy p sep` parses *zero* or more occurrences of `p` separated and
optionally ended by `sep` (in EBNF notation: `(p (sep p)* sep?)?`).
It returns a list of the results returned by `p`.
The parser `skipSepBy1 p sep` is an optimized implementation of `sepBy1 p sep |>> ignore`.
The parser `sepBy1 p sep` parses *one* or more occurrences of `p` separated by `sep`
(in EBNF notation: `p (sep p)*`).
The parser `skipSepBy p sep` is an optimized implementation of `sepBy p sep |>> ignore`.
The parser `sepBy p sep` parses *zero* or more occurrences of `p` separated by `sep`
(in EBNF notation: `(p (sep p)*)?`).
The parser `skipMany1 p` is an optimized implementation of `many1 p |>> ignore`.
The parser `many1 p` behaves like `many p`, except that it requires `p` to succeed at least one time.
`many1 p` is an optimized implementation of `pipe2 p (many p) (fun hd tl -> hd::tl)`.
The parser `skipMany p` is an optimized implementation of `many p |>> ignore`.
The parser `many p` repeatedly applies the parser `p` until `p` fails.
It returns a list of the results returned by `p`.
At the end of the sequence `p` must fail without changing the parser state and without
signalling a `FatalError`, otherwise `many p` will fail with the error reported by `p`.
`many p` tries to guard against an infinite loop by throwing an exception
if `p` succeeds without changing the parser state.
The parser `skipArray n p` is an optimized implementation of `parray n p |>> ignore`.
The parser `parray n p` parses `n` occurences of `p` and
returns the returns the results in an array.
For example, `parray 3 p` is equivalent to `pipe3 p p p (fun a b c -> [|a;b;c|])`.
The parser `tuple5 p1 p2 p3 p4 p5` applies the parsers `p1`, `p2`, `p3`, `p4` and `p5` in sequence and
returns the results in a tuple.
The parser `tuple4 p1 p2 p3 p4` applies the parsers `p1`, `p2`, `p3` and `p4` in sequence and
returns the results in a tuple.
The parser `tuple3 p1 p2 p3` applies the parsers `p1`, `p2` and `p3` in sequence and
returns the results in a tuple.
The parser `tuple2 p1 p2` applies the parsers `p1` and `p2` in sequence and
returns the results in a tuple.
`tuple2 p1 p2` is defined as `p1 .>>. p2`.
The parser `failFatally msg` always fails with a `messageError msg`. It signals a
FatalError, so that no error recovery is attempted (except via backtracking constructs).
The parser `fail msg` always fails with a `messageError msg`.
The error message will be displayed together with other error messages generated for
the same input position.
The parser `p <??> label` behaves like `p <?> label`, except that when `p` fails
after changing the parser state (for example, because `p` consumes input before it fails),
a `CompoundError` message is generated with both the given string `label` and the
error messages generated by `p`.
The parser `p <?> label` applies the parser `p`. If `p` does not change the parser state
(usually because `p` failed), the error messages are replaced with `expected label`.
The parser `lookAhead p` parses `p` and restores the original parse state afterwards.
In case `p` fails after changing the parser state, the error messages are wrapped in a `NestedError`.
If it succeeds, any error messages are discarded. Fatal errors are turned into normal errors.
The parser `notFollowedByL p` behaves like `notFollowedBy p`,
except that it returns an `Unexpected label` error message when the parser `p` fails.
The parser `notFollowedBy p` succeeds if the parser `p` fails to parse at the current position.
Otherwise it fails with a non-fatal error. This parser never changes the parser state.
If the parser `notFollowedBy p` fails, it returns no descriptive error message.
Hence it should only be used together with other parsers that take care of a potential error.
Alternatively, `notFollowedByL p label` can be used to ensure a more descriptive error message.
The parser `followedByL p` behaves like `followedBy p`,
except that it returns an `Expected label` error message when the parser `p` fails.
The parser `followedBy p` succeeds if the parser `p` succeeds at the current position.
Otherwise it fails with a non-fatal error. This parser never changes the parser state.
If the parser `followedBy p` fails, it returns no descriptive error message.
Hence it should only be used together with other parsers that take care of a potential error.
Alternatively, `followedByL p label` can be used to ensure a more descriptive error message.
The parser `notEmpty p` behaves like `p`,
except that it fails when `p` succeeds without consuming input
or changing the parser state in any other way.
The parser `p1 .>>.? p2` behaves like `p1 .>>. p2`, except that it will backtrack
to the beginning if `p2` fails with a non-fatal error and without changing the parser state,
even if `p1` has changed the parser state.
The parser `p1 .>>? p2` behaves like `p1 .>> p2`, except that it will backtrack
to the beginning if `p2` fails with a non-fatal error and without changing the parser state,
even if `p1` has changed the parser state.
The parser `p1 >>? p2` behaves like `p1 >>. p2`, except that it will backtrack
to the beginning if `p2` fails with a non-fatal error and without changing the parser state,
even if `p1` has changed the parser state.
The parser `p >>=? f` behaves like `p >>= f`, except that it will backtrack to the beginning
if the parser returned by `f` fails with a non-fatal error and without changing the parser state,
even if `p` has changed the parser state.
The parser `attempt p` applies the parser `p`.
If `p` fails after changing the parser state or with a fatal error,
`attempt p` will backtrack to the original parser state and report a non-fatal error.
The parser `optional p` skips over an optional occurrence of `p`.
`optional p` is an optimized implementation of `(p >>% ()) <|>% ()`.
The parser `opt p` parses an optional occurrence of `p` as an option value.
`opt p` is an optimized implementation of `(p |>> Some) <|>% None`.
The parser `p <|>% x` is an optimized implementation of `p <|> preturn x`.
The parser `choiceL ps label` is an optimized implementation of `choice ps <?> label`.
The parser `choice ps` is an optimized implementation of `p1 <|> p2 <|> ... <|> pn`,
where `p1` ... `pn` are the parsers in the sequence `ps`.
The parser `p1 <|> p2` first applies the parser `p1`.
If `p1` succeeds, the result of `p1` is returned.
If `p1` fails with a non-fatal error and *without changing the parser state*,
the parser `p2` is applied.
Note: The stream position is part of the parser state, so if `p1` fails after consuming input,
`p2` will not be applied.
The parser `pipe5 p1 p2 p3 p4 p5 f` applies the parsers `p1`, `p2`, `p3`, `p4` and `p5` in sequence.
It returns the result of the function application `f a b c d e`, where `a`, `b`, `c`, `d` and `e` are the results returned by `p1`, `p2`, `p3`, `p4` and `p5`.
The parser `pipe4 p1 p2 p3 p4 f` applies the parsers `p1`, `p2`, `p3` and `p4` in sequence.
It returns the result `f a b c d`, where `a`, `b`, `c` and `d` are the results returned by `p1`, `p2`, `p3` and `p4`.
The parser `pipe3 p1 p2 p3 f` applies the parsers `p1`, `p2` and `p3` in sequence.
It returns the result `f a b c`, where `a`, `b` and `c` are the results returned by `p1`, `p2` and `p3`.
The parser `pipe2 p1 p2 f` applies the parsers `p1` and `p2` in sequence.
It returns the result `f a b`, where `a` and `b` are the results returned by `p1` and `p2`.
The parser `p |>> f` applies the parser `p` and
returns the result `f x`, where `x` is the result returned by `p`.
The parser `between popen pclose p` applies the parsers `pOpen`, `p` and `pEnd` in sequence.
It returns the result of `p`.
The parser `p1 .>>. p2` applies the parsers `p1` and `p2` in sequence and returns the results in a tuple.
The parser `p1 .>> p2` applies the parsers `p1` and `p2` in sequence and returns the result of `p1`.
The parser `p1 >>. p2` applies the parsers `p1` and `p2` in sequence and returns the result of `p2`.
The parser `p >>% x` applies the parser `p` and returns the result `x`.
The parser `p >>= f` first applies the parser `p` to the input, then applies the function `f`
to the result returned by `p` and finally applies the parser returned by `f` to the input.
The parser `pzero` always fails with an empty error message list, i.e. an unspecified error.
`pzero x` is defined as `fun stream -> Reply(Error, NoErrorMessages)`.
The parser `preturn x` always succeeds with the result `x` (without changing the parser state).
`preturn x` is defined as `fun stream -> Reply(x)`.
The parser failed and no error recovery (except after backtracking) should be tried.
The parser failed.
The parser succeeded.
Encodes various bits of information about a parsed number literal.
Returns the fourth suffix char, or EOS if less than four suffix chars were parsed
Returns the third suffix char, or EOS if less than three suffix chars were parsed
Returns the second suffix char, or EOS if less than two suffix chars were parsed.
Returns the first suffix char, or EOS if no suffix char was parsed.
The parsed number literal string. Only includes the parsed suffix chars if the
`NumberLiteralOptions` passed to the `numberLiteral` parser have the `IncludeSuffixCharsInString` flag set.
Eencodes various bits of information on the string literal.
The return type of the `numberLiteral` parser. An instance contains the parsed
number literal and various bits of information about it.
Note that the `String` member contains the string literal without the suffix chars,
except if the `NumberLiteralOptions` passed to the `numberLiteral` parser have the
`IncludeSuffixCharsInString` flag set.
Any parsed suffix chars are always available through the `SuffixChar1` - `4` members.
Encodes the various options of the `numberLiteral` parser.
Failure(errorAsString, error, suserState) holds the parser error and the user state returned by a failing parser,
together with a string representation of the parser error.
Success(result, userState, endPos) holds the result and the user state returned by a successful parser,
together with the position where the parser stopped.
Values of this type are returned by the runParser functions (not by `Parser<_,_>` functions).
Returns the `float32` value represented by the given string in hexadecimal format.
Raises a `System.FormatException` in case the string representation is invalid.
Raises a `System.OverflowException` if the (absolute) value is too large to be represented by a `float32`.
Returns a hexadecimal string representation of the `float32` argument.
Returns the `float` value represented by the given string in hexadecimal format.
Raises a `System.FormatException` in case the string representation is invalid.
Raises a `System.OverflowException` if the (absolute) value is too large to be represented by a `float`.
Returns a hexadecimal string representation of the `float` argument.
`normalizeNewlines str` returns a version of `str`
with all occurances of "\r\n" and "\r" replaced by "\n".
If the argument is `null`, `null` is returned.
`foldCase str` returns a case-folded version of `str`
with all chars mappend using the (non-Turkic) Unicode 1-to-1 case folding mappings
for chars below 0x10000. If the argument is `null`, `null` is returned.
`EOS` is equal to `CharStream<'u>.EndOfStreamChar`.
`previousCharSatisfies f` succeeds if the predicate function `f` returns `false`
when applied to the previous char in the stream, otherwise it fails.
If there is no previous char (because the stream is at the beginning),
this parser succeeds (as opposed to `previousCharSatisfies`).
This parser never changes the parser state.
Any newline ("\n", "\r\n" or "\r") in the input is interpreted as a single char '\n'.
If this parser fails, it returns no descriptive error message; hence it should only be
used together with parsers that take care of a potential error.
`previousCharSatisfies f` succeeds if the predicate function `f` returns `true`
when applied to the previous char in the stream, otherwise it fails.
If there is no previous char (because the stream is at the beginning),
this parser fails (as opposed to `previousCharSatisfiesNot`).
This parser never changes the parser state.
Any newline ("\n", "\r\n" or "\r") in the input is interpreted as a single char '\n'.
If this parser fails, it returns no descriptive error message; hence it should only be
used together with parsers that take care of a potential error.
`next2CharsSatisfyNot f` succeeds if the predicate function `f` returns `false`
when applied to the next 2 chars in the input stream, otherwise it fails.
If there aren't 2 chars remaining in the input stream, this parser succeeds (as opposed to `next2CharsSatisfy`).
This parser never changes the parser state.
Any newline ("\n", "\r\n" or "\r") in the input is interpreted as a single char '\n'.
If this parser fails, it returns no descriptive error message; hence it should only be
used together with parsers that take care of a potential error.
`next2CharsSatisfy f` succeeds if the predicate function `f` returns `true`
when applied to the next 2 chars in the input stream, otherwise it fails.
If there aren't 2 chars remaining in the input stream, this parser fails (as opposed to `next2CharsSatisfyNot`).
This parser never changes the parser state.
Any newline ("\n", "\r\n" or "\r") in the input is interpreted as a single char '\n'.
If this parser fails, it returns no descriptive error message; hence it should only be
used together with parsers that take care of a potential error.
`nextCharSatisfiesNot f` is an optimized implementation of `notFollowedBy (satisfy f)`.
`nextCharSatisfies f` is an optimized implementation of `followedBy (satisfy f)`.
`notFollowedByStringCI str` is an optimized implementation of `notFollowedByL (pstringCI str) ("'" + str + "'")`.
`notFollowedByString str` is an optimized implementation of `notFollowedByL (pstring str) ("'" + str + "'")`.
`followedByStringCI str` is an optimized implementation of `followedByL (pstringCI str) ("'" + str + "'")`.
`followedByString str` is an optimized implementation of `followedByL (pstring str) ("'" + str + "'")`.
`notFollowedByNewline` is an optimized implementation of `notFollowedByL newline "newline"`.
`followedByNewline` is an optimized implementation of `followedByL newline "newline"`.
`notFollowedByEOF` is an optimized implementation of `notFollowedByL eof "end of input"`.
Parses an unsigned integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than 255.
Parses an unsigned integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.UInt16.MaxValue`.
Parses an unsigned integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.UInt32.MaxValue`.
Parses an unsigned integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.UInt64.MaxValue`.
Parses an integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than 127 or less than -128.
Parses an integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.Int16.MaxValue` or less than `System.Int16.MinValue`.
Parses an integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.Int32.MaxValue` or less than `System.Int32.MinValue`.
Parses an integer in decimal, hexadecimal ("0x" prefix), octal ("0o") or binary ("0b") format.
The parser fails
without consuming input, if not at least one digit (including the '0' in the format specifiers "0x" etc.) can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after a format specifier,
after consuming input, if the value represented by the input string is greater than `System.Int64.MaxValue` or less than `System.Int64.MinValue`.
Parses a floating-point number in decimal or hexadecimal format.
The special values NaN and Inf(inity)? (case insensitive) are also recognized.
The parser fails
without consuming input, if not at least one digit (including the '0' in "0x") can be parsed,
after consuming input, if no digit comes after an exponent marker or no hex digit comes after "0x",
after consuming input, if the value represented by the input string (after rounding) is greater than `System.Double.MaxValue` or less than `System.Double.MinValue`.
`numberLiteralE` is an uncurried version of `numberLiteral` that can be used to
implement number parsers without having to construct a `numberLiteral` closure.
`numberLiteral options label` parses a number literal and returns the result in form
of a `NumberLiteral` value. The given `NumberLiteralOptions` argument determines the kind
of number literals accepted. The string `label` is used in the `Expected` error message
that is generated when the parser fails without consuming input.
The parser fails without consuming input, if not at least one digit (including the 0 in the
format specifiers "0x" etc.) can be parsed. It fails after consuming input, if no decimal
digit comes after an exponent marker or no valid digit comes after a format specifier.
`p |> withSkippedString f` applies the parser `p` and returns the result of `f str x`,
where `str` is the string skipped over by `p` and `x` is the result returned by `p`.
`skipped p` applies the parser `p` and returns the chars skipped over by `p` as a string.
All newlines ("\r\n", "\r" or "\n") are normalized to "\n".
`stringsSepBy1 sp sep` parses *one* or more occurrences of `sp` separated by `sep`.
It returns the strings parsed by `sp` *and* `sep` in concatenated form.
`stringsSepBy sp sep` parses *zero* or more occurrences of `sp` separated by `sep`.
It returns the strings parsed by `sp` *and* `sep` in concatenated form.
`many1Strings2 sp1 sp` behaves like `many1Strings sp`, except that it parses the first string with `sp1` instead of `sp`.
`many1Strings sp` parses a sequence of *one* or more strings with the string parser `sp`.
It returns the strings in concatenated form.
Note that `many1Strings sp` does not require the first string to be non-empty.
`manyStrings2 sp1 sp` behaves like `manyStrings sp`, except that it parses the first string with `sp1` instead of `sp`.
`manyStrings sp` parses a sequence of *zero* or more strings with the string parser `sp`.
It returns the strings in concatenated form.
`manyStrings sp` is an optimized implementation of `manyReduce (+) "" sp`.
`many1CharsTillApply2 cp1 cp endp` behaves like `many1CharsTillApply cp endp`, except that it parses the first char with `cp1` instead of `cp`.
`many1CharsTillApply cp endp` parses one char with the char parser `cp`.
Then it parses more chars with `cp` until the parser `endp` succeeds.
It stops after `endp` and returns the result of the function application `f str b`,
where `str` is the parsed string and `b` is result returned by `endp`.
`many1CharsTill2 cp1 cp endp` behaves like `many1CharsTill cp endp`, except that it parses the first char with `cp1` instead of `cp`.
`many1CharsTill cp endp` parses one char with the char parser `cp`.
Then it parses more chars with `cp` until the parser `endp` succeeds.
It stops after `endp` and returns the parsed chars as a string.
`many1CharsTill cp endp` is an optimized implementation of `pipe2 cp (manyCharsTill cp endp) (fun c1 str -> c1.ToString() + str)`
`manyCharsTillApply2 cp1 cp endp` behaves like `manyCharsTillApply cp endp`, except that it parses the first char with `cp1` instead of `cp`.
`manyCharsTillApply cp endp f` parses chars with the char parser `cp` until the parser `endp` succeeds.
It stops after `endp` and returns the result of the function application `f str b`,
where `str` is the parsed string and `b` is result returned by `endp`.
`manyCharsTill2 cp1 cp endp` behaves like `manyCharsTill cp endp`, except that it parses the first char with `cp1` instead of `cp`.
`manyCharsTill cp endp` parses chars with the char parser `cp` until the parser `endp` succeeds.
It stops after `endp` and returns the parsed chars as a string.
`many1Chars2 cp1 cp` behaves like `many1Chars2 cp`, except that it parses the first char with `cp1` instead of `cp`.
`many1Chars cp` parses a sequence of *one* or more chars with the char parser `cp`.
It returns the parsed chars as a string.
`many1Chars cp` is an optimized implementation of `many1 (attempt cp)` that returns
the chars as a string instead of a char list. The equivalence to `many1 (attempt p)`
instead of `many1 p` implies that `many1Chars` never fails after consuming input.
`manyChars2 cp1 cp` behaves like `manyChars2 cp`, except that it parses the first char with `cp1` instead of `cp`.
`manyChars cp` parses a sequence of *zero* or more chars with the char parser `cp`.
It returns the parsed chars as a string.
`manyChars cp` is an optimized implementation of `many (attempt cp)` that returns
the chars as a string instead of a char list. The equivalence to `many (attempt p)`
instead of `many p` implies that `manyChars` never fails.
The `identifier` parser is a configurable parser for the XID identifier syntax
specified in Unicode Standard Annex #31.
`regexL pattern label` is an optimized implementation of `regex pattern <?> label`.
`regex pattern` matches the .NET regular expression given by the string `pattern` on the chars
beginning at the current index in the input stream. It returns the string matched by the regular expression.
If the regular expression does not match, the parser fails without consuming input.
The `System.Text.RegularExpressions.Regex` object that is internally used to match the pattern is constructed
with the `RegexOptions` `MultiLine` and `ExplicitCapture`. In order to ensure that the regular expression
can only match at the beginning of a string, "\\A" is automatically prepended to the pattern.
Newline chars ('\r' and '\n') in the pattern are interpreted literally.
For example, an '\n' char in the pattern will only match "\n", not "\r" or "\r\n".
However, in the returned string all newlines ("\n", "\r\n" or "\r") are normalized to "\n".
For large files the regular expression is *not* applied to a string containing *all* the remaining chars
in the stream. The number of chars that are guaranteed to be visible to the regular expression is specified
during construction of the `CharStream`. If one of the `runParser` function` is used to run the parser,
this number is 43690.
`skipManyMinMaxSatisfy2L minCount maxCount f1 f label` is an optimized implementation of `skipManyMinMaxSatisfy2 minCount maxCount f1 f <?> label`.
`skipManyMinMaxSatisfyL minCount maxCount f label` is an optimized implementation of `skipManyMinMaxSatisfy minCount maxCount f <?> label`.
`manyMinMaxSatisfy2L minCount maxCount f1 f label` is an optimized implementation of `manyMinMaxSatisfy2 minCount maxCount f1 f <?> label`.
`manyMinMaxSatisfyL minCount maxCount f label` is an optimized implementation of `manyMinMaxSatisfy minCount maxCount f <?> label`.
`skipManyMinMaxSatisfy2 minCount maxCount f1 f` is an optimized implementation of `manyMinMaxSatisfy2 minCount maxCount f1 f |>> ignore`.
`skipManyMinMaxSatisfy minCount maxCount f` is an optimized implementation of `manyMinMaxSatisfy minCount maxCount f |>> ignore`.
`manyMinMaxSatisfy2 minCount maxCount f1 f` behaves like `manyMinMaxSatisfy minCount maxCount f`, except that the first char of the parsed string must satisfy `f1` instead of `f`.
`manyMinMaxSatisfy minCount maxCount f` parses a sequence of `minCount` or more chars that satisfy the
predicate function `f` (i.e. chars for which `f` returns `true`), but not more than `maxCount` chars.
It returns the parsed chars as a string. This parser is atomic, i.e. if the first `minCount` chars
do not all satisfy `f`, the parser fails without consuming any input.
Any newline ("\n", "\r\n" or "\r") is converted to the single char '\n'.
Thus, to accept a newline `f '\n'` must return `true`. `f` will never be called with '\r'
and the string returned by `manyMinMaxSatisfy minCount maxCount f` will never contain an '\r'.
`manyMinMaxSatisfy` throws an `ArgumentOutOfRangeException` if `maxCount` is negative.
`skipMany1Satisfy2L f1 f label` is an optimized implementation of `skipMany1Satisfy2 f1 f <?> label`.
`skipMany1SatisfyL f label` is an optimized implementation of `skipMany1Satisfy f <?> label`.
`many1Satisfy2L f1 f label` is an optimized implementation of `many1Satisfy2 f1 f <?> label`.
`many1SatisfyL f label` is an optimized implementation of `many1Satisfy f <?> label`.
`skipMany1Satisfy2 f1 f` is an optimized implementation of `many1Satisfy2 f1 f |>> ignore`.
`skipMany1Satisfy f` is an optimized implementation of `many1Satisfy f |>> ignore`.
`many1Satisfy2 f1 f` behaves like `many1Satisfy f`, except that the
first char of the parsed string must satisfy `f1` instead of `f`.
`many1Satisfy f` parses a sequence of *one* or more chars that satisfy the predicate function `f`
(i.e. chars for which `f` returns `true`). It returns the parsed chars as a string.
If the first char does not satisfy `f`, this parser fails without consuming input.
Any newline ("\n", "\r\n" or "\r") is converted to the single char '\n'.
Thus, to accept a newline `f '\n'` must return `true`. `f` will never be called
with '\r' and the string returned by `many1Satisfy f` will never contain an '\r'.
`skipManySatisfy2 f1 f` is an optimized implementation of `manySatisfy2 f1 f |>> ignore`.
`skipManySatisfy f` is an optimized implementation of `manySatisfy f |>> ignore`.
`manySatisfy2 f1 f` behaves like `manySatisfy f`, except that the
first char of the parsed string must satisfy `f1` instead of `f`.
`manySatisfy f` parses a sequence of *zero* or more chars that satisfy the predicate function `f`
(i.e. chars for which `f` returns `true`). It returns the parsed chars as a string.
Any newline ("\n", "\r\n" or "\r") is converted to the single char '\n'.
Thus, to accept a newline `f '\n'` must return `true`. `f` will never be called
with '\r' and the string returned by `manySatisfy f` will never contain an '\r'.
`skipCharsTillStringCI str maxCount` is an optimized implementation of `charsTillStringCI str maxCount |>> ignore`.
`charsTillStringCI str skipString maxCount` parses all chars before the first case-insensitive occurance of the string `str` and,
if `skipString` is `true`, skips over it. It returns the parsed chars before the string.
If more than `maxCount` chars come before the first case-insensitive occurance of `str`,
the parser *fails* after consuming `maxCount` chars.
Newlines ("\n", "\r\n" or "\r") are counted as single chars and
in the returned string all newlines are normalized to "\n".
`charsTillStringCI str maxCount` throws an `ArgumentOutOfRangeException` if `maxCount` is negative.
`skipCharsTillString str maxCount` is an optimized implementation of `charsTillString str maxCount |>> ignore`.
`charsTillString str skipString maxCount` parses all chars before the first occurance of the string `str` and,
if `skipString` is `true`, skips over `str`. It returns the parsed chars before the string.
If more than `maxCount` chars come before the first occurance of `str`, the parser *fails after consuming* `maxCount` chars.
Newlines ("\n", "\r\n" or "\r") are counted as single chars and
in the returned string all newlines are normalized to "\n".
`charsTillString str maxCount` throws an `ArgumentOutOfRangeException` if `maxCount` is negative.
`skipRestOfLine skipNewline` is an optimized implementation of `restOfLine skipNewline |>> ignore`.
`restOfLine skipNewline` parses any chars before the end of the line
and, if `skipNewline` is `true`, skips to the beginning of the next line (if there is one).
It returns the parsed chars before the end of the line as a string (without a newline).
A line is terminated by a newline ("\n", "\r\n" or "\r") or the end of the input stream.
`skipAnyString n` is an optimized implementation of `anyString n |>> ignore`.
`anyString n` parses any sequence of `n` chars or newlines ("\n", "\r\n" or "\r").
It returns the parsed string. In the returned string all newlines are normalized to "\n".
`anyString n` is an atomic parser: either it succeeds or it fails without consuming any input.
`stringCIReturn str x` is an optimized implementation of `pstringCI str >>% x`.
`skipStringCI str` is an optimized implementation of `pstringCI str |>> ignore`.
`pstringCI str` parses any string that case-insensitively matches the string `str`.
It returns the *parsed* string.
`str` may not contain newline chars ('\n' or '\r').
`stringReturn str x` is an optimized implementation of `pstring str >>% x`.
`skipString str` is an optimized implementation of `pstring str |>> ignore`.
`pstring str` parses the string `str` and returns `str`.
It is an atomic parser: either it succeeds or it fails without consuming any input.
`str` may not contain newline chars ('\n' or '\r').
The parser `eof` only succeeds at the end of the input. It never consumes input.
Skips over any sequence of *one* or more unicode whitespaces and
registers any unicode newline ("\n", "\r\n", "\r", "\u0085, "\u000C",
"\u2028"or "\u2029") as a newline.
Skips over any sequence of *one* or more unicode whitespaces and
registers any unicode newline ("\n", "\r\n", "\r", "\u0085, "\u000C",
"\u2028"or "\u2029") as a newline.
Skips over any sequence of *one* or more whitespaces (space (' '), tab('\t')
or newline ("\n", "\r\n" or "\r")).
Skips over any sequence of *zero* or more whitespaces (space (' '), tab ('\t')
or newline ("\n", "\r\n" or "\r")).
`newlineReturn x` is an optimized implementation of `unicodeNewline >>% x`.
`skipNewline` is an optimized implementation of `unicodeNewline |>> ignore`.
Parses a unicode newline ("\n", "\r\n", "\r", "\u0085", "\u2028", or "\u2029").
Returns '\n'. Note that this parser does not accept the formfeed char '\f' as a newline.
In contrast to most other parsers in FParsec this parser also increments
the internal line count for unicode newline characters other than '\n' and '\r'.
`newlineReturn x` is an optimized implementation of `newline >>% x`.
`skipNewline` is an optimized implementation of `newline |>> ignore`.
Parses a newline ("\n", "\r\n" or "\r"). Returns '\n'.
Is equivalent to `pchar '\n'`.
Parses the tab char '\t' and returns '\t'. Note that a tab char is treated like any other non-newline char:
the column number is incremented by (only) 1.
Returns `true` for any char in the range '0' - '7' and `false` for all other chars.
Returns `true` for any char in the range '0' - '9', 'a' - 'f', 'A' - 'F' and `false` for all other chars.
Returns `true` for any char in the range '0' - '9' and `false` for all other chars.
`isLetter` is equivalent to `System.Char.IsLetter`.
`isLower` is equivalent to `System.Char.IsLower`.
`isUpper` is equivalent to `System.Char.IsUpper`.
Returns `true` for any char in the range 'a' - 'z', 'A' - 'Z' and `false` for all other chars.
Returns `true` for any char in the range 'a' - 'z' and `false` for all other chars.
Returns `true` for any char in the range 'A' - 'Z' and `false` for all other chars.
`isNoneOf str` returns a predicate function.
When this predicate function is applied to a char, it returns `true` if and only if the char is not contained in `str`.
`isAnyOf str` returns a predicate function.
When this predicate function is applied to a char, it returns `true` if and only if the char is contained in `str`.
Parses any char in the range '0' - '7'. Returns the parsed char.
Parses any char in the range '0' - '9', 'a' - 'f' and 'A' - 'F'. Returns the parsed char.
Parses any char in the range '0' - '9'. Returns the parsed char.
Parses any UTF-16 letter char identified by `System.Char.IsLetter`.
Returns the parsed char.
Parses any UTF-16 lowercase letter char identified by `System.Char.IsLower`.
Returns the parsed char.
Parses any UTF-16 uppercase letter char identified by `System.Char.IsUpper`.
Returns the parsed char.
Parses any char in the range 'a' - 'z' and 'A' - 'Z'. Returns the parsed char.
Parses any char in the range 'a' - 'z'. Returns the parsed char.
Parses any char in the range 'A' - 'Z'. Returns the parsed char.
`skipNoneOf s` is an optimized implementation of `noneOf s |>> ignore`.
`noneOf str` parses any char not contained in the string `str`. It returns the parsed char.
If `str` does not contain the char '\n', `noneOf str` parses any newline ("\n", "\r\n" or "\r")
and returns it as as '\n'. (Note that it does not make a difference whether or not
`str` contains '\r'; `noneOf str` will never return '\r'.)
`skipAnyOf str` is an optimized implementation of `anyOf str |>> ignore`.
`anyOf str` parses any char contained in the string `str`. It returns the parsed char.
If `str` contains the char '\n', `anyOf str` parses any newline ("\n", "\r\n" or "\r")
and returns it as '\n'. (Note that it does not make a difference whether or not
`str` contains '\r'; `anyOf str` will never return '\r'.)
`skipSatisfyL f label` is an optimized implementation of `skipSatisfy f <?> label`.
`satisfy f label` is an optimized implementation of `satisfy f <?> label`.
`skipSatisfy f` is an optimized implementation of `satisfy f |>> ignore`.
`satisfy f` parses any one char or newline for which the predicate function `f` returns `true`.
It returns the parsed char.
Any newline ("\n", "\r\n" or "\r") is converted to the single char '\n'.
Thus, to accept a newline `f '\n'` must return `true`. `f` will never be called
with '\r' and `satisfy f` will never return the result '\r'.
`skipAnyChar` is an optimized implementation of `anyChar |>> ignore`.
`anyChar` parses any single char or newline ("\n", "\r\n" or "\r").
Returns the parsed char, or '\n' in case a newline was parsed.
`charReturn c x` is an optimized implementation of `pchar c >>% x`.
`skipChar c` is an optimized implementation of `pchar c |>> ignore`.
`pchar c` parses the char `c` and returns `c`.
If `c = '\r'` or `c = '\n'` then `pchar c` will parse any one newline ("\n", "\r\n" or "\r") and return `c`.
The parser `userStateSatisfies f` succeeds if `f` returns `true`
when applied to the current user state, otherwise it fails.
`updateUserState f` is equivalent to `fun stream -> stream.UserState <- f stream.UserState; Reply(())`.
The parser `setUserState u` sets the user state to `u`.
`setUserState u` is equivalent to `fun stream -> stream.UserState <- u; Reply(())`.
The parser `getUserState` returns the current user state.
`getUserState` is equivalent to `fun stream -> Reply(stream.UserState)`.
The parser `getPosition` returns the current position in the input Stream.
`getPosition` is equivalent to `fun stream -> Reply(stream.Position)`.
`run parser str` is a convenient abbreviation for `runParserOnString parser () "" str`.
`runParserOnFile p ustate path encoding` runs the parser `p` on the content of the file
at the given `path`, starting with the initial user state `ustate`.
In case no unicode byte order mark is found, the file data is assumed to be encoded with the given `encoding`.
The parser's `Reply` is captured and returned as a `ParserResult` value.
`runParserOnStream p ustate streamName stream encoding` runs the parser `p` on the content of
the `System.IO.Stream` `stream`, starting with the initial user state `ustate`. The `streamName`
is used in error messages to describe the source of the input (e.g. a file path) and may be empty.
In case no unicode byte order mark is found, the stream data is assumed to be encoded with the given `encoding`.
The parser's `Reply` is captured and returned as a `ParserResult` value.
`runParserOnSubstring p ustate streamName str index count` runs the parser `p` directly on the content
of the string `str` between the indices `index` (inclusive) and `index + count` (exclusive),
starting with the initial user state `ustate`. The `streamName` is used in error messages to describe
the source of the input (e.g. a file path) and may be empty.
The parser's `Reply` is captured and returned as a `ParserResult` value.
`runParserOnString p ustate streamName str` runs the parser `p` directly on the content of the string `str`,
starting with the initial user state `ustate`. The `streamName` is used in error messages to describe
the source of the input (e.g. a file path) and may be empty.
The parser's `Reply` is captured and returned as a `ParserResult` value.