读取行内后端代码。Read inline code.
@returns {*}
324373
function () {
            var len = this.source.length,
                char,
                result = '';
            if (this.position >= len) {
                return undefined;
            }
            for (; this.position < len; this.position++) {
                char = this.readNextChars(1);

                if (char === '(' && this.quotes.length === 0) {
                    this.brackets.push(this.position);
                } else if (char === ')' && this.quotes.length === 0) {
                    this.brackets.pop();
                }

                //除这些外，且不在引号内部的特殊字符，都break。Special characters, except the following, and is not in quotes, all break.
                if (['.', ',', '(', ')', '[', ']', '"', "'", ' '].indexOf(char) === -1 && /\W/.test(char) && this.quotes.length === 0) {
                    break;
                }

                //class="@name"   class="@arr.join('')"
                if ((char === '"' || char === "'") && (this.brackets.length === 0 || this.brackets[this.brackets.length - 1] < (this.braces[this.braces.length - 1] || {position: -1}).position)) {
                    break;
                }

                //class="@name abc"   class="@arr.join(' ') abc"
                if (char === ' ' && (this.brackets.length === 0 || this.brackets[this.brackets.length - 1] < (this.braces[this.braces.length - 1] || {position: -1}).position)) {
                    break;
                }

                //class="@name.toString()abc"   class="@arr.join().toString()abc"
                if (char === ')' && [').', ')[', ')]', ')('].indexOf(this.readNextChars(2)) === -1) {
                    result += char;
                    this.position++;
                    break;
                }

                if (char === ']' && ['].', '][', ']]', ']('].indexOf(this.readNextChars(2)) === -1) {
                    result += char;
                    this.position++;
                    break;
                }

                //引号的处理。Handle quotes.
                if ((char === '"' || char === "'") && this.readPrevChars(1) !== '\\') {
                    if (this.quotes.length === 0) {
                        this.quotes.push({
                            type: char === '"' ? quotesEnum.doubleQuotes : quotesEnum.singleQuotes,
                            position: this.position
                        });
                    } else if (this.quotes.length > 0) {
                        if (char === '"' && this.quotes[0].type === quotesEnum.doubleQuotes) {
                            this.quotes.pop();
                        } else if (char === "'" && this.quotes[0].type === quotesEnum.singleQuotes) {
                            this.quotes.pop();
                        }
                    }
                }

                result += char;
            }
            //准备进入前端读取模式。Ready to switch to frontend read mode.
            this.state = stateEnum.client;
            return result;
        }
