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.

Better token formatting available?

See original GitHub issue

What is your question?

I have a Lark grammar that has the following production:

!inneroperator : "has" | "=" | "<" | ">" | "<=" | ">=" | "!="

(The whole grammar should parse statements like foo < 3, pretty simple stuff actually)

When I give parse something invalid, such as foo 3, the error message reads:

No terminal defined for '3' at line 1 col 8
foo 3
Expecting: {'EQUAL', 'HAS', 'MORETHAN', '__ANON_1', '__ANON_0', '__ANON_2', 'LESSTHAN'}

This is already quite readable, and I’m impressed. However, I don’t know what these ANON things are, and also I would ideally output = instead of EQUAL. Is that possible?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
erezshcommented, Feb 16, 2021

There has already been some talk about improving the error messages by providing the expected values, so I will keep that in mind as a possible task.

Another easier fix we could do, is include default names for >= and <= and !=, as they are common enough to the landscape.

1reaction
erezshcommented, Feb 16, 2021

When a terminal doesn’t have a name (i.e. defined as "foo"), and Lark can’t guess the name, it calls it ANON.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design Tokens Format Module
This document describes the technical specification for a file format to exchange design tokens between different tools.
Read more >
The Pyramid Design Token Structure: The Best Way to Format ...
The Pyramid Design Token Structure layers and abstracts variables and design tokens so that you can keep foundational items (think, more variables) separately ......
Read more >
Behind GitHub's new authentication token formats
Additionally, we want to make these prefixes clearly distinguishable within the token to improve readability. Thus, we are adding a ...
Read more >
Custom Token Formula Reference - AWS
Specifier. Represents ; 0. Digit placeholder. If the value being formatted has a digit in the position where '0' appears in the format...
Read more >
Format a Token - Cherwell Help - Ivanti
Some Tokens can be reformatted using Modifiers and Formats that change the visual format or calculated value of the Token in a One-Step...
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