Giter Club home page Giter Club logo

csv-parser-generator's People

Contributors

lokimidgard avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fubar-coder

csv-parser-generator's Issues

HasHeader = true produces uncompilable code

This is the compilation error:

0>CustomerDataLoaderFromCsv_csvparse.g.cs(93,9): Error CS0136 : Eine lokale Variable oder ein Parameter namens "next" kann in diesem Bereich nicht deklariert werden, da der Name in einem einschließenden lokalen Bereich zur Definition einer lokalen Variablen oder eines Parameters verwendet wird.
0>CustomerDataLoaderFromCsv_csvparse.g.cs(139,17): Error CS0136 : Eine lokale Variable oder ein Parameter namens "next" kann in diesem Bereich nicht deklariert werden, da der Name in einem einschließenden lokalen Bereich zur Definition einer lokalen Variablen oder eines Parameters verwendet wird.

The problem is that var next for the header isn't scoped and "shadowing" of variables isn't supported in C# (except for lambda expressions).

Index out of range exception

Hi,

I get an IndexOutOfRangeException in the following line:

} while(rest[end] == '"');

The line is part of the following block:

     if (isQuoted)
    {  
        end = 0;
        var oldEnd = end;
        do{
            if(end>0) {
                replaceDoubleQuotes = true;
            }
            oldEnd = end;
            end = rest[(oldEnd + 1)..].IndexOf(quoteSymbol) + 2 + oldEnd;
        } while(rest[end] == '"');
    }

The reason for this error is a CSV file whose last line doesn't end with a newline character (CR and/or LF).

Feature: Parse a single line

Description

It would be nice if I'd be able to parse a single line. The function signature might look like:

// without options
YourType ParseData(ReadOnlySpan<char> line);

// with options
YourType ParseData(ReadOnlySpan<char> line, Options<char> option);

// without options, but bytes instead of char
YourType ParseData(ReadOnlySpan<byte> line);

// with options, but bytes instead of char
YourType ParseData(ReadOnlySpan<byte> line, Options<char> option);

Reason

  • Parallelization of line parsing
  • Avoid allocation of List or similar

Other

Maybe support for lines without newline characters could be limited to single line parsing?

Warning CS8826: Method signature differes

Just something minor: The .NET 8 compiler shows the warning CS8826 when the parameter names are different in the users source code and the generated file.

Maybe it's possible to use the same parameter names as in the users source code (e.g. text instead of raw)?

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.