This is a module definition so parse content till end.
774176
def module_def(self):
        
        if self.module_level == MAX_NESTING_LEVELS:
            self.error("Module nested too deep")
        self.module_level += 1
        module = ModuleDefinition()
        self.parse(module, end_token="}")
        self.module_level -= 1
        self.current_module.pop()
        return module
1110207
function (moduleName, modulePath, contents) {
					if (contents.indexOf("require(") < 0) { return contents; }
					if (modules.indexOf(moduleName) < 0) { return contents; }
					var start = "", end = "";
					layers.forEach(function (l) {
						start += "require([\"" + l.name + "\"], function () {\n";
						end += "\n});";
					});
					return contents.replace("require(", start + "require(") + end;
				}
670479
def parse_content_type(header):
    """"""
    typ = subtyp = None; options = {}
    typ, pos = expect_re(re_token, header, 0)
    _, pos = expect_lit('/', header, pos)
    subtyp, pos = expect_re(re_token, header, pos)
    ctype = header[:pos] if subtyp else ''
    while pos < len(header):
        _, pos = accept_ws(header, pos)
        _, pos = expect_lit(';', header, pos)
        _, pos = accept_ws(header, pos)
        name, pos = expect_re(re_token, header, pos)
        _, pos = expect_lit('=', header, pos)
        char = lookahead(header, pos)
        if char == '"':
            value, pos = expect_re(re_qstring, header, pos)
            value = re_qpair.sub('\\1', value)
        elif char:
            value, pos = expect_re(re_token, header, pos)
        if name and value is not None:
            options[name] = value
    return ctype, options
25678
def parse(scanner, rules, scope = ParserScope.empty)
      backtracking(scanner) do
        if scope = parse_children(scanner, rules, scope.nest)
          yield scope if block_given?
          parse_result(scope)
        end
      end
    end
1233742
def _Parse(self):
    """"""
    root_file_entry = self._file_system.GetRootFileEntry()

    for sub_file_entry in root_file_entry.sub_file_entries:
      volume = APFSVolume(sub_file_entry)
      self._AddVolume(volume)
