Comments (2)
I believe this would be possible to add, but would make the signatures of the rule functions more confusing. Generics can't be attached to a mod
, so they're prepended to the generics list of the functions corresponding to rule
s generated within it:
grammar test1<'g>() for str {
pub rule foo<'r, R>() = ...
}
->
mod test1 {
pub fn foo<'g, 'r, R>(&'input str) {...}
}
If we allow type (and / or const) params on the grammar, they must be reordered in the function definition so all lifetimes come before types:
grammar test1<'g, G>() for str {
pub rule foo<'r, R>() = ...
}
->
mod test1 {
pub fn foo<'g, 'r, G, R>(&'input str) {...}
}
I skipped that complexity because I didn't see a need for grammar type params, but I think it could be added.
from rust-peg.
Would be nice to have, but if I would be the only user, you should maybe not do it...
By the way, I could remove some of the boilerplate by using precedence!{ ... }
. A very nice feature. I could remove more than I initially expected.
from rust-peg.
Related Issues (20)
- Docs: add note on how to 'negate' rule HOT 2
- Span capture with precedence climbing HOT 10
- Matching EOF HOT 3
- Box<impl Trait> `peg` 0.8.1 regression HOT 1
- Support binding token literals in rules HOT 1
- Example of parsing with &[T] input HOT 2
- How to use peg for streams of data - or how to implemented streaming in peg
- Feature Request: ALLCAPS for tokens
- Case Sensitivity HOT 1
- request: provide more helpful context in parse error messages HOT 1
- Stable sort for expected set entries in error messages HOT 2
- warn on missing .PHONY entry for common target names HOT 1
- feature request: a way to query the current line number during parsing HOT 5
- general question about thread safety HOT 1
- Use tracing rather than println?
- Binding captured strings? HOT 6
- help with misleading expected set HOT 2
- How do I escape the dot character in [^ pat]? HOT 1
- rustc warning about unused imports HOT 1
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 rust-peg.