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.

    34 people like this

    Posted: 6 years ago by Arjen Kopinga

  • Uri Parser

    A Uri parser using the Cashel library [1]. This implementation is using ArraySegment 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

    26 people like this

    Posted: 6 years ago by Ryan Riley

  • Functional wrappers for TryParse APIs

    Exemplary convenience wrappers for some of the System..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

    27 people like this

    Posted: 6 years ago by Novox

  • 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.

    5 people like this

    Posted: 5 years ago by Gennady Loskutov

  • JSON parsing with monads

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

    7 people like this

    Posted: 4 years ago by Zach Bray

  • Parse locale files

    This uses fparsec to parse locale files of hte form Id = text {arg:type} = newline = newlne For use with localization.

    1 people like this

    Posted: 3 years ago by devshorts

  • Extract script blocks from html page

    This module extracts all the blocks out of an html page's header. This can be useful if you are writing tools to merge all the js for future minifaction, or for otherwise manipulating the files.

    4 people like this

    Posted: 3 years ago by devshorts

  • Log file parsing

    File parsing, based on multiple lines, using recursive pattern matching with many :: (cons) operator

    2 people like this

    Posted: 3 years ago by Tuomas Hietanen

  • Log file parser for log4Net files

    Log file parser for log4Net files

    3 people like this

    Posted: 3 years ago by Tuomas Hietanen

  • Small Basic Parser

    Small Basic abstract syntax tree, parser and interpreter. Supports Small Basic's keywords and arithmetic, logical and comparison operators.

    9 people like this

    Posted: 3 years ago by Phillip Trelford

  • A Simple Parser

    This is a basic parser that I wrote which takes heavily from the examples in Dom Syme's Expert F# book and http://fsharpforfunandprofit.com/posts/pattern-matching-command-line/

    3 people like this

    Posted: 2 years ago by Joe C