GithubHelp home page GithubHelp logo

Comments (4)

erezsh avatar erezsh commented on August 18, 2024

Sure, I'm open to this feature.
How do you plan to implement it?

from lark.

uriva avatar uriva commented on August 18, 2024

Regexp manipulation on grammar before it is processed. (Not my code so won't take credit:))

from lark.

erezsh avatar erezsh commented on August 18, 2024

If you mean literally running regexps on the grammar, then I won't merge such code. Using regexps, it will be limited to simple expressions only, it won't handle typos well, and it will hinder future additions to the syntax.

That way to implement this feature is to:

  1. Add it to the grammar parser (in load_grammar)

  2. Manipulate the resulting tree, before it's compiled into a new parser

from lark.

erezsh avatar erezsh commented on August 18, 2024

Just added support for this in latest master (not in the official release yet). Let me know if it works for you!
Syntax looks like:

start: some_expression~1..3

from lark.

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.