question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New option for parsing behaviour of invalid **

See original GitHub issue

As per discussion on #68

The pattern **abc should not match abc it should throw an exception by default, This is because as per the read me, if the ** token is used it must be the only content of a segment.

These patterns are a few examples that should all throw:

**abc foo/bar** foo**/ /foo**bar/

Update as result of discussion below: However there are use cases where its desirable to not throw, but instead, parse such invalid usage of double star, to mean two single stars instead. In this situation, instead of throwing when failing to parse an wildcard directory token, it would instead, parse two wildcard tokens (which do not match past current path seperator). However I will make this behaviour “opt in” via setting an option on GlobOptions, as it subverts the behaviour of ** to be interpreted as two single stars, where one single star would suffice, and where using two stars should not otherwise be valid in a glob pattern.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
StefanBertelscommented, Nov 7, 2019

Hi Darell,

thank you for responding my comment.

to be clear: I just gave my two cents, so it’s perfectly fine to disagree and of course it’s your decision. So there is no need to vindicate anything. I’m thankful that you make this library available as open source.

You’re right that dotnet.glob allows all theses usages (opt-in). I just wanted to mention that using some global config/singleton option IMHO might result in code where some people (like me) see disadvantages like side-effects / hidden behavior / possible copy&paste errors. I’ve seen this with e.g. Newtonsoft.Json and I created things like this in my own code multiple times, too… I think this sometimes results in “bad” (near-sighted) defaults like non-strict behavior (because you can “easily” change it, example). Nowadays I think allowing global/singleton config is mostly an anti-pattern. But: just my 2 cents.

Regarding LanguageExt: You probably won’t use it if you care about size. 😃 The library is really huge (but worth every byte). Additionally I don’t know how fast it is. Performance isn’t the main goal of LanguageExt, but Louthy is aware that performance matters.

Kind regards

1reaction
olivier-spinellicommented, Aug 16, 2019

Yes of course, thats’s perfectly fine!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I force Antlr to parse a syntactically invalid program ...
1 Answer 1 ... Depending upon the degree to which you want to recognize "bad" input, ANTLR does this by default. One of...
Read more >
Invalid plan: Failed to parse plan xml. · Issue #1483 · ...
Create a plan with a goal that will call the open api plugin function that has a payload; Error should occur on Run...
Read more >
appears to be Immutable with invalid constructor" when ...
Actual behaviour. The line with var result = Parser.Default.ParseArguments(args, types); throws: System.InvalidOperationException: 'Type ...
Read more >
Guide to the Parser
Unlike LL(1) parsers, PEG-based parsers cannot be ambiguous: if a string parses, it has exactly one valid parse tree. This means that a...
Read more >
optparse — Parser for command line options
Programmer errors are usually erroneous calls to OptionParser.add_option() , e.g. invalid option strings, unknown option attributes, missing option attributes, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found