Git Product home page Git Product logo

parsinator's Introduction

Blog | dev.to | LinkedIn

Hola πŸ‘‹, I'm Cesar Aguirre

A software engineer, lifelong learner, language enthusiast and avid reader

I’m a software engineer based in Colombia πŸ‡¨πŸ‡΄ (not Columbia). I help teams to grow high-quality code. And by high-quality, I mean maintainable and performant.

I share my learning on my journey as a software engineer through my blog. I write about programming and learning in general. In my free time, I like to read πŸ“š books (on paper) and learn and teach πŸ—£οΈ foreign languages.

  • πŸ”­ I’m currently working as C# backend engineer and technical writer
  • 🌱 I’m currently learning JavaScript/React and πŸ‡§πŸ‡· Brazilian Portuguese
  • πŸ‘― I’m looking to collaborate on C#, Python or Go open source projects
  • πŸ’¬ Ask me about C#, language learning or anything else. I don't have all answers, tho
  • ⚑ Fun facts: cat owner, vim user, plain-text lover and Zettelkasten practitioner

Start here

If you don’t know where to start reading my blog, head to any of these posts:

Whether you’re starting out or already on the software engineering journey, join my free 7-day email course to refactor your coding career now β€” I distill 10+ years of career lessons into 7 short emails. Email #1 could save your next software projects from failure.

parsinator's People

Contributors

canro91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

parsinator's Issues

Add section name in Required exception message

Now, Required exception message only shows the name of the value to parse. To ease troubleshooting, Required exception message should display the section name too.

[Test]
public void Parse_RequiredAndPatternNotFound_ThrowsExceptionIncludingSectionName()
{
    var sectionName = "Key";
    var p = new Dictionary<String, IList<IParse>>
    {
        {
            sectionName,
            new List<IParse>
            {
                new Required(new ParseFromRegex(key: "Value", pattern: new Regex(@"Value:\s*(\d+)")))
            }
        }
    };

    var lines = FromText(@"
This line doesn't match");

    var parser = new Parser(p);

    var e = Assert.Throws<ArgumentNullException>(() => parser.Parse(lines));
    StringAssert.Contains(sectionName, e.Message);
}

Make Concatenate work with negative page number parsers

Now, Concatenates only works if given parsers are in the same page or have positive page numbers.

Instead of using a property for PageNumber, create a method to pass the current page and the relative page Parsinator is currently trying to parse. Maybe introduce a method in the base class?

[Test]
public void Parse_ConcatenateTwoPagedParsersANegativeAndPositivePageNumber_ParsersValueFromBothParsersInGivenPages()
{
    var p = new Dictionary<String, IList<IParse>>
    {
        {
            "Key",
            new List<IParse>
            {
                new Concatenate(key: "Value", separator: "|", new List<IParse>
                {
                    new ParseFromRegex(key: "Result", pageNumber: -1, pattern: new Regex(@"Result:\s*(\w+)")),
                    new ParseFromRegex(key: "Value", pageNumber: 2, pattern: new Regex(@"Value:\s*(\d+)"))
                })
            }
        }
    };

    var lines = FromPagesText(
@"Page1 This is a dummy page    Page-3",
@"Page2 Value: 123456           Page-2",
@"Page3 Result: Foo             Page-1");

    var parser = new Parser(p);
    var ds = parser.Parse(lines);

    Assert.AreEqual("Foo|123456", ds["Key"]["Value"]);
}

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.