MCPcopy Create free account
hub / github.com/node-inspector/node-inspector / read_num

Function read_num

front-end/UglifyJS/parse-js.js:340–372  ·  view source on GitHub ↗
(prefix)

Source from the content-addressed store, hash-verified

338 };
339
340 function read_num(prefix) {
341 var has_e = false, after_e = false, has_x = false, has_dot = prefix == ".";
342 var num = read_while(function(ch, i){
343 if (ch == "x" || ch == "X") {
344 if (has_x) return false;
345 return has_x = true;
346 }
347 if (!has_x && (ch == "E" || ch == "e")) {
348 if (has_e) return false;
349 return has_e = after_e = true;
350 }
351 if (ch == "-") {
352 if (after_e || (i == 0 && !prefix)) return true;
353 return false;
354 }
355 if (ch == "+") return after_e;
356 after_e = false;
357 if (ch == ".") {
358 if (!has_dot)
359 return has_dot = true;
360 return false;
361 }
362 return is_alphanumeric_char(ch);
363 });
364 if (prefix)
365 num = prefix + num;
366 var valid = parse_js_number(num);
367 if (!isNaN(valid)) {
368 return token("num", valid);
369 } else {
370 parse_error("Invalid syntax: " + num);
371 }
372 };
373
374 function read_escaped_char() {
375 var ch = next(true);

Callers 2

handle_dotFunction · 0.85
next_tokenFunction · 0.85

Calls 5

read_whileFunction · 0.85
is_alphanumeric_charFunction · 0.85
parse_js_numberFunction · 0.85
tokenFunction · 0.85
parse_errorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…