Comments (6)
I have a somewhat a need for choice
. Since variadic functions aren't possible in rust (yet), I'm wondering what the performance implications are when passing a slice of parsers. OTOH, macros may be utilized to sugar nested or
functions.
from chomp.
@dashed What kind of need? The reason I have not yet implemented choice
is that it I am unsure if it should accept a list of function poiinters or a list of closures. The list-of-function-pointers is different in that it only has one level of indirection from the original slice compared to two of the closures. The first one does not need to box anything but for closures you need to since they are dynamically sized.
As for using or
, there is already a sugar for this in the form of the <|>
operator in the parse!
macro. This is most likely the best solution if you have a static list of branches for the parser.
from chomp.
I recently discovered <|>
operator which seems to make things a bit nicer.
from chomp.
@m4rw3r Do you know if there's a better way to do skip_many_till
? Essentially many_till
that doesn't return.
from chomp.
@dashed To properly make it it would require some additional methods on the internal trait for the bounded combinators. But there is an easy way by implementing a sink implementing FromIterator
which will just discard all the data.
from chomp.
@m4rw3r Thanks for the suggestion! I'll try to investigate this approach.
from chomp.
Related Issues (20)
- How do I examine success/fail? HOT 7
- Update bitflags dependency
- Make `Input` a trait HOT 13
- Proper `prelude` module HOT 1
- More comprehensive examples HOT 4
- `impl Trait` and making Chomp require nightly HOT 3
- HTML extract link parser. HOT 4
- Returning the entire slice matched by a chain of parsers HOT 3
- Non `Copy` `Token`s? HOT 2
- Improving the `buffer` module
- Reorganize types
- Use std::str::from_utf8_unchecked instead of std::mem::transmute
- Accessing numbering::InputPosition::position via map_err HOT 2
- Be able to unwrap Input from InputPosition. HOT 2
- build script causes extra rebuilds
- Many_till combinator seems to end up in an endless loop HOT 2
- Improve parse! macro documentation
- string parser (and possibly others internally using consume_while) force unnecessary stream reads HOT 1
- Question: What is the idiomatic way of parsing a string from a byte slice?
- parse! macro doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chomp.