Snippets tagged parsing

  • Parsing string expressions, the lazy way

    Sometimes you'd be surprised at what functionality you can find inside the .Net framework. Apparently the DataTable object can compute string expressions. Nice for testing your own parser implementation, and/or for lazy coders like me. Note that the DataTable is created only once and reused with each function call.

    29 people like this
    Posted: 1 years ago by Arjen Kopinga

  • Uri Parser

    A Uri parser using the Cashel library [1]. This implementation is using ArraySegment<byte> as the underlying state, as I'm using it within a server, but it would be trivial to switch it to using a list. Also, note that I am not parsing the Uri into any specific structure, though that, too, would be trivial. For my current purposes, I just needed to validate the Uri. [1] https://github.com/panesofglass/cashel

    20 people like this
    Posted: 1 years ago by Ryan Riley

  • Int32.tryParse

    Converts the string representation of a number in-place to an Int32. A return value of None indicates the conversion failed.

    18 people like this
    Posted: 1 years ago by Phillip Trelford

  • Functional wrappers for TryParse APIs

    Exemplary convenience wrappers for some of the System.<Typename>.TryParse APIs, using the combined power of F#' return value deconstruction mechanism via pattern matching, active patterns and option types instead of "out/ref" parameters

    15 people like this
    Posted: 1 years ago by Novox

  • sscanf - parsing with format strings

    A more complete version of sscanf, as proposed on stackoverflow by kvb: http://stackoverflow.com/questions/2415705/read-from-console-in-f

    7 people like this
    Posted: 1 years ago by Wolfgang Meyer

  • Lazily split string

    Splits strings lazily, instead of splitting entire string into an array like System.String.Split. Especially useful for very large strings.

    6 people like this
    Posted: 1 years ago by Daniel Robinson

  • Yet another command-line parser

    The snippet shows a parser for command-line arguments supporting value lists for single commands. Calling with the following arguments: "Arg 1" "Arg 2" -test "Case 1" "Case 2" -show -skip "tag" produces the following map: map [("", seq ["Arg 1"; "Arg 2"]); ("show", seq []); ("skip", seq ["tag"]);("test", seq ["Case 1"; "Case 2"])] which can be used to find what data have been sent along with different commands. Calling with the following: "Arg 1" "Arg 2" /test="Case 1" "Case 2" --show /skip:tag produces the same result.

    2 people like this
    Posted: 7 months ago by Gennady Loskutov

  • Loading .fs files

    This script facilitates to load all the .fs files in the specified F# project in correct compilation order.

    3 people like this
    Posted: 4 months ago by nagat01

  • JSON parsing with monads

    JSON parsing with monads. See also "Expression parsing with monads" (http://fssnip.net/bi). Author URL: http://www.zbray.com

    5 people like this
    Posted: 1 months ago by Zach Bray

  • Speech Stackoverflow article automatically

    This snippet automatically speeches text of question,answers and comments in a Stackoverflow article. It requires HtmlAgilityPack(available from Nuget package manager).(Attention: You need reset F# interactive to stop the speech)

    5 people like this
    Posted: 7 days ago by nagat01