Comments (9)
Because Superpower doesn't backtrack, I'd expect A.Then(B).Or(C).Or(D).Many().AtEnd()
to fail if B
fails, without attempting any additional parses. Does that match what you see?
from superpower.
@nblumhardt no, not really, unfortunately. Consider the case when A is zero-width, e.g. Parse.Not(something)
from superpower.
Here is an example: https://github.com/AndrewSav/CommandLineParserPoc/blob/ca154fec085b96966d5cd45373270bef1b40536c/CommandLineParserPoC/CommandLineParser.cs#L161
The parser matches either binary switch list switch or value switch. The remaining type is value and it is invalid in the beginning. So I want to test for it and fail if that's so with a nice error message. Currently I'm getting the "At end" message that is not that nice.
from superpower.
Will have a closer look at this - thanks 👍
from superpower.
Closing this one as stale; still seems worth investigating but will need some concrete direction to move forwards. Thanks @AndrewSav
from superpower.
@nblumhardt Seriously? What have I done wrong?
from superpower.
Perhaps I misunderstood your conclusions in your PR - is it possible to implement this atop what we have in Superpower today?
from superpower.
@nblumhardt apologies, what PR are we talking about? I might have forgotten something.
is it possible to implement this atop what we have in Superpower today?
That's what this issue is about. Is it possible? If not, why? This seems to me as something that is reasonable. I understand that did not come up in your usage scenarios, so I wanted to know if there are ways to solve this I have not thought of with what is already there. If there are not, than solving it by improving Superpower seems as a good thing to do for wider users or Superpower, so I was looking for ideas on how we go about it, what is actually required to make this work.
If your resources constraint and time allocation simply does not allow for improving the library beyond your own needs, and you want to close issues on that basis, then just let me know. To me reading this thread feels like you said you would take a closer look and then closed it with a comment I could not really understand.
from superpower.
Sorry Andrew, I think it's me confused, I thought the linked PR which you closed was exploring this.
Time for working on this is low right now, but no doubt some opportunities will come up in the future and I'll have a chance to dig in.
The aim is to keep the open issues list fresh, so that when some time is available, I can skip any dead-ends or no-longer-needed requests. Between the Datalust projects, Serilog-related ones, and others, this can mean sorting through a lot of issues, and it's not a 100% scientific process :-)
On this issue in particular, it seems to need some deep digging; if anyone following along is able to get to the bottom of what's needed, that would help guide it towards a solution. Cheers!
from superpower.
Related Issues (20)
- Zero allocation parsing? HOT 1
- Unit Testing? HOT 1
- Is it normal that NaturalUInt32 raise System.OverflowException : Value was either too large or too small for a UInt32 ? HOT 2
- [Request] Need a new introductory blog for v2 (or v3) HOT 1
- Questions: My On Going Questions HOT 4
- Parsing confusion: Zero-width parsers, what rewinds and when, and properly returning a "failed" parse? HOT 4
- [Question] New Release? HOT 1
- Thank you for writing superpower HOT 1
- Better `Message` HOT 5
- Using backslash in CStyle QuotedString causes syntax error HOT 1
- `OptionalOrNull()` HOT 2
- Send parser value into another parser HOT 1
- Tokenizer and Parser Assistance HOT 3
- TokenizerBuilder and Mapping CLR Types HOT 2
- Dynamically referencing Parsers via Decorators for TokenizerBuilder HOT 2
- Some way to check the next token HOT 3
- Missing: Cheat sheet for upgrading from Sprache to Superpower HOT 1
- How to handle consecutive delimiters HOT 6
- dotnet 8 upgrade? HOT 5
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 superpower.