\Fubber\ParsingStringParser

Usage: $parser = new StringParser('Some "string to be" parsed', TRUE); // TRUE means that you want to ignore whitespace

while($data = $parser->consume()) { echo "Got: '$data'. Type is '".$parser->type."'\n"; // TYPE is one of the StringParser::CONSUMED*-constants or NULL }

  Peeking on the next token:
  $peek = $parser->consume();
  $parser->push($peek);                                                   // Adds $data to the beginning of the string and will be returned again

  The parser will generally work on any type of string, and will split it by whitespace, quoted strings, single words, integers and floats. For example:
  123.456.789 will be returned as first "123.456" of type FLOAT, then "." of type SYMBOLS then 789 of type INTEGER.

Summary

Methods
Properties
Constants
__construct()
push()
consume()
$type
$_rest
$_l
CONSUMED_WHITESPACE
CONSUMED_QUOTED
CONSUMED_WORD
CONSUMED_INTEGER
CONSUMED_FLOAT
CONSUMED_SYMBOLS
CONSUMED_NOTHING
_consumeWord()
_consumeQuotes()
_consumeNumber()
$_skipWhitespace
N/A
No private methods found
No private properties found
N/A

Constants

CONSUMED_WHITESPACE

CONSUMED_WHITESPACE

CONSUMED_QUOTED

CONSUMED_QUOTED

CONSUMED_WORD

CONSUMED_WORD

CONSUMED_INTEGER

CONSUMED_INTEGER

CONSUMED_FLOAT

CONSUMED_FLOAT

CONSUMED_SYMBOLS

CONSUMED_SYMBOLS

CONSUMED_NOTHING

CONSUMED_NOTHING

Properties

$type

$type : 

Type

$_rest

$_rest : 

Type

$_l

$_l : 

Type

$_skipWhitespace

$_skipWhitespace : 

Type

Methods

__construct()

__construct(  $string,   $skipWhitespace = FALSE) 

Parameters

$string
$skipWhitespace

push()

push(  $string) 

Parameters

$string

consume()

consume() 

Consume some data from the string and return it

_consumeWord()

_consumeWord() 

_consumeQuotes()

_consumeQuotes() 

_consumeNumber()

_consumeNumber()