ebnf-parser icon indicating copy to clipboard operation
ebnf-parser copied to clipboard

Allow leading underscores?

Open dfreeman opened this issue 10 years ago • 3 comments

I noticed that lex-parser allows leading underscores in names, but ebnf-parser doesn't. Is it intentional that nonterminal names shouldn't be able have leading underscores?

dfreeman avatar Oct 05 '15 14:10 dfreeman

AFAICT: no.

It's probably a slip-up in keeping the various lexers & parsers in sync: there's a similar 'problem' (you almost never encounter it, until...) with grammar tokens being allowed to end with a - hyphen according to some regexes, then not to some others.

Related material (WARNING these are commit refs in my fork; some (for possibly large sums of 'some' ;-) ) of the bugs mentioned there do not manifest in the mainline; nevertheless... there's quite a bit of overlap too):

  • SHA-1: 35b2fcc1620f62e42c3fe961a8cbf42e9df5a309 * unify IDs vs. NAMEs across the board: IDs are [a-zA-Z_][a-zA-Z0-9_]* while NAMES are that too, but also accept '-' in the middle, e.g. a_b is an ID (and a NAME), while a-b is a NAME, but not an ID. $names are ID-based as they appear inside code so allowing a '-' in there would be confusing as it would permit $ labels like this one: $a-1 which is a legal NAME a-1 rather than being read as expression $a - 1
  • SHA-1: a0987b161ca360cd89e2a271f7bf435d7b7aa155 * Allow for leading underscores in identifiers

GerHobbelt avatar Oct 26 '15 17:10 GerHobbelt

(Last commit there was merged from you yourself)

GerHobbelt avatar Oct 26 '15 17:10 GerHobbelt

@GerHobbelt It's true that that last commit is from me, but it's not in this logical repository; it's only present in my fork.

dfreeman avatar Oct 27 '15 13:10 dfreeman