wdebeaum / peg.jl Goto Github PK
View Code? Open in Web Editor NEWDefine a Parsing Expression Grammar via a macro and abuse of Julia syntax.
License: Other
Define a Parsing Expression Grammar via a macro and abuse of Julia syntax.
License: Other
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.
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.
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 ?
I have a set of rules and after parsing I would like to easily determine which ones were applied during parsing. Is there a way to find that out?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.