263190
function LoopStopInjector() {

    var t = {};

    t.inject = inject;

    return t;

    /**
     * This method is for struggle with some possible infinite loops.
     *
     * @public
     * @param {String} code The source code.
     */
    function inject(code) {

        var LOOP_CHECK = 'if (LoopStopManager.shouldStopExecution(%d)) break; ';
        var LOOP_EXIT = '\nLoopStopManager.exitedLoop(%d);\n';

        var loopId = 1;
        var patches = [];

        var loopStatements = ["ForOfStatement",
                              "ForStatement",
                              "ForInStatement",
                              "WhileStatement",
                              "DoWhileStatement"];

        esprima.parse(code, { range: true }, function(node) {

            var isItLoopStatement = loopStatements.indexOf(node.type) != -1;

            if (isItLoopStatement) {

                var start = 1 + node.body.range[0];
                var end = node.body.range[1];
                var prolog = LOOP_CHECK.replace('%d', loopId);
                var epilog = '';

                if (node.body.type !== 'BlockStatement') {

                    // `while(1) doThat()` becomes `while(1) {doThat()}`
                    prolog = '{' + prolog;
                    epilog = '}';
                    --start;

                }

                patches.push({ pos: start, str: prolog });
                patches.push({ pos: end, str: epilog });
                patches.push({ pos: node.range[1] + 1, str: LOOP_EXIT.replace('%d', loopId) });

                loopId++;

            }

        });

        patches.sort(function (a, b) { return b.pos - a.pos }).forEach(function (patch) {

            code = code.slice(0, patch.pos) + patch.str + code.slice(patch.pos);

        });

        return code;

    }

}
232289
function preprocessCode (code) {

  // Remove starting comments
  while (code.indexOf('//') === 0) {
    code = code.slice(code.indexOf('\n'));
  }

  // Starts with an object literal
  if (code.indexOf('{') === 0) {
    code = 'var json = ' + code;

  // Starts with an object property
  } else if (code.indexOf(':') !== -1 &&
             code.indexOf(':') < code.indexOf(' ')) {
    code = 'var json = {' + code + '}';
  }

  // Starts with an anonymous function
  if (code.indexOf('function') === 0) {
    code = 'var func = ' + code;
  }

  // Contains ...
  return code.replace('...', '');
}
389027
function markdown(text, inline) {
    var r;

    if (text !== undefined)
      r = md_conrefs.replaceConref(text);

    else
      r = "";

    r = namp(r).html;

    // inline markdown means to strip enclosing tag, which in this case is <p>
    if (inline === true) {
        r = r.slice(3, -5);
    }

    // FIXME
    // desugar [[foo#bar]] tokens into local links
    // N.B. in order to not apply conversion in <code> blocks,
    // we first store replace code blocks with nonces
    var codes = {};
    r = r.replace(/(<code>[\s\S]*?<\/code>)/g, function (all, def) {
      var nonce = Math.random().toString().substring(2);
      codes[nonce] = def;
      return '@-=@=-@' + nonce + '@-=@=-@';
    });

    // convert [[link]] to links
    r = r.replace(/\[\[([\s\S]+?)\]\]/g, function (all, def) {
      def = def.split(/\s+/);
      id = def.shift();
      // invalid references don't produce links
      /*if (!list[id]) {// it's in a different file--list only refers to current page
          obj = fullList[id];

          if (obj === undefined) { // it might be global
              obj = {};
              obj.id = id;
          }
      }*/
      //else {
          obj = list[id];
      //}

      var obj = _.extend({name: def.join(' ') || id, globalId: id}, list[id]);
      obj.name = def.join(' ') || id;

      // lame, but I'm tired of writing stuff like [[child_process.fork `child_process.fork()`]]
      // If I didn't do this, it'd come out as an unstyled link
      if (def.length == 0) {
        if (obj.type === undefined && additionalObjsJSON[obj.name] === undefined && obj.name !== "Mixed") {
          console.error("Error".red + ": you tried to create a short link to an object that doesn't exist!");
          console.error(obj);
        } 

        if (additionalObjsJSON[obj.name] !== undefined)
          obj.name = "<code>" + obj.name + "</code>";
        else if (obj.type && obj.type !== "class" && obj.type.indexOf("property") < 0)
          obj.name = "<code>" + obj.name + "()</code>";
        else
          obj.name = "<code>" + obj.name + "</code>";
      }

      return link(obj, ['link-short'], true);
    });

    // restore code blocks, given previously stored nonces
    r = r.replace(/@-=@=-@(\d+)@-=@=-@/g, function (all, nonce) {
      return codes[nonce];
    });

    return r;
  }
885643
function (block) {
        es.readArray([
          '<!--',
          '  processed by htmlbuild',
          '-->'
        ].map(function (str) {
          return block.indent + str;
        })).pipe(block);
      }
946974
public function inlineJs() {
		// Process any actions first
		$this->processBulkActions();
		$this->truncateExports();
		$js = '';

		// Map the export form to equivalents in latest exports table
		$filetypes = \Pressbooks\Modules\Export\filetypes();
		$map = [];
		foreach ( $filetypes as $k => $v ) {
			$map[ "export_formats[{$k}]" ] = $this->getTinyHash( $this->getFormat( $v ) );
		}
		$map = wp_json_encode( $map, JSON_FORCE_OBJECT );
		$js .= "var _pb_export_formats_map = {$map}; ";

		// Pins
		$all_possible_pins = [];
		foreach ( $this->getFiles() as $filepath ) {
			$file = basename( $filepath );
			$key = 'pin[' . $this->getTinyHash( $file ) . ']';
			$all_possible_pins[ $key ] = $this->getTinyHash( $this->getFormat( $file ) );
		}
		$pins = get_transient( self::PIN );
		if ( ! is_array( $pins ) ) {
			$pins = [];
		}
		foreach ( $pins as $k => $v ) {
			if ( ! isset( $all_possible_pins[ $k ] ) ) {
				unset( $pins[ $k ] );
			}
		}
		$pins = wp_json_encode( $pins, JSON_FORCE_OBJECT );
		$js .= "var _pb_export_pins_inventory = {$pins}; ";

		return $js;
	}
