Git Product home page Git Product logo

peg.jl's People

Contributors

staticfloat avatar tkelman avatar wdebeaum 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

Watchers

 avatar  avatar

Forkers

tkelman zeta1999

peg.jl's Issues

Cannot parse that has non latin characters

Hello, @wdebeaum .
I have an issue which I say at the title. In the fact PEG.jl throws the error in the following code.

using PEG
@rule s = r".+"
parse_whole(s, "あaaa")
ERROR: LoadError: ArgumentError: invalid SubString index
Stacktrace:
 [1] SubString{String}(::String, ::Int64, ::Int64) at ./strings/types.jl:17
 [2] getindex(::SubString{String}, ::UnitRange{Int64}) at ./strings/types.jl:83
 [3] (::PEG.##4#6)(::SubString{String}, ::Dict{Tuple{Symbol,Int64},Union{Tuple{Any,SubString}, Void}}) at /path/to/.julia/v0.6/PEG/src/PEG.jl:178
 [4] cache_rule(::Symbol, ::PEG.##4#6, ::SubString{String}, ::Dict{Tuple{Symbol,Int64},Union{Tuple{Any,SubString}, Void}}) at /path/to/.julia/v0.6/PEG/src/PEG.jl:108 (repeats 2 times)
 [5] s(::String, ::Dict{Tuple{Symbol,Int64},Union{Tuple{Any,SubString}, Void}}) at /path/to/.julia/v0.6/PEG/src/PEG.jl:329
 [6] #parse_next#7(::Bool, ::Function, ::#s, ::String) at /path/to/.julia/v0.6/PEG/src/PEG.jl:350
 [7] (::PEG.#kw##parse_next)(::Array{Any,1}, ::PEG.#parse_next, ::Function, ::String) at ./<missing>:0
 [8] parse_whole(::Function, ::String) at /path/to/.julia/v0.6/PEG/src/PEG.jl:395
 [9] include_from_node1(::String) at ./loading.jl:576
 [10] include(::String) at ./sysimg.jl:14
 [11] process_options(::Base.JLOptions) at ./client.jl:305
 [12] _start() at ./client.jl:371
while loading /path/to/test.jl, in expression starting on line 3

Julia's pcre is not broken in this case. It's seems an issue of PEG.jl .
Could you help me with treating non latin characters ?

Word/punctuation string modifiers complicates parsing syntax that is sensitive to newlines

This package is very neat. Thanks for releasing it!

For grammars that are sensitive to line breaks, the word and punctuation macro modifiers r","p or r","w cannot be used in some cases, necessitating (AFAIU) more complicated workarounds. It would be convenient to either have versions of p and w modifiers that do not match all whitespace, but just horizontal whitespace or to just make that the default behavior of p and w.

@wdebeaum: what are your thoughts? I would be very happy to submit a PR.

Why should I use 'w'?

Thank you for awesome library.
I would like to ask you about the syntax of regular expression in PEG.jl. Why should I use w? Julia supports \b as pcre, so we could write them like r"\w+\b"p.
Best regards.

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.