Skip to content

Commit

Permalink
void
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Jul 19, 2011
1 parent 35bc76e commit 46de362
Showing 1 changed file with 42 additions and 55 deletions.
97 changes: 42 additions & 55 deletions jslint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// jslint.js
// 2011-07-18
// 2011-07-19

// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)

Expand Down Expand Up @@ -3527,9 +3527,10 @@ klass: do {
prefix('void', function () {
this.first = expression(0);
this.arity = 'prefix';
if (this.first.id !== '(number)' || this.first.string) {
warn('unexpected_a', this);
return this;
if (option.es5) {
warn('expected_a_b', this, 'undefined', 'void');
} else if (this.first.number !== 0) {
warn('expected_a_b', this.first, '0', artifact(this.first));
}
this.type = 'undefined';
return this;
Expand Down Expand Up @@ -5911,10 +5912,10 @@ klass: do {
case 'root':
case 'target':
case 'visited':
advance();
advance_identifier(next_token.string);
break;
case 'lang':
advance();
advance_identifier('lang');
advance('(');
if (!next_token.identifier) {
warn('expected_lang_a');
Expand All @@ -5925,13 +5926,13 @@ klass: do {
case 'nth-last-child':
case 'nth-last-of-type':
case 'nth-of-type':
advance();
advance_identifier(next_token.string);
advance('(');
style_child();
advance(')');
break;
case 'not':
advance();
advance_identifier('not');
advance('(');
if (next_token.id === ':' && peek(0).string === 'not') {
warn('not');
Expand Down Expand Up @@ -6022,44 +6023,40 @@ klass: do {
while (next_token.id === '@') {
i = peek();
advance('@');
if (next_token.identifier) {
switch (next_token.string) {
case 'import':
switch (next_token.string) {
case 'import':
advance_identifier('import');
if (!css_url()) {
warn('expected_a_b',
next_token, 'url', artifact());
advance();
if (!css_url()) {
warn('expected_a_b',
next_token, 'url', artifact());
advance();
}
semicolon();
break;
case 'media':
advance_identifier('media');
for (;;) {
if (!next_token.identifier || css_media[next_token.string] !== true) {
stop('expected_media_a');
}
semicolon();
break;
case 'media':
advance();
for (;;) {
if (!next_token.identifier || css_media[next_token.string] !== true) {
stop('expected_media_a');
}
advance();
if (next_token.id !== ',') {
break;
}
comma();
if (next_token.id !== ',') {
break;
}
advance('{');
style_list();
advance('}');
break;
case 'font-face':
advance();
advance('{');
font_face();
advance('}');
break;
default:
warn('expected_at_a');
comma();
}
} else {
warn('expected_at_a');
advance('{');
style_list();
advance('}');
break;
case 'font-face':
advance_identifier('font-face');
advance('{');
font_face();
advance('}');
break;
default:
stop('expected_at_a');
}
}
style_list();
Expand Down Expand Up @@ -6252,10 +6249,7 @@ klass: do {
}
xmode = 'html';
advance('</');
if (!next_token.identifier && next_token.string !== 'script') {
warn('expected_a_b', next_token, 'script', artifact());
}
advance();
advance_identifier('script');
xmode = 'outer';
break;
case 'style':
Expand All @@ -6264,11 +6258,7 @@ klass: do {
styles();
xmode = 'html';
advance('</');
if (!next_token.identifier && next_token.string !== 'style') {
warn('expected_a_b', next_token, 'style', artifact());
}
advance();
xmode = 'outer';
advance_identifier('style');
break;
case 'input':
switch (attribute.type) {
Expand Down Expand Up @@ -6330,15 +6320,12 @@ klass: do {
advance('<');
attributes = {};
tag_name = next_token;
if (!tag_name.identifier) {
warn('bad_name_a', tag_name);
}
name = tag_name.string;
advance_identifier(name);
if (option.cap) {
name = name.toLowerCase();
}
tag_name.name = name;
advance();
if (!stack) {
stack = [];
do_begin(name);
Expand Down Expand Up @@ -6951,7 +6938,7 @@ klass: do {
};
itself.jslint = itself;

itself.edition = '2011-07-18';
itself.edition = '2011-07-19';

return itself;

Expand Down

0 comments on commit 46de362

Please sign in to comment.