MCPcopy
hub / github.com/Tampermonkey/tampermonkey / it

Function it

src/jslint.js:1217–1254  ·  view source on GitHub ↗
(type, value)

Source from the content-addressed store, hash-verified

1215// Produce a token object. The token inherits from a syntax symbol.
1216
1217 function it(type, value) {
1218 var id, the_token;
1219 if (type === '(string)' || type === '(range)') {
1220 if (jx.test(value)) {
1221 warn_at('url', line, from);
1222 }
1223 }
1224 the_token = Object.create(syntax[(
1225 type === '(punctuator)' || (type === '(identifier)' &&
1226 Object.prototype.hasOwnProperty.call(syntax, value))
1227 ? value
1228 : type
1229 )] || syntax['(error)']);
1230 if (type === '(identifier)') {
1231 the_token.identifier = true;
1232 if (value === '__iterator__' || value === '__proto__') {
1233 stop_at('reserved_a', line, from, value);
1234 } else if (!option.nomen &&
1235 (value.charAt(0) === '_' ||
1236 value.charAt(value.length - 1) === '_')) {
1237 warn_at('dangling_a', line, from, value);
1238 }
1239 }
1240 if (type === '(number)') {
1241 the_token.number = +value;
1242 } else if (value !== undefined) {
1243 the_token.string = String(value);
1244 }
1245 the_token.line = line;
1246 the_token.from = from;
1247 the_token.thru = character;
1248 id = the_token.id;
1249 prereg = id && (
1250 ('(,=:[!&|?{};~+-*%^<>'.indexOf(id.charAt(id.length - 1)) >= 0) ||
1251 id === 'return' || id === 'case'
1252 );
1253 return the_token;
1254 }
1255
1256 function match(x) {
1257 var exec = x.exec(source_row), first;

Callers 4

stringFunction · 0.70
numberFunction · 0.70
regexpFunction · 0.70
jslint.jsFile · 0.70

Calls 2

warn_atFunction · 0.85
stop_atFunction · 0.85

Tested by

no test coverage detected