src/JinScript/JinScriptParser.php
private function parse()
    {
        $handle = fopen($this->filepath, 'r');
        if(! $handle) throw new \Exception("Can't read file $this->filepath");

        $plugin = null;

        while(($line = fgets($handle)) !== false) {

            /* Skip comments and empty lines */
            if(starts_with($line, '#') || trim($line) === '') continue;

            /* Find description setting */
            else if(starts_with($line, 'description')) $this->parseDescription($line);

            /* Find help setting */
            else if(starts_with($line, 'help')) $this->parseHelp($line);

            /* Capture commands */
            else if(starts_with_whitespace($line)) $plugin->parseCommand($line);

            /* Start plugin capture */
            else {
                $plugin = $this->parseCurrentPlugin($line);
            }
        }

        fclose($handle);

        /* Set state as parsed */
        $this->isParsed = true;
    }
private function parse()
    {
        $handle = fopen($this->filepath, 'r');
        if(! $handle) throw new \Exception("Can't read file $this->filepath");

        $plugin = null;

        while(($line = fgets($handle)) !== false) {

            /* Skip comments and empty lines */
            if(starts_with($line, '#') || trim($line) === '') continue;

            /* Find description setting */
            else if(starts_with($line, 'description')) $this->parseDescription($line);

            /* Find help setting */
            else if(starts_with($line, 'help')) $this->parseHelp($line);

            /* Capture commands */
            else if(starts_with_whitespace($line)) $plugin->parseCommand($line);

            /* Start plugin capture */
            else {
                $plugin = $this->parseCurrentPlugin($line);
            }
        }

        fclose($handle);

        /* Set state as parsed */
        $this->isParsed = true;
    }
private function parse ( ) { $ handle = fopen ( $ this -> filepath , 'r' ) ; if ( ! $ handle ) throw new \ Exception ( "Can't read file $this->filepath" ) ; $ plugin = null ; while ( ( $ line = fgets ( $ handle ) ) !== false ) { /* Skip comments and empty lines */ if ( starts_with ( $ line , '#' ) || trim ( $ line ) === '' ) continue ; /* Find description setting */ else if ( starts_with ( $ line , 'description' ) ) $ this -> parseDescription ( $ line ) ; /* Find help setting */ else if ( starts_with ( $ line , 'help' ) ) $ this -> parseHelp ( $ line ) ; /* Capture commands */ else if ( starts_with_whitespace ( $ line ) ) $ plugin -> parseCommand ( $ line ) ; /* Start plugin capture */ else { $ plugin = $ this -> parseCurrentPlugin ( $ line ) ; } } fclose ( $ handle ) ; /* Set state as parsed */ $ this -> isParsed = true ; }
Private since files should only be parsed when neccesary
Private since files should only be parsed when neccesary