parse the source file

@return void
963535
private function parse_source()
	{
		if ( !$this->file() )
		{
			return null;
		}
		
		// get the file
		$lines = file( $this->file );
		
		/*
		 * parse the relevant source
		 */
		$size = 10;
		
		$start = $this->line - ( $size / 2 );
		$end = $this->line + ( $size / 2 );
		
		// check if start is in the middle of a comment
		while( $start > 0 && substr( trim( $lines[$start-1] ), 0, 1 ) === '*' )
		{
			$start--;
		}
		
		$source = array();
		
		for ( $i=$start-1; $i<$end; $i++ )
		{
			if ( array_key_exists( $i, $lines ) )
			{
				$source[$i] = str_replace( "\t", '    ', $lines[$i] );
			}
		}
		
		$this->source = $source;
	}
1242327
private function parseFiles()
    {
        $parser = $this->app['parser'];
        $builder = $this->app['descriptor.builder'];

        $builder->createProjectDescriptor();
        $projectDescriptor = $builder->getProjectDescriptor();
        $projectDescriptor->setName($this->title);

        $paths = [];

        // filesets
        foreach ($this->filesets as $fs) {
            $ds = $fs->getDirectoryScanner($this->project);
            $dir = $fs->getDir($this->project);
            $srcFiles = $ds->getIncludedFiles();

            foreach ($srcFiles as $file) {
                $paths[] = $dir . FileSystem::getFileSystem()->getSeparator() . $file;
            }
        }

        $this->project->log("Will parse " . count($paths) . " file(s)", Project::MSG_VERBOSE);

        $files = new \phpDocumentor\Fileset\Collection();
        $files->addFiles($paths);

        $mapper = new \phpDocumentor\Descriptor\Cache\ProjectDescriptorMapper($this->app['descriptor.cache']);
        $mapper->garbageCollect($files);
        $mapper->populate($projectDescriptor);

        $parser->setPath($files->getProjectRoot());
        $parser->setDefaultPackageName($this->defaultPackageName);

        $parser->parse($builder, $files);

        $mapper->save($projectDescriptor);

        return $mapper;
    }
963903
protected function parse()
    {
        $this->parseParam('sort');
        $this->parseParam('fields');
        $this->parseParam('limit');
        if ($this->isEloquentBuilder()) {
            $this->parseParam('with');
        }
        $this->parseFilter();
    }
977807
public function parse() {
		/** @noinspection PhpParamsInspection */
		return $this -> execute(Util::cache(
			$this -> file,
			$this -> raw,
			'viper',
			function($data): NodeCollection {
				$tokens = $this -> tokenize($data);
				return $this -> formLogicalTree($tokens);
			}
		), $this -> data);
	}
86952
public function parse() {
        $name_without_parens = preg_replace('/[{}]/', '', $this->full_name);

        $parts = explode('|', $name_without_parens);
        $name_without_pipes = trim($parts[0]);

        $parts = explode('::', $name_without_pipes);
        $name_without_case_keys = trim($parts[0]);
        array_shift($parts);
        $this->case_keys = array_map('trim', $parts);

        $parts = explode(':', $name_without_case_keys);
        $this->short_name = trim($parts[0]);
        array_shift($parts);
        $this->context_keys = array_map('trim', $parts);

        $this->separator = (strpos($this->full_name,'||') !== false) ? '||' : '|';

        $this->parameters = array();
        $parts = explode($this->separator, $name_without_parens);
        if (count($parts) > 1) {
            $parts = explode(',', $parts[1]);
            foreach($parts as $part) {
                array_push($this->parameters, trim($part));
            }
        }
    }
340643
public function parse()
    {
        $templates = array();
        $finder = new Finder(); 
        
        $directories = array(
            $this->templatesDir, 
        );
        
        $globalResourcesFolder = $this->kernelDir . '/Resources/views/' . $this->themeName;
        if (is_dir($globalResourcesFolder)) {
            $directories[] = $globalResourcesFolder;
        }
        
        $templateFiles = $finder->files('*.twig')->in($directories);
        foreach ($templateFiles as $template) {
            $template = (string)$template;
            $templateName = basename($template);
            $templateContents = file_get_contents($template);
            
            $slots = $this->fetchSlots($templateContents);
            if (empty($slots)) {
                continue;
            }
            
            $templates[$templateName]['assets']['external_stylesheets'] = $this->fetchExternalStylesheets($templateContents);
            $templates[$templateName]['assets']['external_javascripts'] = $this->fetchExternalJavascripts($templateContents);
            $templates[$templateName]['assets']['external_stylesheets_cms'] = $this->fetchExternalStylesheetsCms($templateContents);
            $templates[$templateName]['assets']['external_javascripts_cms'] = $this->fetchExternalJavascriptsCms($templateContents);
            $templates[$templateName]['slots'] = $slots;
            if (strpos($template, $this->kernelDir) === false) {
                $templates[$templateName]['generate_template'] = dirname($template) == $this->templatesDir;
            }
        }
        
        return $templates;
    }
