AproJo
view release on metacpan or search on metacpan
share/files/public/skins/default/jquery-ui-1.9.1.custom/development-bundle/external/jshint.js view on Meta::CPAN
obj["(explicitNewcap)"] = true;
} else {
error("Bad option value.", v);
}
t = lex.token();
} else {
if (o === "/*jshint" || o === "/*jslint") {
error("Missing option value.", t);
}
obj[t.value] = false;
if (o === "/*global" && minus === true) {
JSHINT.blacklist[t.value] = t.value;
updatePredefined();
}
t = v;
}
}
if (o === "/*members") {
option.quotmark = quotmarkValue;
}
combine(predefined, predef);
for (var key in predef) {
if (is_own(predef, key)) {
declared[key] = nt;
}
}
if (filter) {
assume();
}
}
// We need a peek function. If it has an argument, it peeks that much farther
// ahead. It is used to distinguish
// for ( var i in ...
// from
// for ( var i = ...
function peek(p) {
var i = p || 0, j = 0, t;
while (j <= i) {
t = lookahead[j];
if (!t) {
t = lookahead[j] = lex.token();
}
j += 1;
}
return t;
}
// Produce the next token. It looks for programming errors.
function advance(id, t) {
switch (token.id) {
case "(number)":
if (nexttoken.id === ".") {
warning("A dot following a number can be confused with a decimal point.", token);
}
break;
case "-":
if (nexttoken.id === "-" || nexttoken.id === "--") {
warning("Confusing minusses.");
}
break;
case "+":
if (nexttoken.id === "+" || nexttoken.id === "++") {
warning("Confusing plusses.");
}
break;
}
if (token.type === "(string)" || token.identifier) {
anonname = token.value;
}
if (id && nexttoken.id !== id) {
if (t) {
if (nexttoken.id === "(end)") {
warning("Unmatched '{a}'.", t, t.id);
} else {
warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
nexttoken, id, t.id, t.line, nexttoken.value);
}
} else if (nexttoken.type !== "(identifier)" ||
nexttoken.value !== id) {
warning("Expected '{a}' and instead saw '{b}'.",
nexttoken, id, nexttoken.value);
}
}
prevtoken = token;
token = nexttoken;
for (;;) {
nexttoken = lookahead.shift() || lex.token();
if (nexttoken.id === "(end)" || nexttoken.id === "(error)") {
return;
}
if (nexttoken.type === "special") {
doOption();
} else {
if (nexttoken.id !== "(endline)") {
break;
}
}
}
}
// This is the heart of JSHINT, the Pratt parser. In addition to parsing, it
// is looking for ad hoc lint patterns. We add .fud to Pratt's model, which is
// like .nud except that it is only used on the first token of a statement.
share/files/public/skins/default/jquery-ui-1.9.1.custom/development-bundle/external/jshint.js view on Meta::CPAN
if (i) {
return i;
}
if (token.id === "function" && nexttoken.id === "(") {
warning("Missing name in function declaration.");
} else {
error("Expected an identifier and instead saw '{a}'.",
nexttoken, nexttoken.value);
}
}
function reachable(s) {
var i = 0, t;
if (nexttoken.id !== ";" || noreach) {
return;
}
for (;;) {
t = peek(i);
if (t.reach) {
return;
}
if (t.id !== "(endline)") {
if (t.id === "function") {
if (!option.latedef) {
break;
}
warning(
"Inner functions should be listed at the top of the outer function.", t);
break;
}
warning("Unreachable '{a}' after '{b}'.", t, t.value, s);
break;
}
i += 1;
}
}
function statement(noindent) {
var i = indent, r, s = scope, t = nexttoken;
if (t.id === ";") {
advance(";");
return;
}
// Is this a labelled statement?
if (t.identifier && !t.reserved && peek().id === ":") {
advance();
advance(":");
scope = Object.create(s);
addlabel(t.value, "label");
if (!nexttoken.labelled && nexttoken.value !== "{") {
warning("Label '{a}' on {b} statement.", nexttoken, t.value, nexttoken.value);
}
if (jx.test(t.value + ":")) {
warning("Label '{a}' looks like a javascript url.", t, t.value);
}
nexttoken.label = t.value;
t = nexttoken;
}
// Is it a lonely block?
if (t.id === "{") {
block(true, true);
return;
}
// Parse the statement.
if (!noindent) {
indentation();
}
r = expression(0, true);
// Look for the final semicolon.
if (!t.block) {
if (!option.expr && (!r || !r.exps)) {
warning("Expected an assignment or function call and instead saw an expression.",
token);
} else if (option.nonew && r.id === "(" && r.left.id === "new") {
warning("Do not use 'new' for side effects.", t);
}
if (nexttoken.id === ",") {
return comma();
}
if (nexttoken.id !== ";") {
if (!option.asi) {
// If this is the last statement in a block that ends on
// the same line *and* option lastsemic is on, ignore the warning.
// Otherwise, complain about missing semicolon.
if (!option.lastsemic || nexttoken.id !== "}" ||
nexttoken.line !== token.line) {
warningAt("Missing semicolon.", token.line, token.character);
}
}
} else {
adjacent(token, nexttoken);
advance(";");
nonadjacent(token, nexttoken);
}
}
// Restore the indentation.
indent = i;
scope = s;
return r;
}
function statements(startLine) {
( run in 1.821 second using v1.01-cache-2.11-cpan-98e64b0badf )