1254885
function() {
        var str = "",
          quote = exprI(index++),
          closed = false,
          ch;

        while (index < length) {
          ch = exprI(index++);
          if (ch === quote) {
            closed = true;
            break;
          } else if (ch === "\\") {
            // Check for all of the common escape codes
            ch = exprI(index++);
            switch (ch) {
              case "n":
                str += "\n";
                break;
              case "r":
                str += "\r";
                break;
              case "t":
                str += "\t";
                break;
              case "b":
                str += "\b";
                break;
              case "f":
                str += "\f";
                break;
              case "v":
                str += "\x0B";
                break;
              default:
                str += "\\" + ch;
            }
          } else {
            str += ch;
          }
        }

        if (!closed) {
          throwError('Unclosed quote after "' + str + '"', index);
        }

        return {
          type: code.LITERAL,
          value: str,
          raw: quote + str + quote
        };
      }
326613
function () {

        var st     = stack()[2],
            result = {};

        result.filename = path.basename(st.getFileName());
        result.line = st.getLineNumber();

        return result;
    }
349426
function parseIncludes(codes, includes) {
    const result = {};
    for (const id of Object.keys(codes)) {
        const code = codes[id];
        result[id] = code.split('\n').map(function(line) {
            if (line.trim().substr(0, 8) !== '#include') return line;
            const pos = line.indexOf('#include') + 8;
            let includeName = line.substr(pos).trim();
            // We accept all this systaxes:
            // #include foo
            // #include 'foo'
            // #include <foo>
            // #include "foo"
            if ("'<\"".indexOf(includeName.charAt(0)) > -1) {
                includeName = includeName.substr(1, includeName.length - 2);
            }
            const snippet = includes[includeName];
            if (typeof snippet !== 'string') {
                console.error("Include <" + includeName + "> not found in ", includes);
                throw Error("Include not found in shader: " + includeName);
            }
            return snippet;
        }).join("\n");
    }
    return result;
}
918650
function dummyMarkdown() {
    var codeBlock = /^```/;
    var quoteBlock = /^>/;
    var listBlock = /^\* /;

    var commentInline = '<!--.*-->';
    var codeInline = '`.+`';

    function split(content) {
        var pattern = new RegExp([commentInline, codeInline].join('|'), 'g');
        var result = null;
        var last = 0;
        var output = [];

        while ((result = pattern.exec(content)) !== null) {
            output.push({ transform: true, content: content.slice(last, result.index)});
            output.push({ transform: false, content: result[0]});
            last = pattern.lastIndex;
        }

        output.push({ transform: true, content: content.slice(last)});

        return output;
    }

    return function (input) {
        var output = [];
        var lines = input.split('\n');

        for (var l = 0; l < lines.length; l++) {
            var line = lines[l];
            var e;
            var content;

            if (codeBlock.test(line)) {
                e = l + 1;
                while (!codeBlock.test(lines[e])) {
                    e++;
                }

                output.push({ transform: false, content: lines.slice(l, e + 1).join('\n') + '\n\n' });
                l = e;
            } else if (quoteBlock.test(line)) {
                e = l + 1;
                while (quoteBlock.test(lines[e])) {
                    e++;
                }

                content = [line].concat(lines.slice(l + 1, e).map(function (nextLine) {
                    return nextLine.slice(2);
                })).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (listBlock.test(line)) {
                e = l + 1;
                while (lines[e] !== '') {
                    if (!listBlock.test(lines[e])) {
                        lines[e - 1] += ' ' + lines[e];
                        lines[e] = '';
                    }
                    e++;
                }

                content = lines.slice(l, e).filter(function (line) {
                    return line !== '';
                }).join('\n') + '\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (line !== '') {
                e = l + 1;
                while (lines[e] !== '') {
                    e++;
                }

                content = lines.slice(l, e).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            }
        }

        return output;
    };
}
721902
function parse (code) {
  Object.keys(syntax).forEach((s) => {
    code = code.replace(syntax[s], (_, m) => {
      // ensure if the regex only matches part of the string that we keep the leftover
      let leftOver = _.replace(m, '')
      // encode the string and class
      let parsed = `{#${s}#${encode(m)}#}`

      if (s === 'function' && leftOver) {
        // we want to parse sub commands and the easiest way to do that is to
        // run over the leftOver portion of the function call with the same regex
        let startingParenthesis = leftOver.indexOf('(')
        let endingParenthesis = leftOver.lastIndexOf(')')
        let endingComma = leftOver.lastIndexOf(';')

        // since we don't want to create a new string for every operation
        // we can simply walk the string and replace the character that needs it
        let subFunction = leftOver.replace(/./g, (c, i) => {
          // we can define a waterfall case that only replaces the three positions with nothing
          // leaving the other characters in their place
          switch (i) {
            case startingParenthesis:
            case endingParenthesis:
            case endingComma:
              return ''
            default:
              return c
          }
        })
        leftOver = `(${parse(subFunction)})${endingComma > -1 ? ';' : ''}`
      }
      return parsed + leftOver
    })
  })
  return code
}
830249
function() {
    var self = this;
    
    if (typeof CompilerInitialized !== "undefined") return true;
    
    oldPrepend = $.fn.prepend;
    $.fn.prepend = function()
    {
      var isFragment =
        arguments[0][0] && arguments[0][0].parentNode
        && arguments[0][0].parentNode.nodeName == "#document-fragment";
      var result = oldPrepend.apply(this, arguments);
      if (isFragment)
      AngularCompile(arguments[0]);
      return result;
    };
    
    oldAppend = $.fn.append;
    $.fn.append = function()
    {
      var isFragment =
        arguments[0][0] && arguments[0][0].parentNode
        && arguments[0][0].parentNode.nodeName == "#document-fragment";
      var result = oldAppend.apply(this, arguments);
      if (isFragment)
      AngularCompile(arguments[0]);
      return result;
    };

    AngularCompile = function(root)
    {
      var injector = angular.element($('[ng-app]')[0]).injector();
      var $compile = injector.get('$compile');
      var $rootScope = injector.get('$rootScope');
      var result = $compile(root)($rootScope);
      $rootScope.$digest();
      return result;
    }
    
    CompilerInitialized = true;
  }
