lark icon indicating copy to clipboard operation
lark copied to clipboard

Show values of terminals in errors, instead of names, when appropriate

Open erezsh opened this issue 5 years ago • 5 comments

erezsh avatar Oct 13 '20 10:10 erezsh

So, first thing would be to define "apropiate" .

Something like :

  • If terminal comes from a simple string and string length is less than some integer, except from debug mode in that case show full string
  • If terminal comes from union of strings and total length less than some int... same a before.
  • If terminal comes from anon regex it would be great to show them in debug mode or at least show them as anon_regex_n
  • if terminal is an anon mix strings and regex show something like anon_mix_n

Is there other kinds of terminals?

omega16 avatar Oct 14 '20 05:10 omega16

Even when not in debug mode, /[A-Z]+\-\d+/ is still more informative than __ANON_17. But if you stick with ANON, then can we get them numbered by their line and column in the grammar? So __ANON_17 would be __ANON_L45_C23 or similar. Actually, that labeling scheme for anonymous terminals is probably a good idea regardless of what we do with error messages.

charles-esterbrook avatar Oct 19 '20 13:10 charles-esterbrook

@charles-esterbrook That's a nice idea!

erezsh avatar Oct 19 '20 14:10 erezsh

Is someone working on this right now? Otherwise I will give it a try.

MegaIng avatar Oct 19 '20 14:10 MegaIng

Go ahead. I didn't get started yet, and I don't think anyone else did.

erezsh avatar Oct 19 '20 14:10 erezsh