Git Product home page Git Product logo

Comments (1)

TheOtherMarcus avatar TheOtherMarcus commented on July 22, 2024

This is not exactly a bug in Parsley, it just works different compared to PyMeta2. The meaning of the two string quotes (', ") should be described better in the documentation. Se below for a possible parser improvement as well.

In the test code, I try to match using " - ". The double quoted string is matched as a Token, and Parsley helpfully removes any whitespace that may come before it, effectively matching the pattern (' '* ' - '). This will of course never match. The correct pattern to use in this case is ' - ', which is matched against the exact string.

It works in PyMeta2 because " - " is not matched as a Token, but as a string. The PyMeta2 parser will parse ' - ' successfully, but it will never match, as it is handled by the exactly matcher, which only compares the first character on the input stream against the string. A pattern that works both in Parsley and PyMeta2 would have to be written as (' ' '-' ' '). (PyMeta2 has a token matcher as well, but I am unsure if it can be invoked.)

Maybe the Parsley grammar should fail to parse Tokens that start with whitespace. PyMeta2 on the other hand should fail on anything longer than a single character within single quotes.

from parsley.

Related Issues (20)

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.