Comments (7)
This is already supported, in fact. You do it by adding the type parameters to the grammar
declaration, like so:
grammar<F:Factory>;
from lalrpop.
Ah, actually, I think bounds have to be written as where clauses:
grammar<F> where F: Factory;
Anyway, let me know how that works for you. I don't know that I've tested this functionality very thoroughly, as I myself have not yet had a user for it.
from lalrpop.
I began to port my grammar from rust-peg
to Lalrpop. So far I hit the following problems;
- The
'input
lifetime comes after theF
type parameter.
pub fn parse_Term<
F,
'input,
>(
input: &'input str,
) -> Result<i32, __ParseError<usize,(usize, &'input str),()>> where
F: ParserFactory,
{...}
This is true not just for functions, but for impls:
impl<F, 'input, > __ToTriple<F, 'input, > for Result<(usize, (usize, &'input str), usize),()> {...}
-
The generic type parameters are not propagated:
__state0(...)
instead of
__state0::<F>(...)
from lalrpop.
OK, I think I fixed that problem, thanks for the report!
from lalrpop.
(You'll have to use the git version for now though.)
from lalrpop.
Note the new test case:
from lalrpop.
Thanks!
from lalrpop.
Related Issues (20)
- Release a new version and yank last release HOT 4
- Adding a feature `unicode` HOT 5
- Using `ThinVec` instead of `Vec` HOT 3
- Error in 0.20's generated code HOT 3
- Custom lexer needs context information from the parser? HOT 7
- Custom lexer with custom Token type HOT 8
- Dangling symlinks anywhere in the crate cause obscure build failures HOT 1
- Is it supposed to be possible to use the lexer generator without enabling the unicode feature? HOT 7
- Assertion instead of error message HOT 3
- Additional bracket make generated code fail to compile. HOT 1
- Online yacc/lex grammar editor/tester HOT 2
- Custom parser errors HOT 10
- Grouping rules together HOT 1
- Confusion about Ambiguous regex HOT 1
- Parsing from standard input? HOT 2
- Release 0.20.1 not SemVer compatible? HOT 7
- How can I parse newline-separated code with lalrpop? HOT 2
- Lane Table not quite correct? HOT 2
- Access to span in fallible actions HOT 1
- Replace term with anstream? HOT 3
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 lalrpop.