Giter Site home page Giter Site logo

pest's People

Contributors

01mf02 avatar abhimanyu003 avatar benbrittain avatar birkenfeld avatar bobbbay avatar bors[bot] avatar cad97 avatar cgm616 avatar dragostis avatar emirvildanov avatar flying-sheep avatar golddranks avatar huacnlee avatar jkarns275 avatar jstnlef avatar kivikakk avatar luizdepra avatar lwandrebeck avatar mariacruceat avatar marinpostma avatar melorian94 avatar noahtheduke avatar scowcron avatar skifire13 avatar sunjay avatar sunng87 avatar theverydarkness avatar tomtau avatar victor-savu avatar wirelyre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pest's Issues

try! fails inside of process! matchers.

try! tries to return a Result<A, B>, but all matchers are defined as (Result<A, B>, usize) behind the scenes.

One possible solution to this problems is to catch every try! call in the macro and replace it with a modified version that knows about the extra usize.

Referenced from #51.

Error handling during process!-matchers

Are there any plans to introduce some syntax-sugar for error handling
during process!-matchers, to make error handling easier?

The only way I currently see is if for example every matcher returns a Result<A, B>,
that you'd always have to do something like:

_xyz(&self) -> Result<A, B> {
    (&x: y, z_result: _matcher_z()) => {
        let z = try!(z_result);
        Ok(...)
   }
}

Some possible syntax sugar (without checking if it can be implemented):

_xyz(&self) -> Result<A, B> {
    (&x: y, z?: _matcher_z()) => {
        Ok(...)
   }
}

Is there any better method to do it and what are your plans in this area as well as
for error handling generally?

process! support mutability-specifier for bindings

What do you think about extending the process!-macro to support a syntax like:

(&a: token, mut b: _parserXYZ()) => { ... }

This would essentially allow passing e.g. a vec/linked list around and modifying it in-place.

The current workaround would be forcing a move:

(&a: token, b: _parserXYZ()) => { let mut b_mut = b; ... }

Grammar multi-tool.

An external tool that can analyze pest grammars (maybe process too?) and convert between different types of grammars (if/where applicable).

  • check grammar syntax
  • check left-recursion
  • check name collisions
  • check arbitrary file with grammar

Add examples for process!

The calculator does the math but I assume most users will want to build an AST so an example for that would be nice, the one in the docs is a bit too light imo.

The Lua language one would be nice but might be quite complex to do, right now the docs seems a bit small for the process! part. We could actually put Tera there as an example once it's done.

Add changelog

Would be nice to see what changes between each version, can be just a footnote on a README

Add capturing.

AST or closure.

The parser should remember rule, start & length in a queue after parsing.

Parallelize parsing.

This can be an interesting idea to keep in mind for the future. I have already experimented with single-consumer-single-producer queues in order to have a token-producing and a token-consuming queue, but the performance is lack-luster, even when using state-of-the-art data structures and algorithms.

A possible approach here would be to have a 2-layered parsing approach: one would divide the input with a really simple grammar, and the other would parallelly parse these divisions.

List parsing

I have the following rule in my grammar:

function = { symbol ~ ["("] ~ expression ~ ([","] ~ expression) ~ [")"] }

and I try to parse it like this:

(_: function, fun: main(), arguments: _arguments()) => {
    Function(fun, arguments)
},
_arguments(&self) -> Vec<Expression> {
    (head: main(), tail: _arguments()) => {
        let mut tail = tail;
        tail.push(head);
        tail
    },
    () => {
        Vec::new()
    }
}

This however panics! with the message that no rules matched.
What am I doing wrong?

Recursion limit causes problems with larger character classes

I am developing a parser for email headers. One of the rules is designed to match a single character out of a large list:

atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

Trying to code this directly fails to compile with the "recursion limit reached" error. Reducing the list of characters using ['X'..'Y'] ranges still fails to compile as there are still too many ranges.

Ideally, this would be supported by a single test like [["abcdefg..!#$%&...{|}"]].

Silent atomic rule?

It seems @_{ ... } or _@{ ... } is not allowed, but I guess it's necessary for some scenario.

Restyle grammar.

  • replace lists, heaps, stacks from () to []
  • space everything accordingly

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.