Code Monkey home page Code Monkey logo

Comments (6)

sunsided avatar sunsided commented on August 16, 2024

Hey Danny, thanks for the report - that's correct, there is no support for comments yet. I'll see to add them when I find the time for it.

from pddl-rs.

dannyhammer avatar dannyhammer commented on August 16, 2024

Where would a comment parser fit into this? I assume it would be under parsers/utilities.rs, similar to ws. I am new to nom, having uses pest before, so I am not certain of how a comment parser would be implemented, perhaps something like this?

/// A combinator that takes a parser `inner` and produces a parser that consumes
/// all leading comment characters `;` and the endline char or EOF at the end of
/// the line, returning the outputs of `inner`.
pub fn comment<'a, F, O>(inner: F) -> impl FnMut(Span<'a>) -> ParseResult<'a, O>
where
    F: FnMut(Span<'a>) -> ParseResult<'a, O>,
{
    delimited(many1(char(';')), ws(inner), alt((line_ending, eof)))
}

This seems to work for simple tests with strings like ; content, ;; content, ; content\n, ;content, etc.

However, I am not sure where this would be integrated so that it works throughout the parser, such as in my example above.

Thoughts?

from pddl-rs.

sunsided avatar sunsided commented on August 16, 2024

Utilities would be a good spot - I noticed you forked the repo already, but if the tests go through here on GitHub it will be fixed in #82 and I'll release a new version right away.

I had a little argument with nom about this too just now. That both ws and the comment parser would have to ignore spaces, which in turn interfered with space_separated_list1 and the likes.

from pddl-rs.

sunsided avatar sunsided commented on August 16, 2024

It's available in 0.0.7 now - could you give it a try and tell me if it checks out?

from pddl-rs.

dannyhammer avatar dannyhammer commented on August 16, 2024

Works for all examples I was utilizing it for. I really appreciate your swiftness at acknowledging and resolving this issue.

from pddl-rs.

sunsided avatar sunsided commented on August 16, 2024

Pleasure! If you can put the library to good use, do tell - I'd be happy to hear your feedback!

from pddl-rs.

Related Issues (1)

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.