Git Product home page Git Product logo

parsecclone's Issues

Satisfy user state fails to backtrack on failure

If a satisfyUserState parser returns None but also the user state predicate returns false, then the None should be ignored and the state should backtrack. Right now, anything other than a Some will fail and not backtrack which causes instability in other parsers since the stream position has been modified.

Performance Benchmarks

It'd be nice to see some benchmarks to show the advantage of parsecclone over alternatives

BenchmarkDotNet NuGet version is really easy to use and generates preformatted charts that you can paste straight into the readme.

Build failing with float parsing

   System.ArgumentOutOfRangeException : Index and length must refer to a location within the string.
Parameter name: length
  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0006a] in <a07d6bf484a54da2861691df910339b1>:0 
  at FooStringUnitTests.testFloat () [0x00047] in <5968faeedd987869a7450383eefa6859>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a07d6bf484a54da2861691df910339b1>:0 

https://travis-ci.org/devshorts/ParsecClone/builds/253690729

@jinahong can you take a look and see if this is related? This will prevent cutting a new release

Remove CombinatorCS

Now that the blit emit code is all in f# we don't need to have a c# library dependency.

We need to remove the project, update the msbuild, the nuspec, and the readme.

BinParser, how to seek to begin of stream?

Hi,

I am trying rewrite my hand-made binary parser with ParserClone and can not figure out how can I seek from begin of stream? For example, suppose there is 64 byte-length file and I need to begin to parse offset which locates at end of file (last 4 bytes). Then I need to seek from begin of file by this parsed offset and parse another int32.

Create test file:

let writeTestFile () =
    use f = IO.File.OpenWrite("testfile.bin")
    use bw = new IO.BinaryWriter(f)

    let value = 55
    let offset = 32

    do bw.BaseStream.Seek(int64 offset, IO.SeekOrigin.Begin) |> ignore
    do bw.Write(BitConverter.GetBytes(value))

    do bw.BaseStream.Seek(int64 60, IO.SeekOrigin.Begin) |> ignore
    do bw.Write(BitConverter.GetBytes(offset))

Parse:

let parseTestFile () =
    let parser =
        bp.skip 60
        >>. bp.int32  // parse offset
        // ??? seek from start by readed offset
        >>. bp.int32 // parse value

    let fs = IO.File.OpenRead("testfile.bin")
    let bs = makeBinStream fs

    parser bs |> printfn "%A"

How can I do that?

Satisfy user state fails to backtrack on failure

If a satisfyUserState parser returns None but also the user state predicate returns false, then the None should be ignored and the state should backtrack. Right now, anything other than a Some will fail and not backtrack which causes instability in other parsers since the stream position has been modified.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.