169750
function(code) {
    var lines = [];
    code.split(/\n/).forEach(line => {
      var segs = line.split(/(\s*#)/);
      var ln = {code: segs[0]};
      if (segs.length > 1)
        ln.comment = segs.reduce((c, seg, i) => i > 1 ? c + seg : seg, '');
      lines.push(ln);
    });
    return lines;
  }
1091122
function getNodeFromCode(code) {
    if (convert.mapFileCommentRegex.test(code)) {
        try {
            return SourceNode.fromStringWithSourceMap(
                convertCode2Script(code),
                new SourceMapConsumer(convert.fromComment(code).toObject())
            );
        } catch (error) {
            console.error('getNodeFromCode() error: ' + error);
            const node = new SourceNode();
            node.add(convertCode2Script(code));
            return node;
        }
    } else {
        const node = new SourceNode();
        node.add(convertCode2Script(code));
        return node;
    }
}
1044542
function prune(code) {
  var ast = esprima.parse(code);

  estraverse.replace(ast, {
    leave: function leave(node, parent) {
      var ret;

      if ('IfStatement' === node.type) {
        if ('BinaryExpression' !== node.test.type) return;

        if ('self' === node.test.left.argument.name) {
          node.alternate = null;
        } else if ('global' === node.test.left.argument.name) {
          ret = node.alternate;
        }

        return ret;
      }

      if (
          'BlockStatement' === node.type
        && 'FunctionExpression' === parent.type
      ) {
        return node.body[0].alternate.alternate;
      }
    }
  });

  return escodegen.generate(ast, {
    format: {
      indent: { style: '  ' },
      semicolons: false,
      compact: true
    }
  });
}
21805
async function readStdin() {
  let code = "";
  const stdin = process.stdin;
  return new Promise(resolve => {
    stdin.setEncoding("utf8");
    stdin.on("readable", () => {
      const chunk = process.stdin.read();
      if (chunk !== null) code += chunk;
    });
    stdin.on("end", () => {
      resolve(code);
    });
  });
}
827427
function(){
    var type = this.expect('atrule').val
      , node = new nodes.Atrule(type)
      , tok;
    this.skipSpacesAndComments();
    node.segments = this.selectorParts();
    this.skipSpacesAndComments();
    tok = this.peek().type;
    if ('indent' == tok || '{' == tok || ('newline' == tok
      && '{' == this.lookahead(2).type)) {
      this.state.push('atrule');
      node.block = this.block(node);
      this.state.pop();
    }
    return node;
  }