928898
function &parse()
    {

        $rootDoc =& new rootDoc($this);
        $ii = 0;
        foreach ($this->_files as $path => $files) {
            $this->_sourceIndex = $ii++;
            if (isset($this->_options['overview'])) $this->_overview = $this->makeAbsolutePath($this->_options['overview'], $this->sourcePath());
            if (isset($this->_options['package_comment_dir'])) $this->_packageCommentDir = $this->makeAbsolutePath($this->_options['package_comment_dir'], $this->sourcePath());

            foreach ($files as $filename) {
                if ($filename) {
                    $this->message('Reading file "'.$filename.'"');
                    $fileString = @file_get_contents($filename);
                    if ($fileString !== FALSE) {
                        $fileString = str_replace( "\r\n", "\n", $fileString ); // fix Windows line endings
                        $fileString = str_replace( "\r", "\n", $fileString ); // fix ancient Mac line endings

                        $this->_currentFilename = $filename;

                        $tokens = token_get_all($fileString);

                        if (!$this->_verbose) echo 'Parsing tokens';

                        /* This array holds data gathered before the type of element is
                        discovered and an object is created for it, including doc comment
                        data. This data is stored in the object once it has been created and
                        then merged into the objects data fields upon object completion. */
                        $currentData = array();

                        $currentPackage = $this->_defaultPackage; // the current package
                        if ($this->_useClassPathAsPackage) { // magic up package name from filepath
                            $currentPackage .= '\\'.str_replace(' ', '\\', ucwords(str_replace(DIRECTORY_SEPARATOR, ' ', substr(dirname($filename), strlen($this->sourcePath()) + 1))));
                        }
                        $defaultPackage = $oldDefaultPackage = $currentPackage;
                        $fileData = array();

                        $currentElement = array(); // stack of element family, current at top of stack
                        $ce =& $rootDoc; // reference to element at top of stack

                        $open_curly_braces = FALSE;
                        $in_parsed_string = FALSE;

                        $counter = 0;
                        $lineNumber = 1;
                        $commentNumber = 0;

                        $numOfTokens = count($tokens);
                        for ($key = 0; $key < $numOfTokens; $key++) {
                            $token = $tokens[$key];
                            if (!$in_parsed_string && is_array($token)) {

                                $lineNumber += substr_count($token[1], "\n");

                                if ($commentNumber == 1 && (
                                    $token[0] == T_CLASS ||
                                    $token[0] == T_INTERFACE ||
                                    $token[0] == T_FUNCTION ||
                                    $token[0] == T_VARIABLE
                                )) { // we have a code block after the 1st comment, so it is not a file level comment
                                    $defaultPackage = $oldDefaultPackage;
                                    $fileData = array();
                                }

                                switch ($token[0]) {

                                case T_COMMENT: // read comment
                                case T_ML_COMMENT: // and multiline comment (deprecated in newer versions)
                                case T_DOC_COMMENT: // and catch PHP5 doc comment token too
                                    $currentData = array_merge($currentData, $this->processDocComment($token[1], $rootDoc));
                                    if ($currentData) {
                                        $commentNumber++;
                                        if ($commentNumber == 1) {
                                            if (isset($currentData['package'])) { // store 1st comment incase it is a file level comment
                                                $oldDefaultPackage = $defaultPackage;
                                                $defaultPackage = $currentData['package'];
                                            }
                                            $fileData = $currentData;
                                        }
                                    }
                                    break;

                                case T_CLASS:
                                // read class
                                    $class =& new classDoc($this->_getProgramElementName($tokens, $key), $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create class object
                                    $this->verbose('+ Entering '.get_class($class).': '.$class->name());
                                    if (isset($currentData['docComment'])) { // set doc comment
                                        $class->set('docComment', $currentData['docComment']);
                                    }
                                    $class->set('data', $currentData); // set data
                                    if (isset($currentData['package']) && $currentData['package'] != NULL) { // set package
                                        $currentPackage = $currentData['package'];
                                    }
                                    $class->set('package', $currentPackage);

                                    $parentPackage =& $rootDoc->packageNamed($class->packageName(), TRUE); // get parent package
                                    $parentPackage->addClass($class); // add class to package
                                    $class->setByRef('parent', $parentPackage); // set parent reference
                                    $currentData = array(); // empty data store
                                    if ($this->_includeElements($class)) {
                                        $currentElement[count($currentElement)] =& $class; // re-assign current element
                                    }
                                    $ce =& $class;
                                    break;

                                case T_INTERFACE:
                                // read interface
                                    $interface =& new classDoc($this->_getProgramElementName($tokens, $key), $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create interface object
                                    $this->verbose('+ Entering '.get_class($interface).': '.$interface->name());
                                    if (isset($currentData['docComment'])) { // set doc comment
                                        $interface->set('docComment', $currentData['docComment']);
                                    }
                                    $interface->set('data', $currentData); // set data
                                    $interface->set('interface', TRUE); // this element is an interface
                                    if (isset($currentData['package']) && $currentData['package'] != NULL) { // set package
                                        $currentPackage = $currentData['package'];
                                    }
                                    $interface->set('package', $currentPackage);

                                    $parentPackage =& $rootDoc->packageNamed($interface->packageName(), TRUE); // get parent package
                                    $parentPackage->addClass($interface); // add class to package
                                    $interface->setByRef('parent', $parentPackage); // set parent reference
                                    $currentData = array(); // empty data store
                                    if ($this->_includeElements($interface)) {
                                        $currentElement[count($currentElement)] =& $interface; // re-assign current element
                                    }
                                    $ce =& $interface;
                                    break;

                                case T_TRAIT:
                                // read trait
                                    $trait =& new classDoc($this->_getProgramElementName($tokens, $key), $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create trait object
                                    $this->verbose('+ Entering '.get_class($trait).': '.$trait->name());
                                    if (isset($currentData['docComment'])) { // set doc comment
                                        $trait->set('docComment', $currentData['docComment']);
                                    }
                                    $trait->set('data', $currentData); // set data
                                    $trait->set('trait', TRUE); // this element is a trait
                                    if (isset($currentData['package']) && $currentData['package'] != NULL) { // set package
                                        $currentPackage = $currentData['package'];
                                    }
                                    $trait->set('package', $currentPackage);

                                    $parentPackage =& $rootDoc->packageNamed($trait->packageName(), TRUE); // get parent package
                                    $parentPackage->addClass($trait); // add class to package
                                    $trait->setByRef('parent', $parentPackage); // set parent reference
                                    $currentData = array(); // empty data store
                                    if ($this->_includeElements($trait)) {
                                        $currentElement[count($currentElement)] =& $trait; // re-assign current element
                                    }
                                    $ce =& $trait;
                                    break;

                                case T_EXTENDS:
                                // get extends clause
                                    $superClassName = $this->_getProgramElementName($tokens, $key);
                                    $ce->set('superclass', $superClassName);
                                    if ($superClass =& $rootDoc->classNamed($superClassName) && $commentTag =& $superClass->tags('@text')) {
                                        $ce->setTag('@text', $commentTag);
                                    }
                                    break;

                                case T_IMPLEMENTS:
                                // get implements clause
                                    $interfaceName = $this->_getProgramElementName($tokens, $key);
                                    $interface =& $rootDoc->classNamed($interfaceName);
                                    if ($interface) {
                                        $ce->set('interfaces', $interface);
                                    }
                                    break;

                                case T_THROW:
                                // throws exception
                                    $className = $this->_getNext($tokens, $key, T_STRING);
                                    $class =& $rootDoc->classNamed($className);
                                    if ($class) {
                                        $ce->setByRef('throws', $class);
                                    } else {
                                        $ce->set('throws', $className);
                                    }
                                    break;

                                case T_PRIVATE:
                                    $currentData['access'] = 'private';
                                    break;

                                case T_PROTECTED:
                                    $currentData['access'] = 'protected';
                                    break;

                                case T_PUBLIC:
                                    $currentData['access'] = 'public';
                                    break;

                                case T_ABSTRACT:
                                    $currentData['abstract'] = TRUE;
                                    break;

                                case T_FINAL:
                                    $currentData['final'] = TRUE;
                                    break;

                                case T_STATIC:
                                    $currentData['static'] = TRUE;
                                    break;

                                case T_VAR:
                                    $currentData['var'] = 'var';
                                    break;

                                case T_CONST:
                                    $currentData['var'] = 'const';
                                    break;

                                case T_USE:
                                    if (strtolower(get_class($ce)) == 'classdoc') {
                                        while ($tokens[++$key][0] != ';') {
                                            if ($tokens[$key][0] == T_STRING) {
                                                $className = $tokens[$key][1];
                                                $class =& $rootDoc->classNamed($className);
                                                if ($class) {
                                                    $ce->setByRef('traits', $class);
                                                } else {
                                                    $ce->set('traits', $className);
                                                }
                                            }
                                        }
                                    }
                                    break;

                                case T_NAMESPACE:
                                case T_NS_C:
                                    $namespace = '';
                                    while ($tokens[++$key][0] != T_STRING);
                                    $namespace = $tokens[$key++][1];
                                    while ($tokens[$key][0] == T_NS_SEPARATOR) {
                                        $namespace .= $tokens[$key++][1] . $tokens[$key++][1];
                                    }
                                    $currentPackage = $defaultPackage = $oldDefaultPackage = $namespace;
                                    $key--;
                                    break;

                                case T_FUNCTION:
                                // read function
                                    $name = $this->_getProgramElementName($tokens, $key);
                                    $method =& new methodDoc($name, $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create method object
                                    $this->verbose('+ Entering '.get_class($method).': '.$method->name());
                                    if (isset($currentData['docComment'])) { // set doc comment
                                        $method->set('docComment', $currentData['docComment']); // set doc comment
                                    }
                                    $method->set('data', $currentData); // set data
                                    $ceClass = strtolower(get_class($ce));
                                    if ($ceClass == 'rootdoc') { // global function, add to package
                                        $this->verbose(' is a global function');
                                        if (isset($currentData['access']) && $currentData['access'] == 'private') $method->makePrivate();
                                        if (isset($currentData['package']) && $currentData['package'] != NULL) { // set package
                                            $method->set('package', $currentData['package']);
                                        } else {
                                            $method->set('package', $currentPackage);
                                        }
                                        $method->mergeData();
                                        $parentPackage =& $rootDoc->packageNamed($method->packageName(), TRUE); // get parent package
                                        if ($this->_includeElements($method)) {
                                            $parentPackage->addFunction($method); // add method to package
                                        }
                                    } elseif ($ceClass == 'classdoc' || $ceClass == 'methoddoc') { // class method, add to class
                                        $method->set('package', $ce->packageName()); // set package
                                        if ($method->name() == '__construct' || strtolower($method->name()) == strtolower($ce->name())) { // constructor
                                            $this->verbose(' is a constructor of '.get_class($ce).' '.$ce->name());
                                            $method->set("name", "__construct");
                                            $ce->addMethod($method);
                                        } else {
                                            if ($this->_hasPrivateName($method->name())) $method->makePrivate();
                                            if (isset($currentData['access']) && $currentData['access'] == 'private') $method->makePrivate();
                                            $this->verbose(' is a method of '.get_class($ce).' '.$ce->name());
                                            if ($this->_includeElements($method)) {
                                                $method->mergeData();
                                                $ce->addMethod($method);
                                            }
                                            /*
                                            if ($name == 'exec') {
                                                echo "\n", $name, "\n";
                                                foreach ($method->_parameters as $tagName => $tag) {
                                                    echo $tagName;
                                                }
                                                echo "\n";
                                                #die;
                                            }
                                            //*/
                                        }
                                    }
                                    $currentData = array(); // empty data store
                                    $currentElement[count($currentElement)] =& $method; // re-assign current element
                                    $ce =& $method;
                                    break;

                                case T_STRING:

                                    if ($token[1] == 'define') {
                                        $const =& new fieldDoc($this->_getNext($tokens, $key, T_CONSTANT_ENCAPSED_STRING), $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create constant object

                                        $this->verbose('Found '.get_class($const).': global constant '.$const->name());
                                        $const->set('final', TRUE); // is constant
                                        $value = '';
                                        do {
                                            $key++;
                                        } while (isset($tokens[$key]) && $tokens[$key] != ',');
                                        $key++;
                                        while (isset($tokens[$key]) && $tokens[$key] != ')') {
                                            if (is_array($tokens[$key])) {
                                                $value .= $tokens[$key][1];
                                            } else {
                                                $value .= $tokens[$key];
                                            }
                                            $key++;
                                        }
                                        $value = trim($value);
                                        if (substr($value, 0, 5) == 'array') {
                                            $value = 'array(...)';
                                        }
                                        $const->set('value', $value);
                                        if (is_numeric($value)) {
                                            $const->set('type', new type('int', $rootDoc));
                                        } elseif (strtolower($value) == 'true' || strtolower($value) == 'false') {
                                            $const->set('type', new type('bool', $rootDoc));
                                        } elseif (
                                            substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"' ||
                                            substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'"
                                        ) {
                                            $const->set('type', new type('str', $rootDoc));
                                        }
                                        unset($value);
                                        if (isset($currentData['docComment'])) { // set doc comment
                                            $const->set('docComment', $currentData['docComment']);
                                        }
                                        $const->set('data', $currentData); // set data
                                        if (isset($currentData['package'])) { // set package
                                            $const->set('package', $currentData['package']);
                                        } else {
                                            $const->set('package', $currentPackage);
                                        }
                                        $const->mergeData();
                                        $parentPackage =& $rootDoc->packageNamed($const->packageName(), TRUE); // get parent package
                                        if ($this->_includeElements($const)) {
                                            $parentPackage->addGlobal($const); // add constant to package
                                        }
                                        $currentData = array(); // empty data store

                                    // member constant
                                    } elseif (isset($currentData['var']) && $currentData['var'] == 'const') {
                                        do {
                                            $key++;
                                            if ($tokens[$key] == '=') {
                                                $name = $this->_getPrev($tokens, $key, array(T_VARIABLE, T_STRING));
                                                $value = '';
                                            } elseif (isset($value) && $tokens[$key] != ',' && $tokens[$key] != ';') { // set value
                                                if (is_array($tokens[$key])) {
                                                    $value .= $tokens[$key][1];
                                                } else {
                                                    $value .= $tokens[$key];
                                                }
                                            } elseif ($tokens[$key] == ',' || $tokens[$key] == ';') {
                                                if (!isset($name)) {
                                                    $name = $this->_getPrev($tokens, $key, array(T_VARIABLE, T_STRING));
                                                }
                                                $const =& new fieldDoc($name, $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create field object
                                                $this->verbose('Found '.get_class($const).': '.$const->name());
                                                if ($this->_hasPrivateName($const->name())) $const->makePrivate();
                                                $const->set('final', TRUE);
                                                if (isset($value)) { // set value
                                                    $value = trim($value);
                                                    if (strlen($value) > 30 && substr($value, 0, 5) == 'array') {
                                                        $value = 'array(...)';
                                                    }
                                                    $const->set('value', $value);
                                                    if (is_numeric($value)) {
                                                        $const->set('type', new type('int', $rootDoc));
                                                    } elseif (strtolower($value) == 'true' || strtolower($value) == 'false') {
                                                        $const->set('type', new type('bool', $rootDoc));
                                                    } elseif (
                                                        substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"' ||
                                                        substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'"
                                                    ) {
                                                        $const->set('type', new type('str', $rootDoc));
                                                    }
                                                }
                                                if (isset($currentData['docComment'])) { // set doc comment
                                                    $const->set('docComment', $currentData['docComment']);
                                                }
                                                $const->set('data', $currentData); // set data
                                                $const->set('package', $ce->packageName()); // set package
                                                $const->set('static', TRUE);
                                                $this->verbose(' is a member constant of '.get_class($ce).' '.$ce->name());
                                                $const->mergeData();
                                                if ($this->_includeElements($const)) {
                                                    $ce->addConstant($const);
                                                }
                                                unset($name);
                                                unset($value);
                                            }
                                        } while (isset($tokens[$key]) && $tokens[$key] != ';');
                                        $currentData = array(); // empty data store

                                    // function parameter
                                    } elseif (strtolower(get_class($ce)) == 'methoddoc' && $ce->inBody == 0) {
                                        $typehint = NULL;
                                        do {
                                            $key++;
                                            if (!isset($tokens[$key])) break;
                                            if ($tokens[$key] == ',' || $tokens[$key] == ')') {
                                                unset($param);
                                            } elseif (is_array($tokens[$key])) {
                                                if ($tokens[$key][0] == T_STRING && !isset($param)) { // type hint
                                                    $typehint = $tokens[$key][1];
                                                } elseif ($tokens[$key][0] == T_VARIABLE && !isset($param)) {
                                                    $param =& new fieldDoc($tokens[$key][1], $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create constant object
                                                    $this->verbose('Found '.get_class($param).': '.$param->name());
                                                    if (isset($currentData['docComment'])) { // set doc comment
                                                        $param->set('docComment', $currentData['docComment']);
                                                    }
                                                    if ($typehint) {
                                                        $param->set('type', new type($typehint, $rootDoc));
                                                        $this->verbose(' has a typehint of '.$typehint);
                                                    }
                                                    $param->set('data', $currentData); // set data
                                                    $param->set('package', $ce->packageName()); // set package
                                                    $this->verbose(' is a parameter of '.get_class($ce).' '.$ce->name());
                                                    $param->mergeData();
                                                    $ce->addParameter($param);
                                                    $typehint = NULL;
                                                } elseif (isset($param) && ($tokens[$key][0] == T_STRING || $tokens[$key][0] == T_CONSTANT_ENCAPSED_STRING || $tokens[$key][0] == T_LNUMBER)) { // set value
                                                    $value = $tokens[$key][1];
                                                    $param->set('value', $value);
                                                    if (!$typehint) {
                                                        if (is_numeric($value)) {
                                                            $param->set('type', new type('int', $rootDoc));
                                                        } elseif (strtolower($value) == 'true' || strtolower($value) == 'false') {
                                                            $param->set('type', new type('bool', $rootDoc));
                                                        } elseif (
                                                            substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"' ||
                                                            substr($value, 0, 1) == "'" && substr($value, -1, 1) == "'"
                                                        ) {
                                                            $param->set('type', new type('str', $rootDoc));
                                                        }
                                                    }
                                                }
                                            }
                                        } while (isset($tokens[$key]) && $tokens[$key] != ')');
                                        $currentData = array(); // empty data store
                                    }
                                    break;

                                case T_VARIABLE:
                                    // read global variable
                                    if (strtolower(get_class($ce)) == 'rootdoc') { // global var, add to package
                                        $global =& new fieldDoc($tokens[$key][1], $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create constant object
                                        $this->verbose('Found '.get_class($global).': global variable '.$global->name());
                                        if (isset($tokens[$key - 1][0]) && isset($tokens[$key - 2][0]) && $tokens[$key - 2][0] == T_STRING && $tokens[$key - 1][0] == T_WHITESPACE) {
                                            $global->set('type', new type($tokens[$key - 2][1], $rootDoc));
                                        } while (isset($tokens[$key]) && $tokens[$key] != '=' && $tokens[$key] != ';') {
                                            $key++;
                                        }
                                        if (isset($tokens[$key]) && $tokens[$key] == '=') {
                                            $default = '';
                                            $key2 = $key + 1;
                                            do {
                                                if (is_array($tokens[$key2])) {
                                                    if ($tokens[$key2][1] != '=') $default .= $tokens[$key2][1];
                                                } else {
                                                    if ($tokens[$key2] != '=') $default .= $tokens[$key2];
                                                }
                                                $key2++;
                                            } while (isset($tokens[$key2]) && $tokens[$key2] != ';' && $tokens[$key2] != ',' && $tokens[$key2] != ')');
                                            $global->set('value', trim($default, ' ()')); // set value
                                        }
                                        if (isset($currentData['docComment'])) { // set doc comment
                                            $global->set('docComment', $currentData['docComment']);
                                        }
                                        $global->set('data', $currentData); // set data
                                        if (isset($currentData['package'])) { // set package
                                            $global->set('package', $currentData['package']);
                                        } else {
                                            $global->set('package', $currentPackage);
                                        }
                                        $global->mergeData();
                                        $parentPackage =& $rootDoc->packageNamed($global->packageName(), TRUE); // get parent package
                                        if ($this->_includeElements($global)) {
                                            $parentPackage->addGlobal($global); // add constant to package
                                        }
                                        $currentData = array(); // empty data store

                                // read member variable
                                    } elseif (
                                        (isset($currentData['var']) && $currentData['var'] == 'var') ||
                                        (isset($currentData['access']) && ($currentData['access'] == 'public' || $currentData['access'] == 'protected' || $currentData['access'] == 'private'))
                                    ) {
                                        unset($name);
                                        do {
                                            $key++;
                                            if ($tokens[$key] == '=') { // start value
                                                $name = $this->_getPrev($tokens, $key, T_VARIABLE);
                                                $value = '';
                                                $bracketCount = 0;
                                            } elseif (isset($value) && ($tokens[$key] != ',' || $bracketCount > 0) && $tokens[$key] != ';') { // set value
                                                if ($tokens[$key] == '(') {
                                                    $bracketCount++;
                                                } elseif ($tokens[$key] == ')') {
                                                    $bracketCount--;
                                                }
                                                if (is_array($tokens[$key])) {
                                                    $value .= $tokens[$key][1];
                                                } else {
                                                    $value .= $tokens[$key];
                                                }
                                            } elseif ($tokens[$key] == ',' || $tokens[$key] == ';') {
                                                if (!isset($name)) {
                                                    $name = $this->_getPrev($tokens, $key, T_VARIABLE);
                                                }
                                                $field =& new fieldDoc($name, $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create field object
                                                $this->verbose('Found '.get_class($field).': '.$field->name());
                                                if ($this->_hasPrivateName($field->name())) $field->makePrivate();
                                                if (isset($value)) { // set value
                                                    $value = trim($value);
                                                    if (strlen($value) > 30 && substr($value, 0, 5) == 'array') {
                                                        $value = 'array(...)';
                                                    }
                                                    $field->set('value', $value);
                                                }
                                                if (isset($currentData['docComment'])) { // set doc comment
                                                    $field->set('docComment', $currentData['docComment']);
                                                }
                                                $field->set('data', $currentData); // set data
                                                $field->set('package', $ce->packageName()); // set package
                                                $this->verbose(' is a member variable of '.get_class($ce).' '.$ce->name());
                                                $field->mergeData();
                                                if ($this->_includeElements($field)) {
                                                    $ce->addField($field);
                                                }
                                                unset($name);
                                                unset($value);
                                            }
                                        } while (isset($tokens[$key]) && $tokens[$key] != ';');
                                        $currentData = array(); // empty data store

                                    }
                                    break;

                                case T_CURLY_OPEN:
                                case T_DOLLAR_OPEN_CURLY_BRACES: // we must catch this so we don't accidently step out of the current block
                                    $open_curly_braces = TRUE;
                                    break;
                                }

                            } else { // primitive tokens

                                switch ($token) {
                                case '{':
                                    if (!$in_parsed_string) {
                                        $ce->inBody++;
                                    }
                                    break;
                                case '}':
                                    if (!$in_parsed_string) {
                                        if ($open_curly_braces) { // end of var curly brace syntax
                                            $open_curly_braces = FALSE;
                                        } else {
                                            $ce->inBody--;
                                            if ($ce->inBody == 0 && count($currentElement) > 0) {
                                                $ce->mergeData();
                                                $this->verbose('- Leaving '.get_class($ce).': '.$ce->name());
                                                array_pop($currentElement); // re-assign current element
                                                if (count($currentElement) > 0) {
                                                    $ce =& $currentElement[count($currentElement) - 1];
                                                } else {
                                                    unset($ce);
                                                    $ce =& $rootDoc;
                                                }
                                                $currentPackage = $defaultPackage;
                                            }
                                        }
                                    }
                                    break;
                                case ';': // case for closing abstract functions
                                    if (!$in_parsed_string && $ce->inBody == 0 && count($currentElement) > 0) {
                                        $ce->mergeData();
                                        $this->verbose('- Leaving empty '.get_class($ce).': '.$ce->name());
                                        array_pop($currentElement); // re-assign current element
                                        if (count($currentElement) > 0) {
                                            $ce =& $currentElement[count($currentElement) - 1];
                                        } else {
                                            unset($ce);
                                            $ce =& $rootDoc;
                                        }
                                    }
                                    break;
                                case '"': // catch parsed strings so as to ignore tokens within
                                    $in_parsed_string = !$in_parsed_string;
                                    break;
                                }
                            }

                            $counter++;
                            if ($counter > 99) {
                                if (!$this->_verbose) echo '.';
                                $counter = 0;
                            }
                        }
                        if (!$this->_verbose) echo "\n";

                        $rootDoc->addSource($filename, $fileString, $fileData);

                    } else {
                        $this->error('Could not read file "'.$filename.'"');
                        exit;
                    }
                }
            }
        }

        // add parent data to child elements
        $this->message('Merging superclass data');
        $this->_mergeSuperClassData($rootDoc);

        return $rootDoc;
    }
696517
def process_content_type(text)
      content = {}

      field_start = text.index(';')

      content['content-type'] = text[0 ... field_start].strip

      parts = text.split(';')

      parts.each do |part|
        (name, value) = part.gsub(/\"/, '').split('=')

        content[name.strip] = value ? value.strip : value
      end

      content
    end
1115351
def parsed(self):
        
        if not self._parsed:

            self._parsed = json.loads(self.content)

        return self._parsed
1305526
def _Parse(self):
    """"""
    root_file_entry = self._file_system.GetRootFileEntry()
    tsk_volume = self._file_system.GetTSKVolume()
    self.bytes_per_sector = tsk_partition.TSKVolumeGetBytesPerSector(tsk_volume)

    for sub_file_entry in root_file_entry.sub_file_entries:
      tsk_vs_part = sub_file_entry.GetTSKVsPart()
      start_sector = tsk_partition.TSKVsPartGetStartSector(tsk_vs_part)
      number_of_sectors = tsk_partition.TSKVsPartGetNumberOfSectors(tsk_vs_part)

      if start_sector is None or number_of_sectors is None:
        continue

      if tsk_partition.TSKVsPartIsAllocated(tsk_vs_part):
        volume = TSKVolume(sub_file_entry, self.bytes_per_sector)
        self._AddVolume(volume)

      volume_extent = volume_system.VolumeExtent(
          start_sector * self.bytes_per_sector,
          number_of_sectors * self.bytes_per_sector)

      self._sections.append(volume_extent)
679647
def parse(self):
        """"""
        for package in os.listdir(self.root_directory):
            directory = os.path.join(self.root_directory, package)
            if not os.path.isdir(directory):
                continue
            dir_contents = os.listdir(directory)
            sdists = [tarball for tarball in dir_contents
                      if (tarball.endswith('.tar.gz')
                          and tarball.startswith(package + '-'))]
            for sdist in sdists:
                version = sdist.replace('.tar.gz', '').replace(
                    package + '-', '')
                self.packages[package].append(version)
829128
def content_for route
      parts = route.split("/").delete_if &:empty?
      content = parts.inject(self) do |page, part|
        page.children[part.to_sym] if page
      end
      content
    end
573611
async def loadmodule(self, module):
        '''
        
        '''
        self._logger.debug('Try to load module %r', module)
        if hasattr(module, '_instance'):
            self._logger.debug('Module is already initialized, module state is: %r', module._instance.state)
            if module._instance.state == ModuleLoadStateChanged.UNLOADING or module._instance.state == ModuleLoadStateChanged.UNLOADED:
                # Wait for unload
                um = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.UNLOADED)
                await um
            elif module._instance.state == ModuleLoadStateChanged.SUCCEEDED:
                pass
            elif module._instance.state == ModuleLoadStateChanged.FAILED:
                raise ModuleLoadException('Cannot load module %r before unloading the failed instance' % (module,))
            elif module._instance.state == ModuleLoadStateChanged.NOTLOADED or module._instance.state == ModuleLoadStateChanged.LOADED or module._instance.state == ModuleLoadStateChanged.LOADING:
                # Wait for succeeded or failed
                sm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.SUCCEEDED)
                fm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.FAILED)
                _, m = await M_(sm, fm)
                if m is sm:
                    pass
                else:
                    raise ModuleLoadException('Module load failed for %r' % (module,))
        if not hasattr(module, '_instance'):
            self._logger.info('Loading module %r', module)
            inst = module(self.server)
            # Avoid duplicated loading
            module._instance = inst
            # When reloading, some of the dependencies are broken, repair them
            if hasattr(module, 'referencedBy'):
                inst.dependedBy = set([m for m in module.referencedBy if hasattr(m, '_instance') and m._instance.state != ModuleLoadStateChanged.UNLOADED])
            # Load Module
            for d in module.depends:
                if hasattr(d, '_instance') and d._instance.state == ModuleLoadStateChanged.FAILED:
                    raise ModuleLoadException('Cannot load module %r, it depends on %r, which is in failed state.' % (module, d))
            try:
                for d in module.depends:
                    if hasattr(d, '_instance') and d._instance.state == ModuleLoadStateChanged.SUCCEEDED:
                        d._instance.dependedBy.add(module)
                preloads = [d for d in module.depends if not hasattr(d, '_instance') or \
                            d._instance.state != ModuleLoadStateChanged.SUCCEEDED]
                for d in preloads:
                    self.subroutine(self.loadmodule(d), False)
                sms = [ModuleLoadStateChanged.createMatcher(d, ModuleLoadStateChanged.SUCCEEDED) for d in preloads]
                fms = [ModuleLoadStateChanged.createMatcher(d, ModuleLoadStateChanged.FAILED) for d in preloads]
                def _callback(event, matcher):
                    raise ModuleLoadException('Cannot load module %r, it depends on %r, which is in failed state.' % (module, event.module))
                await self.with_callback(self.wait_for_all(*sms), _callback, *fms)
            except:
                for d in module.depends:
                    if hasattr(d, '_instance') and module in d._instance.dependedBy:
                        self._removeDepend(module, d)
                self._logger.warning('Loading module %r stopped', module, exc_info=True)
                # Not loaded, send a message to notify that parents can not 
                async def _msg():
                    await self.wait_for_send(ModuleLoadStateChanged(module, ModuleLoadStateChanged.UNLOADED, inst))
                self.subroutine(_msg(), False)
                del module._instance
                raise
            for d in preloads:
                d._instance.dependedBy.add(module)
            self.activeModules[inst.getServiceName()] = module
            await module._instance.changestate(ModuleLoadStateChanged.LOADING, self)
            await module._instance.load(self)
            if module._instance.state == ModuleLoadStateChanged.LOADED or module._instance.state == ModuleLoadStateChanged.LOADING:
                sm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.SUCCEEDED)
                fm = ModuleLoadStateChanged.createMatcher(module._instance.target, ModuleLoadStateChanged.FAILED)
                _, m = await M_(sm, fm)
                if m is sm:
                    pass
                else:
                    raise ModuleLoadException('Module load failed for %r' % (module,))
            self._logger.info('Loading module %r completed, module state is %r', module, module._instance.state)
            if module._instance.state == ModuleLoadStateChanged.FAILED:
                raise ModuleLoadException('Module load failed for %r' % (module,))
941009
def parse(self):
        """"""
        start = time.time()

        if self.cache:
            self.load_cache()

        if not self.cache_loaded:
            super(ObjParser, self).parse()

        logger.info("%s: Load time: %s", self.file_name, time.time() - start)
468829
def _parse_content(fh):
    """"""
    content = iter(fh)
    deps = {}

    for line in content:
        # quickly discard most of the lines
        if 'fades' not in line:
            continue

        # discard other string with 'fades' that isn't a comment
        if '#' not in line:
            continue

        # assure that it's a well commented line and no other stuff
        line = line.strip()
        index_of_last_fades = line.rfind('fades')
        index_of_first_hash = line.index('#')

        # discard when fades does not appear after #
        if index_of_first_hash > index_of_last_fades:
            continue

        import_part, fades_part = line.rsplit("#", 1)

        # discard other comments in the same line that aren't for fades
        if "fades" not in fades_part:
            import_part, fades_part = import_part.rsplit("#", 1)

        fades_part = fades_part.strip()
        if not fades_part.startswith("fades"):
            continue

        if not import_part:
            # the fades comment was done at the beginning of the line,
            # which means that the import info is in the next one
            import_part = next(content).strip()

        if import_part.startswith('#'):
            continue

        # get module
        import_tokens = import_part.split()
        if import_tokens[0] == 'import':
            module_path = import_tokens[1]
        elif import_tokens[0] == 'from' and import_tokens[2] == 'import':
            module_path = import_tokens[1]
        else:
            logger.debug("Not understood import info: %s", import_tokens)
            continue
        module = module_path.split(".")[0]
        # If fades know the real name of the pkg. Replace it!
        if module in PKG_NAMES_DB:
            module = PKG_NAMES_DB[module]
        # To match the "safe" name that pkg_resources creates:
        module = module.replace('_', '-')

        # get the fades info after 'fades' mark, if any
        if len(fades_part) == 5 or fades_part[5:].strip()[0] in "<>=!":
            # just the 'fades' mark, and maybe a version specification, the requirement is what
            # was imported (maybe with that version comparison)
            requirement = module + fades_part[5:]
        elif fades_part[5] != " ":
            # starts with fades but it's part of a longer weird word
            logger.warning("Not understood fades info: %r", fades_part)
            continue
        else:
            # more complex stuff, to be parsed as a normal requirement
            requirement = fades_part[5:]

        # parse and convert the requirement
        parsed_req = parse_fade_requirement(requirement)
        if parsed_req is None:
            continue
        repo, dependency = parsed_req
        deps.setdefault(repo, []).append(dependency)

    return deps
1235151
def parse(self, dictionary=None, end_token=None):
        
        self.level += 1
        name = []
        if dictionary is None:
            dictionary = self.config
        while True:
            token = self.next()
            if token is None:
                # we have got to the end of the config
                break
            t_type = token["type"]
            t_value = token["value"]
            if t_type == "newline":
                continue
            elif t_value == end_token:
                self.level -= 1
                return
            elif t_type == "literal":
                value = self.remove_quotes(t_value)
                if not name and not re.match("[a-zA-Z_]", value):
                    self.error("Invalid name")
                name.append(value)
            elif t_type == "function":
                self.error("Name expected")
            elif t_type == "operator":
                name = " ".join(name)
                if not name:
                    self.error("Name expected")
                elif t_value == "+=" and name not in dictionary:
                    # deal with encoded names
                    if name.split(":")[0] not in dictionary:
                        # order is treated specially
                        if not (self.level == 1 and name == "order"):
                            self.error("{} does not exist".format(name))
                if t_value in ["{"]:
                    if self.current_module:
                        self.check_child_friendly(self.current_module[-1])
                    self.check_module_name(name)
                    self.current_module.append(name)
                value = self.assignment(token)
                # order is treated specially to create a list
                if self.level == 1 and name == "order":
                    if not value:
                        self.error("Invalid module")
                    self.check_module_name(value, offset=1)
                    dictionary.setdefault(name, []).append(value)
                # assignment of  module definition
                elif t_value == "{":
                    # If this is an py3status module and in a container and has
                    # no instance name then give it an anon one.  This allows
                    # us to have multiple non-instance named modules defined
                    # without them clashing.
                    if (
                        self.level > 1
                        and " " not in name
                        and name not in I3S_MODULE_NAMES
                    ):
                        name = "{} _anon_module_{}".format(name, self.anon_count)
                        self.anon_count += 1
                    dictionary[name] = value
                # assignment of value
                elif t_value == "=":
                    try:
                        name, value = self.process_value(
                            name, value, self.current_module[-1]
                        )
                    except IndexError:
                        self.error("Missing {", previous=True)
                    dictionary[name] = value
                # appending to existing values
                elif t_value == "+=":
                    dictionary[name] += value
                else:
                    self.error("Unexpected character")
                name = []
35540
def modules(self, value):
        """"""

        modules = [module.__name__ for module in self.loadmodules(value)]

        self._modules = [
            module for module in self._modules + modules
            if module not in self._modules
        ]
349023
def _check_parse_modtime(self, filepath, fname):
        """"""       
        #We also want to perform a reparse if the XML documentation file for the
        #module changed, since the docs are also cached.
        file_mtime = self._get_mod_mtime(filepath)
        
        #If we have parsed this file and have its modules in memory, its
        #filepath will be in self._parsed. Otherwise we can load it from
        #file or from a cached pickle version.
        if filepath.lower() in self._parsed: 
            #Get the name of the first module in that file from the modulefiles
            #list. Find out when it was last modified.
            module_mtime = None
            if fname in self._modulefiles:
                if len(self._modulefiles[fname]) == 0:
                    msg.warn("Module file {} has no modules defined inside of it!".format(fname))
                    return None
                
                modulename = self._modulefiles[fname][0]
                if modulename in self.modules:
                    #Make sure that if there are modules with the same name but different
                    #files, that we are working with the correct one.
                    if filepath.lower() != self.modules[modulename].filepath:
                        msg.warn("module {} parsed ".format(modulename) + 
                                 "from {}, not {}".format(self.modules[modulename].filepath,
                                                          filepath))
                    module_mtime = self.modules[modulename].change_time

            if module_mtime is not None:
                if module_mtime < file_mtime:
                    #The file has been modified since we reloaded the module.
                    #Return the two times we used for the comparison so the
                    #module file can be reloaded.
                    return [module_mtime, file_mtime]
                else:
                    return None
        else:
            #The file has never been parsed by this CodeParser. We can
            #either do a full parse or a pickle load.
            return [file_mtime]