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.

Feature: discard operator for terminals?

See original GitHub issue

Played around with this on friday, and the biggest distraction while trying to develop a grammar, was whitespace and comment nodes, which generate a lot of noise.

It’s pretty common to need to allow optional whitespace (and/or comments) in or around various statements and blocks, and I suppose there could be other types of terminals (commas or other separators, string delimiters, etc.) which could be usefully discarded.

How about adding a discard operator?

Maybe something like a prefix operator @ to “mute” an expression - here’s a small portion of JSON grammar with whitespace and commas muted:

grammar CanopyJson

document  <-  @__ (object / array) @__

object    <-  "{" pair (@"," pair)* "}" / "{" @__ "}"

...

__        <-  [\s]*

Would that work?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
y8commented, Feb 1, 2019

Could you please make a release with this feature? This is really hard do deal with whitespace/comments nodes

2reactions
guioconnorcommented, Aug 6, 2018

Hello.

I believe this never made it to production; npm’s latest release date is 3y ago and a quick try breaks the compilation on the @ symbol. Is there any plan to release this feature?

Read more comments on GitHub >

github_iconTop Results From Across the Web

DISCARD TERMINAL - IBM
The DISCARD TERMINAL command removes the definition of a terminal from the local CICS® system, so that the system no longer has access...
Read more >
Discards - unassigned discardable variables - Microsoft Learn
Discards are placeholder variables that are intentionally unused in application code. Discards are equivalent to unassigned variables; ...
Read more >
discards qualifiers - c++ - Stack Overflow
The fix is to declare unsigned int TotalTimeInSeconds() const; , which says that the member function can be called via const references (and...
Read more >
Operators (reactor-core 3.5.1)
Invoke a (local or global) hook that processes elements that get discarded. This includes elements that are dropped (for malformed sources), but also...
Read more >
TCP/IP Distributed Systems Services Operations Guide - Unisys
The DISCARD command causes the unprocessed commands in a suspended load file to be discarded, but it does not remove the command file...
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