Better documentation for `createLanguage` and `lazy`
See original GitHub issueI’d like to create a parameterized parser, much like many of the built in parser combinators (eg seq
or string
). I was a little confused as to why I couldn’t call the parser functions I defined with createLanguage
as functions (I found out they’re not functions).
It would be nice to be able to do something like:
var L = Parsimmon.createLanguage({
oneThenAnother: function(a,b) {
return Parsimmon.seq(a,b)
},
something: function() {
return L.oneThenAnother(string("a"),string("b"))
}
})
But it seems the only parameter that parser functions created by createLanguage
get is the language namespace that I already have access to via L
. So it makes me wonder, why am I using createLangauge
at all? I don’t quite understand the importance of the Lazy
and createLanguage
functions, which would help clarify this situation: https://github.com/jneen/parsimmon/issues/202.
Issue Analytics
- State:
- Created 6 years ago
- Comments:48 (6 by maintainers)
Top Results From Across the Web
parsimmon/API.md at master - GitHub
createLanguage is the best starting point for building a language parser in Parsimmon. It organizes all of your parsers, collects them into a...
Read more >Translation | Django documentation
In this case, the lazy translations in result will only be converted to strings when result itself is used in a string (usually...
Read more >Chapter 19: Internationalization - The Django Book
Django also ships with more than 50 different localization files. If you're not a native English speaker, ... Always use lazy translations in...
Read more >Configuration Parameters | Tanzu Greenplum Docs
Larger values may improve the quality of the Postgres Planner estimates. ... of the segment file when VACUUM is run without the FULL...
Read more >Oracle Text - Technical Overviews
Oracle Text - Technical Overviews. These technical overviews provide a developer-view of features in Oracle Text. They were originally released to cover the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, I see. In that case you’d need something like this:
Since
withState
returns a newLanguage
you would have to chain off of the new object.I should probably have some time tonight to make a branch with an example of what I mean for a (optionally) stateful and consistent replacement for
createLanguage
.