-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions about potentially migrating from Sprache. #71
Comments
ExceptHave you tried using There might also be a need for RegexIsn't it sad that you are using Regexes ;) But sure it could definitely have a new parser with regexes. Might be an issue though later on if we decide to handle streams instead of char buffers. May I suggest instead that you use a parser to find the delimiters, then use Default ValueApparently I already filed an issue for this, with a mitigation #59 CheckI believe ManyThese could use an option |
First of all, thanks for the quick response. I have a lot of things to go away and consider/work through))
As far as I think Regarding var braceClose = Terms.Text("}");
var bracketClose = Terms.Text("]");
var doubleBraceClose = Terms.Text("}}");
var doubleBracketClose = Terms.Text("]]");
Literals.Pattern(x => x <= Char.MaxValue).Not(doubleBraceClose.Or(doubleBracketClose).Or(braceClose).Or(bracketClose));
//or with an added AnyChar.
Literals.AnyChar.Not(doubleBraceClose.Or(doubleBracketClose).Or(braceClose).Or(bracketClose)); Perhaps it would look better if when starting with Literals.AnyChar.Not(doubleBraceClose).Or(doubleBracketClose).Or(braceClose).Or(bracketClose);
We all have our burdens to bear... I'll take a look at Would a potential built-in boolean value parser be considered? I guess it is easy enough to add for anyone. Terms.Text("true").Or(Terms.Text("false")); I'll look at using
I will log an issue for a |
I don't like the implicit Not, I want to keep using parenthesis to express the boundaries of the parser. Otherwise there can be too many ambiguities. I think It can already read integers and decimal, I filed an issue for hexadecimal, and exponentials might be good to add to the existing ones as an option. |
I still think it would be nice if Parser<T> Not<T>(params Parser<T>[] parsers) I think A general "number" value (for want of a better name) that covered integer, decimal, hexadecimal and exponential values would be great. |
I have a project that I am considering moving from Sprache to Parlot, but even after looking through the available parser combinators there are a few instances where similar functionality does not exist, or I don't understand how to use the available parsers to achieve the same thing that I would do in Sprache.
Any Character Except This Set
With Sprache I can currently do something similar to this:
I have tried looking at
Parsers.AnyCharBefore()
to replaceParse.AnyChar
however it does not seem possible, to chain theParser<char>
andParser<string>
instances as I can with usingExcept()
andMany()
in Sprache.I have not seen an option here for converting a
Parser<char>
to aParser<IEnumerable<char>>
(Many()
orOnce()
) and then toParser<string>
(Text()
).Regex
I noticed there is an option for
Literals.Pattern()
, but no visible way of creating a Parser from a Regex. In Sprache I have some parsers that look something like this:Is it possible to also use Regexes in Parsers in Parlot?
Returning A Default Value If Parser Is Optional
In Sprache there is the
GetOrDefault()
that can be used on the result ofOptional()
. DoesTryParse()
do the same thing or would it need to be accounted for inThen()
. My Sprache basic example would look something like this:Check The Result Of A Parser
Is there any way of matching the parser, but not consuming the result? There is a delegate in Sprache that takes an input, but does not consume the matched result, as I understand it. I have used it like this:
OneOrMany & ZeroOrMany
No question here, but it would be cool if
Many
could be numerically limited, or introduce two new options that could do that, likeOneOrSuccessive()
/ZeroOrSuccessive()
. Sprache has aRepeat(int)
option that I have used a few times through a couple of projects.Apologies for all the questions. It is highly likely that I have read through the parser combinators misunderstood an equivalent or been unsure of how to apply it. Hopefully other people looking to migrate from Sprache might find this useful too? Thanks.
The text was updated successfully, but these errors were encountered: