Giter Site home page Giter Site logo

pikaparser.jl's People

Contributors

arcj137442 avatar exaexa 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

Watchers

 avatar

pikaparser.jl's Issues

complete scanning of `canMatchZeroChars`

apparently, there are convoluted cases that result in the topologic order of derivation of canMatchZeroChars giving wrong results.

Change the derivation to a flood-fill algorithm.

support SOF/EOF marks

...because it's just much more handy than checking if the match really matched everything

Extra clauses to simplify frontend

  • counted repetion, similar to (something){123} in regex. Possibly doable by using the option index in ZeroOrMore (or OneOrMore) to count the matched repetitions.
  • sepBy alternative (can be generalized by stuff like alternated / cycled / ...)

Precedence

Hi, I was trying to parse regexes with this parser and couldn't get the | operator to work.

For abc|de I get

sequence(
    expr(char()),
    expr(char()),
    expr(either(sequence(expr(char())), pipe(), sequence(expr(char()), expr(char())))),
)

Because I don't know how to specify that | should have the largest possible sequences on left and right.

The relevant grammar parts of this are :sequence => P.one_or_more(:expr), then :expr => P.first(:either, :negative_lookahead, :positive_lookahead, :positive_lookbehind, :negative_lookbehind, :zero_or_more, :one_or_more, :repetition, :repetition_at_least, :repetition_from_to, :maybe, :noncapturing_group, :capturing_group, :not_set, :set, :specialized_char, :dot, :normalized_char, :char, :_begin, :_end) and :either => P.seq(:sequence, :pipe, :sequence).

I saw that https://github.com/lukehutch/pikaparser has precedence integers for clauses but I didn't see anything here, is that a missing piece of the puzzle?

[Feature request] Accept Regex expressions in `Scan`

Proposal

Often I find myself that some clauses are more easily parsed with a regex than with PikaParser clauses. The solution is to user a Scan in a way similar to:

rules = Dict(
    ...,
    :id => PikaParser.scan() do x
        matched = match(r"^[a-z][a-zA-Z0-9_]*", x)
        isnothing(matched) && return 0
        length(matched.match)
    end,
    ...,
)

It would be great if we could just pass the regex to scan.

Unsolved issues

Only regex of the form r"^..." should be accepted. If the ^ clause is not present, then the regex will search the pattern along all the input.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

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.