1114226
public function parse(){
		$where = $order = $group = $limit = $q = '';
		$source = $this->parseSource();

		if($this->stmt->getConditions())
			$where = $this->parseWhere();
		if($this->stmt instanceof Result && $this->stmt->getGrouping())
			$group = $this->parseGrouping();
		if($this->stmt->getSorting())
			$order = $this->parseSorting();

		$this->clauses = array($source, $where, $group, $order);

		if($this->stmt->getType() === Manager::STMT_SELECT)
			$q = $this->parseSelectStmt();
		elseif($this->stmt->getType() === Manager::STMT_INSERT)
			$q = $this->parseInsertStmt();
		elseif($this->stmt->getType() === Manager::STMT_UPDATE)
			$q = $this->parseUpdateStmt();
		elseif($this->stmt->getType() === Manager::STMT_DELETE)
			$q = $this->parseDeleteStmt();

		return trim($q);
	}
1063241
private function parse() {

		$lines = file($this -> viewmodel -> getFile());

		$this -> code = '';

		$classes = [

			'MatchEcho',
			'MatchForeach',
			'MatchEndForeach',
			'MatchFor',
			'MatchEndFor',
			'MatchIf',
			'MatchIsset',
			'MatchNotIsset',
			'MatchEmpty',
			'MatchNotEmpty',
			'MatchElseIf',
			'MatchElse',
			'MatchEndIf',
			'MatchEndIsset',
			'MatchEndNotIsset',
			'MatchEndEmpty',
			'MatchEndNotEmpty',
			'MatchForm',
			'MatchTranslation',
			'MatchEscape',
			'MatchRouter',
			'MatchHelper',
			'MatchPartial',
			'MatchFails',
			'MatchPasses',
			'MatchPHPTags'
		];

		foreach($lines as $linenumber => $line) {
			
			foreach($classes as $class) {
				
				$class = self :: NAMESPACE_MATCH . $class;
				$match = new $class($line);
				$line  = $match -> replace() -> getLine();
			}

			//User defined functions
			foreach(TemplateData :: getTemplateFunctions() as $action => $closure) {

				$class = self :: NAMESPACE_MATCH . 'MatchUserDefined';
				$match = new $class($line, $action);
				$line  = $match -> replace() -> getLine();
			}
			
			$this -> code .= trim($line) . "\n";
		}

		$this -> code = trim($this -> code);

		return $this -> code;
	}
928260
public function parse()
    {
        foreach ($this->parsedMail->getAttachments() as $attachment) {
            // Only use the Abusehub formatted reports, skip all others
            if (preg_match(config("{$this->configBase}.parser.report_file"), $attachment->filename)) {
                // Create temporary working environment for the parser ($this->tempPath, $this->fs)
                $this->createWorkingDir();
                file_put_contents($this->tempPath . $attachment->filename, $attachment->getContent());

                $csvReader = new Reader\CsvReader(new SplFileObject($this->tempPath . $attachment->filename));
                $csvReader->setHeaderRowNumber(0);

                // Loop through all csv reports
                foreach ($csvReader as $report) {
                    if (!empty($report['report_type'])) {
                        $this->feedName = $report['report_type'];

                        // If feed is known and enabled, validate data and save report
                        if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                            // Sanity check
                            if ($this->hasRequiredFields($report) === true) {
                                // incident has all requirements met, filter and add!
                                $report = $this->applyFilters($report);

                                $incident = new Incident();
                                $incident->source      = config("{$this->configBase}.parser.name");
                                $incident->source_id   = false;
                                $incident->ip          = $report['src_ip'];
                                $incident->domain      = false;
                                $incident->class       = config("{$this->configBase}.feeds.{$this->feedName}.class");
                                $incident->type        = config("{$this->configBase}.feeds.{$this->feedName}.type");
                                $incident->timestamp   = strtotime($report['event_date'] .' '. $report['event_time']);
                                $incident->information = json_encode($report);

                                $this->incidents[] = $incident;
                            }
                        }
                    } else {
                        // We cannot parse this report, since we haven't detected a report_type.
                        $this->warningCount++;
                    }
                } // end foreach: loop through csv lines
            } // end if: found report file to parse
        } // end foreach: loop through attachments

        return $this->success();
    }
1046362
def _parse(self, source, name, filename):
        """"""
        return Parser(self, source, name, encode_filename(filename)).parse()
726633
public function parse()
    {
        foreach($this->parser->parse($this->inputFile) as $item) {
            $writer = WriterFactory::create($item['type'], $this->config);

            if($writer) {
                $writer->write($item);
            }
        }
    }
914938
protected function parseContent()
    {
        $contentString = strtok($this->query, '/');

        $content = [];
        $delim = '(),';
        $tok = strtok($contentString, $delim);
        while ($tok !== false) {
            $content[] = $tok;
            $tok = strtok($delim);
        }

        $this->contentTypes = $content;
    }
