lib/Aegis/Lexer.php
public function tokenize(string $input) : TokenStream
    {
        $this->prepare($input);

        // Loop each character
        while ($this->cursor < $this->end) {
            $this->currentChar = $this->input[$this->cursor];

            if (preg_match('@'.Token::REGEX_T_EOL.'@', $this->currentChar)) {
                if ($this->mode !== self::MODE_IDENT) {
                    ++$this->line;
                    $this->lineOffset = $this->cursor + 1;
                }
            }

            switch ($this->mode) {

                case self::MODE_ALL:
                    $this->lexAll();
                    break;
                case self::MODE_INSIDE_TAG:
                    $this->lexInsideTag();
                    break;
                case self::MODE_IDENT:
                    $this->lexIdent();
                    break;
                case self::MODE_VAR:
                    $this->lexVar();
                    break;
                case self::MODE_STRING:
                    $this->lexString();
                    break;
                case self::MODE_NUMBER:
                    $this->lexNumber();
                    break;
                case self::MODE_OP:
                    $this->lexOperator();
                    break;
            }
        }

        return $this->stream;
    }
public function tokenize(string $input) : TokenStream
    {
        $this->prepare($input);

        // Loop each character
        while ($this->cursor < $this->end) {
            $this->currentChar = $this->input[$this->cursor];

            if (preg_match('@'.Token::REGEX_T_EOL.'@', $this->currentChar)) {
                if ($this->mode !== self::MODE_IDENT) {
                    ++$this->line;
                    $this->lineOffset = $this->cursor + 1;
                }
            }

            switch ($this->mode) {

                case self::MODE_ALL:
                    $this->lexAll();
                    break;
                case self::MODE_INSIDE_TAG:
                    $this->lexInsideTag();
                    break;
                case self::MODE_IDENT:
                    $this->lexIdent();
                    break;
                case self::MODE_VAR:
                    $this->lexVar();
                    break;
                case self::MODE_STRING:
                    $this->lexString();
                    break;
                case self::MODE_NUMBER:
                    $this->lexNumber();
                    break;
                case self::MODE_OP:
                    $this->lexOperator();
                    break;
            }
        }

        return $this->stream;
    }
public function tokenize ( string $ input ) : TokenStream { $ this -> prepare ( $ input ) ; // Loop each character while ( $ this -> cursor < $ this -> end ) { $ this -> currentChar = $ this -> input [ $ this -> cursor ] ; if ( preg_match ( '@' . Token :: REGEX_T_EOL . '@' , $ this -> currentChar ) ) { if ( $ this -> mode !== self :: MODE_IDENT ) { ++ $ this -> line ; $ this -> lineOffset = $ this -> cursor + 1 ; } } switch ( $ this -> mode ) { case self :: MODE_ALL : $ this -> lexAll ( ) ; break ; case self :: MODE_INSIDE_TAG : $ this -> lexInsideTag ( ) ; break ; case self :: MODE_IDENT : $ this -> lexIdent ( ) ; break ; case self :: MODE_VAR : $ this -> lexVar ( ) ; break ; case self :: MODE_STRING : $ this -> lexString ( ) ; break ; case self :: MODE_NUMBER : $ this -> lexNumber ( ) ; break ; case self :: MODE_OP : $ this -> lexOperator ( ) ; break ; } } return $ this -> stream ; }
Tokenizes a string into a TokenStream

@param $input
@return TokenStream
Tokenizes a string into a TokenStream