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

typeof regex literal #657

Closed
stoyan opened this Issue Sep 20, 2012 · 1 comment

Comments

Projects
None yet
3 participants
@stoyan
Copy link

stoyan commented Sep 20, 2012

var a = typeof /[a-z]/;

is an error:
Expected an identifier and instead saw '/'.

@kangax

This comment has been minimized.

Copy link
Contributor

kangax commented Oct 13, 2012

Might be related:

var x;
if (x /= 2) { }

produces:

Expected ')' to match '(' from line 2 and instead saw '/='.

and bunch of other errors related to parsing error.

@valueof valueof closed this in df3337d Dec 7, 2012

jugglinmike added a commit to jugglinmike/jshint that referenced this issue Oct 21, 2014

Added support for 'typeof /[a-z]/' and 'if (x /= 2) { ... }'
This commit fixes two things:

 1. We can now parse regular expressions preceded by 'typeof'.
 2. You can use *=, +=, etc. punctuators as conditions (you still
    need option 'boss' to turn off the warning though).

Closes jshintGH-657.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment