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

Function parse

front-end/UglifyJS/parse-js.js:615–1189  ·  view source on GitHub ↗
($TEXT, strict_mode, embed_tokens)

Source from the content-addressed store, hash-verified

613NodeWithToken.prototype.toString = function() { return this.name; };
614
615function parse($TEXT, strict_mode, embed_tokens) {
616
617 var S = {
618 input : typeof $TEXT == "string" ? tokenizer($TEXT, true) : $TEXT,
619 token : null,
620 prev : null,
621 peeked : null,
622 in_function : 0,
623 in_loop : 0,
624 labels : []
625 };
626
627 S.token = next();
628
629 function is(type, value) {
630 return is_token(S.token, type, value);
631 };
632
633 function peek() { return S.peeked || (S.peeked = S.input()); };
634
635 function next() {
636 S.prev = S.token;
637 if (S.peeked) {
638 S.token = S.peeked;
639 S.peeked = null;
640 } else {
641 S.token = S.input();
642 }
643 return S.token;
644 };
645
646 function prev() {
647 return S.prev;
648 };
649
650 function croak(msg, line, col, pos) {
651 var ctx = S.input.context();
652 js_error(msg,
653 line != null ? line : ctx.tokline,
654 col != null ? col : ctx.tokcol,
655 pos != null ? pos : ctx.tokpos);
656 };
657
658 function token_error(token, msg) {
659 croak(msg, token.line, token.col);
660 };
661
662 function unexpected(token) {
663 if (token == null)
664 token = S.token;
665 token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")");
666 };
667
668 function expect_token(type, val) {
669 if (is(type, val)) {
670 return next();
671 }
672 token_error(S.token, "Unexpected token " + S.token.type + ", expected " + type);

Callers

nothing calls this directly

Calls 12

tokenizerFunction · 0.85
nextFunction · 0.85
$statementFunction · 0.85
add_tokensFunction · 0.85
prevFunction · 0.85
curryFunction · 0.85
isFunction · 0.85
unexpectedFunction · 0.85
statementFunction · 0.85
asFunction · 0.85
expectFunction · 0.70
expressionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…