protected function loop()
    {
        while ($this->a !== false && !is_null($this->a) && $this->a !== '') {

            switch ($this->a) {
                // new lines
                case "\n":
                    // if the next line is something that can't stand alone preserve the newline
                    if (strpos('(-+{[@', $this->b) !== false) {
                        echo $this->a;
                        $this->saveString();
                        break;
                    }

                    // if B is a space we skip the rest of the switch block and go down to the
                    // string/regex check below, resetting $this->b with getReal
                    if($this->b === ' ')
                        break;

                // otherwise we treat the newline like a space

                case ' ':
                    if(static::isAlphaNumeric($this->b))
                        echo $this->a;

                    $this->saveString();
                    break;

                default:
                    switch ($this->b) {
                        case "\n":
                            if (strpos('}])+-"\'', $this->a) !== false) {
                                echo $this->a;
                                $this->saveString();
                                break;
                            } else {
                                if (static::isAlphaNumeric($this->a)) {
                                    echo $this->a;
                                    $this->saveString();
                                }
                            }
                            break;

                        case ' ':
                            if(!static::isAlphaNumeric($this->a))
                                break;

                        default:
                            // check for some regex that breaks stuff
                            if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) {
                                $this->saveRegex();
                                continue;
                            }

                            echo $this->a;
                            $this->saveString();
                            break;
                    }
            }

            // do reg check of doom
            $this->b = $this->getReal();

            if(($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false))
                $this->saveRegex();
        }
    }
protected function loop()
    {
        while ($this->a !== false && !is_null($this->a) && $this->a !== '') {

            switch ($this->a) {
                // new lines
                case "\n":
                    // if the next line is something that can't stand alone preserve the newline
                    if (strpos('(-+{[@', $this->b) !== false) {
                        echo $this->a;
                        $this->saveString();
                        break;
                    }

                    // if B is a space we skip the rest of the switch block and go down to the
                    // string/regex check below, resetting $this->b with getReal
                    if($this->b === ' ')
                        break;

                // otherwise we treat the newline like a space

                case ' ':
                    if(static::isAlphaNumeric($this->b))
                        echo $this->a;

                    $this->saveString();
                    break;

                default:
                    switch ($this->b) {
                        case "\n":
                            if (strpos('}])+-"\'', $this->a) !== false) {
                                echo $this->a;
                                $this->saveString();
                                break;
                            } else {
                                if (static::isAlphaNumeric($this->a)) {
                                    echo $this->a;
                                    $this->saveString();
                                }
                            }
                            break;

                        case ' ':
                            if(!static::isAlphaNumeric($this->a))
                                break;

                        default:
                            // check for some regex that breaks stuff
                            if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) {
                                $this->saveRegex();
                                continue;
                            }

                            echo $this->a;
                            $this->saveString();
                            break;
                    }
            }

            // do reg check of doom
            $this->b = $this->getReal();

            if(($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false))
                $this->saveRegex();
        }
    }
protected function loop ( ) { while ( $ this -> a !== false && ! is_null ( $ this -> a ) && $ this -> a !== '' ) { switch ( $ this -> a ) { // new lines case "\n" : // if the next line is something that can't stand alone preserve the newline if ( strpos ( '(-+{[@' , $ this -> b ) !== false ) { echo $ this -> a ; $ this -> saveString ( ) ; break ; } // if B is a space we skip the rest of the switch block and go down to the // string/regex check below, resetting $this->b with getReal if ( $ this -> b === ' ' ) break ; // otherwise we treat the newline like a space case ' ' : if ( static :: isAlphaNumeric ( $ this -> b ) ) echo $ this -> a ; $ this -> saveString ( ) ; break ; default : switch ( $ this -> b ) { case "\n" : if ( strpos ( '}])+-"\'' , $ this -> a ) !== false ) { echo $ this -> a ; $ this -> saveString ( ) ; break ; } else { if ( static :: isAlphaNumeric ( $ this -> a ) ) { echo $ this -> a ; $ this -> saveString ( ) ; } } break ; case ' ' : if ( ! static :: isAlphaNumeric ( $ this -> a ) ) break ; default : // check for some regex that breaks stuff if ( $ this -> a === '/' && ( $ this -> b === '\'' || $ this -> b === '"' ) ) { $ this -> saveRegex ( ) ; continue ; } echo $ this -> a ; $ this -> saveString ( ) ; break ; } } // do reg check of doom $ this -> b = $ this -> getReal ( ) ; if ( ( $ this -> b == '/' && strpos ( '(,=:[!&|?' , $ this -> a ) !== false ) ) $ this -> saveRegex ( ) ; } }
The primary action occurs here. This function loops through the input string,
outputting anything that's relevant and discarding anything that is not.
The primary action occurs here . This function loops through the input string outputting anything that s relevant and discarding anything that is not .