980039
public function parse()
    {
        $result = [];

        $result['status'] = $this->service->getStatusCode();
        $this->setLogs($result['status'], 'status');

        // Format the head response.
        $result['headers'] = $this->service->getHeaders();
        if ($result['headers']) {
            $result['headers'] = $this->getResponseArray($result['headers'], 'headers');
        }
        $result['headersRaw'] = implode('; ', $result['headers']);
        $this->setLogs($result['headers'], 'headers');

        $result['bodySize'] = $this->service->getBody()->getSize();
        $this->setLogs($result['bodySize'], 'size');

        $result['bodyRaw'] = $this->service->getBody()->getContents();
        $this->setLogs($result['bodyRaw'], 'bodyRaw');

        // Format the body response.
        $responseExpectedFormat = trim(
            strtolower(isset($this->responseExpected->format) ? $this->responseExpected->format : 'auto')
        );
        // Move the expected format to the top of the detection array.
        if ('auto' !== $responseExpectedFormat) {
            $key = array_search($responseExpectedFormat, $this->contentTypes);
            if (false !== $key) {
                $this->contentTypes = array_flip(
                    array_merge([$this->contentTypes[$key] => '-'], array_flip($this->contentTypes))
                );
            }
        }
        $this->setLogs($responseExpectedFormat, 'format');
        $result['format'] = $responseExpectedFormat;

        // If auto mode, discern content type in a very forgiving manner from the header.
        if ('auto' === $result['format']) {
            foreach ($result['headers'] as $keaderType => $header) {
                if ('contenttype' === str_replace(['-', '_', ' '], '', strtolower($keaderType))) {
                    foreach ($this->contentTypes as $key => $contentType) {
                        if (strpos(strtolower($header), $contentType)) {
                            $result['format'] = $contentType;
                            // Move this type to the top of the detection array.
                            $this->contentTypes = array_flip(
                                array_merge([$this->contentTypes[$key] => '-'], array_flip($this->contentTypes))
                            );
                            $this->setLogs($contentType, 'headerFormat');
                            break;
                        }
                    }
                    break;
                }
            }
        }

        $result['body'] = [];
        // Attempt to parse with a proffered list of types.
        foreach ($this->contentTypes as $contentType) {
            $attemptBody = $this->getResponseArray($result['bodyRaw'], $contentType);
            if ($attemptBody) {
                $result['body']   = $attemptBody;
                $result['format'] = $contentType;
                $this->setLogs($contentType, 'bodyFormat');
                break;
            }
            $this->setLogs($contentType, 'bodyFormatsAttempted');
            // If in test-mode do not cycle through all types unless we are truly in auto mode.
            if (!$this->test && 'auto' === $responseExpectedFormat) {
                break;
            }
        }
        $this->setLogs($result['body'], 'body');

        $this->valid          = (bool) $result['status'];
        $this->responseActual = $result;

        return $this;
    }
412121
protected function parseArgs()
    {
        parent::parseArgs();
        if (empty($this->args['usuario']) or empty($this->args['clave'])) {
            $this->error('Debe indicar --usuario y --clave del usuario que se autenticará en el SII');
        }
        if (empty($this->args['contribuyente'])) {
            $this->args['contribuyente'] = $this->args['usuario'];
        }
        if (empty($this->args['salida'])) {
            $this->args['salida'] = 'libredte_mipyme_respaldo_'.$this->args['contribuyente'];
        }
        if (!is_dir($this->args['salida'])) {
            mkdir($this->args['salida'], 0755, true);
            mkdir($this->args['salida'].'/emitidos', 0755, true);
            mkdir($this->args['salida'].'/recibidos', 0755, true);
            mkdir($this->args['salida'].'/iecv', 0755, true);
        }
    }
554759
public function parseIncr($files)
    {
        foreach($files as $file)
        {
            if(isset($this->fileMap[$file]))
            {
                unset($this->fileMap[$file]);
            }
            if(!is_file($file))
            {
                continue;
            }
            $content = file_get_contents($file);
            if(preg_match('/namespace ([^;]+);/', $content, $matches) <= 0)
            {
                continue;
            }
            $namespace = trim($matches[1]);
            $className = $namespace . '\\' . basename($file, '.php');
            if(class_exists($className))
            {
                $this->parse($className);
            }
        }
    }
849826
public function parse_data() {
		$data = [];
		foreach ( get_object_vars( $this ) as $key => $value ) {
			$data[ $key ] = 'contributors' === $key ? $this->create_contributors( $value ) : $value;
		}
		$data = $this->faq_as_h4( $data );
		$data = $this->readme_section_as_h4( 'changelog', $data );
		$data = $this->readme_section_as_h4( 'description', $data );

		@unlink( $this->readme_path );

		return $data;
	}
331265
public function parse()
	{
		while ($this->state && $this->state !== 'emit' && $this->has_data())
		{
			$state = $this->state;
			$this->$state();
		}
		$this->data = '';
		if ($this->state === 'emit')
		{
			return true;
		}
		else
		{
			$this->version = '';
			$this->encoding = '';
			$this->standalone = '';
			return false;
		}
	}