Comments (8)
It would be nice indeed
from parsec.
Looking at the source, we could see that isSpace
is used. I think we could add one more field in the LanguageDef
record, like treatNewLineAsSpace :: Bool
, which controls how isSpace
from Data.Char
is called. I could create a PR if this proposal sounds sensible.
from parsec.
I could create a PR if this proposal sounds sensible.
This would be cool. I'm also interested in hearing @aslatter 's opinion about the improvement.
from parsec.
@albertnetymk What if someone wants to treat separately other space characters like tab? I have never had the need for this, but I'm wondering if a more general solution can be achieved.
from parsec.
@doppioandante One simple solution could be creating one more field, like treatTabAsSpace :: Bool
. By that time, it's probably good to come up with a more general solution. For now, I think treating new lines specially is enough, avoid over engineering.
from parsec.
@jkarni, @doppioandante Work has been started on this issue in Megaparsec, see branch new-lexer
. While it may be not entirely usable for now, you could try it and give your feedback. I've posted a comment in dedicated issue thread: mrkkrp/megaparsec#5.
from parsec.
@mrkkrp Cool, I had solved forking parsec and introducing a dirty hack.
My project has a really dumb parser (basically some fake asm) but I'll certainly try to switch to megaparsec and see if it clicks.
from parsec.
@doppioandante, Thanks! If it doesn't click, please describe your experience, so we can correct our shortcomings. Megaparsec is almost ready for its first release, lexer (token parser is Parsec's terminology) is the only thing that's left.
from parsec.
Related Issues (20)
- Allow semigroups-0.19: Also in tests. HOT 1
- New library with Hspec expectations for testing Parsec parsers HOT 1
- Export internals
- Documentation Error: <||> should be <|?>
- "unexpected end of input, expecting end of input" HOT 4
- Update metadata on Hackage
- (>>=) leaks memory
- Documentation regarding updatePosChar does not match the function's behaviour
- tokenise comments
- add a parameter to makeTokenParser to specify options for treating space by lexeme
- `updatePosChar` does not increment line number like doccumentation says
- GHC 9.2.1 release? HOT 2
- Which unfoldM is meant in "unfoldM uncons gives the [t] corresponding to the stream"?
- Compatibility with mtl-2.3 HOT 2
- string function not working correctly with (<|>) when the head of the strings are the same but their tails are not HOT 2
- Link in readme broken HOT 1
- How to handle include?
- Parsec crashes HOT 2
- cabal build -c 'mtl == 2.2.1' fails because of Safe Haskell HOT 7
- Generate syntax highlighting files 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 parsec.