src/Luminous/Scanners/PerlScanner.php
public function isDelimiter()
    {
        for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
            $t = $this->tokens[$i];
            if ($t[0] === null || $t[0] === 'COMMENT') {
                continue;
            } elseif ($t[0] === 'OPENER' || $t[0] === 'OPERATOR') {
                return true;
            } elseif ($t[0] === 'IDENT') {
                switch ($t[1]) {
                    // named operators
                    case 'lt':
                    case 'gt':
                    case 'le':
                    case 'ge':
                    case 'eq':
                    case 'ne':
                    case 'cmp':
                    case 'and':
                    case 'or':
                    case 'xor':
                    // other keywords/functions
                    case 'if':
                    case 'elsif':
                    case 'while':
                    case 'unless':
                    case 'split':
                    case 'print':
                        return true;
                }
            }
            return false;
        }
        return true;
    }
public function isDelimiter()
    {
        for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
            $t = $this->tokens[$i];
            if ($t[0] === null || $t[0] === 'COMMENT') {
                continue;
            } elseif ($t[0] === 'OPENER' || $t[0] === 'OPERATOR') {
                return true;
            } elseif ($t[0] === 'IDENT') {
                switch ($t[1]) {
                    // named operators
                    case 'lt':
                    case 'gt':
                    case 'le':
                    case 'ge':
                    case 'eq':
                    case 'ne':
                    case 'cmp':
                    case 'and':
                    case 'or':
                    case 'xor':
                    // other keywords/functions
                    case 'if':
                    case 'elsif':
                    case 'while':
                    case 'unless':
                    case 'split':
                    case 'print':
                        return true;
                }
            }
            return false;
        }
        return true;
    }
public function isDelimiter ( ) { for ( $ i = count ( $ this -> tokens ) - 1 ; $ i >= 0 ; $ i -- ) { $ t = $ this -> tokens [ $ i ] ; if ( $ t [ 0 ] === null || $ t [ 0 ] === 'COMMENT' ) { continue ; } elseif ( $ t [ 0 ] === 'OPENER' || $ t [ 0 ] === 'OPERATOR' ) { return true ; } elseif ( $ t [ 0 ] === 'IDENT' ) { switch ( $ t [ 1 ] ) { // named operators case 'lt' : case 'gt' : case 'le' : case 'ge' : case 'eq' : case 'ne' : case 'cmp' : case 'and' : case 'or' : case 'xor' : // other keywords/functions case 'if' : case 'elsif' : case 'while' : case 'unless' : case 'split' : case 'print' : return true ; } } return false ; } return true ; }
by looking behind in the token stream.
by looking behind in the token stream .