Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow leading underscores? #8

Open
dfreeman opened this issue Oct 5, 2015 · 3 comments
Open

Allow leading underscores? #8

dfreeman opened this issue Oct 5, 2015 · 3 comments

Comments

@dfreeman
Copy link

dfreeman commented Oct 5, 2015

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?

@GerHobbelt
Copy link
Contributor

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: 35b2fcc * 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: a0987b1 * Allow for leading underscores in identifiers

@GerHobbelt
Copy link
Contributor

(Last commit there was merged from you yourself)

@dfreeman
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants